5. Set pFields = pFeatClass.Fields
6. 'Find the field with the aliasname \7. i = pFields.FindFieldByAliasName(\8. 'Set the current field 9. Set pField = pFields.Field(i) 10. 'Delete field from featureclass 11. pFeatClass.DeleteField pField
4. 关于IPoint接口(esriGeometry)
IPoint接口的第一个方法PutCoords(X,Y)(方法,设置该点的坐标)或者直接调用可以读写的属性X和Y,将坐标赋值给X和Y 例子代码:
1. Dim pPoint As IPoint 2. Set pPoint = New Point 3. pPoint.PutCoords 100, 100
IPoint接口的第二个方法QueryCoords(X,Y) (方法,得到该点的坐标) 例子代码:
1. Dim pPoint as IPoint
2. Dim dX as Double, dY as Double 3. pPoint.QueryCoords dX, dY
IPoint接口的第三个方法ConstrainAngle (constraintAngle, anchor, allowOpposite ) (方法,如果第三个参数allowOpposite为True,则将第二个参数anchor这个点作为一个原点,然后以第一个参数constraintAngle为与x轴的角度,做一条直线,再将调用此参数的点向该直线做垂线并交于一个新点,并将调用此方法的点移动到该点)例子代码: 1. 'Finds the closes point to line from (0,0) with angles 2. 'defined by steps of pi/4 (Note all angles in radians) 3. Dim pApoint As IPoint 4. Dim pNpoint As IPoint 5. Dim pi As Double
6. Dim dAngle As Double 7. Dim i As Long 8.
9. Set pApoint = New Point 10. pi = 4 * Atn(1) 11. dAngle = 0
12. pApoint.PutCoords 0, 0 13.
14. Set pNpoint = New Point 15.
16. For i = 0 To 7
17. pNpoint.PutCoords 1, 0 18. dAngle = i * pi / 4
19. pNpoint.ConstrainAngle dAngle, pApoint, True
20. MsgBox \= \& i & \& vbCrLf & pNpoint.X & \& pNpoint.Y 21. Next i
IPoint接口的第四个方法ConstrainDistance (constraintRadius, anchor ) (方法,以第二个参数anchor这个点为圆心,然后以第一个参数constraintRadius为半径做一个圆,将调用此参数的点移动到该点与圆心做线段交于该圆的交点上)例子代码: 1. Public Sub t_constraindistance() 2. Dim pPoint As IPoint 3. Dim pNPoint As IPoint 4. Dim dRadius As Double 5.
6. Set pPoint = New Point 7. pPoint.PutCoords 0, 0 8.
9. Set pNPoint = New Point 10. pNPoint.PutCoords 2, 2 11. dRadius = 1.4142135623731 12.
13. pNPoint.ConstrainDistance dRadius, pPoint
14. MsgBox \15. End Sub
5. 关于IPointArray接口(esriGeometry)
IPointArray接口的第一个方法Add(p) (方法,向该类型的数组变量添加Point) IPointArray接口的第二个属性Count (只读,获得该数组变量中Point的个数,返回Long类型变量)
IPointArray接口的第三个属性Element(Index) (只读,获得该数组变量中位于参数Index索引位置的点Point,返回一个Point类型的变量)
IPointArray接口的第四个方法Insert (Index, p ) (方法,向索引位置Index插入一个点Point)
IPointArray接口的第五个方法Remove (Index ) (方法,移除索引位置Index的点Point) IPointArray接口的第六个方法RemoveAll (方法,移除所有在此数组中的点)
6. 关于IPointCollection接口(esriGeometry)
IPointCollection接口的第一个方法AddPoint(inPoint [,before] [,after]) (方法,向该类型的点集变量添加Point,第一个参数为添加的Point,第二个第三个参数为可选择的参数,默认添加进点集的末尾)
IPointCollection接口的第二个属性Point(i) (只读,获得该点集变量中第i个位置的Point,返回IPoint类型变量,i从0计算开始)
IPointCollection接口的第三个属性PointCount (只读,获得该点集变量中点的个数,返回Long类型变量,切记,如果一个PointCollection变量是由闭合的Geometry转换而来的话,那么点的个数比节点数多一个,因为是闭合的,所以首位节点是同一个点)
7. 关于IPolyline接口(esriGeometry)
IPolyline接口的第一个属性FromPoint与ToPoint(读写,设置或者读取该点的起始点和终止点,返回都是IPoint类型的变量)
IPolyline接口的第二个方法QueryFromPoint (from )(方法,返回IPoint类型的变量到参数from)
IPolyline接口的第三个方法QueryToPoint (to ) (方法,返回IPoint类型的变量到参数to)
1. Public Sub t_ICurve_QueryPoints() 2. Dim pID As New UID 3. pID = \4. Dim pEditor As IEditor 5. Dim pApp As IApplication 6. Set pApp = MxApplication
7. Set pEditor = pApp.FindExtensionByCLSID(pID) 8.
9. If pEditor.SelectionCount <> 1 Then 10. MsgBox \11. Exit Sub 12. End If 13.
14. Dim pEnumFeat As IEnumFeature 15. Dim pFeature As IFeature 16.
17. Set pEnumFeat = pEditor.EditSelection 18.
19. Dim pCurve As ICurve 20. Dim pPointFrom As IPoint 21. Dim pPointTo As IPoint 22.
23. Set pPointFrom = New Point 24. Set pPointTo = New Point 25.
26. Set pFeature = pEnumFeat.Next 27.
28. While Not pFeature Is Nothing
29. If pFeature.Shape.GeometryType = esriGeometryPolyline Or _ 30. esriGeometryPolyline Or esriGeometryLine Then 31. Set pCurve = pFeature.Shape 32. pCurve.QueryFromPoint pPointFrom
33. pCurve.QueryToPoint pPointTo
34. MsgBox \
35. & \
pPointFrom.Y & vbCrLf _
36. & \(x,y) = \& pPointTo.X & \& pPointTo.Y
& vbCrLf 37. End If
38. Set pFeature = pEnumFeat.Next 39. Wend 40. End Sub
IPolyline接口的第四个方法Generalize (maxAllowableOffset ) (方法,用道格拉斯普克发来简化polyline)
IPolyline接口的第五个方法Weed (maxAllowableOffsetFactor ) (方法,和方法Generalize类似,均为简化polyline的方法,不同的是参数。)
8. 关于IGeometry接口(esriGeometry) 1. Public Sub t_IGeometry_polygon() 2. Dim pID As New UID 3. pID = \4. Dim pEditor As IEditor 5. Dim pApp As IApplication 6. Set pApp = Application
7. Set pEditor = pApp.FindExtensionByCLSID(pID) 8.
9. If pEditor.SelectionCount <> 1 Then 10. MsgBox \11. Exit Sub 12. End If 13.
14. Dim pEnumFeat As IEnumFeature
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库ArcEngine - 开发接口集(2)在线全文阅读。
相关推荐: