Class Polygon


  • public final class Polygon
    extends Geometry
    A representation of a GeoJSON Polygon.
    Since:
    3.1
    • Constructor Detail

      • Polygon

        public Polygon​(java.util.List<Position> exterior,
                       java.util.List<Position>... holes)
        Construct an instance with the given coordinates.
        Parameters:
        exterior - the exterior ring of the polygon
        holes - optional interior rings of the polygon
      • Polygon

        public Polygon​(PolygonCoordinates coordinates)
        Construct an instance with the given coordinates.
        Parameters:
        coordinates - the coordinates
      • Polygon

        public Polygon​(@Nullable
                       CoordinateReferenceSystem coordinateReferenceSystem,
                       PolygonCoordinates coordinates)
        Construct an instance with the given coordinates and coordinate reference system.
        Parameters:
        coordinateReferenceSystem - the coordinate reference system
        coordinates - the coordinates
    • Method Detail

      • getCoordinates

        public PolygonCoordinates getCoordinates()
        Gets the GeoJSON coordinates of the polygon
        Returns:
        the coordinates, which must have at least one element
      • getExterior

        public java.util.List<Position> getExterior()
        Gets the exterior coordinates.
        Returns:
        the exterior coordinates
      • getHoles

        public java.util.List<java.util.List<Position>> getHoles()
        Get the holes in this polygon.
        Returns:
        the possibly-empty list of holes
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class Geometry
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object