Package org.postgis
Class ComposedGeom
- java.lang.Object
-
- org.postgis.Geometry
-
- org.postgis.ComposedGeom
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
GeometryCollection,MultiLineString,MultiPolygon,PointComposedGeom,Polygon
public abstract class ComposedGeom extends Geometry
ComposedGeom - Abstract base class for all Geometries that are composed out of other Geometries. In fact, this currently are all Geometry subclasses except Point.- Author:
- [email protected]
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Geometry[]EMPTYprotected Geometry[]subgeomsThe Array containing the geometries This is only to be exposed by concrete subclasses, to retain type safety.-
Fields inherited from class org.postgis.Geometry
ALLTYPES, dimension, GEOMETRYCOLLECTION, haveMeasure, LINEARRING, LINESTRING, MULTILINESTRING, MULTIPOINT, MULTIPOLYGON, POINT, POLYGON, srid, type, UNKNOWN_SRID
-
-
Constructor Summary
Constructors Modifier Constructor Description ComposedGeom(int type)Constructs an instance with the specified typeprotectedComposedGeom(int type, String value, boolean haveM)protectedComposedGeom(int type, Geometry[] geoms)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancheckConsistency()Do some internal consistency checks on the geometry.protected abstract Geometry[]createSubGeomArray(int size)Return the appropriate instance of the sub-geometry array - this encapsulates subclass specific array instantiationprotected abstract GeometrycreateSubGeomInstance(String token, boolean haveM)Return the appropriate instance of the sub-geometry - this encapsulates subclass specific constructor callsprotected booleanequalsintern(Geometry other)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.PointgetFirstPoint()Optimized versionPointgetLastPoint()Optimized versionPointgetPoint(int n)Get the nth Point of the geometryGeometrygetSubGeometry(int index)inthashCode()java.lang.Object hashCode implementationprotected voidinnerWKT(StringBuffer sb)Render the "inner" part of the WKT (inside the brackets) into the StringBuffer.booleanisEmpty()Iteratoriterator()protected voidmediumWKT(StringBuffer sb)Render the WKT without the type name, but including the brackets into the StringBufferintnumGeoms()intnumPoints()Return the number of Points of the geometryvoidsetSrid(int srid)Recursively sets the srid on this geometry and all contained subgeometries-
Methods inherited from class org.postgis.Geometry
equals, equals, getDimension, getSrid, getType, getTypeString, getTypeString, getValue, initSRID, isMeasured, outerWKT, outerWKT, parseSRID, toString
-
-
-
-
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)
-
ComposedGeom
protected ComposedGeom(int type, String value, boolean haveM) throws SQLException- Throws:
SQLException
-
-
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-geometryhaveM- 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:GeometryWhether 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:
equalsinternin classGeometry- Parameters:
other- geometry to compare- Returns:
- true if equal, false otherwise
-
numPoints
public int numPoints()
Description copied from class:GeometryReturn the number of Points of the geometry
-
getPoint
public Point getPoint(int n)
Description copied from class:GeometryGet the nth Point of the geometry
-
getLastPoint
public Point getLastPoint()
Optimized version- Specified by:
getLastPointin classGeometry- Returns:
- the final Point in this geometry
-
getFirstPoint
public Point getFirstPoint()
Optimized version- Specified by:
getFirstPointin classGeometry- Returns:
- the initial Point in this geometry
-
iterator
public Iterator iterator()
-
isEmpty
public boolean isEmpty()
-
mediumWKT
protected void mediumWKT(StringBuffer sb)
Description copied from class:GeometryRender the WKT without the type name, but including the brackets into the StringBuffer
-
innerWKT
protected void innerWKT(StringBuffer sb)
Description copied from class:GeometryRender the "inner" part of the WKT (inside the brackets) into the StringBuffer.
-
hashCode
public int hashCode()
Description copied from class:Geometryjava.lang.Object hashCode implementation
-
checkConsistency
public boolean checkConsistency()
Description copied from class:GeometryDo 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:
checkConsistencyin classGeometry- Returns:
- true if all checks are passed.
-
-