77范文网 - 专业文章范例文档资料分享平台

ArcEngine - 开发接口集(5)

来源:网络收集 时间:2020-02-21 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

就是一行数据,删除该行就能相应的删除这个Feature)

IFeature接口的第三个属性Extent(只读,获取该Feature要素在地图上的一个矩形范围,返回值为IEnvelope类型)

IFeature接口的第四个属性FeatureType(只读,获取该Feature要素的要素类型,返回值为枚举类型的esriFeatureType)

IFeature接口的第五个属性Fields(只读,获取该Feature要素的字段集合,返回值为IFields类型)

IFeature接口的第六个属性Shape(读写,获取该Feature要素的图形,返回值为IGeometry类型,或者各种实体化的类型,如IPolyline)

IFeature接口的第七个属性ShapeCopy(只读,克隆该Feature要素的几何图形,返回值为IGeometry类型)

IFeature 接口的第八个方法Store(方法,保存该行。) 此属性可用于对Feature要素的几何图形进行操作,步骤如下:

用IFeature.ShapeCopy方法获取一个已经存在的Geometry,或者新建一个Geometry 对Geometry进行操作

通过IFeature.Shape属性将Geometry写入 通过IFeature.Store方法保存该Feature要素 例子代码:

1. Dim pFeature As IFeature 2. Dim pGeo As IGeometry 3. Set pGeo = pFeature.ShapeCopy 4. 'Change the shape 5. pFeature.Shape = pGeo 6. pFeature.Store

IFeature接口的第九个属性Value(读写,利用字段的索引进行对该要素该字段的值的读写) 注意,索引Index是从0开始的。 object.Value(Index ) = [ value ]

IFeature 接口的第十个属性Table(只读,将该行要素转换成ITable格式的数据,即可对一张表进行数据操作,具体方法查看ITable接口) 例子代码:

1. Dim pTable As ITable 2. Set pTable = pRow.Table

12. 关于IRow接口(esriGeoDatabase)

IRow接口的第一个方法Delete(方法,删除该行)

IRow接口的第二个属性Fields(只读,获取该Feature要素的字段集合,返回值为IFields类型)此方法类似于IFeature接口的Fields属性

IRow 接口的第三个方法Store(方法,保存该行。)此方法类似于IFeature接口的Store方法

IRow接口的第四个属性Table(只读,获取该行所在的表格,返回值为ITable类型) 例子代码:

1. Dim pTable As ITable 2. Set pTable = pRow.Table

IRow接口的第五个属性Value(Index) (读写,获取该行在参数索引的字段的值,注意,索引Index是从0开始的。) object.Value(Index ) = [ value ]

IRow接口的第六个属性HasOID(只读,判断指出该行是否有OID) IRow接口的第七个属性OID(只读,获取该行的OID值) 例子代码:

1. If pRow.HasOID Then 2. Debug.Print pRow.OID 3. End If

13. 关于IFeatureClass接口(esriGeoDatabase) 1. Dim pFeatcls As IFeatureClass 2. Dim pFeatLayer As IFeatureLayer 3. Dim pDoc As IMxDocument 4. Dim pMap As IMap 5.

6. Set pDoc = ThisDocument 7. Set pMap = pDoc.Maps.Item(0) 8. Set pFeatLayer = pMap.Layer(0)

9. Set pFeatcls = pFeatLayer.FeatureClass

IFeatureClass接口的第一个方法AddField(Field) (方法,增加一个属性字段到这个要素类,其中传入的参数为一个IField接口的变量,此变量可以由其他要素类获得并赋值给要操作的要素类,可用IFeilds接口的Field属性来获得)

IFeatureClass接口的第二个方法DeleteField(Field) (方法,删除一个属性字段,其中传入的参数为一个IField接口的变量)

IFeatureClass接口的第三个属性Fields(只读,获取该要素类的全部属性字段,返回一个IFields类型的变量) 例子代码:

1. 'Assume we have a reference to a feature class, pFC 2. Dim pFields As IFields 3. Dim pField As IField 4. Set pFields = pFC.Fields

5. Set pField = pFields.Field(pFields.FindField(\6.

7. pFC.DeleteField pField

IFeatureClass接口的第四个方法FindField(Name) (方法,去查找在该要素类里面是否含有参数名字的属性字段,如果有,则返回索引,没有,则返回-1)

IFeatureClass接口的第五个属性AreaField(只读,获取属性字段为geometry的那一个Field) 例子代码:

1. Dim pFeatcls As IfeatureClass 2. Dim pFeatLayer As IFeatureLayer 3. Dim pDoc As IMxDocument 4. Dim pMap As Imap 5.

6. Set pDoc = ThisDocument 7. Set pMap = pDoc.Maps.Item(0) 8. Set pFeatLayer = pMap.Layer(0)

9. Set pFeatcls = pFeatLayer.FeatureClass 10. Dim pFld As IField

11. Set pFld = pFeatcls.AreaField 12.

13. If Not pFld Is Nothing Then 14. MsgBox pFld.Name 15. End If

IFeatureClass接口的第六个方法Search (filter, Recycling) (方法,去得到一个IFeatureCursor类型的游标,该游标由filter来控制赛选,如果filter等于null,则返回整个featureclass的游标,再用IfeatureCursor的NextFeature的方法依次得到每一个Feature) 例子代码:

1. Dim pFeatcls As IFeatureClass 2. Dim pFeatLayer As IFeatureLayer 3. Dim pDoc As IMxDocument 4. Dim pMap As IMap 5.

6. Set pDoc = ThisDocument 7. Set pMap = pDoc.Maps.Item(0) 8. Set pFeatLayer = pMap.Layer(0) 9. Set pFeatcls = pFeatLayer.FeatureClass 10.

11. ' +++ create the query filter, and give 12. ' +++ it a where clause 13. Dim pQFilt As IQueryFilter 14. Dim pFeatCur As IFeatureCursor 15.

16. Set pQFilt = New QueryFilter

17. pQFilt.WhereClause = \18. Set pFeatCur = pFeatcls.Search(pQFilt, False) 19.

20. ' +++ get the area field 21. Dim pFlds As IFields

22. Dim pFld As IField 23. Dim lAIndex As Long 24.

25. Set pFlds = pFeatcls.Fields 26. lAIndex = pFlds.FindField (\27. Set pFld = pFlds.Field(lAIndex) 28.

29. ' +++ a variable to hold the total area 30. Dim dtotArea As Double 31. dtotArea = 0# 32.

33. ' +++ loop through all of the features and 34. ' +++ calculate the sum of all of the areas 35. Dim pFeat As IFeature

36. Set pFeat = pFeatCur.NextFeature 37. Do

38. dtotArea = dtotArea + pFeat.Value(lAIndex) 39. Set pFeat = pFeatCur.NextFeature 40. Loop Until pFeat Is Nothing 41.

42. ' +++ send the total area to a message box 43. MsgBox dtotArea

IFeatureClass接口的第七个方法Insert(useBuffering) (方法,去得到一个IFeatureCursor类型的游标,来用作插入新的Features,useBuffering是一个布尔型参数,当为True时即可以插入新的Feature,再用IFeatureCursor的InsertFeature (buffer )的方法去插入一个新的Feature) 例子代码:

1. Dim pFeatcls As IFeatureClass 2. Dim pFeatLayer As IFeatureLayer 3. Dim pDoc As IMxDocument 4. Dim pMap As Imap

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库ArcEngine - 开发接口集(5)在线全文阅读。

ArcEngine - 开发接口集(5).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/jiaoyu/772901.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: