Problem: 当ArcMap数据框投影改变时,地理数据库注记发生旋转
文章编号 : 33682
软件: ArcGIS - ArcEditor 9.1, 9.2, 9.3, 9.3.1 ArcGIS - ArcInfo 9.1, 9.2, 9.3, 9.3.1 ArcGIS - ArcView 9.1, 9.2, 9.3, 9.3.1
操作系统: N/A
软件: ArcGIS - ArcEditor 9.1, 9.2, 9.3, 9.3.1 ArcGIS - ArcInfo 9.1, 9.2, 9.3, 9.3.1 ArcGIS - ArcView 9.1, 9.2, 9.3, 9.3.1
操作系统: N/A
1 个回复
易智瑞技术支持
赞同来自:
原因: 当在特定坐标系统创建地理数据库注记时,该注记与页面保持水平。当ArcMap数据框的投影转换为具有不同中央经线的新坐标系统后,注记将围绕新的中央经线发生顺时针或逆时针旋转。
解决方法:
以下脚本可将注记几何从线转为点。作为点几何,当注记所在的ArcMap数据框坐标系统转换为具有新中央经线值的坐标系统时,该注记将不再发生旋转。 以下是在ArcMap中安装和运行脚本的步骤: 1. 在ArcMap中打开新的空地图,向地图中添加注记要素类。 2. 转到工具> 宏命令> Visual Basic编辑器。 3. 在Visual Basic编辑器中,在左侧面板中工程-工程下,打开Normal(Normal.mxt) > ArcMap 对象 >此文档。 4. 单击插入>文件,导航至AnnoLine2Point.txt文件所在的目录,双击文件将其添加到页面中。 5. 保持Visual Basic编辑器窗口处于打开状态,返回到ArcMap中,开启编辑会话。要进行编辑的目标图层就是注记要素类。 6. 在内容列表中右键单击注记要素类名称,选择>选择全部。 7. 返回Visual Basic编辑器窗口,单击运行>运行宏,选择宏“AnnoLine2Point”,然后单击运行。
Option Explicit ' Author ESRI BeLux - nov 2004 Public Sub AnnoLineToPoint() ' Condition: ' - Start Edit session ' - Annotation selected (with text different from null string) ' ----------------------------------------------------------- Dim pEditor As IEditor Dim pID As New UID Dim pEnumFeature As IEnumFeature Dim pFeature As IFeature Dim Count As Long Dim pActiveView As IActiveView Dim number_feature As Integer 'Nombre de features modifiés number_feature = 0 pID = "esriEditor.Editor" Set pEditor = Application.FindExtensionByCLSID(pID) pEditor.StartOperation Set pEnumFeature = pEditor.EditSelection pEnumFeature.Reset Set pFeature = pEnumFeature.Next Do Until pFeature Is Nothing Dim pElement As IElement Dim pAnnoF As IAnnotationFeature Set pAnnoF = pFeature Set pElement = pAnnoF.Annotation If TypeOf pElement Is ITextElement Then If TypeOf pElement.Geometry Is IPolyline Then Dim pGeometry As IGeometry Dim pPointColl As IPointCollection Set pGeometry = pFeature.Shape Set pPointColl = pGeometry Dim pPointColl2 As IPoint Set pPointColl2 = New Point 'Place the point of the point on the middle of the line 'The text is place in a polygone. Dim newx As Double, newy As Double newx = ((pPointColl.Point(0).X + pPointColl.Point(3).X) / 2) newy = ((pPointColl.Point(0).Y + pPointColl.Point(3).Y) / 2) pPointColl2.PutCoords newx, newy Set pGeometry = pPointColl2 pElement.Geometry = pGeometry Dim pTextElement As ITextElement Set pTextElement = pElement Dim pSimpTextSymbol As ISimpleTextSymbol 'we need to reset the offset because the feature shape doesn't 'represent it. Otherwise, the text will move if it has offsets Set pSimpTextSymbol = pTextElement.Symbol pSimpTextSymbol.Angle = 0 ' Force the texte to be horizontal pTextElement.Symbol = pSimpTextSymbol Set pElement = pTextElement pAnnoF.Annotation = pElement Set pFeature = pAnnoF pFeature.Store number_feature = number_feature + 1 'do nothing for lines: we are working with points here End If End If Set pFeature = pEnumFeature.Next Loop pEditor.StopOperation "Convert Line to point annotations for " & number_feature & " features." pEditor.Display.Invalidate Nothing, True, esriAllScreenCaches End Sub
创建时间:2012-02-27
最近更新: 2012-02-27
【原文链接】
http://support.esrichina.com.c ... .html
要回复问题请先登录或注册