向Scene或Globe中加入3D文本标注是很多人都困扰过的问题,我也曾经困扰了很久,其中关键的语句就是Update上,下面是加入3D文本的函数
''' <summary>
''' 加3D文本
''' </summary>
''' <param name="ptext">要加入的文本内容</param>
''' <param name="pAnchorPoint">添加文本的点</param>
''' <param name="pHeight">文本的高度</param>
''' <param name="pDepth">文本的深度</param>
''' <param name="pGC3D">包含文本的图层</param>
''' <remarks></remarks>
Public Shared Sub DrawText(ByVal pAnchorPoint As IPoint, ByVal pText As String, ByVal pHeight As Double, ByVal pDepth As Double, ByVal pColor As IRgbColor, ByVal pGC3D As IGraphicsContainer3D)
Dim pTextElement As IText3DElement = New Text3DElement
Dim pFillShapeElement As IFillShapeElement = New Text3DElement
Dim pFillSymbol As IFillSymbol = New SimpleFillSymbol
pFillSymbol.Color = pColor
With pTextElement
.AnchorPoint = pAnchorPoint
.Alignment = esriT3DAlignment.esriT3DAlignHorizontal
.Height = pHeight
.Text = pText
.AxisRotation = esriT3DRotationAxis.esriT3DRotateAxisZ
.BoldFont = True
.Depth = pDepth
.OrientationPlane = esriT3DOrientationPlane.esriT3DPlaneXZ
.ZAxisScale = 1
.Justification = esriT3DJustification.esriT3DJustifyCenter
.Update()
End With
pFillShapeElement = pTextElement
pFillShapeElement.Symbol = pFillSymbol
pGC3D.AddElement(pTextElement)
End Sub
posted on 2008-02-22 17:02
王者之魂 阅读(68)
评论(1) 编辑 收藏