码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-05-21 17:43:49      阅读:250      评论:0      收藏:0      [点我收藏+]

标签:查询   arc   ring   pre   search   csdn   oid   row   static   

转自原文 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中删除要素的几种方法总结

标签:查询   arc   ring   pre   search   csdn   oid   row   static   

原文地址:http://www.cnblogs.com/arxive/p/6885330.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!