Package io.github.sebasbaumh.postgis
Class Point
java.lang.Object
io.github.sebasbaumh.postgis.Geometry
io.github.sebasbaumh.postgis.Point
- All Implemented Interfaces:
Serializable
Point geometry.
- Author:
- Sebastian Baumhekel
- See Also:
-
Field Summary
FieldsFields inherited from class io.github.sebasbaumh.postgis.Geometry
UNKNOWN_SRID
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Do some internal consistency checks on the geometry.boolean
coordsAreEqual
(Point other) copy()
Creates a copy of thisPoint
.double
Calculates the distance to the givenPoint
.boolean
java.lang.Object equals implementationGets the coordinates of thisGeometry
.double
getM()
Gets the measurement.int
Gets the number of coordinates of thisGeometry
.double
getX()
Gets the X-coordinate.double
getY()
Gets the Y-coordinate.double
getZ()
Gets the Z-coordinate.int
hashCode()
boolean
Returns whether we have a measure (4th dimension)boolean
is3d()
Checks if thisGeometry
is 3d.boolean
isEmpty()
Ist thisGeometry
empty, so does it contain no coordinates or other geometries?void
setM
(double m) Sets the measurement.void
setX
(double x) Sets the X-coordinate.void
setY
(double y) Sets the Y-coordinate.void
setZ
(double z) Sets the Z-coordinate.to2d()
Gets thisPoint
as a 2d object.toString()
-
Field Details
-
TYPE
public static final int TYPEThe OGIS geometry type number for points.- See Also:
-
-
Constructor Details
-
Point
public Point()Constructs an empty instance. -
Point
public Point(double x, double y) Constructs a new Point- Parameters:
x
- the longitude / x ordinatey
- the latitude / y ordinate
-
Point
public Point(double x, double y, double z) Constructs a new Point- Parameters:
x
- the longitude / x ordinatey
- the latitude / y ordinatez
- the radius / height / elevation / z ordinate (can beDouble.NaN
for no coordinate)
-
Point
public Point(double x, double y, double z, double m) Constructs a new Point- Parameters:
x
- the longitude / x ordinatey
- the latitude / y ordinatez
- the radius / height / elevation / z ordinate (can beDouble.NaN
for no coordinate)m
- measure (4th dimension)
-
-
Method Details
-
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. 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 classGeometry
- Returns:
- true if all checks are passed.
-
coordsAreEqual
- Parameters:
other
-Point
- Returns:
- true on success, else false
-
copy
Creates a copy of thisPoint
.- Returns:
Point
-
distance
Calculates the distance to the givenPoint
.- Parameters:
p
-Point
- Returns:
- distance
-
equals
Description copied from class:Geometry
java.lang.Object equals implementation -
getCoordinates
Description copied from class:Geometry
Gets the coordinates of thisGeometry
.- Specified by:
getCoordinates
in classGeometry
- Returns:
- coordinates
-
getM
public double getM()Gets the measurement.- Returns:
- measurement on success, else
Double.NaN
-
getNumberOfCoordinates
public int getNumberOfCoordinates()Description copied from class:Geometry
Gets the number of coordinates of thisGeometry
.- Specified by:
getNumberOfCoordinates
in classGeometry
- Returns:
- number of coordinates
-
getX
public double getX()Gets the X-coordinate.- Returns:
- X-coordinate on success, else
Double.NaN
-
getY
public double getY()Gets the Y-coordinate.- Returns:
- Y-coordinate on success, else
Double.NaN
-
getZ
public double getZ()Gets the Z-coordinate.- Returns:
- Z-coordinate on success, else
Double.NaN
-
hashCode
public int hashCode() -
hasMeasure
public boolean hasMeasure()Description copied from class:Geometry
Returns whether we have a measure (4th dimension)- Specified by:
hasMeasure
in classGeometry
- Returns:
- true if the geometry has a measure, false otherwise
-
is3d
public boolean is3d()Description copied from class:Geometry
Checks if thisGeometry
is 3d. -
isEmpty
public boolean isEmpty()Description copied from class:Geometry
Ist thisGeometry
empty, so does it contain no coordinates or other geometries? -
setM
public void setM(double m) Sets the measurement.- Parameters:
m
- measurement
-
setX
public void setX(double x) Sets the X-coordinate.- Parameters:
x
- X-coordinate
-
setY
public void setY(double y) Sets the Y-coordinate.- Parameters:
y
- Y-coordinate
-
setZ
public void setZ(double z) Sets the Z-coordinate.- Parameters:
z
- Z-coordinate
-
to2d
Gets thisPoint
as a 2d object.- Returns:
Point
-
toString
-