java.lang.Object
org.apache.tinkerpop.gremlin.structure.geo.Geometry
org.apache.tinkerpop.gremlin.structure.geo.Point
All Implemented Interfaces:
Comparable<Geometry>

public final class Point extends Geometry
A point geometry representing a single location in 2D or 3D space. Points are immutable.
Since:
4.0.0
  • Method Details

    • of

      public static Point of(double x, double y)
      Creates a 2D point with Model.CARTESIAN model (SRID 0).
      Parameters:
      x - the x coordinate
      y - the y coordinate
      Returns:
      the point
      Throws:
      IllegalArgumentException - if x or y is NaN or infinite
      Since:
      4.0.0
    • of

      public static Point of(double x, double y, Model model)
      Creates a 2D point with the specified model.
      Parameters:
      x - the x coordinate (longitude for Model.GEOGRAPHIC)
      y - the y coordinate (latitude for Model.GEOGRAPHIC)
      model - Model.CARTESIAN or Model.GEOGRAPHIC
      Returns:
      the point
      Throws:
      IllegalArgumentException - if x or y is NaN or infinite, if model is Model.GEOGRAPHIC and x is outside -180 to 180 or y is outside -90 to 90, or if model is Model.OTHER or null
      Since:
      4.0.0
    • of

      public static Point of(double x, double y, double z)
      Creates a 3D point with Model.CARTESIAN model (SRID 0).
      Parameters:
      x - the x coordinate
      y - the y coordinate
      z - the z coordinate
      Returns:
      the point
      Throws:
      IllegalArgumentException - if any coordinate is NaN or infinite
      Since:
      4.0.0
    • of

      public static Point of(double x, double y, double z, Model model)
      Creates a 3D point with the specified model.
      Parameters:
      x - the x coordinate (longitude for Model.GEOGRAPHIC)
      y - the y coordinate (latitude for Model.GEOGRAPHIC)
      z - the z coordinate (elevation)
      model - Model.CARTESIAN or Model.GEOGRAPHIC
      Returns:
      the point
      Throws:
      IllegalArgumentException - if x, y or z is NaN or infinite, if model is Model.GEOGRAPHIC and x is outside -180 to 180 or y is outside -90 to 90, or if model is Model.OTHER or null
      Since:
      4.0.0
    • empty

      public static Point empty()
      Creates an empty 2D Model.CARTESIAN point.
      Returns:
      an empty point
      Since:
      4.0.0
    • empty

      public static Point empty(Model model)
      Creates an empty 2D point with the specified model.
      Parameters:
      model - Model.CARTESIAN or Model.GEOGRAPHIC
      Returns:
      an empty point
      Throws:
      IllegalArgumentException - if model is Model.OTHER or null
      Since:
      4.0.0
    • x

      public double x()
      Returns the x coordinate (longitude for Model.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 for Model.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: Geometry
      Returns true if this geometry is empty (has no coordinates). For collections, returns true if all parts are empty.
      Specified by:
      isEmpty in class Geometry
      Returns:
      true if empty
    • equals

      public boolean equals(Object o)
      Description copied from class: Geometry
      Exact equality: same type, same SRID, same coordinates (including z flag). Coordinates are compared numerically, so -0.0 equals 0.0.
      Specified by:
      equals in class Geometry
    • hashCode

      public int hashCode()
      Description copied from class: Geometry
      Hash code consistent with equals. Zero values are normalized so -0.0 and 0.0 hash alike.
      Specified by:
      hashCode in class Geometry