1 //删除要素类. 2 //例如:[email protected]"G:\doc\gis\1.400\data\pdb.mdb", featureClassPath="res2_4m". 3 private void featureClass_delete(string workspacePath, string featureClassPath) { 4 ESRI.ArcGIS.Geodatabase.IWorkspaceFactory wsf = new ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass(); 5 ESRI.ArcGIS.Geodatabase.IWorkspace ws = wsf.OpenFromFile(workspacePath, 0); 6 ESRI.ArcGIS.Geodatabase.IFeatureWorkspace fws = (ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)ws; 7 ESRI.ArcGIS.Geodatabase.IFeatureClass fc = fws.OpenFeatureClass(featureClassPath); 8 //注意的是这里需要为IDataset(IFeatureClass没有删除的功能). 9 ESRI.ArcGIS.Geodatabase.IDataset ds = (ESRI.ArcGIS.Geodatabase.IDataset)fc; 10 ds.Delete(); 11 }
时间: 2024-10-25 19:38:04