LuciadCPillar 2023.1.04
luciad::MapNavigator::RotateAction Class Referencefinal

Class that allows to build a rotate action and apply it, either directly or using an animation. More...

#include <luciad/maps/MapNavigator.h>

Public Member Functions

 ~RotateAction ()
 
RotateActionanimate (bool animated)
 Specifies if the action should use an animation. More...
 
RotateActioncenter (const Point &centerMapLocation)
 Sets the center around which to rotate. More...
 
RotateActiondeltaPitch (double deltaPitch)
 Sets the pitch value that needs to be added to the initial pitch of the 3D camera. More...
 
RotateActiondeltaRotation (Azimuth deltaRotation)
 Sets the 2D rotation that needs to be added to the initial rotation of the camera. More...
 
RotateActiondeltaYaw (Azimuth deltaYaw)
 Sets the yaw value that needs to be added to the initial yaw of the 3D camera. More...
 
RotateActionduration (std::chrono::milliseconds duration)
 Specifies the duration of the animation. More...
 
void rotate () const
 Applies the rotate action. More...
 
RotateActiontargetPitch (double targetPitch)
 Sets the target pitch value of the 3D camera. More...
 
RotateActiontargetRotation (Azimuth targetRotation)
 Sets the target angle of the 2D camera rotation. More...
 
RotateActiontargetYaw (Azimuth targetYaw)
 Sets the target yaw of the 3D camera. More...
 

Detailed Description

Class that allows to build a rotate action and apply it, either directly or using an animation.

Rotating works by:

Example: Rotate the (2D) view

const auto& viewMapTransformation = map->getViewMapTransformation();
auto point = viewMapTransformation.viewToMap(Map::LocationMode::ClosestSurface, viewLocation);
if (point) {
map->getMapNavigator().newRotateAction().center(*point).deltaRotation(45).rotate();
}
@ ClosestSurface
Defines the view-to-map transformation mode where, for a given view point (pixels),...

Example of an incremental rotate action (for example based on a mouse drag):

const auto& viewMapTransformation = map->getViewMapTransformation();
auto point = viewMapTransformation.viewToMap(Map::LocationMode::ClosestSurface, viewLocation);
if (point) {
rotateAction = map->getMapNavigator().newRotateAction().center(*point);
// When a drag event arrives
rotateAction->deltaRotation(originalViewLocation.x - event.x).rotate();
// When an other drag event arrives
rotateAction->deltaRotation(originalViewLocation.x - event.x).rotate();
// When the drag gesture stops: cleanup
rotateAction.reset();
}

Constructor & Destructor Documentation

◆ ~RotateAction()

luciad::MapNavigator::RotateAction::~RotateAction ( )

Member Function Documentation

◆ animate()

RotateAction & luciad::MapNavigator::RotateAction::animate ( bool  animated)

Specifies if the action should use an animation.

Parameters
animatedif this action should use an animation. The default is false.
Returns
this

◆ center()

RotateAction & luciad::MapNavigator::RotateAction::center ( const Point centerMapLocation)

Sets the center around which to rotate.

This property is mandatory. Not setting it will cause the RotateAction::rotate method to throw an exception.

Parameters
centerMapLocationthe center, defined in the reference of the Map
Returns
this
Exceptions
luciad::InvalidArgumentExceptionif the toMapLocation parameter is not in the map coordinate reference.

◆ deltaPitch()

RotateAction & luciad::MapNavigator::RotateAction::deltaPitch ( double  deltaPitch)

Sets the pitch value that needs to be added to the initial pitch of the 3D camera.

Pitch is defined as the camera's tilt angle. A value of 0 points the camera towards the horizon (i.e. horizontally); -90 points straight down towards the ground and +90 points straight up.

This method can only be called when the Map is a 3D map (see Map::is3D).

Parameters
deltaPitchthe pitch value that needs to be added to the initial pitch of the 3D camera, expressed in degrees.
Returns
this
Exceptions
luciad::InvalidArgumentExceptionif the Map is a 2D Map.

◆ deltaRotation()

RotateAction & luciad::MapNavigator::RotateAction::deltaRotation ( Azimuth  deltaRotation)

Sets the 2D rotation that needs to be added to the initial rotation of the camera.

This method can only be called when the Map is a 2D map (see Map::is3D).

Parameters
deltaRotationthe 2D rotation that needs to be added to the initial rotation of the camera
Returns
this
Exceptions
luciad::InvalidArgumentExceptionif the Map is a 3D Map.

◆ deltaYaw()

RotateAction & luciad::MapNavigator::RotateAction::deltaYaw ( Azimuth  deltaYaw)

Sets the yaw value that needs to be added to the initial yaw of the 3D camera.

This method can only be called when the Map is a 3D map (see Map::is3D).

Parameters
deltaYawthe yaw value that needs to be added to the initial yaw of the 3D camera.
Returns
this
Exceptions
luciad::InvalidArgumentExceptionif the Map is a 2D Map.

◆ duration()

RotateAction & luciad::MapNavigator::RotateAction::duration ( std::chrono::milliseconds  duration)

Specifies the duration of the animation.

This parameter is only used if animate(bool) is called with true as argument.

Parameters
durationthe duration of the animation in milliseconds. The default is 2000 (=2 seconds)
Returns
this

◆ rotate()

void luciad::MapNavigator::RotateAction::rotate ( ) const

Applies the rotate action.

Exceptions
luciad::LogicExceptionif the action is not built correctly, for example if mandatory parameters are missing, or if incompatible parameters are configured.

◆ targetPitch()

RotateAction & luciad::MapNavigator::RotateAction::targetPitch ( double  targetPitch)

Sets the target pitch value of the 3D camera.

After the rotate operation finishes, the map's pitch will equal this value.

Pitch is defined as the camera's tilt angle. A value of 0 points the camera towards the horizon (i.e. horizontally); -90 points straight down towards the ground and +90 points straight up.

This method can only be called when the Map is a 3D map (see Map::is3D).

Parameters
targetPitchthe target pitch value of the 3D camera, expressed in degrees
Returns
this
Exceptions
luciad::InvalidArgumentExceptionif the Map is a 2D Map.
Since
2021.1

◆ targetRotation()

RotateAction & luciad::MapNavigator::RotateAction::targetRotation ( Azimuth  targetRotation)

Sets the target angle of the 2D camera rotation.

After the rotate operation finishes, the map's rotation will equal this value.

This method can only be called when the Map is a 2D map (see Map::is3D).

Parameters
targetRotationthe target angle of the 2D camera rotation.
Returns
this
Exceptions
luciad::InvalidArgumentExceptionif the Map is a 3D Map.
Since
2021.1

◆ targetYaw()

RotateAction & luciad::MapNavigator::RotateAction::targetYaw ( Azimuth  targetYaw)

Sets the target yaw of the 3D camera.

After the rotate operation finishes, the map's yaw will equal this value.

This method can only be called when the Map is a 3D map (see Map::is3D).

Parameters
targetYawthe target yaw of the 3D camera
Returns
this
Exceptions
luciad::InvalidArgumentExceptionif the Map is a 2D Map.
Since
2021.1