Class Feature
java.lang.Object
com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
com.vaadin.flow.component.map.configuration.Feature
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
PointBasedFeature
A geographic feature to be displayed on a map. A feature represents a point
of interest, such as an address, a building, a vehicle, or any other entity.
- See Also:
-
Field Summary
Fields inherited from class com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
propertyChangeSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe geometry representing the feature, for example aPointor a polygon.getStyle()TheStyledefines how the feature should be visually displayed.getText()The text that should be displayed next to the feature.Returns the custom text style for rendering this feature'sgetText().getType()The unique type name of this class.booleanWhether the feature can be dragged on the map using pointing devices or notvoidsetDraggable(boolean draggable) Sets whether the feature can be dragged on the map using pointing devices or not.voidsetGeometry(SimpleGeometry geometry) Sets the geometry representing the feature.voidSets the style that defines how the feature should be visually displayed.voidSets the text that should be displayed next to the feature.voidsetTextStyle(TextStyle textStyle) Sets a custom text style for rendering this feature'sgetText().Methods 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
-
Feature
public Feature()
-
-
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
-
getGeometry
The geometry representing the feature, for example aPointor a polygon.- Returns:
- the current geometry
-
setGeometry
Sets the geometry representing the feature.- Parameters:
geometry- the new geometry, not null
-
getStyle
TheStyledefines how the feature should be visually displayed.- Returns:
- the current style
-
setStyle
Sets the style that defines how the feature should be visually displayed.- Parameters:
style- the new style, not null
-
getText
The text that should be displayed next to the feature.- Returns:
- the text string
-
setText
Sets the text that should be displayed next to the feature. Set tonullto remove the text.- Parameters:
text- the new text string, ornullto remove the text
-
getTextStyle
Returns the custom text style for rendering this feature'sgetText(). Returnsnullby default, which means the text is rendered with a default text style.- Returns:
- the custom text style, or
nullif no custom text style has been set
-
setTextStyle
Sets a custom text style for rendering this feature'sgetText(). By default, a feature has no custom text style, which means the text is rendered with a default text style. Can be set tonullto remove the custom text style.This is a convenience method for
Style.setTextStyle(TextStyle). If this feature does not have a style instance yet, an empty one is created.- Parameters:
textStyle- the new custom text style, ornullto remove the custom text style
-
isDraggable
public boolean isDraggable()Whether the feature can be dragged on the map using pointing devices or not -
setDraggable
public void setDraggable(boolean draggable) Sets whether the feature can be dragged on the map using pointing devices or not. Enabling this will make the feature draggable on the map, indicated by a pointer cursor when hovering over the feature. The feature's position / geometry is automatically updated after dropping the feature. UseMapBase.addFeatureDropListener(ComponentEventListener)to get notified when a feature has been moved.- Parameters:
draggable- whether the feature can be dragged or not
-