首页 > 代码库 > ArcGIS Engine中删除要素的几种方法总结
ArcGIS Engine中删除要素的几种方法总结
转自原文 ArcGIS Engine中删除要素的几种方法总结
/// <summary> /// 通过IFeature.Delete方法删除要素 /// </summary> /// <param name="pFeatureclass">要素类</param> /// <param name="strWhereClause">查询条件</param> public static void DeleteFeatureByIFeature(IFeatureClass pFeatureclass, string strWhereClause) { IQueryFilter pQueryFilter = new QueryFilterClass(); pQueryFilter.WhereClause = strWhereClause; IFeatureCursor pFeatureCursor = pFeatureclass.Search(pQueryFilter, false); IFeature pFeature = pFeatureCursor.NextFeature(); while (pFeature != null) { pFeature.Delete(); pFeature = pFeatureCursor.NextFeature(); } } /// <summary> /// 通过IFeatureCursor.DeleteFeature方法删除要素 /// </summary> /// <param name="pFeatureclass">要素类</param> /// <param name="strWhereClause">查询条件</param> public static void DeleteFeatureByIFeatureCursor(IFeatureClass pFeatureclass, string strWhereClause) { IQueryFilter pQueryFilter = new QueryFilterClass(); pQueryFilter.WhereClause = strWhereClause; IFeatureCursor pFeatureCursor = pFeatureclass.Update(pQueryFilter, false); IFeature pFeature = pFeatureCursor.NextFeature(); while (pFeature != null) { pFeatureCursor.DeleteFeature(); pFeature = pFeatureCursor.NextFeature(); } } /// <summary> /// 通过ITable.DeleteSearchedRows方法删除要素 /// </summary> /// <param name="pFeatureclass">要素类</param> /// <param name="strWhereClause">查询条件</param> public static void DeleteFeatureByITable(IFeatureClass pFeatureclass, string strWhereClause) { IQueryFilter pQueryFilter = new QueryFilterClass(); pQueryFilter.WhereClause = strWhereClause; ITable pTable = pFeatureclass as ITable; pTable.DeleteSearchedRows(pQueryFilter); }
ArcGIS Engine中删除要素的几种方法总结
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。