首页 > 代码库 > ArcGIS Engine检索要素集、要素类和要素
ArcGIS Engine检索要素集、要素类和要素
转自原文 ArcGIS Engine检索要素集、要素类和要素
[csharp] view plain copy print?
- /// <summary>
- /// 获取所有要素集
- /// </summary>
- /// <param name="workspace">工作空间对象</param>
- /// <returns>要素集列表</returns>
- public static List<IFeatureDataset> GetAllFeatureClass(IWorkspace workspace)
- {
- IEnumDataset dataset = workspace.get_Datasets(esriDatasetType.esriDTFeatureDataset);
- IFeatureDataset featureDataset = dataset.Next() as IFeatureDataset;
- List<IFeatureDataset> featureDatasetList = new List<IFeatureDataset>();
- while (featureDataset != null)
- {
- featureDatasetList.Add(featureDataset);
- featureDataset = dataset.Next() as IFeatureDataset;
- }
- return featureDatasetList;
- }
[csharp] view plain copy print?
- /// <summary>
- /// 获取所有要素类
- /// </summary>
- /// <param name="featureDataset">要素集</param>
- /// <returns>要素类列表</returns>
- public static List<IFeatureClass> GetAllFeatureClass(IFeatureDataset featureDataset)
- {
- IFeatureClassContainer featureClassContainer = (IFeatureClassContainer)featureDataset;
- IEnumFeatureClass enumFeatureClass = featureClassContainer.Classes;
- IFeatureClass featureClass = enumFeatureClass.Next();
- List<IFeatureClass> featureClassList = new List<IFeatureClass>();
- while (featureClass != null)
- {
- featureClassList.Add(featureClass);
- featureClass = enumFeatureClass.Next();
- }
- return featureClassList;
- }
[csharp] view plain copy print?
- /// <summary>
- /// 获取所有要素
- /// </summary>
- /// <param name="featureClass">要素类</param>
- /// <returns>要素列表</returns>
- public static List<IFeature> GetAllFeatureClass(IFeatureClass featureClass)
- {
- List<IFeature> featureList = new List<IFeature>();
- IFeatureCursor featureCursor = featureClass.Search(null, false);
- IFeature feature = featureCursor.NextFeature();
- while (feature != null)
- {
- featureList.Add(feature);
- feature = featureCursor.NextFeature();
- }
- return featureList;
- }
ArcGIS Engine检索要素集、要素类和要素
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。