Class Polygon
java.lang.Object
com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
com.vaadin.flow.component.map.configuration.geometry.SimpleGeometry
com.vaadin.flow.component.map.configuration.geometry.Polygon
- All Implemented Interfaces:
Serializable
Geometry that represents a polygon.
- See Also:
-
Field Summary
Fields inherited from class com.vaadin.flow.component.map.configuration.AbstractConfigurationObject
propertyChangeSupport
-
Constructor Summary
ConstructorsConstructorDescriptionPolygon
(Coordinate[][] coordinates) Constructs a newPolygon
geometry based on the provided two-dimensional array of coordinates.Polygon
(List<Coordinate> coordinates) Constructs a newPolygon
geometry based on the provided list of coordinates. -
Method Summary
Modifier and TypeMethodDescriptionCoordinate[][]
The coordinates where the polygon is located, as a two-dimensional array.getType()
The unique type name of this class.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
translate
(double deltaX, double deltaY) Translate the geometry by the specified deltaMethods 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
-
Polygon
Constructs a newPolygon
geometry based on the provided list of 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 coordinates that define the polygon- Throws:
IllegalArgumentException
- if the provided coordinate list is null or empty
-
Polygon
Constructs a newPolygon
geometry based on the provided two-dimensional array of coordinates. 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 coordinates that locate the polygon- Throws:
IllegalArgumentException
- if any of the arrays in the provided coordinates array are null or empty
-
-
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
-
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
-
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
-
translate
public void translate(double deltaX, double deltaY) Description copied from class:SimpleGeometry
Translate the geometry by the specified delta- Specified by:
translate
in classSimpleGeometry
- Parameters:
deltaX
- amount to move on x-axisdeltaY
- amount to move on y-axis
-