Class ScaleControl
java.lang.Object
com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
com.vaadin.flow.component.map.configuration.controls.Control
com.vaadin.flow.component.map.configuration.controls.ScaleControl
- All Implemented Interfaces:
Serializable
A control that displays a scale indicator on the map. The control can be
displayed as a simple scale line or as a more detailed scale bar with
segments.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDisplay mode for the scale control.static enumUnits for the scale control. -
Field Summary
Fields inherited from class com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
propertyChangeSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the display mode of the scale control.Returns the maximum width of the scale control in pixels, ornullif no maximum is set.intReturns the minimum width of the scale control in pixels.intReturns the number of steps (segments) in the scale bar.getType()The unique type name of this class.getUnits()Returns the units used for the scale control.booleanReturns whether to show the scale as proportion below the scale bar.voidsetDisplayMode(ScaleControl.DisplayMode displayMode) Sets the display mode of the scale control.voidsetMaxWidth(Integer maxWidth) Sets the maximum width of the scale control in pixels.voidsetMinWidth(int minWidth) Sets the minimum width of the scale control in pixels.voidsetScaleBarSteps(int scaleBarSteps) Sets the number of steps (segments) for the scale bar.voidsetScaleBarTextVisible(boolean scaleBarTextVisible) Sets whether to show the scale as proportion below.voidsetUnits(ScaleControl.Unit units) Sets the units to use for the scale control.Methods inherited from class com.vaadin.flow.component.map.configuration.controls.Control
isVisible, setVisibleMethods inherited from class com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
addChild, addNullableChild, addPropertyChangeListener, collectChanges, deepMarkAsDirty, getId, markAsDirty, notifyChange, notifyChange, removeChild, removePropertyChangeListener, setId, update
-
Constructor Details
-
ScaleControl
public ScaleControl()
-
-
Method Details
-
getType
Description copied from class:AbstractConfigurationObjectThe unique type name of this class. Used by the client-side synchronization mechanism to determine which OpenLayers class to synchronize into.- Specified by:
getTypein classAbstractConfigurationObject
-
getMinWidth
public int getMinWidth()Returns the minimum width of the scale control in pixels.- Returns:
- the minimum width in pixels
-
setMinWidth
public void setMinWidth(int minWidth) Sets the minimum width of the scale control in pixels. Default value is64.- Parameters:
minWidth- the minimum width in pixels
-
getMaxWidth
Returns the maximum width of the scale control in pixels, ornullif no maximum is set.- Returns:
- the maximum width in pixels, or
null
-
setMaxWidth
Sets the maximum width of the scale control in pixels. Set tonullto remove the limit. Default value isnull.- Parameters:
maxWidth- the maximum width in pixels, ornullfor no limit
-
getUnits
Returns the units used for the scale control.- Returns:
- the units
-
setUnits
Sets the units to use for the scale control. Default value isScaleControl.Unit.METRIC.- Parameters:
units- the units, not null- Throws:
NullPointerException- if units is null
-
getDisplayMode
Returns the display mode of the scale control.- Returns:
- the display mode
-
setDisplayMode
Sets the display mode of the scale control. Default value isScaleControl.DisplayMode.LINE.- Parameters:
displayMode- the display mode, not null- Throws:
NullPointerException- if displayMode is null
-
getScaleBarSteps
public int getScaleBarSteps()Returns the number of steps (segments) in the scale bar. This is only used whengetDisplayMode()returnsScaleControl.DisplayMode.BAR.- Returns:
- the number of scale bar steps
-
setScaleBarSteps
public void setScaleBarSteps(int scaleBarSteps) Sets the number of steps (segments) for the scale bar. This is only used whensetDisplayMode(DisplayMode)is set toScaleControl.DisplayMode.BAR. Default value is4.- Parameters:
scaleBarSteps- the number of scale bar steps
-
isScaleBarTextVisible
public boolean isScaleBarTextVisible()Returns whether to show the scale as proportion below the scale bar. This is only used whengetDisplayMode()returnsScaleControl.DisplayMode.BAR.- Returns:
trueif text is shown below the scale bar
-
setScaleBarTextVisible
public void setScaleBarTextVisible(boolean scaleBarTextVisible) Sets whether to show the scale as proportion below. This is only used whensetDisplayMode(DisplayMode)is set toScaleControl.DisplayMode.BAR. Default value isfalse.- Parameters:
scaleBarTextVisible-trueto show text below the scale bar
-