Exemplo n.º 1
0
void main()
{
	MGraph g;
	int i, j, q = 1;
	PathMatrix p;
	DistancMatrix d;
	char filename[8] = "map.txt";

	CreateFromFile(g, filename, 0);
	for (i = 0; i < g.vexnum; i++)
		g.arcs[i][i].adj = 0;

	ShortestPath_FLOYD(g, p, d);
	while (q) {
		printf("请选择:1 查询  0 结束\n");
		scanf("%d", &q);
		if (q) {
			printf("城市代码:\n");
			for (i = 0; i < g.vexnum; i++) {
				printf("%2d.%-8s", i, g.vexs[i].name);
				if (i % 7 == 6)
					printf("\n");
			}
			printf("\n请输入要查询的起点城市代码 终点城市代码:");
			scanf("%d%d", &i, &j);
			path(g, d, p, i, j);
		}
	}
}
Exemplo n.º 2
0
void CubeTexture::OnResetDevice()
{
	if(!YString::isEmpty(mFilePath[0]))
	{
		CreateFromFile(mFilePath[0], mFilePath[1], mFilePath[2], mFilePath[3], mFilePath[4], mFilePath[5]);
	}
}
Exemplo n.º 3
0
//===============================================
//コンストラクタ
//===============================================
//[input]
//	name:ファイル名
//[return]
//	なし
//===============================================	
CSound::CSound(char *name, int index)
{
//	ZeroMemory(&m_pSound->pFile, sizeof(FILEDATA) );
	
	CreateFromFile(name, true, index);
	
	SetVolume(100, index);
}
Exemplo n.º 4
0
    Entity* EntityCreator::CreateFromSceneNode(const Json::Value& node) {
        AssertExistence(node, "filepath");
        string filepath = node.get("filepath", "undefined").asString();

        Entity* entity = nullptr;

        try {
            entity = CreateFromFile(filepath);
        } catch (const FileNotFoundException& exception) {
            entity = CreateFromFile(ResourceManager::Get()->GetDataRootDir() + filepath);
        }

        if (CheckExistence(node, "name")) {
            string name = node.get("name", "undefined").asString();
            entity->SetName(name);
        }

        if (CheckExistence(node, "script")) {
            string script = node.get("script", "undefined").asString();
            
        }

        if (CheckExistence(node, "position")) {
            string positionStr = node.get("position", "0.0 0.0 0.0").asString();
            entity->SetPosition(Vector3f(positionStr));
        }

        if (CheckExistence(node, "scale")) {
            string scaleStr = node.get("scale", "1.0 1.0 1.0").asString();
            entity->SetScale(Vector3f(scaleStr));
        }

        if (CheckExistence(node, "rotation")) {
            string rotationStr = node.get("rotation", "0.0 0.0 0.0 1.0").asString();
            entity->SetRotation(Quaternion(rotationStr));
        }

        entity->EnablePhysics();

        return entity;
    }
Exemplo n.º 5
0
Vector<Image *> ImageLoader::CreateFromFile(const FilePath & pathname)
{
    File *file = File::Create(pathname, File::OPEN | File::READ);
    
    if(!file)
    {
        Logger::Error("[ImageLoader::CreateFromFile] Cannot open file %s", pathname.GetAbsolutePathname().c_str());
        return Vector<Image *>();
    }
    
    Vector<Image *>imageSet = CreateFromFile(file);
    SafeRelease(file);
	return imageSet;
};
Exemplo n.º 6
0
int
COclcompParser::CreateFromFile (const char *filename)
{
  // load entire file into the memory buffer
  FILE *file = fopen (filename, "rb");
  if (!file)
  {
    return 0;
  }

  int ret = CreateFromFile (file);
  fclose (file);
  return ret;
}
Exemplo n.º 7
0
size_t CFixedStringListW::CreateFromFile( const wchar_t * const pchFileName, size_t nLetterCount )
{
	HANDLE	hFile = ::CreateFileSafeW( pchFileName, GENERIC_READ );
	if( hFile == INVALID_HANDLE_VALUE )
	{
		return 0;
	}

	size_t	nResultSize = CreateFromFile( hFile, nLetterCount );

	CloseHandle( hFile );

	return nResultSize;
}
Exemplo n.º 8
0
// Reads from the given file. Returns false in case of error.
bool Plumbing::DeSerialize(TFile* fp) {
  stack_.truncate(0);
  no_ = 0;  // We will be modifying this as we AddToStack.
  int32_t size;
  if (fp->FReadEndian(&size, sizeof(size), 1) != 1) return false;
  for (int i = 0; i < size; ++i) {
    Network* network = CreateFromFile(fp);
    if (network == nullptr) return false;
    AddToStack(network);
  }
  if ((network_flags_ & NF_LAYER_SPECIFIC_LR) &&
      !learning_rates_.DeSerialize(fp)) {
    return false;
  }
  return true;
}
Exemplo n.º 9
0
Arquivo: Main.cpp Projeto: Og192/CPro
int main(void)
{
	int i,j,k;
	MGraph g;
	PathMatrix p;
	ShortestPathTable d;
	int order[MAX_VERTEX_NUM];//辅助数组,按最短路径上的顶点次序依次存储顶点序号
	for (i = 0; i < MAX_VERTEX_NUM;++i)
	{//初始化顶点序号为-1
		order[i] = -1;
	}
	CreateFromFile(g,"2.txt",0);
	Display(g);
	ShortestPath_DIJ(g,0,p,d);
	printf("最短路径数组p[i][j]如下:\n");
	for (i = 0; i < g.vexnum; ++i)
	{
		for (j = 0; j < g.vexnum; ++j)
		{
			printf("%2d",p[i][j]);
		}
		printf("\n");
	}
	
	for (i = 1; i < g.vexnum; ++i)
	{
		printf("%s->%s的最短路径为:  ",g.vex[0].name,g.vex[i].name);
		for (j = 0; j < g.vexnum; ++j)
		{
			if (p[i][j] > 0)
			{
				order[p[i][j]] = j;//按路径次序依次存储顶点序号
			}
		}
		for (k = 1;order[k] > -1;++k)
		{
			printf("%s->",g.vex[order[k]].name);//按序输出已排好的顶点序号
			order[k] = -1;                      //恢复默认值,以便存储下一条最短路径的定点序号
		}
		printf("\b\b  距离为:%d",d[i]);
		printf("\n");
	}
	return 0;
}
Exemplo n.º 10
0
void wxSFBitmapShape::Deserialize(wxXmlNode* node)
{
	// HINT: overload it for custom actions...

	wxSFRectShape::Deserialize(node);

	wxRealPoint prevSize = m_nRectSize;

    if(!m_sBitmapPath.IsEmpty())
    {
        CreateFromFile(m_sBitmapPath);
    }

	if(m_fCanScale)
	{
		if(m_nRectSize != prevSize)
		{
			m_nRectSize = prevSize;
			RescaleImage(prevSize);
		}
		else
			Scale(1, 1);
	}
}
Exemplo n.º 11
0
Configuration* Configuration::ParseMainArgs(int argc, char* argv[]) {
    if(argc == 2) return CreateFromFile(argv[1]);
    return CreateFromFile();
}
Exemplo n.º 12
0
 virtual ChmEngine *Clone() {
     return CreateFromFile(fileName);
 }
Exemplo n.º 13
0
//--------------------------------------------------------------------------------------
HRESULT SDKMesh::Create( LPCTSTR szFileName, bool bCreateAdjacencyIndices )
{
	return CreateFromFile( szFileName, bCreateAdjacencyIndices );
}
Exemplo n.º 14
0
UITexture::UITexture(const std::string &filename) :
    Texture(GL_TEXTURE_2D, Format(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE), CLAMP, LINEAR, false)
{
	CreateFromFile(filename);
}
Exemplo n.º 15
0
void ModelTexture::Load()
{
	assert(!IsCreated());
	CreateFromFile(m_filename, false);
}
Exemplo n.º 16
0
size_t CFixedStringListW::CreateFromFile( const CFixedStringW & rcFileName, size_t nLetterCount )
{
	return CreateFromFile( rcFileName.GetBuffer(), nLetterCount );
}