locationToScreen method
- required ArcGISPoint mapPoint,
Converts a location in map coordinates to screen coordinates relative to the upper-left corner of the map view.
The screen coordinates are in device-independent pixels (DIP) relative to the upper-left corner at position 0,0. The screen coordinates returned may lie outside the current map view bounds. For example, if a map of the world is zoomed in to the extent of Africa, a map location within South America would result in a screen coordinate that is outside the screens bounds.
If the WrapAroundMode is enabled on the map view, this method returns the closest screen location matching the specified map location. If the map coordinate is in the visible area the method will return that screen coordinate, otherwise it will return the screen coordinate from the frame closest to the visible area.
To call this method, assign a map to the map view, ensure that it is loaded and the draw status is DrawStatus.completed.
Parameters:
mapPoint
— A location defined within the spatial reference of the map view.
Return Value: An Offset for the screen in pixels. NAN for x and y if an error occurs.
Implementation
Offset locationToScreen({
required ArcGISPoint mapPoint,
}) {
final coordinate = _withThrowingErrorHandler((errorHandler) {
return runtimecore.RT_MapView_locationToScreen(
_handle,
mapPoint._handle,
errorHandler,
);
});
return coordinate.toOffset();
}