|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.geom.Point2D
org.openstreetmap.josm.data.coor.Coordinate
org.openstreetmap.josm.data.coor.LatLon
public class LatLon
LatLon are unprojected latitude / longitude coordinates. This class is immutable.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.geom.Point2D |
---|
java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Float |
Field Summary | |
---|---|
static java.text.DecimalFormat |
cDdFormatter
|
private static java.text.DecimalFormat |
cDmMinuteFormatter
|
private static java.text.DecimalFormat |
cDmsMinuteFormatter
|
private static java.text.DecimalFormat |
cDmsSecondFormatter
|
static java.lang.String |
EAST
|
static int |
MAX_SERVER_DIGITS
|
static double |
MAX_SERVER_INV_PRECISION
|
static double |
MAX_SERVER_PRECISION
Minimum difference in location to not be represented as the same position. |
static java.lang.String |
NORTH
|
static java.lang.String |
SOUTH
|
static java.lang.String |
WEST
|
Fields inherited from class org.openstreetmap.josm.data.coor.Coordinate |
---|
x, y |
Constructor Summary | |
---|---|
LatLon(double lat,
double lon)
|
|
LatLon(LatLon coor)
|
Method Summary | |
---|---|
static java.lang.String |
dm(double pCoordinate)
Replies the coordinate in degrees/minutes format |
static java.lang.String |
dms(double pCoordinate)
Replies the coordinate in degrees/minutes/seconds format |
boolean |
equals(java.lang.Object obj)
|
boolean |
equalsEpsilon(LatLon other)
|
LatLon |
getCenter(LatLon ll2)
|
LatLon |
getRoundedToOsmPrecision()
Replies a clone of this lat LatLon, rounded to OSM precisions, i.e. |
LatLon |
getRoundedToOsmPrecisionStrict()
Replies a clone of this lat LatLon, rounded to OSM precisions, i.e. |
double |
greatCircleDistance(LatLon other)
Computes the distance between this lat/lon and another point on the earth. |
int |
hashCode()
|
double |
heading(LatLon other)
Returns the heading, in radians, that you have to use to get from this lat/lon to another. |
LatLon |
interpolate(LatLon ll2,
double proportion)
|
boolean |
isOutSideWorld()
|
boolean |
isValid()
Replies true if lat is in the range [-90,90] and lon is in the range [-180,180] |
static boolean |
isValidLat(double lat)
Replies true if lat is in the range [-90,90] |
static boolean |
isValidLon(double lon)
Replies true if lon is in the range [-180,180] |
boolean |
isWithin(Bounds b)
|
double |
lat()
|
java.lang.String |
latToString(CoordinateFormat d)
|
double |
lon()
|
java.lang.String |
lonToString(CoordinateFormat d)
|
static double |
roundToOsmPrecision(double value)
Returns the value rounded to OSM precisions, i.e. |
static double |
roundToOsmPrecisionStrict(double value)
Returns the value rounded to OSM precision. |
java.lang.String |
toDisplayString()
Returns this lat/lon pair in human-readable format. |
static double |
toIntervalLat(double value)
|
static double |
toIntervalLon(double value)
Returns a valid OSM longitude [-180,+180] for the given extended longitude value. |
java.lang.String |
toString()
|
Methods inherited from class org.openstreetmap.josm.data.coor.Coordinate |
---|
getX, getY, setLocation |
Methods inherited from class java.awt.geom.Point2D |
---|
clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, setLocation |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final double MAX_SERVER_PRECISION
public static final double MAX_SERVER_INV_PRECISION
public static final int MAX_SERVER_DIGITS
private static java.text.DecimalFormat cDmsMinuteFormatter
private static java.text.DecimalFormat cDmsSecondFormatter
private static java.text.DecimalFormat cDmMinuteFormatter
public static final java.text.DecimalFormat cDdFormatter
public static final java.lang.String SOUTH
public static final java.lang.String NORTH
public static final java.lang.String WEST
public static final java.lang.String EAST
Constructor Detail |
---|
public LatLon(double lat, double lon)
public LatLon(LatLon coor)
Method Detail |
---|
public static boolean isValidLat(double lat)
lat
- the latitude
public static boolean isValidLon(double lon)
lon
- the longitude
public boolean isValid()
public static double toIntervalLat(double value)
public static double toIntervalLon(double value)
lon
- A longitude value not restricted to the [-180,+180] range.public static java.lang.String dms(double pCoordinate)
pCoordinate
- The coordinate to convert
public static java.lang.String dm(double pCoordinate)
pCoordinate
- The coordinate to convert
public double lat()
public java.lang.String latToString(CoordinateFormat d)
public double lon()
public java.lang.String lonToString(CoordinateFormat d)
public boolean equalsEpsilon(LatLon other)
true
if the other point has almost the same lat/lon
values, only differing by no more than
1 / MAX_SERVER_PRECISION
.public boolean isOutSideWorld()
true
, if the coordinate is outside the world, compared
by using lat/lon.public boolean isWithin(Bounds b)
true
if this is within the given bounding box.public double greatCircleDistance(LatLon other)
other
- the other point.
public double heading(LatLon other)
other
- the "destination" position
public java.lang.String toDisplayString()
public LatLon interpolate(LatLon ll2, double proportion)
public LatLon getCenter(LatLon ll2)
public java.lang.String toString()
toString
in class java.lang.Object
public static double roundToOsmPrecision(double value)
public static double roundToOsmPrecisionStrict(double value)
roundToOsmPrecision(double)
, since the rounding error has been fixed.
public LatLon getRoundedToOsmPrecision()
public LatLon getRoundedToOsmPrecisionStrict()
public int hashCode()
hashCode
in class Coordinate
public boolean equals(java.lang.Object obj)
equals
in class Coordinate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |