Select to view content in your preferred language

drawing callout text element in mapview with fix distance from polygon centroid ?

4002
1
01-13-2015 12:58 PM
helenchu
Frequent Contributor

Hi,

What I'm trying to achieve is placing a call out text with anchor point is the polygon centroid.  I got that done.  However for the callout part, I don't know how to make it appear about 1/2 an inch away from the point (polygon's centroid) on the screen. 

Any help is greatly appreciated.

pArea = pFeature.Shape

pPointAnchor = pArea.Centroid

pPointText = ??????

Dim pCallout As ICallout

pCallout = New BalloonCallout

pCallout.AnchorPoint = pPointAnchor

Dim pElement As IElement

pElement = pTextElement

Dim pTextSymbol As IFormattedTextSymbol

pTextSymbol = New TextSymbol

pTextSymbol.Background = pCallout

pTextSymbol.Color = pColor

pTextSymbol.Font = pFontDisp

pTextElement.Symbol = pTextSymbol

pElement.Geometry = pPointText

pGraphicsContainer.AddElement(pElement, 0)

pGraphicsContainer.AddElement(pointElement, 0)

Tags (2)
0 Kudos
1 Reply
AhmedEl-Sisi
Deactivated User

Hi Helen,

You can reach this using ITransform2D.Move Method  it will move your element dx units horizontally and dy units vertically.

The code should be like the following before you add your element to graphics container

:

Dim transform2d As ITransform2D = CType(pElement, ITransform2D)
'move your element by dX and dY in map units
transform2d.Move(dX, dY)
0 Kudos