public static final class MapNavigator.FitAction extends Object implements AutoCloseable
Fitting works by:
Example: Execute a fit action
map.getMapNavigator().newFitAction().bounds(bounds).fitMarginPercent(5).fit();
Modifier and Type | Method and Description |
---|---|
MapNavigator.FitAction |
animate(boolean animated)
Specifies if the action should use an animation.
|
MapNavigator.FitAction |
bounds(Bounds bounds)
Sets the bounds to fit on.
|
void |
close() |
MapNavigator.FitAction |
duration(Duration duration)
Specifies the duration of the animation.
|
protected void |
finalize() |
void |
fit()
Applies the fit action.
|
MapNavigator.FitAction |
fitMarginPercent(double fitMarginPercent)
The fit margin is the margin between the bounds to fit on and the edge of the visible map.
|
public void close()
close
in interface AutoCloseable
@NotNull public MapNavigator.FitAction bounds(@NotNull Bounds bounds)
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@NotNull public MapNavigator.FitAction fitMarginPercent(double fitMarginPercent) throws IllegalArgumentException
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.IllegalArgumentException
- when a fit margin >= 50% is specified, or a value <= 0.@NotNull public MapNavigator.FitAction animate(boolean animated)
animated
- if this action should use an animation. The default is false.@NotNull public MapNavigator.FitAction duration(@NotNull Duration duration)
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)public void fit() throws IllegalStateException
IllegalStateException
- if the action is not built correctly, for example if mandatory parameters are missing, or if incompatible parameters are configured.