public class LatLonPointImpl extends Object implements LatLonPoint, Serializable
LatLonPoint,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected double |
lat
East latitude in degrees, always +/- 90
|
protected double |
lon
North longitude in degrees, always +/- 180
|
| Constructor and Description |
|---|
LatLonPointImpl()
Default constructor with values 0,0.
|
LatLonPointImpl(double lat,
double lon)
Creates a LatLonPoint from component latitude and longitude values.
|
LatLonPointImpl(LatLonPoint pt)
Copy Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
betweenLon(double lon,
double lonBeg,
double lonEnd)
Deprecated.
|
boolean |
equals(Object other) |
static double |
getClockwiseDistanceTo(double from,
double to) |
double |
getLatitude()
Returns the latitude, in degrees.
|
double |
getLongitude()
Returns the longitude, in degrees.
|
int |
hashCode() |
static double |
latNormal(double lat)
Normalize the latitude to lie between +/-90
|
static String |
latToString(double lat,
int ndec)
Make a nicely formatted representation of a latitude, eg 40.34N or 12.9S.
|
static double |
lonDiff(double lon1,
double lon2)
Find difference (lon1 - lon2) normalized so that maximum value is += 180.
|
static double |
lonNormal(double lon)
Normalize the longitude to lie between +/-180
|
static double |
lonNormal(double lon,
double center)
put longitude into the range [center +/- 180] deg
|
static double |
lonNormal360(double lon)
put longitude into the range [0, 360] deg
|
static double |
lonNormalFrom(double lon,
double start)
put longitude into the range [start, start+360] deg
|
static String |
lonToString(double lon,
int ndec)
Make a nicely formatted representation of a longitude, eg 120.3W or 99.99E.
|
boolean |
nearlyEquals(LatLonPoint that,
double maxRelDiff)
Returns
true if this point is nearly equal to that. |
static double |
range180(double lon)
put longitude into the range [-180, 180] deg
|
void |
set(double lat,
double lon)
set lat, lon using double values
|
void |
set(float lat,
float lon)
set lat, lon using float values
|
void |
set(LatLonPoint pt)
set lat, lon using values of pt
|
void |
setLatitude(double lat)
Set the latitude, in degrees.
|
void |
setLongitude(double lon)
Set the longitude, in degrees.
|
String |
toString()
Default string representation
|
String |
toString(int sigDigits)
String representation in the form, eg 40.23N 105.1W
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitnearlyEqualsprotected double lat
protected double lon
public LatLonPointImpl()
public LatLonPointImpl(LatLonPoint pt)
pt - point to copypublic LatLonPointImpl(double lat,
double lon)
lat - north latitude in degreeslon - east longitude in degreespublic static boolean betweenLon(double lon,
double lonBeg,
double lonEnd)
lon - point to testlonBeg - beginning longitudelonEnd - ending longitudepublic static double getClockwiseDistanceTo(double from,
double to)
public static double range180(double lon)
lon - lon to normalizepublic static double lonNormal360(double lon)
lon - lon to normalizepublic static double lonNormal(double lon,
double center)
lon - lon to normalizecenter - center pointpublic static double lonNormalFrom(double lon,
double start)
lon - lon to normalizestart - starting pointpublic static double lonNormal(double lon)
lon - east latitude in degreespublic static double lonDiff(double lon1,
double lon2)
lon1 - startlon2 - endpublic static double latNormal(double lat)
lat - north latitude in degreespublic static String latToString(double lat, int ndec)
lat - the latitude.ndec - number of digits to right of decimal pointpublic static String lonToString(double lon, int ndec)
lon - the longitude.ndec - number of digits to right of decimal pointpublic double getLongitude()
getLongitude in interface LatLonPointpublic double getLatitude()
getLatitude in interface LatLonPointpublic void set(LatLonPoint pt)
pt - point to usepublic void set(double lat,
double lon)
lat - lat valuelon - lon valuepublic void set(float lat,
float lon)
lat - lat valuelon - lon valuepublic void setLongitude(double lon)
lon - east longitude in degreespublic void setLatitude(double lat)
lat - north latitude in degreespublic boolean nearlyEquals(LatLonPoint that, double maxRelDiff)
LatLonPointtrue if this point is nearly equal to that. The "near equality" of points is determined
using Misc.nearlyEquals(double, double, double), with the specified maxRelDiff.nearlyEquals in interface LatLonPointthat - the other point to check.maxRelDiff - the maximum relative difference the two points may have.true if this point is nearly equal to that.public String toString()
public String toString(int sigDigits)
sigDigits - significant digits