ARCGIS PRO SDK 利用几何对象集合创建多行注记

利用几何对象GeometryBag创建多行注记,选择编辑效果如下图

如果采用点放置,效果如下

利用几何对象GeometryBag创建多行注记实现代码:

复制代码
'''zg:字高
'''zk:字宽
'''zt:字体名称
'''ys:字体重
'''selectedColor:颜色
'''PP MapPoint点
'''AnnoLayer 写入 AnnotationLayer  注记类图层
Dim AnnoLayer As AnnotationLayer
Dim annoFCDef As AnnotationFeatureClassDefinition
Dim txtSymbol As CIMTextSymbol
Dim PsymbolRef As CIMSymbolReference
Dim PCIMTextGraphic As CIMTextGraphic
Dim PannoFeat As AnnotationFeature
Dim selectedColor As CIMColor
Dim pp As MapPoint
Dim dx As Double, dy As Double
Dim zj_text As String
Dim PannoFeat As AnnotationFeature
Dim pFeature As Feature
Await QueuedTask.Run(Sub()
                         pAnnoFeatureClass = AnnoLayer.GetFeatureClass
                         dx = PP.X
                         dy = PP.Y
                         txtSymbol = SymbolFactory.Instance.ConstructTextSymbol(selectedColor)
                         rowBuffer = pAnnoFeatureClass.CreateRowBuffer()
                         pFeature = pAnnoFeatureClass.CreateRow(rowBuffer)
                         PannoFeat = pFeature
                         PannoFeat.SetStatus(AnnotationStatus.Placed)
                         PannoFeat.SetAnnotationClassID(1)
                         PCIMTextGraphic = New CIMTextGraphic()
                         zj_text = "神坊村九组" & vbLf & "神坊村<CHR spacing='-15'>---------------------------------------</CHR>40.53" & vbLf & "DK0001"
                         PCIMTextGraphic.Text = zj_text
                         Dim pGeometryBagBuilder As GeometryBagBuilderEx = New GeometryBagBuilderEx(RF1)
                         Dim builder As ArcGIS.Core.Geometry.GeometryBag
                         Dim builline As ArcGIS.Core.Geometry.Polyline
                         Dim newPoints1 As New List(Of Coordinate2D)()
                         For i As Integer = 0 To 2
                             newPoints1 = New List(Of Coordinate2D)()
                             If i = 0 Then
                                 newPoints1.Add(New Coordinate2D(dx, dy + zg * zjhj * DQBLC / 1000))
                                 newPoints1.Add(New Coordinate2D(dx + zg * 3 * DQBLC / 1000, dy + zg * zjhj * DQBLC / 1000))
                             End If
                             If i = 1 Then
                                 newPoints1.Add(New Coordinate2D(dx, dy))
                                 newPoints1.Add(New Coordinate2D(dx + zg * 3 * DQBLC / 1000, dy))
                             End If
                             If i = 2 Then
                                 newPoints1.Add(New Coordinate2D(dx, dy - zg * zjhj * DQBLC / 1000))
                                 newPoints1.Add(New Coordinate2D(dx + zg * 3 * DQBLC / 1000, dy - zg * zjhj * DQBLC / 1000))
                             End If
                             builline = New PolylineBuilderEx(newPoints1).ToGeometry
                             pGeometryBagBuilder.AddGeometry(builline)
                         Next
                         builder = pGeometryBagBuilder.ToGeometry
                         PCIMTextGraphic.Shape = builder
                         txtSymbol.Angle = dAngle     '获取或设置应用于文本符号的旋转量 (以度为单位),以几何图形为单位。
                         txtSymbol.SetColor(selectedColor)
                         txtSymbol.HorizontalAlignment =                                                   ArcGIS.Core.CIM.HorizontalAlignment.Left
                         txtSymbol.VerticalAlignment = ArcGIS.Core.CIM.VerticalAlignment.Center
                         txtSymbol.SetSize(zg)
                         txtSymbol.FontStyleName = ys
                         txtSymbol.FontFamilyName = zt    '字体家庭名称
                         txtSymbol.Height = zg
                         txtSymbol.LetterWidth = zk / zg * 100%
                         PsymbolRef = New CIMSymbolReference()
                         PsymbolRef.Symbol = txtSymbol
                         PCIMTextGraphic.Symbol = PsymbolRef
                         PannoFeat.SetGraphic(PCIMTextGraphic)
                         pFeature.Store()
                     End Sub)
相关推荐
七夜zippoe5 小时前
OpenClaw 技能发布与共享:从开发到社区贡献的完整指南
arcgis·skills·openclaw·clawhub·技能发布·技能共享
GIS地信小匠5 小时前
(27)ArcGIS Pro 范围内汇总、汇总统计数据与交集制表:空间统计三工具全攻略
arcgis·空间分析·数据处理·国土空间规划·空间统计·gis教程·arcgls pro
城数派7 小时前
2014-2025年全国监测站点的逐月空气质量数据(15个指标\Excel\Shp格式)
arcgis·信息可视化·数据分析·excel
GIS地信小匠3 天前
(26)ArcGIS Pro 面要素叠加编辑:更新与交集取反工具实操全解
arcgis·空间分析·数据处理·gis教程·arcgls pro
freewlt3 天前
Monorepo 架构下的前端工程化实践:pnpm + Turborepo 从入门到落地
前端·arcgis·架构
GIS地信小匠3 天前
(21)ArcGIS Pro 矢量拆分与相交分析:按属性 / 位置拆分 + 重叠提取全攻略
arcgis·空间分析·数据处理·gis教程·arcgls pro
GIS地信小匠3 天前
(25)ArcGIS Pro 要素字段融合、分配面:面要素空间编辑攻略
arcgis·空间分析·数据处理·gis教程·arcgls pro
FlDmr4i283 天前
ArcGIS授权管理器断网后自动停止
网络·arcgis
2401_863801464 天前
制作转换3Dtiles时候cesium(b3dm)模型没有阴影,没有材质感,发白显示太假怎么办
3d·arcgis·材质·3dtiles
liuccn5 天前
MBTiles的概念讲解
arcgis