Package io.github.sebasbaumh.postgis
Class Geometry
- java.lang.Object
-
- io.github.sebasbaumh.postgis.Geometry
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
Curve,MultiGeometry,Point,PolygonBase
@NonNullByDefault public abstract class Geometry extends java.lang.Object implements java.io.SerializableThe base class of all geometries- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intUNKNOWN_SRIDOfficial UNKNOWN srid value
-
Constructor Summary
Constructors Modifier Constructor Description protectedGeometry(int type)Constructor for subclasses.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancheckConsistency()Do some internal consistency checks on the geometry.booleanequals(java.lang.Object obj)java.lang.Object equals implementationabstract java.lang.Iterable<Point>getCoordinates()Gets the coordinates of thisGeometry.intgetDimension()Deprecated.useis3d()insteadabstract intgetNumberOfCoordinates()Gets the number of coordinates of thisGeometry.intgetSrid()The OGIS geometry type number of this geometry.intgetType()Gets the OGIS geometry type number of this geometry.inthashCode()abstract booleanhasMeasure()Returns whether we have a measure (4th dimension)abstract booleanis3d()Checks if thisGeometryis 3d.abstract booleanisEmpty()Ist thisGeometryempty, so does it contain no coordinates or other geometries?intnumPoints()Deprecated.usegetNumberOfCoordinates()insteadvoidsetSrid(int srid)Recursively sets the srid on this geometry and all contained subgeometries
-
-
-
Field Detail
-
UNKNOWN_SRID
public static final int UNKNOWN_SRID
Official UNKNOWN srid value- See Also:
- Constant Field Values
-
-
Method Detail
-
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
public boolean equals(@Nullable java.lang.Object obj)java.lang.Object equals implementation- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- geometry to compare- Returns:
- true if equal, false otherwise
-
getCoordinates
public abstract java.lang.Iterable<Point> getCoordinates()
Gets the coordinates of thisGeometry.- Returns:
- coordinates
-
getDimension
@Deprecated public int getDimension()
Deprecated.useis3d()insteadQueries the number of geometric dimensions of this geometry. This does not include measures, as opposed to the server.- Returns:
- The dimensionality (eg, 2D or 3D) of this geometry.
-
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()
- Overrides:
hashCodein classjava.lang.Object
-
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 thisGeometryis 3d.- Returns:
- true on success, else false
-
isEmpty
public abstract boolean isEmpty()
Ist thisGeometryempty, so does it contain no coordinates or other geometries?- Returns:
- true on success, else false
-
numPoints
@Deprecated public final int numPoints()
Deprecated.usegetNumberOfCoordinates()insteadReturn the number of Points of the geometry- Returns:
- number of points in the geometry
-
setSrid
public void setSrid(int srid)
Recursively sets the srid on this geometry and all contained subgeometries- Parameters:
srid- the SRID for this geometry
-
-