Class ComposedGeom

    • Field Detail

      • EMPTY

        public static final Geometry[] EMPTY
      • subgeoms

        protected Geometry[] subgeoms
        The Array containing the geometries This is only to be exposed by concrete subclasses, to retain type safety.
    • Constructor Detail

      • ComposedGeom

        public ComposedGeom​(int type)
        Constructs an instance with the specified type
        Parameters:
        type - int value corresponding to the geometry type.
      • ComposedGeom

        protected ComposedGeom​(int type,
                               Geometry[] geoms)
    • Method Detail

      • getSubGeometry

        public Geometry getSubGeometry​(int index)
      • numGeoms

        public int numGeoms()
      • createSubGeomInstance

        protected abstract Geometry createSubGeomInstance​(String token,
                                                          boolean haveM)
                                                   throws SQLException
        Return the appropriate instance of the sub-geometry - this encapsulates subclass specific constructor calls
        Parameters:
        token - The token containing the value for the sub-geometry
        haveM - flag to indicate the existence of a measure
        Returns:
        the new sub-geometry
        Throws:
        SQLException - if a SQLException is thrown
      • createSubGeomArray

        protected abstract Geometry[] createSubGeomArray​(int size)
        Return the appropriate instance of the sub-geometry array - this encapsulates subclass specific array instantiation
        Parameters:
        size - number of elements in the array
        Returns:
        Geometry array corresponding to the sub-geometry
      • equalsintern

        protected boolean equalsintern​(Geometry other)
        Description copied from class: Geometry
        Whether test coordinates for geometry - subclass specific code Implementors can assume that dimensin, type, srid and haveMeasure are equal, other != null and other is the same subclass.
        Specified by:
        equalsintern in class Geometry
        Parameters:
        other - geometry to compare
        Returns:
        true if equal, false otherwise
      • numPoints

        public int numPoints()
        Description copied from class: Geometry
        Return the number of Points of the geometry
        Specified by:
        numPoints in class Geometry
        Returns:
        number of points in the geometry
      • getPoint

        public Point getPoint​(int n)
        Description copied from class: Geometry
        Get the nth Point of the geometry
        Specified by:
        getPoint in class Geometry
        Parameters:
        n - the index of the point, from 0 to numPoints()-1;
        Returns:
        nth point in the geometry
      • getLastPoint

        public Point getLastPoint()
        Optimized version
        Specified by:
        getLastPoint in class Geometry
        Returns:
        the final Point in this geometry
      • getFirstPoint

        public Point getFirstPoint()
        Optimized version
        Specified by:
        getFirstPoint in class Geometry
        Returns:
        the initial Point in this geometry
      • isEmpty

        public boolean isEmpty()
      • mediumWKT

        protected void mediumWKT​(StringBuffer sb)
        Description copied from class: Geometry
        Render the WKT without the type name, but including the brackets into the StringBuffer
        Overrides:
        mediumWKT in class Geometry
        Parameters:
        sb - StringBuffer to render into
      • innerWKT

        protected void innerWKT​(StringBuffer sb)
        Description copied from class: Geometry
        Render the "inner" part of the WKT (inside the brackets) into the StringBuffer.
        Specified by:
        innerWKT in class Geometry
        Parameters:
        sb - StringBuffer to render into
      • hashCode

        public int hashCode()
        Description copied from class: Geometry
        java.lang.Object hashCode implementation
        Overrides:
        hashCode in class Geometry
      • checkConsistency

        public boolean checkConsistency()
        Description copied from class: Geometry
        Do some internal consistency checks on the geometry. Currently, all Geometries must have a valid dimension (2 or 3) and a valid type. 2-dimensional Points must have Z=0.0, as well as non-measured Points must have m=0.0. Composed geometries must have all equal SRID, dimensionality and measures, as well as that they do not contain NULL or inconsistent subgeometries. BinaryParser and WKTParser should only generate consistent geometries. BinaryWriter may produce invalid results on inconsistent geometries.
        Overrides:
        checkConsistency in class Geometry
        Returns:
        true if all checks are passed.
      • setSrid

        public void setSrid​(int srid)
        Description copied from class: Geometry
        Recursively sets the srid on this geometry and all contained subgeometries
        Overrides:
        setSrid in class Geometry
        Parameters:
        srid - the SRID for this geometry