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 double
distance(double px, double py)
Returns the euclidean distance from thisCoordinate
to a specified coordinate.protected double
distance(Coordinate coor)
Returns the euclidean distance from thisCoordinate
to a specifiedCoordinate
.double
distanceSq(double px, double py)
Returns the square of euclidean distance from thisCoordinate
to a specified coordinate.protected double
distanceSq(Coordinate coor)
Returns the square of the euclidean distance from thisCoordinate
to a specifiedCoordinate
.boolean
equals(java.lang.Object obj)
double
getX()
double
getY()
int
hashCode()
-
-
-
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 thisCoordinate
to a specifiedCoordinate
.- Parameters:
coor
- the specified coordinate to be measured against thisCoordinate
- Returns:
- the euclidean distance from this
Coordinate
to a specifiedCoordinate
- Since:
- 6166
-
distance
public final double distance(double px, double py)
Returns the euclidean distance from thisCoordinate
to a specified coordinate.- Parameters:
px
- the X coordinate of the specified point to be measured against thisCoordinate
py
- the Y coordinate of the specified point to be measured against thisCoordinate
- 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 thisCoordinate
to a specifiedCoordinate
.- Parameters:
coor
- the specified coordinate to be measured against thisCoordinate
- Returns:
- the square of the euclidean distance from this
Coordinate
to a specifiedCoordinate
- Since:
- 6166
-
distanceSq
public final double distanceSq(double px, double py)
Returns the square of euclidean distance from thisCoordinate
to a specified coordinate.- Parameters:
px
- the X coordinate of the specified point to be measured against thisCoordinate
py
- the Y coordinate of the specified point to be measured against thisCoordinate
- Returns:
- the square of the euclidean distance from this
Coordinate
to a specified coordinate - Since:
- 6166
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-