Class GeometryCollection

java.lang.Object
com.kheops.jmap.spatial.DefaultGeometry
com.kheops.jmap.spatial.GeometryCollection
All Implemented Interfaces:
Geometry, Serializable, Cloneable
Direct Known Subclasses:
Complex, MultiAnnotation, MultiCurve, MultiPoint, MultiSurface

public abstract class GeometryCollection extends DefaultGeometry
See Also:
  • Field Details

  • Constructor Details

    • GeometryCollection

      public GeometryCollection()
    • GeometryCollection

      public GeometryCollection(Geometry[] geometries)
  • Method Details

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • boundary

      public Geometry boundary()
      The boundary of this geometryCollection, made of the boundary of each element
      Returns:
      a line string which defines the boundary of the current geometry.
    • validate

      public static Geometry validate(GeometryCollection geometryCollection)
      Validates all geometries in the specified GeometryCollection, removing all geometries that aren't georeferenced. If the remaining geometry list is empty, then null is returned.
      Parameters:
      geometryCollection - the geometry collection to validate.
      Returns:
      the validated geometry collection, of null if the specified geometry collection doesn't contain any valid geometries.
    • fit

      public static Geometry fit(List<Geometry> list)
      returns the best type of collection for the element in the List
      Parameters:
      list -
    • setGeometries

      public abstract void setGeometries(Geometry[] geometries)
    • getBounds

      public Rectangle getBounds()
      the BoundingBox
      Returns:
      the bounding box of this geometry.
    • createBounds

      public void createBounds()
      creates the bounding box
      called in the constructor, not needed from outside
    • area

      public double area()
      Description copied from interface: Geometry
      Returns the geometry area. If the geometry is not a surface, then 0 shall be returned.
      Returns:
      the geometry area.
    • length

      public double length()
      Description copied from interface: Geometry
      Returns the geometry length. If the geometry is a surface, then the geometry perimeter shall be returned.
      Returns:
      the geometry length.
    • serialize

      public Point[] serialize()
      Returns this geometry as an array of Point.
      Returns:
      this geometry as an array of Point.
    • numGeometries

      public int numGeometries()
    • geometryN

      public Geometry geometryN(int N)
    • getGeometries

      public Geometry[] getGeometries()
    • getGeometryCount

      public int getGeometryCount()
    • spatiallyEquals

      public boolean spatiallyEquals(Geometry geometry, PrecisionModel precisionModel)
      Tests if this geometry is equal to the argument, on a topological point of view.
      Parameters:
      geometry - the geometry to be tested.
      precisionModel - the precision model to use while comparing geometries.
      Returns:
      whether both geometries are spatially equals.
    • translate

      public void translate(double dx, double dy)
      Translate this geometry with the specified values.
      Parameters:
      dx - translation on the X-axis.
      dy - translation on the Y-axis.
    • keepPoint

      public static PointTypeGeometry keepPoint(List geometries)
      warning : it alters the List geometries (by removing all except Point, and breaking MultiPoint into Point)
      Parameters:
      geometries -
      Returns:
    • keepPoint

      public static PointTypeGeometry keepPoint(Geometry g)
    • keepLineString

      public static LineTypeGeometry keepLineString(List geometries)
    • keepLineString

      public static LineTypeGeometry keepLineString(Geometry g)
    • keepPolygon

      public static PolygonTypeGeometry keepPolygon(List geometries)
    • keepPolygon

      public static PolygonTypeGeometry keepPolygon(Geometry g)
    • clone

      public abstract GeometryCollection clone()
      Clones this geometry.
      Specified by:
      clone in interface Geometry
      Specified by:
      clone in class DefaultGeometry
      Returns:
      a deep copy of the current geometry.
    • transform

      public Geometry transform(Transformation tr)
      Creates a clone of the current geometry and returns the new instance transformed with the specified geometry transformation.
      The returned geometry can be of any geometry types after the transformation.
      Parameters:
      tr - the transformation to apply.
      Returns:
      the newly created and transformed geometry instance.
    • sizeOf

      public int sizeOf()
      Returns an approximation in bytes of the memory used by this geometry.
      Returns:
      the memory used by this geometry.