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


    转自原文 ArcGIS Engine中删除要素的几种方法总结

    1. /// <summary>  
    2. /// 通过IFeature.Delete方法删除要素  
    3. /// </summary>  
    4. /// <param name="pFeatureclass">要素类</param>  
    5. /// <param name="strWhereClause">查询条件</param>  
    6. public static void DeleteFeatureByIFeature(IFeatureClass pFeatureclass, string strWhereClause)  
    7. {  
    8.     IQueryFilter pQueryFilter = new QueryFilterClass();  
    9.     pQueryFilter.WhereClause = strWhereClause;  
    10.     IFeatureCursor pFeatureCursor = pFeatureclass.Search(pQueryFilter, false);  
    11.     IFeature pFeature = pFeatureCursor.NextFeature();  
    12.     while (pFeature != null)  
    13.     {  
    14.         pFeature.Delete();  
    15.         pFeature = pFeatureCursor.NextFeature();  
    16.     }  
    17. }  
    1. /// <summary>  
    2.  /// 通过IFeatureCursor.DeleteFeature方法删除要素  
    3.  /// </summary>  
    4.  /// <param name="pFeatureclass">要素类</param>  
    5.  /// <param name="strWhereClause">查询条件</param>  
    6.  public static void DeleteFeatureByIFeatureCursor(IFeatureClass pFeatureclass, string strWhereClause)  
    7.  {  
    8.      IQueryFilter pQueryFilter = new QueryFilterClass();  
    9.      pQueryFilter.WhereClause = strWhereClause;  
    10.      IFeatureCursor pFeatureCursor = pFeatureclass.Update(pQueryFilter, false);  
    11.      IFeature pFeature = pFeatureCursor.NextFeature();  
    12.      while (pFeature != null)  
    13.      {  
    14.          pFeatureCursor.DeleteFeature();  
    15.          pFeature = pFeatureCursor.NextFeature();  
    16.      }  
    17.  }  
    1. /// <summary>  
    2. /// 通过ITable.DeleteSearchedRows方法删除要素  
    3. /// </summary>  
    4. /// <param name="pFeatureclass">要素类</param>  
    5. /// <param name="strWhereClause">查询条件</param>  
    6. public static void DeleteFeatureByITable(IFeatureClass pFeatureclass, string strWhereClause)  
    7. {  
    8.     IQueryFilter pQueryFilter = new QueryFilterClass();  
    9.     pQueryFilter.WhereClause = strWhereClause;  
    10.     ITable pTable = pFeatureclass as ITable;  
    11.     pTable.DeleteSearchedRows(pQueryFilter);  
  • 相关阅读:
    计算机网络常见面试题
    字节跳动2022秋招提前批来了!!!
    IBM Watson Studio
    Git提交GitHub
    python获取股票和基金等数据
    Cloud Foundry
    微软亚洲研究院的NLP一例
    Streamlit的学习小记
    在线学习云技术相关等
    IBM云部署相关
  • 原文地址:https://www.cnblogs.com/arxive/p/6305423.html
Copyright © 2020-2023  润新知