All Implemented Interfaces:
Serializable

public class Polygon extends SimpleGeometry
Geometry that represents a polygon.
See Also:
  • Constructor Details

    • Polygon

      public Polygon(List<Coordinate> coordinates)
      Constructs a new Polygon 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

      public Polygon(Coordinate[][] coordinates)
      Constructs a new Polygon 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

      public String 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 class AbstractConfigurationObject
    • setCoordinates

      public void setCoordinates(List<Coordinate> coordinates)
      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

      public void setCoordinates(Coordinate[][] coordinates)
      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

      public Coordinate[][] 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 class SimpleGeometry
      Parameters:
      deltaX - amount to move on x-axis
      deltaY - amount to move on y-axis