转自原文 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);
- }
没有整理与归纳的知识,一文不值!高度概括与梳理的知识,才是自己真正的知识与技能。 永远不要让自己的自由、好奇、充满创造力的想法被现实的框架所束缚,让创造力自由成长吧! 多花时间,关心他(她)人,正如别人所关心你的。理想的腾飞与实现,没有别人的支持与帮助,是万万不能的。
本文转自wenglabs博客园博客,原文链接:http://www.cnblogs.com/arxive/p/6305423.html
,如需转载请自行联系原作者