• 对Feature的操作插入添加删除


    转自:http://www.cnblogs.com/henyihanwobushi/archive/2013/03/21/2972415.html

    1、插入
     1  2 
     3 /// <summary>
     4 
     5 ///向featureclass中批量插入features ,批量插入features,用buffer的方法,要比循环一个个Store的方法快
     6 
     7 ///</summary>
     8 
     9 /// <param name="pFeatureClass">操作数据所在的IFeatureClass</param>
    10 
    11 private void InsertFeatures( IFeatureClass pFeatureClass , List< IGeometry> pGeos )
    12 
    13 {
    14 
    15   IFeatureBuffer pFeatBuf = pFeatureClass.CreateFeatureBuffer();
    16 
    17   IFeature pFeat = pFeatBuf;
    18 
    19   IFeatureCursor pFeatCur= pFeatureClass.Insert(true);
    20 
    21   for(int i = 0 ;i< pGeos.Count ;i++)
    22 
    23   {
    24 
    25   pFeat.Shape = pGeos(i);
    26 
    27   pFeatCur.InsertFeature(pFeatBuf);
    28 
    29   //避免一次flush,导致速度过慢
    30 
    31   if (i Mod 100 == 0 )
    32 
    33   {
    34 
    35     pFeatCur.Flush()
    36 
    37   }
    38 
    39   pFeatCur.Flush()
    40 
    41 }

    2.删除

     1 ///<summary>删除某featurelayer中所有feature
     2 
     3 /// 该方法可以给一个queryfilter,进行删除符合条件的Ifeatures///</summary>
     4 
     5 /// <param name="pLayer ">:操作的图层</param>
     6 
     7 Private void DeleteAllFeatures(IFeatureLayer pLayer )
     8 
     9 {
    10 
    11   ITable pTable = pLayer.FeatureClass;
    12 
    13   pTable.DeleteSearchedRows(null);
    14 
    15 }

     ------------------------------------------------------ 补充分割线 ------------------------------------------------------

    还有更效率的方法:http://blog.csdn.net/freewaywalker/article/details/23703863


  • 相关阅读:
    Bank4
    Bank3
    Bank2
    Bank1
    Kubernetes核心技术Service
    kubernetes的Pod
    kubernetes如何快速编写yaml文件
    Kuberbetes的Secret
    Kuberbetes的Job和CronJob
    Kuberbetes的DaemonSet
  • 原文地址:https://www.cnblogs.com/marvelousone/p/7448185.html
Copyright © 2020-2023  润新知