Class PolygonFeature
java.lang.Object
com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
com.vaadin.flow.component.map.configuration.Feature
com.vaadin.flow.component.map.configuration.feature.PolygonFeature
- All Implemented Interfaces:
Serializable
A convenience class for displaying a polygon on the map.
Technically this is a Feature
that uses a Polygon
geometry
for representation.
- See Also:
-
Field Summary
Fields inherited from class com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
propertyChangeSupport
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new polygon feature with the default style.PolygonFeature
(List<Coordinate> coordinates) Creates a new polygon feature with the default style using the provided coordinates. -
Method Summary
Modifier and TypeMethodDescriptionCoordinate[][]
The coordinates where the polygon is located, as a two-dimensional array.ThePolygon
geometry representing this feature.void
setCoordinates
(Coordinate[][] coordinates) Sets the coordinates that define the polygon as a two-dimensional array.void
setCoordinates
(List<Coordinate> coordinates) Sets the coordinates that define the polygon.void
setGeometry
(SimpleGeometry geometry) Sets the geometry representing this feature.Methods inherited from class com.vaadin.flow.component.map.configuration.Feature
getStyle, getText, getTextStyle, getType, isDraggable, setDraggable, setStyle, setText, setTextStyle
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
-
PolygonFeature
public PolygonFeature()Creates a new polygon feature with the default style. -
PolygonFeature
Creates a new polygon feature with the default style using the provided coordinates. The provided coordinate list defines a linear ring, where the first coordinate and the last should be equivalent to ensure a closed ring. This ring specifies the outer boundary or surface of the polygon without any holes.Coordinates must be specified in the map's user projection, which by default is
EPSG:4326
, also referred to as GPS coordinates.- Parameters:
coordinates
- the list of coordinates that define the vertices of the polygon
-
-
Method Details
-
getCoordinates
The coordinates where the polygon is located, as a two-dimensional array. The first array represents the outer boundary of the polygon as a linear ring of coordinates. Each subsequent array represents a linear ring defining a hole in the polygon's surface. A linear ring is defined as an array of coordinates where the first and the last coordinates are identical.- Returns:
- the current coordinates
-
setCoordinates
Sets the coordinates that define the polygon. The provided coordinate list defines a linear ring, where the first coordinate and the last should be equivalent to ensure a closed ring. This ring specifies the outer boundary or surface of the polygon without any holes.Coordinates must be specified in the map's user projection, which by default is
EPSG:4326
, also referred to as GPS coordinates.- Parameters:
coordinates
- the new coordinates
-
setCoordinates
Sets the coordinates that define the polygon as a two-dimensional array. The first array represents the outer boundary of the polygon as a linear ring of coordinates. Each subsequent array represents a linear ring defining a hole in the polygon's surface. A linear ring is defined as an array of coordinates where the first and the last coordinates are identical.Coordinates must be specified in the map's user projection, which by default is
EPSG:4326
, also referred to as GPS coordinates.- Parameters:
coordinates
- the new coordinates
-
getGeometry
ThePolygon
geometry representing this feature.- Overrides:
getGeometry
in classFeature
- Returns:
- the current polygon geometry
-
setGeometry
Sets the geometry representing this feature. This must be aPolygon
geometry.- Overrides:
setGeometry
in classFeature
- Parameters:
geometry
- the new geometry, not null- Throws:
IllegalArgumentException
- if the geometry is not an instance ofPolygon
-