Package org.openstreetmap.josm.data.coor
Class Coordinate
- java.lang.Object
-
- org.openstreetmap.josm.data.coor.Coordinate
-
- All Implemented Interfaces:
java.io.Serializable
abstract class Coordinate extends java.lang.Object implements java.io.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
-
-
Constructor Summary
Constructors Constructor Description Coordinate(double x, double y)Construct the point with latitude / longitude values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubledistance(double px, double py)Returns the euclidean distance from thisCoordinateto a specified coordinate.protected doubledistance(Coordinate coor)Returns the euclidean distance from thisCoordinateto a specifiedCoordinate.doubledistanceSq(double px, double py)Returns the square of euclidean distance from thisCoordinateto a specified coordinate.protected doubledistanceSq(Coordinate coor)Returns the square of the euclidean distance from thisCoordinateto a specifiedCoordinate.booleanequals(java.lang.Object obj)doublegetX()doublegetY()inthashCode()
-
-
-
Constructor Detail
-
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 Detail
-
getX
public double getX()
-
getY
public double getY()
-
distance
protected final double distance(Coordinate coor)
Returns the euclidean distance from thisCoordinateto a specifiedCoordinate.- Parameters:
coor- the specified coordinate to be measured against thisCoordinate- Returns:
- the euclidean distance from this
Coordinateto a specifiedCoordinate - Since:
- 6166
-
distance
public final double distance(double px, double py)
Returns the euclidean distance from thisCoordinateto a specified coordinate.- Parameters:
px- the X coordinate of the specified point to be measured against thisCoordinatepy- the Y coordinate of the specified point to be measured against thisCoordinate- Returns:
- the euclidean distance from this
Coordinateto a specified coordinate - Since:
- 6166
-
distanceSq
protected final double distanceSq(Coordinate coor)
Returns the square of the euclidean distance from thisCoordinateto a specifiedCoordinate.- Parameters:
coor- the specified coordinate to be measured against thisCoordinate- Returns:
- the square of the euclidean distance from this
Coordinateto a specifiedCoordinate - Since:
- 6166
-
distanceSq
public final double distanceSq(double px, double py)
Returns the square of euclidean distance from thisCoordinateto a specified coordinate.- Parameters:
px- the X coordinate of the specified point to be measured against thisCoordinatepy- the Y coordinate of the specified point to be measured against thisCoordinate- Returns:
- the square of the euclidean distance from this
Coordinateto a specified coordinate - Since:
- 6166
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-