public IList <FeatureName> get_FeatureDataSetNames() //遍历矢量要素集 { IList <FeatureName> names = new List <FeatureName>(); if (this.m_workSpace != null) { IFeatureClass feaClass; IEnumDatasetName enumDatasetName = m_workSpace.get_DatasetNames(esriDatasetType.esriDTFeatureDataset); IDatasetName datasetName = enumDatasetName.Next();//DataSet的名字 while (datasetName != null) { FeatureName name = new FeatureName(); name.FeatDSName = datasetName.Name.ToString(); IFeatureDatasetName featureDatasetName = (IFeatureDatasetName)datasetName; IEnumDatasetName enumDatasetNameFC = featureDatasetName.FeatureClassNames; //是FeatureClass的名字集合 IDatasetName datasetNameFC = enumDatasetNameFC.Next(); while (datasetNameFC != null) { //添加FeatureClass的名字 name.FCName.Add(datasetNameFC.Name.ToString()); feaClass = ((IFeatureWorkspace)m_workSpace).OpenFeatureClass(datasetNameFC.Name.ToString()); name.ShapType.Add(feaClass.ShapeType); name.FeatureType.Add(feaClass.FeatureType); datasetNameFC = enumDatasetNameFC.Next(); } names.Add(name); datasetName = enumDatasetName.Next(); } } return(names); }
//遍历矢量要素集 public IList<FeatureName> get_FeatureDataSetNames() { IList<FeatureName> names=new List<FeatureName>(); if (this.m_workSpace != null) { IFeatureClass feaClass; IEnumDatasetName enumDatasetName = m_workSpace.get_DatasetNames(esriDatasetType.esriDTFeatureDataset); IDatasetName datasetName = enumDatasetName.Next();//DataSet的名字 while (datasetName != null) { FeatureName name = new FeatureName(); name.FeatDSName = datasetName.Name.ToString(); IFeatureDatasetName featureDatasetName = (IFeatureDatasetName)datasetName; IEnumDatasetName enumDatasetNameFC = featureDatasetName.FeatureClassNames; //是FeatureClass的名字集合 IDatasetName datasetNameFC = enumDatasetNameFC.Next(); while(datasetNameFC != null) { //添加FeatureClass的名字 name.FCName.Add(datasetNameFC.Name.ToString()); feaClass = ((IFeatureWorkspace)m_workSpace).OpenFeatureClass(datasetNameFC.Name.ToString()); name.ShapType.Add(feaClass.ShapeType); name.FeatureType.Add(feaClass.FeatureType); datasetNameFC = enumDatasetNameFC.Next(); } names.Add(name); datasetName = enumDatasetName.Next(); } } return names; }