QString path1 = path.replace(".smwu",".udb"); UGDataSource *ds = UGDataSourceManager::CreateDataSource(UGEngineType::UDB); ds->GetConnectionInfo().m_nType = UGC::UDB; ds->GetConnectionInfo().m_bReadOnly = false; ds->GetConnectionInfo().m_strAlias = L"A"; ds->GetConnectionInfo().m_strServer = Translator::QStr2UGStr(path1); if(ds->Create()) { //默认点数据集创建 UGDatasetVectorInfo* info1 = new UGDatasetVectorInfo (); info1->m_nType = UGC ::UGDataset ::DatasetType ::Point; UGString name1 = ds->GetUnoccupiedDatasetName(_U ("myPoint")); info1->m_strName = name1 ; info1->m_strTableName =name1 ; UGDatasetVector* datasetresult1 = ds->CreateDatasetVector(*info1); //默认线数据集创建 UGDatasetVectorInfo* info2 = new UGDatasetVectorInfo (); info2->m_nType = UGC ::UGDataset ::DatasetType ::Line; UGString name2 = ds->GetUnoccupiedDatasetName(_U("myLine")); info2->m_strName = name2 ; info2->m_strTableName =name2 ; UGDatasetVector * datasetresult2 = ds->CreateDatasetVector(*info2); //默认面数据集创建 UGDatasetVectorInfo* info3 = new UGDatasetVectorInfo (); info3->m_nType = UGC ::UGDataset ::DatasetType ::Region; UGString name3 = ds->GetUnoccupiedDatasetName(_U ("myPlane")); info3->m_strName = name3 ; info3->m_strTableName =name3 ; UGDatasetVector * datasetresult3 = ds->CreateDatasetVector(*info3); } workspace->OpenDataSource(ds->GetConnectionInfo()); workspace->m_WorkspaceConnection.m_bFailIfExists = false;
我在后面有用workspace函数打开,但还是没绑定