Arc Engine Page Layoutcontrol Get page coordinates from centroid of polygon

4061
0
12-31-2014 12:06 PM
BobFolsom
New Contributor

Help Please.

 

I have an Arc Engine application that contains a PAGELAYOUT CONTROL In the code progressing I have acquired the centroid's of some selected polygons in realworld coordinates (ie  x = 2484242.45 and Y = 276913.75)  I have verified the coordinates are correct in arc map for the selected polygons.  I am trying to use the centroid x, y location to be the anchor point for some balloon callouts. thus converting the realworld coordinates to page units (ie x = 1.1 in & y = 4.3in)  Here I run into problems.  Here is function I found on esri site but Obviously I am missing something and I know it is probably something simple.  Can anyone help  I am definately not getting page units to anchor the text balloon callouts like I expected.  I am thinking I might have to populates some constants prior to running the conversion.  Here is the function as I have used it

 

 

Function GetScreenCoordinatesFromMapCoorindates(ByVal mapPoint As ESRI.ArcGIS.Geometry.IPoint, ByVal activeView As ESRI.ArcGIS.Carto.IActiveView, ByVal mapenvelope As IEnvelope) As ESRI.ArcGIS.Geometry.IPoint

 

If mapPoint Is Nothing OrElse mapPoint.IsEmpty OrElse activeView Is Nothing Then

     Return Nothing

End If

 

Dim screenDisplay As ESRI.ArcGIS.Display.IScreenDisplay = activeView.ScreenDisplay

 

Dim displayTransformation As ESRI.ArcGIS.Display.IDisplayTransformation = screenDisplay.DisplayTransformation

 

Dim x As System.Int32

Dim y As System.Int32

 

displayTransformation.FromMapPoint(mapPoint, x, y)

 

Dim returnPoint As ESRI.ArcGIS.Geometry.IPoint = New ESRI.ArcGIS.Geometry.PointClass

 

returnPoint.PutCoords(x, y)

 

Return returnPoint

 

End Function

Tags (2)
0 Kudos
0 Replies