高效的Insert方法

2008-05-22 09:43:55.0     推荐:0    收藏:0    评论:0     来源:e800数据库频道
Insert Feature是我们在开发过程中最容易遇到的问题,如果Insert的feature个数有限,那么你也许不关注Insert的速度问题。但是数据量比较大》500个的时候,你就会发现如果使用 IFeatureClass. CreateFeature的速度基本是无法忍受的。

其实ArcObjects中提供了一个接口,可以满足快速批量插入的要求。他就是:IFeatureBuffer
使用方法如下:
Set pFeatureBuffer = pFC.CreateFeatureBuffer
Set pFeatureCursor = pFC.Insert(True)
Set pFeature = pFeatureBuffer
Set pPolyline = New Polyline
'Create 100 features using FeatureBuffer and insert into a feature cursor
For i = 0 To 99
'Set the feature's shape TODO
Set pFeature.Shape = pPolyline
'Insert the feature into the feature cursor
q = pFeatureCursor.InsertFeature(pFeatureBuffer)
Next i
'Flush the feature cursor to the database
pFeatureCursor.Flush
您可以针对本文进行:[评论]  [收藏]  [推荐]  
  • 共有0条评论  点击查看更多评论
  • 网友评论仅供网友表达个人看法,并不表明e800同意其观点或证实其描述
我想发表评论:
用户名密码
  • 匿名发表
    验证码: