Package com.luciad.maps
Class Map.ViewMapTransformation
java.lang.Object
com.luciad.maps.Map.ViewMapTransformation
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
Map
This class allows to transform between view (pixel coordinates on the screen) and map coordinates.
Unlike Camera
, it takes into account what is visible on the screen. When transforming a point from view to map coordinates, this method will select the nearest visible surface. When transforming a point from map to view coordinates, it will take into account the visibility of that map point.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected void
finalize()
Transform a point from the world reference to a coordinate in the view space.viewToMap
(Map.LocationMode locationMode, Coordinate coordinate) Transform a coordinate from the view to a point in the world reference using the desired location mode.
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
viewToMap
@Nullable public Point viewToMap(@NotNull Map.LocationMode locationMode, @NotNull Coordinate coordinate) Transform a coordinate from the view to a point in the world reference using the desired location mode.- Parameters:
locationMode
- the desired location mode.coordinate
- the point in the view space (device independent pixels)- Returns:
- the point on the
Map
, ornull
when the given view point does not correspond to a point on theMap
. - See Also:
-
mapToView
Transform a point from the world reference to a coordinate in the view space.If the point cannot be represented on the view, a
null
is returned. This happens for example when the given world point lies behind the camera.Note: this method does not take into account whether a point is hidden by something else on the screen. It can for example transform point on the back of the globe to view coordinates.
- Parameters:
point
- the point in the map space.- Returns:
- the coordinate in the view space (device independent pixels), or
null
. - Throws:
IllegalArgumentException
- when the point is not defined in the map reference.
-