Class MultiPolygon

All Implemented Interfaces:
Geometry, PolygonTypeGeometry, Serializable, Cloneable

public class MultiPolygon extends MultiSurface implements PolygonTypeGeometry
This class represents a collection of Polygon
A single Polygon is allowed even if it's not the correct class.
See Also:
  • Constructor Details

    • MultiPolygon

      public MultiPolygon()
    • MultiPolygon

      public MultiPolygon(Polygon[] polygons)
  • Method Details

    • clone

      public MultiPolygon clone()
      Description copied from class: GeometryCollection
      Clones this geometry.
      Specified by:
      clone in interface Geometry
      Specified by:
      clone in class GeometryCollection
      Returns:
      a deep copy of the current geometry.
    • centroid

      public Point centroid()
      Calculates centroid of this collection of polygons.
      Computed as the center of mass of the centroids of polygons, weighted by their area
      Specified by:
      centroid in interface PolygonTypeGeometry
      Specified by:
      centroid in class MultiSurface
      Returns:
    • serialize

      public Point[] serialize()
      Description copied from class: GeometryCollection
      Returns this geometry as an array of Point.
      Specified by:
      serialize in interface Geometry
      Overrides:
      serialize in class GeometryCollection
      Returns:
      this geometry as an array of Point.
    • pointOnSurface

      public Point pointOnSurface()
      a Point on one of the polygon
      Specified by:
      pointOnSurface in interface PolygonTypeGeometry
      Specified by:
      pointOnSurface in class MultiSurface
      Returns:
    • getPolygons

      public Polygon[] getPolygons()
      Returns:
    • setGeometries

      public void setGeometries(Geometry[] geometries)
      Specified by:
      setGeometries in class GeometryCollection
    • setPolygons

      public void setPolygons(Polygon[] polygons)
      Parameters:
      polygons -
    • polygonIterator

      public PolygonGeometryIterator polygonIterator()
      Specified by:
      polygonIterator in interface PolygonTypeGeometry
    • toString

      public String toString()
      Description copied from interface: Geometry
      Returns information about the current geometry.
      Specified by:
      toString in interface Geometry
      Overrides:
      toString in class Object
      Returns:
      information about the current geometry.
    • getGeometryId

      public short getGeometryId()
      Description copied from interface: Geometry
      Returns the geometry class id. This method is useful for geometry serialization.
      Specified by:
      getGeometryId in interface Geometry
      Returns:
      the geometry id.
    • getGeometryType

      public int getGeometryType()
      Description copied from interface: Geometry
      Returns the geometry type for this geometry.
      Specified by:
      getGeometryType in interface Geometry
      Returns:
      the geometry type.
      See Also:
    • getCenteredPoint

      public Point getCenteredPoint()
      Description copied from interface: Geometry
      This method returns a point that is typically centered on the geometry. If the geometry is a point, the point is returned. If it is a line, a point on the curve interpolated at 50% is returned. If the geometry is a surface, the centroid is returned if it is inside the polygon, if not, a point inside the polygon (but likely not exactly in the center) will be returned. If the geometry is a collection, the method is called on the first part of the collection.
      Specified by:
      getCenteredPoint in interface Geometry
      Returns:
      a point likely at the center of the geometry
      See Also:
    • getRings

      public LinearRing[] getRings()