ArcGIS接口详细说明

注意!!!一般情况设置为True,来控制倍数的放大

Expand scales thesizeoftheEnvelope. IfasRatio =FALSE,theexpansionisadditive. XMin = XMin - dx YMin = YMin - dy XMax = XMax +dx YMax = YMax +dy

If asRatio = TRUE,theexpansionismultiplicative. XMin = (XMin - dx*Width)/2 YMin = (YMin - dy*Height)/2 XMax = (XMax +dx*Width)/2 YMax = (YMax +dy*Height)/2

The Envelope remainscenteredatthesameposition.

IEnvelope接口的第十个方法Offset (X, Y)(方法,将已有的一个边框的按照输入参数的大小来进行水平竖直的移动)

例子代码:

Private Sub btnOffset_Click() m_pEnveLope.Offset10,20 update_props

End Sub 注意!!!

The new positionoftheEnvelopeisasfollows: newXMin = old XMin+X newYMin =oldYMin+Y newXMax =oldXMax+X newYMax =oldYMax+Y

11. 关于IFeature接口(esriGeoDatabase) IFeature接口的第一个属性Class(只读)

IFeature接口的第二个方法Delete(方法,删除该行。因为一个Feature在表格中对应的就是一行数据,删除该行就能相应的删除这个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要素

例子代码:

Dim pFeature AsIFeature Dim pGeo AsIGeometry Set pGeo = pFeature.ShapeCopy 'Change the shape pFeature.Shape =pGeo pFeature.Store

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

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

例子代码:

Dim pTable AsITable Set pTable = pRow.Table

12. 关于IRow接口(esriGeoDatabase) IRow接口的第一个方法Delete(方法,删除该行)

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

IRow 接口的第三个方法Store(方法,保存该行。)此方法类似于IFeature接口的Store方法 IRow接口的第四个属性Table(只读,获取该行所在的表格,返回值为ITable类型)

例子代码:

Dim pTable AsITable Set pTable = pRow.Table

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

object.Value(Index ) = [ value ]

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

例子代码:

If pRow.HasOID Then Debug.Print pRow.OID

End If

13. 关于IFeatureClass接口(esriGeoDatabase)

Dim pFeatcls AsIFeatureClass Dim pFeatLayer AsIFeatureLayer Dim pDoc AsIMxDocument Dim pMap AsIMap

Set pDoc = ThisDocument Set pMap = pDoc.Maps.Item(0) Set pFeatLayer = pMap.Layer(0) Set pFeatcls = pFeatLayer.FeatureClass

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

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

例子代码:

'Assume we haveareferencetoafeatureclass,pFC Dim pFields AsIFields Dim pField AsIField Set pFields = pFC.Fields

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

pFC.DeleteFieldpField

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

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

例子代码:

Dim pFeatcls AsIfeatureClass Dim pFeatLayer AsIFeatureLayer Dim pDoc AsIMxDocument Dim pMap AsImap

Set pDoc = ThisDocument Set pMap = pDoc.Maps.Item(0) Set pFeatLayer = pMap.Layer(0) Set pFeatcls = pFeatLayer.FeatureClass Dim pFld AsIField

Set pFld = pFeatcls.AreaField

If Not pFldIsNothingThen MsgBox pFld.Name End If

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

例子代码:

Dim pFeatcls AsIFeatureClass Dim pFeatLayer AsIFeatureLayer Dim pDoc AsIMxDocument Dim pMap AsIMap

Set pDoc = ThisDocument Set pMap = pDoc.Maps.Item(0) Set pFeatLayer = pMap.Layer(0) Set pFeatcls = pFeatLayer.FeatureClass

'+++createthequeryfilter,andgive '+++itawhereclause Dim pQFilt AsIQueryFilter Dim pFeatCur AsIFeatureCursor

Set pQFilt = NewQueryFilter pQFilt.WhereClause= \ 'COM'\ Set pFeatCur = pFeatcls.Search(pQFilt,False)

'+++gettheareafield Dim pFlds AsIFields Dim pFld AsIField Dim lAIndex AsLong

Set pFlds = pFeatcls.Fields lAIndex =pFlds.FindField(\ Set pFld = pFlds.Field(lAIndex)

'+++avariabletoholdthetotalarea Dim dtotArea AsDouble dtotArea =0#

'+++loopthroughallofthefeaturesand '+++calculatethesumofalloftheareas Dim pFeat AsIFeature

Set pFeat = pFeatCur.NextFeature Do

dtotArea =dtotArea+pFeat.Value(lAIndex) Set pFeat = pFeatCur.NextFeature Loop Until pFeatIsNothing

'+++sendthetotalareatoamessagebox MsgBox dtotArea

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

例子代码:

Dim pFeatcls AsIFeatureClass Dim pFeatLayer AsIFeatureLayer Dim pDoc AsIMxDocument

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4