ArcEngine接⼝⼤全(⼆)《转⾃ESRI中国社区》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 UID3. pID = \"esriEditor.editor\"4. Dim pEditor As IEditor5. Dim pApp As IApplication6. Set pApp = MxApplication
7. Set pEditor = pApp.FindExtensionByCLSID(pID)8.
9. If pEditor.SelectionCount <> 1 Then10. MsgBox \"select one Curve\"11. Exit Sub12. End If13.
14. Dim pEnumFeat As IEnumFeature15. Dim pFeature As IFeature16.
17. Set pEnumFeat = pEditor.EditSelection18.
19. Dim pCurve As ICurve20. Dim pPointFrom As IPoint21. Dim pPointTo As IPoint22.
23. Set pPointFrom = New Point24. Set pPointTo = New Point25.
26. Set pFeature = pEnumFeat.Next27.
28. While Not pFeature Is Nothing
29. If pFeature.Shape.GeometryType = esriGeometryPolyline
Or _
30. esriGeometryPolyline Or esriGeometryLine Then31. Set pCurve = pFeature.Shape32. pCurve.QueryFromPoint pPointFrom33. pCurve.QueryToPoint pPointTo
34. MsgBox \"+++ICurve properties...\" & vbCrLf _35. & \"Curve.QueryFromPoint (x,y) = \" & pPointFrom.X &\
36. & \"Curve.QueryToPoint (x,y) = \" & pPointTo.X & \& pPointTo.Y & vbCrLf37. End If
38. Set pFeature = pEnumFeat.Next
39. WendIPolyline接⼝的第四个⽅法Generalize(maxAllowableOffset )(⽅法,⽤道格拉斯普克发来简化polyline)
IPolyline接⼝的第五个⽅法Weed (maxAllowableOffsetFactor )(⽅法,和⽅法Generalize类似,均为简化polyline的⽅法,不同的是参数。)
8. 关于IGeometry接⼝(esriGeometry)1.Public Sub t_IGeometry_polygon()2. Dim pID As New UID3. pID = \"esriEditor.editor\"4. Dim pEditor As IEditor5. Dim pApp As IApplication6. Set pApp = Application
7. Set pEditor = pApp.FindExtensionByCLSID(pID)8.
9. If pEditor.SelectionCount <> 1 Then10. MsgBox \"select one polygon\"11. Exit Sub12. End If13.
14. Dim pEnumFeat As IEnumFeature15. Dim pFeature As IFeature16.
17. Set pEnumFeat = pEditor.EditSelection18.
19. Dim pGeometry As IGeometry20.
21. Set pFeature = pEnumFeat.Next22.
23. While Not pFeature Is Nothing
24. If pFeature.Shape.GeometryType = esriGeometryPolygonThen
25.(通过pFeature.Shape获得Geometry)26. Set pGeometry = pFeature.Shape
27. MsgBox \"+++Polygon::IGeometry properties...\" &vbCrLf _
28. & \"Dimension = \" & pGeometry.Dimension & vbCrLf _29. & \"Geometry type = \" & pGeometry.GeometryType &vbCrLf _
30. & \"Envelope = \" & pGeometry.Envelope.XMin & \pGeometry.Envelope.YMin & \31. & pGeometry.Envelope.XMax & \pGeometry.Envelope.YMin & vbCrLf _
32. & \"IsEmpty = \" & pGeometry.IsEmpty & vbCrLf _33. & \"SpatialReference = \" &
http://www.doczj.com/doc/77ec0180d4d8d15abe234eea.html34. End If
35. Set pFeature = pEnumFeat.Next36. Wend37.End Sub
IGeometry接⼝的第⼀个属性Dimension(只读,返回⼀个类型为esriGeometryDimension的该图形的⼏何维度)-1 esriGeometryNoDimension1 esriGeometry0Dimension2 esriGeometry1Dimension4 esriGeometry2Dimension5 esriGeometry25Dimension6 esriGeometry3Dimension
IGeometry接⼝的第⼆个属性Extent(只读,返回⼀个类型为IEnvelope的该图形的⼏何范围的最⼤边框)
IGeometry接⼝的第三个属性GeometryType(只读,返回⼀个类型为esriGeometryType的该图形的⼏何类型)esriGeometryNull = 0esriGeometryPoint = 1esriGeometryMultipoint = 2
esriGeometryPolyline = 3 esriGeometryPolygon = 4 esriGeometryEnvelope = 5 esriGeometryPath = 6 esriGeometryAny = 7esriGeometryMultiPatch = 9 esriGeometryRing = 11 esriGeometryLine = 13 esriGeometryCircularArc = 14
esriGeometryBezier3Curve = 15 esriGeometryEllipticArc = 16 esriGeometryBag = 17 esriGeometryTriangleStrip = 18esriGeometryTriangleFan = 19 esriGeometryRay = 20 esriGeometrySphere = 21
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- ovod.cn 版权所有 湘ICP备2023023988号-4
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务