LuciadCPillar 2023.1.04
|
Class that allows to build a fit action and apply it, either directly or using an animation. More...
#include <luciad/maps/MapNavigator.h>
Public Member Functions | |
~FitAction () | |
FitAction & | animate (bool animated) |
Specifies if the action should use an animation. More... | |
FitAction & | bounds (Bounds bounds) |
Sets the bounds to fit on. More... | |
FitAction & | duration (std::chrono::milliseconds duration) |
Specifies the duration of the animation. More... | |
void | fit () const |
Applies the fit action. More... | |
FitAction & | fitMarginPercent (double fitMarginPercent) |
The fit margin is the margin between the bounds to fit on and the edge of the visible map. More... | |
Class that allows to build a fit action and apply it, either directly or using an animation.
Fitting works by:
Example: Execute a fit action
luciad::MapNavigator::FitAction::~FitAction | ( | ) |
FitAction & luciad::MapNavigator::FitAction::animate | ( | bool | animated | ) |
Specifies if the action should use an animation.
animated | if this action should use an animation. The default is false. |
Sets the bounds to fit on.
These bounds can be defined in any reference
This parameter is mandatory. Not setting it will cause FitAction::fit to throw an exception.
bounds | the bounds to fit on |
FitAction & luciad::MapNavigator::FitAction::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.
duration | the duration of the animation in milliseconds. The default is 2000 (=2 seconds) |
void luciad::MapNavigator::FitAction::fit | ( | ) | const |
Applies the fit action.
luciad::LogicException | if the action is not built correctly, for example if mandatory parameters are missing, or if incompatible parameters are configured. |
FitAction & luciad::MapNavigator::FitAction::fitMarginPercent | ( | double | fitMarginPercent | ) |
The fit margin is the margin between the bounds to fit on and the edge of the visible map.
A fit margin of "5%" will add a margin of 5% of the map's screen dimensions on each side of the bounds, the center remains unchanged.
This parameter is optional. The default fit margin is 2%.
fitMarginPercent | a fit margin, expressed as a percentage. |
luciad::InvalidArgumentException | when a fit margin >= 50% is specified, or a value <= 0. |