Package io.github.sebasbaumh.postgis
Class Geometry
java.lang.Object
io.github.sebasbaumh.postgis.Geometry
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Curve
,MultiGeometry
,Point
,PolygonBase
The base class of all geometries
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Do some internal consistency checks on the geometry.boolean
java.lang.Object equals implementationGets the coordinates of thisGeometry
.abstract int
Gets the number of coordinates of thisGeometry
.int
getSrid()
The OGIS geometry type number of this geometry.int
getType()
Gets the OGIS geometry type number of this geometry.int
hashCode()
abstract boolean
Returns whether we have a measure (4th dimension)abstract boolean
is3d()
Checks if thisGeometry
is 3d.abstract boolean
isEmpty()
Ist thisGeometry
empty, so does it contain no coordinates or other geometries?void
setSrid
(int srid) Recursively sets the srid on this geometry and all contained subgeometries
-
Field Details
-
UNKNOWN_SRID
public static final int UNKNOWN_SRIDOfficial UNKNOWN srid value- See Also:
-
-
Constructor Details
-
Geometry
protected Geometry(int type) Constructor for subclasses.- Parameters:
type
- has to be given by all subclasses
-
-
Method Details
-
checkConsistency
public boolean checkConsistency()Do some internal consistency checks on the geometry. Currently, all Geometries must have a valid dimension (2 or 3) and a valid type. 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.- Returns:
- true if all checks are passed.
-
equals
java.lang.Object equals implementation -
getCoordinates
Gets the coordinates of thisGeometry
.- Returns:
- coordinates
-
getNumberOfCoordinates
public abstract int getNumberOfCoordinates()Gets the number of coordinates of thisGeometry
.- Returns:
- number of coordinates
-
getSrid
public int getSrid()The OGIS geometry type number of this geometry.- Returns:
- the SRID of this geometry
-
getType
public int getType()Gets the OGIS geometry type number of this geometry.- Returns:
- type of this geometry
-
hashCode
public int hashCode() -
hasMeasure
public abstract boolean hasMeasure()Returns whether we have a measure (4th dimension)- Returns:
- true if the geometry has a measure, false otherwise
-
is3d
public abstract boolean is3d()Checks if thisGeometry
is 3d.- Returns:
- true on success, else false
-
isEmpty
public abstract boolean isEmpty()Ist thisGeometry
empty, so does it contain no coordinates or other geometries?- Returns:
- true on success, else false
-
setSrid
public void setSrid(int srid) Recursively sets the srid on this geometry and all contained subgeometries- Parameters:
srid
- the SRID for this geometry
-