GIS內核-加載矢量圖層示例

void MainWindow::AddLayerMutilLabel()
{
	GsShpGeoDatabaseFactoryPtr shpFac = new GsShpGeoDatabaseFactory();
	GsGeoDatabaseFactoryPtr fac = new GsFileGeoDatabaseFactory();
	GsConnectProperty cp;
	cp.DataSourceType = GsDataSourceType::eShapeFile;

	GsString str = "../tests/testdata/shp";
	GsFile modelFile(GsFileSystem::ModuleFileName().c_str());
	GsString fullPath = GsFileSystem::Combine(modelFile.Parent().FullPath().c_str(), str.c_str());
	cp.Server =  fullPath;
	GsGeoDatabasePtr db = fac->Open(cp);
     GsFeatureClassPtr fcs = db->OpenFeatureClass("COUL_Lite");
    GsFeatureLayerPtr ptest = new GsFeatureLayer(fcs);
    space->layerBox().addLayer(ptest); 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章