Class Coordinate

java.lang.Object
org.openstreetmap.josm.data.coor.Coordinate
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
EastNorth, LatLon

abstract class Coordinate extends Object implements Serializable
Base class of points of both coordinate systems. The variables are default package protected to allow routines in the data package to access them directly. As the class itself is package protected too, it is not visible outside of the data package. Routines there should only use LatLon or EastNorth.
Since:
6162
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final double
     
    protected final double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Coordinate(double x, double y)
    Construct the point with latitude / longitude values.
  • Method Summary

    Modifier and Type
    Method
    Description
    final double
    distance(double px, double py)
    Returns the euclidean distance from this Coordinate to a specified coordinate.
    protected final double
    Returns the euclidean distance from this Coordinate to a specified Coordinate.
    final double
    distanceSq(double px, double py)
    Returns the square of euclidean distance from this Coordinate to a specified coordinate.
    protected final double
    Returns the square of the euclidean distance from this Coordinate to a specified Coordinate.
    boolean
     
    double
     
    double
     
    int
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • x

      protected final double x
    • y

      protected final double y
  • Constructor Details

    • Coordinate

      Coordinate(double x, double y)
      Construct the point with latitude / longitude values.
      Parameters:
      x - X coordinate of the point.
      y - Y coordinate of the point.
  • Method Details

    • getX

      public double getX()
    • getY

      public double getY()
    • distance

      protected final double distance(Coordinate coor)
      Returns the euclidean distance from this Coordinate to a specified Coordinate.
      Parameters:
      coor - the specified coordinate to be measured against this Coordinate
      Returns:
      the euclidean distance from this Coordinate to a specified Coordinate
      Since:
      6166
    • distance

      public final double distance(double px, double py)
      Returns the euclidean distance from this Coordinate to a specified coordinate.
      Parameters:
      px - the X coordinate of the specified point to be measured against this Coordinate
      py - the Y coordinate of the specified point to be measured against this Coordinate
      Returns:
      the euclidean distance from this Coordinate to a specified coordinate
      Since:
      6166
    • distanceSq

      protected final double distanceSq(Coordinate coor)
      Returns the square of the euclidean distance from this Coordinate to a specified Coordinate.
      Parameters:
      coor - the specified coordinate to be measured against this Coordinate
      Returns:
      the square of the euclidean distance from this Coordinate to a specified Coordinate
      Since:
      6166
    • distanceSq

      public final double distanceSq(double px, double py)
      Returns the square of euclidean distance from this Coordinate to a specified coordinate.
      Parameters:
      px - the X coordinate of the specified point to be measured against this Coordinate
      py - the Y coordinate of the specified point to be measured against this Coordinate
      Returns:
      the square of the euclidean distance from this Coordinate to a specified coordinate
      Since:
      6166
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object