ArcGIS Engine中删除要素的几种方法总结

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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中删除要素的几种方法总结的主要内容,如果未能解决你的问题,请参考以下文章

Arcgis engine 要素集的复制和删除

ArcGIS Engine效率探究——要素的添加和删除属性的读取和更新

ArcGIS Engine -- 常用方法

ArcGIS Engine开发之地图导出

ArcGIS Engine中怎么获取Map中已经选择的要素呢

Arcgis Engine的拓扑检查类