Class Point
java.lang.Object
org.apache.tinkerpop.gremlin.structure.geo.Geometry
org.apache.tinkerpop.gremlin.structure.geo.Point
- All Implemented Interfaces:
Comparable<Geometry>
A point geometry representing a single location in 2D or 3D space.
Points are immutable.
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic Pointempty()Creates an empty 2DModel.CARTESIANpoint.static PointCreates an empty 2D point with the specified model.booleanExact equality: same type, same SRID, same coordinates (including z flag).inthashCode()Hash code consistent with equals.booleanisEmpty()Returns true if this geometry is empty (has no coordinates).static Pointof(double x, double y) Creates a 2D point withModel.CARTESIANmodel (SRID 0).static Pointof(double x, double y, double z) Creates a 3D point withModel.CARTESIANmodel (SRID 0).static PointCreates a 3D point with the specified model.static PointCreates a 2D point with the specified model.doublex()Returns the x coordinate (longitude forModel.GEOGRAPHIC).doubley()Returns the y coordinate (latitude forModel.GEOGRAPHIC).doublez()Returns the z coordinate, or NaN if this is a 2D point.
-
Method Details
-
of
Creates a 2D point withModel.CARTESIANmodel (SRID 0).- Parameters:
x- the x coordinatey- the y coordinate- Returns:
- the point
- Throws:
IllegalArgumentException- if x or y is NaN or infinite- Since:
- 4.0.0
-
of
Creates a 2D point with the specified model.- Parameters:
x- the x coordinate (longitude forModel.GEOGRAPHIC)y- the y coordinate (latitude forModel.GEOGRAPHIC)model-Model.CARTESIANorModel.GEOGRAPHIC- Returns:
- the point
- Throws:
IllegalArgumentException- if x or y is NaN or infinite, ifmodelisModel.GEOGRAPHICand x is outside -180 to 180 or y is outside -90 to 90, or ifmodelisModel.OTHERor null- Since:
- 4.0.0
-
of
Creates a 3D point withModel.CARTESIANmodel (SRID 0).- Parameters:
x- the x coordinatey- the y coordinatez- the z coordinate- Returns:
- the point
- Throws:
IllegalArgumentException- if any coordinate is NaN or infinite- Since:
- 4.0.0
-
of
Creates a 3D point with the specified model.- Parameters:
x- the x coordinate (longitude forModel.GEOGRAPHIC)y- the y coordinate (latitude forModel.GEOGRAPHIC)z- the z coordinate (elevation)model-Model.CARTESIANorModel.GEOGRAPHIC- Returns:
- the point
- Throws:
IllegalArgumentException- if x, y or z is NaN or infinite, ifmodelisModel.GEOGRAPHICand x is outside -180 to 180 or y is outside -90 to 90, or ifmodelisModel.OTHERor null- Since:
- 4.0.0
-
empty
Creates an empty 2DModel.CARTESIANpoint.- Returns:
- an empty point
- Since:
- 4.0.0
-
empty
Creates an empty 2D point with the specified model.- Parameters:
model-Model.CARTESIANorModel.GEOGRAPHIC- Returns:
- an empty point
- Throws:
IllegalArgumentException- ifmodelisModel.OTHERor null- Since:
- 4.0.0
-
x
public double x()Returns the x coordinate (longitude forModel.GEOGRAPHIC).- Returns:
- the x coordinate
- Throws:
IllegalStateException- if this point is empty- Since:
- 4.0.0
-
y
public double y()Returns the y coordinate (latitude forModel.GEOGRAPHIC).- Returns:
- the y coordinate
- Throws:
IllegalStateException- if this point is empty- Since:
- 4.0.0
-
z
public double z()Returns the z coordinate, or NaN if this is a 2D point.- Returns:
- the z coordinate or NaN
- Throws:
IllegalStateException- if this point is empty- Since:
- 4.0.0
-
isEmpty
public boolean isEmpty()Description copied from class:GeometryReturns true if this geometry is empty (has no coordinates). For collections, returns true if all parts are empty. -
equals
Description copied from class:GeometryExact equality: same type, same SRID, same coordinates (including z flag). Coordinates are compared numerically, so -0.0 equals 0.0. -
hashCode
public int hashCode()Description copied from class:GeometryHash code consistent with equals. Zero values are normalized so -0.0 and 0.0 hash alike.
-