Class GeometryCollection

java.lang.Object
org.apache.tinkerpop.gremlin.structure.geo.Geometry
org.apache.tinkerpop.gremlin.structure.geo.GeometryCollection
All Implemented Interfaces:
Comparable<Geometry>
Direct Known Subclasses:
MultiCurve, MultiPoint, MultiSurface

public class GeometryCollection extends Geometry
A geometry collection containing any mix of geometry types. GeometryCollections are immutable.
Since:
4.0.0
  • Method Details

    • of

      public static GeometryCollection of(Geometry... geometries)
      Creates a geometry collection from an array of geometries. All geometries must have the same SRID and z-dimension flag. A collection must have at least 1 geometry; use empty() or empty(Model) for an empty collection. An element may be empty, and may itself be a collection as long as the nesting limit is respected.
      Parameters:
      geometries - the geometries, at least 1 of them
      Returns:
      the collection
      Throws:
      IllegalArgumentException - if geometries is null, if it holds no geometries, if any element is null, if the geometries do not all have the same SRID and the same z dimension, or if this collection taken together with its deepest nested element would exceed 32 levels of collection nesting, where every collection, including a MultiPoint, MultiLineString or MultiPolygon, counts as one level
      Since:
      4.0.0
    • empty

      public static GeometryCollection empty()
      Creates an empty geometry collection with Model.CARTESIAN model.
      Returns:
      an empty collection
      Since:
      4.0.0
    • empty

      public static GeometryCollection empty(Model model)
      Creates an empty geometry collection with the specified model.
      Parameters:
      model - Model.CARTESIAN or Model.GEOGRAPHIC
      Returns:
      an empty collection
      Throws:
      IllegalArgumentException - if model is Model.OTHER or null
      Since:
      4.0.0
    • geometries

      public List<? extends Geometry> geometries()
      Returns an unmodifiable list of geometries in this collection. Subclasses that admit only one kind of part narrow the element type: MultiPoint.geometries() returns List<Point>, MultiLineString.geometries() returns List<LineString> and MultiPolygon.geometries() returns List<Polygon>.
      Returns:
      the geometries as a list of Geometry or a narrower element type, an empty list when this collection holds no parts
      Since:
      4.0.0
    • isEmpty

      public boolean isEmpty()
      Description copied from class: Geometry
      Returns true if this geometry is empty (has no coordinates). For collections, returns true if all parts are empty.
      Specified by:
      isEmpty in class Geometry
      Returns:
      true if empty
    • equals

      public boolean equals(Object o)
      Description copied from class: Geometry
      Exact equality: same type, same SRID, same coordinates (including z flag). Coordinates are compared numerically, so -0.0 equals 0.0.
      Specified by:
      equals in class Geometry
    • hashCode

      public int hashCode()
      Description copied from class: Geometry
      Hash code consistent with equals. Zero values are normalized so -0.0 and 0.0 hash alike.
      Specified by:
      hashCode in class Geometry