Package net.postgis.jdbc.geometry
Class ComposedGeom
java.lang.Object
net.postgis.jdbc.geometry.Geometry
net.postgis.jdbc.geometry.ComposedGeom
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
GeometryCollection,MultiLineString,MultiPolygon,PointComposedGeom,Polygon
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:
- markus.schaber@logix-tt.com
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Geometry[]protected Geometry[]The Array containing the geometries This is only to be exposed by concrete subclasses, to retain type safety.Fields inherited from class net.postgis.jdbc.geometry.Geometry
ALLTYPES, dimension, GEOMETRYCOLLECTION, haveMeasure, LINEARRING, LINESTRING, MULTILINESTRING, MULTIPOINT, MULTIPOLYGON, POINT, POLYGON, srid, type, UNKNOWN_SRID -
Constructor Summary
ConstructorsModifierConstructorDescriptionComposedGeom(int type) Constructs an instance with the specified typeprotectedComposedGeom(int type, String value, boolean haveM) protectedComposedGeom(int type, Geometry[] geoms) -
Method Summary
Modifier and TypeMethodDescriptionbooleanDo 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.Optimized versionOptimized versiongetPoint(int n) Get the nth Point of the geometrygetSubGeometry(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()iterator()protected voidRender the WKT without the type name, but including the brackets into the StringBufferintnumGeoms()intReturn the number of Points of the geometryvoidsetSrid(int srid) Recursively sets the srid on this geometry and all contained subgeometriesMethods inherited from class net.postgis.jdbc.geometry.Geometry
equals, equals, getDimension, getSrid, getType, getTypeString, getTypeString, getValue, initSRID, isMeasured, outerWKT, outerWKT, parseSRID, toString
-
Field Details
-
EMPTY
-
subgeoms
The Array containing the geometries This is only to be exposed by concrete subclasses, to retain type safety.
-
-
Constructor Details
-
ComposedGeom
public ComposedGeom(int type) Constructs an instance with the specified type- Parameters:
type- int value corresponding to the geometry type.
-
ComposedGeom
-
ComposedGeom
- Throws:
SQLException
-
-
Method Details
-
getSubGeometry
-
numGeoms
public int numGeoms() -
createSubGeomInstance
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
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
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
Description copied from class:GeometryGet the nth Point of the geometry -
getLastPoint
Optimized version- Specified by:
getLastPointin classGeometry- Returns:
- the final Point in this geometry
-
getFirstPoint
Optimized version- Specified by:
getFirstPointin classGeometry- Returns:
- the initial Point in this geometry
-
iterator
-
isEmpty
public boolean isEmpty() -
mediumWKT
Description copied from class:GeometryRender the WKT without the type name, but including the brackets into the StringBuffer -
innerWKT
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.
-
setSrid
public void setSrid(int srid) Description copied from class:GeometryRecursively sets the srid on this geometry and all contained subgeometries
-