LuciadCPillar 2023.1.04
luciad::Map::ViewMapTransformation Class Referenceabstract

This class allows to transform between view (pixel coordinates on the screen) and map coordinates. More...

#include <luciad/maps/Map.h>

Public Member Functions

virtual ~ViewMapTransformation ()=default
 
virtual std::optional< CoordinatemapToView (const Point &point) const =0
 Transform a point from the world reference to a coordinate in the view space. More...
 
virtual std::optional< PointviewToMap (LocationMode locationMode, const Coordinate &coordinate) const =0
 Transform a coordinate from the view to a point in the world reference using the desired location mode. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~ViewMapTransformation()

virtual luciad::Map::ViewMapTransformation::~ViewMapTransformation ( )
virtualdefault

Member Function Documentation

◆ mapToView()

virtual std::optional< Coordinate > luciad::Map::ViewMapTransformation::mapToView ( const Point point) const
pure virtual

Transform a point from the world reference to a coordinate in the view space.

If the point cannot be represented on the view, a std::nullopt 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
pointthe point in the map space.
Returns
the coordinate in the view space (device independent pixels), or std::nullopt.
Exceptions
InvalidArgumentExceptionwhen the point is not defined in the map reference.

◆ viewToMap()

virtual std::optional< Point > luciad::Map::ViewMapTransformation::viewToMap ( LocationMode  locationMode,
const Coordinate coordinate 
) const
pure virtual

Transform a coordinate from the view to a point in the world reference using the desired location mode.

Parameters
locationModethe desired location mode.
See also
LocationMode
Parameters
coordinatethe point in the view space (device independent pixels)
Returns
the point on the Map, or std::nullopt when the given view point does not correspond to a point on the Map.