Class Geometry

java.lang.Object
com.massifmaps.geometry.Geometry
Direct Known Subclasses:
LineGeometry, MultiGeometry, PointGeometry, PolygonGeometry

public class Geometry extends Object
A base class for all geometry types.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if this object is equal to the specified object.
    Returns the minimal bounds for the geometry.
    Returns the center point of the geometry.
    Returns the geometry as a GeoJSON string, in its own coordinates.

    Here rather than only on Feature because serialising a shape otherwise means constructing
    a GeoJSONGeometryWriter, which no string-based binding can do.
    int
    Returns what kind of geometry this is.

    Without it the only way to tell a MultiPoint from a Point is a downcast, or - from a
    scripting binding - matching on the wrapper's class name.
    int
    Returns the hash value of this object.

    Methods inherited from class java.lang.Object

    clone, getClass, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • equals

      public boolean equals(Object obj)
      Checks if this object is equal to the specified object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The reference object.
      Returns:
      True when objects are equal, false otherwise.
    • hashCode

      public int hashCode()
      Returns the hash value of this object.
      Overrides:
      hashCode in class Object
      Returns:
      The hash value of this object.
    • getCenterPos

      public MapPos getCenterPos()
      Returns the center point of the geometry.
      Returns:
      The center point of the geometry.
    • getType

      public int getType()
      Returns what kind of geometry this is.

      Without it the only way to tell a MultiPoint from a Point is a downcast, or - from a
      scripting binding - matching on the wrapper's class name.
      Returns:
      The geometry type.
    • getBounds

      public MapBounds getBounds()
      Returns the minimal bounds for the geometry.
      Returns:
      The bounds for the geometry.
    • getGeoJSON

      public String getGeoJSON()
      Returns the geometry as a GeoJSON string, in its own coordinates.

      Here rather than only on Feature because serialising a shape otherwise means constructing
      a GeoJSONGeometryWriter, which no string-based binding can do.
      Returns:
      The geometry as GeoJSON.