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

ArcEngine - 开发接口集(3)

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

15. Dim pFeature As IFeature 16.

17. Set pEnumFeat = pEditor.EditSelection 18.

19. Dim pGeometry As IGeometry 20.

21. Set pFeature = pEnumFeat.Next 22.

23. While Not pFeature Is Nothing

24. If pFeature.Shape.GeometryType = esriGeometryPolygon Then 25. (通过pFeature.Shape获得Geometry) 26. Set pGeometry = pFeature.Shape

27. MsgBox \28. & \29. & \30. & \= \& pGeometry.Envelope.XMin & \&

pGeometry.Envelope.YMin & \

31. & pGeometry.Envelope.XMax & \

vbCrLf _

32. & \ \

33. & \34. End If

35. Set pFeature = pEnumFeat.Next 36. Wend 37. End Sub

IGeometry接口的第一个属性Dimension(只读,返回一个类型为esriGeometryDimension的该图形的几何维度)

-1 esriGeometryNoDimension 1 esriGeometry0Dimension 2 esriGeometry1Dimension 4 esriGeometry2Dimension

5 esriGeometry25Dimension 6 esriGeometry3Dimension

IGeometry接口的第二个属性Extent(只读,返回一个类型为IEnvelope的该图形的几何范围的最大边框)

IGeometry接口的第三个属性GeometryType(只读,返回一个类型为esriGeometryType的该图形的几何类型)

esriGeometryNull = 0 esriGeometryPoint = 1 esriGeometryMultipoint = 2 esriGeometryPolyline = 3 esriGeometryPolygon = 4 esriGeometryEnvelope = 5 esriGeometryPath = 6 esriGeometryAny = 7 esriGeometryMultiPatch = 9 esriGeometryRing = 11 esriGeometryLine = 13 esriGeometryCircularArc = 14 esriGeometryBezier3Curve = 15 esriGeometryEllipticArc = 16 esriGeometryBag = 17 esriGeometryTriangleStrip = 18 esriGeometryTriangleFan = 19 esriGeometryRay = 20 esriGeometrySphere = 21

9. 关于IArea接口(esriGeometry) 1. Public Sub t_IArea_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. If pEditor.SelectionCount <> 1 Then 9. MsgBox \10. Exit Sub 11. End If 12.

13. Dim pEnumFeat As IEnumFeature 14. Dim pFeature As IFeature 15. Dim i As Long 16.

17. Set pEnumFeat = pEditor.EditSelection 18.

19. Dim pArea As IArea 20. Dim pCenter As IPoint 21. Dim pLabel As IPoint 22. Set pCenter = New Point 23. Set pLabel = New Point 24.

25. Set pFeature = pEnumFeat.Next 26.

27. While Not pFeature Is Nothing

28. If pFeature.Shape.GeometryType = esriGeometryPolygon Then 29. Set pArea = pFeature.Shape

30. MsgBox \31. & \

32. & \33. & \34. & pArea.LabelPoint.X & vbCrLf _

35. & \36.

37. pArea.QueryCentroid pCenter 38. pArea.QueryLabelPoint pLabel

39. MsgBox \40. & \41. & \42. End If

43. Set pFeature = pEnumFeat.Next 44. Wend 45. End Sub

IArea接口的第一个属性Area(只读,返回一个double类型的数值,为此Area的面积) IArea接口的第二个属性Centroid(只读,返回一个IPoint类型的变量,为此Area的重心) IArea接口的第三个属性LablePoint(只读,返回一个IPoint类型的变量,为此Area的标签的位置,一般都在此Area的内部)

IArea接口的第四个方法QueryCentroid (Center ) (方法,Center参数为一个IPoint类型的变量,通过调用此方法将重心点赋值给参数Center)

IArea接口的第五个方法QueryLablePoint (LablePoint ) (方法,LablePoint参数为设置IPoint类型的变量,通过调用此方法将标签点赋值给参数LablePoint)

10. 关于IEnvelope接口(esriGeometry) 应用:(中心放大)

1. Public Sub ZoomInCenter()

2. Dim pMxDocument As IMxDocument 3. Dim pActiveView As IActiveView

4. Dim pDisplayTransform As IDisplayTransformation 5. Dim pEnvelope As IEnvelope 6. Dim pCenterPoint As IPoint 7.

8. Set pMxDocument = Application.Document

9. Set pActiveView = pMxDocument.FocusMap 10. Set

pDisplayTransform

=

pActiveView.ScreenDisplay.DisplayTransformation 11. Set pEnvelope = pDisplayTransform.VisibleBounds

12. 'In this case, we could have set pEnvelope to IActiveView::Extent 13. 'Set pEnvelope = pActiveView.Extent 14. Set pCenterPoint = New Point 15.

16. pCenterPoint.x = ((pEnvelope.XMax - pEnvelope.XMin) / 2) + pEnvelope.XMin 17. pCenterPoint.y = ((pEnvelope.YMax - pEnvelope.YMin) / 2) + pEnvelope.YMin 18. pEnvelope.width = pEnvelope.width / 2 19. pEnvelope.height = pEnvelope.height / 2 20. pEnvelope.CenterAt pCenterPoint

21. pDisplayTransform.VisibleBounds = pEnvelope 22. pActiveView.Refresh 23. End Sub

IEnvelope接口的第一个方法CenterAt(pPoint) (方法,将这个矩形的边框移动到参数pPoint的位置,但是其他属性不变,如它的Width和Height) 例子代码:

1. ' The example shows how to move an Envelope to a new 2. ' center point (pPoint). 3. Public Sub t_EnvCenterAt() 4. Dim pEnv1 As IEnvelope 5. Dim pPoint As IPoint 6.

7. Set pEnv1 = New Envelope 8. Set pPoint = New Point 9.

10. pEnv1.PutCoords 100, 100, 200, 200 11. pPoint.PutCoords 0, 0 12.

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

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