赞
踩
对于ArcEngine重复地向要素类中添加数据,一般的方法是
1通过IFeatureClass.FeatureClass.CreateFeature()方法返回一个IFeature对象,
2再通过IFeature接口下的set_Value(int index,object obj)方法属性赋值等
3设置IFeature.shape属性
4最后再通过IFeature.store()方法进行存储
这种方法重复新建要素,数据量小还没影响,数据量大时,则会浪费很多时间。
推荐使用IFeatureBuffer接口
实例化方法:IFeatureBuffer pFeatureBuffer = pFeatureClass.CreateFeatureBuffer()
具体例子:
IFeatureBuffer pFeatureBuffer = pFeatureClass.CreateFeatureBuffer();
IFeatureCursor featurecursor = pFeatureClass.Insert(true);
foreach (IFeature fttt in FeatureDictionary.Keys)
{
pFeatureBuffer.Shape = fttt.Shape;
pFeatureBuffer.set_Value(2, fttt.get_Value(0).ToString());
pFeatureBuffer.set_Value(3, FeatureDictionary[fttt].ToString());
featurecursor.InsertFeature(pFeatureBuffer);
}
featurecursor.Flush();
System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。