Getting map coordinates from screen coordinates
Call GetMapCoordinatesFromScreenCoordinates by passing in an IPoint that contains the x,y values from the device (screen) in your Windows application and an IActiveView. An IPoint containing the real-world (map) coordinates is returned.
See the following:
[Java]
static IPoint getMapCoordinatesFromScreenCoordinates(IPoint screenPoint, IActiveView
activeView)throws Exception{
if (screenPoint == null || screenPoint.isEmpty() || activeView == null)
return null;
IScreenDisplay screenDisplay = activeView.getScreenDisplay();
IDisplayTransformation displayTransformation =
screenDisplay.getDisplayTransformation();
return displayTransformation.toMapPoint((int)screenPoint.getX(), (int)
screenPoint.getY());
}
See Also:
Convert map coordinates to screen coordinatesDevelopment licensing | Deployment licensing |
---|---|
ArcView | ArcView |
ArcEditor | ArcEditor |
ArcInfo | ArcInfo |
Engine Developer Kit | Engine Runtime |