完整代码:
Dim PWKID As Integer
dim zyzwx as Double
'创建空间参考
PWKID = 4513 - 25 + Val(zyzwx) / 3
Dim RF1 As ArcGIS.Core.Geometry.SpatialReference = SpatialReferenceBuilder.CreateSpatialReference(PWKID)
Dim shapeDescription As ShapeDescription = New ShapeDescription(GeometryType.Polygon, RF1)
'获取默认地理数据库
Dim gdbPath As String = Project.Current.DefaultGeodatabasePath
'创建要素类
Await QueuedTask.Run(Sub()
Dim globalIDFieldDescription As FieldDescription =
FieldDescription.CreateGlobalIDField()
Dim FieldDescription1 As FieldDescription =
FieldDescription.CreateStringField("备注", 50)
Dim FieldDescription2 As FieldDescription = FieldDescription.CreateStringField("所属图", 50)
fieldDescriptions = New List(Of FieldDescription) From {globalIDFieldDescription, FieldDescription1, FieldDescription2}
shapeDescription = New ShapeDescription(GeometryType.Polygon, RF1)
Dim generalPlacementProperties As CIMMaplexGeneralPlacementProperties = New CIMMaplexGeneralPlacementProperties
With generalPlacementProperties '常规放置属性
.AllowBorderOverlap = True '允许边框重叠
.PlacementQuality = MaplexQualityType.High '精准放置
.DrawUnplacedLabels = True
.InvertedLabelTolerance = 1.0 '容差
.RotateLabelWithDisplay = True '随显示旋转标签
End With
Dim blueLabelClass As CIMLabelClass = New CIMLabelClass
With blueLabelClass
.Name = "Blue"
.ExpressionTitle = "Expression-Blue"
.ExpressionEngine = LabelExpressionEngine.Arcade
.Expression = "$feature.OBJECTID"
.ID = 1
.Priority = 0
.Visibility = True
.TextSymbol = New CIMSymbolReference
With .TextSymbol
.Symbol = New CIMTextSymbol()
End With
End With
Dim labelClasses As List(Of CIMLabelClass) = New List(Of CIMLabelClass) From {blueLabelClass}
Dim AnnotationFeatureClassDescription As AnnotationFeatureClassDescription = New AnnotationFeatureClassDescription(lva(0), fieldDescriptions, shapeDescription, generalPlacementProperties, labelClasses)
AnnotationFeatureClassDescription.ReferenceScale = 5000
SchemaBuilder.Create(AnnotationFeatureClassDescription)
Dim success As Boolean = SchemaBuilder.Build()
End Sub)
txtSymbol:
Angel 文本符号的放置角度
BlockProgression 多行文本的堆叠方向
Callout 引线
DrawSoftHyphen 连字符
FlipAngle 文本翻转(镜像)到位的角度
FontEffects 上下标
FontEncoding 获取文字的Encoding
FontFamilyName 字体名称
FontStyleName 字形样式,例如粗体、斜体。
FontType 字体样式,如宋体。
HaloSize 描边大小
HaloSymbol 描边符号
Height 文本高度
HorizontalAlignment 文本与几何体水平对齐的对齐类型
VerticalAlignment 文本与几何体垂直对齐的对齐类型
IndentAfter 后缩进
IndentBefore 前缩进
IndentFirstLine 首行缩进
LetterSpacing 字间距
LetterWidth 字宽度
LineGap 行间距
LineGapType 行间距类型
OffsetX X轴偏移
OffsetY Y轴偏移
ShadowColor 阴影颜色
ShadowOffsetX 阴影X轴偏移
ShadowOffsetY 阴影Y轴偏移
SmallCaps 字母大小写
Strikethrough 删除线
Symbol 文字符号
TextDirection 文字方向
Underline 下划线
WordSpacing 单词间距