com.vaadin.flow.component.map.configuration.
Class Feature
All Implemented Interfaces:
Direct Known Subclasses:
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 a
Point
or a polygon.getStyle()
The
Style
defines 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's
getText()
.getType()
The unique type name of this class.
boolean
Whether the feature can be dragged on the map using pointing devices or not
void
setDraggable
(boolean draggable) Sets whether the feature can be dragged on the map using pointing devices or not.
void
setGeometry
(SimpleGeometry geometry) Sets the geometry representing the feature.
void
Sets the style that defines how the feature should be visually displayed.
void
Sets the text that should be displayed next to the feature.
void
setTextStyle
(TextStyle textStyle) Sets a custom text style for rendering this feature's
getText()
.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:
AbstractConfigurationObject
The unique type name of this class. Used by the client-side synchronization mechanism to determine which OpenLayers class to synchronize into.
Specified by:
getType
in classAbstractConfigurationObject
-
getGeometry
The geometry representing the feature, for example a
Point
or a polygon.Returns:
the current geometry
-
setGeometry
Sets the geometry representing the feature.
Parameters:
geometry
- the new geometry, not null -
getStyle
The
Style
defines 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 to
null
to remove the text.Parameters:
text
- the new text string, ornull
to remove the text -
getTextStyle
Returns the custom text style for rendering this feature's
getText()
. Returnsnull
by default, which means the text is rendered with a default text style.Returns:
the custom text style, or
null
if no custom text style has been set -
setTextStyle
Sets a custom text style for rendering this feature's
getText()
. By default, a feature has no custom text style, which means the text is rendered with a default text style. Can be set tonull
to 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, ornull
to 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. Use
MapBase.addFeatureDropListener(ComponentEventListener)
to get notified when a feature has been moved.Parameters:
draggable
- whether the feature can be dragged or not
-