public class LatLong
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable, java.awt.datatransfer.Transferable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
deg |
static int |
FORMAT_DECIMALMINUTES |
static int |
FORMAT_MINUTESSECONDS |
static double |
MetersPerMile |
Constructor and Description |
---|
LatLong() |
LatLong(double latitude,
double longitude) |
LatLong(double latitude,
double longitude,
double height) |
LatLong(java.lang.String string)
USE WITH CAUTION uses
LatLong.valueOfSubstring
|
Modifier and Type | Method and Description |
---|---|
LatLong |
addDistanceMeters(double addX,
double addY)
Add distances in metres East and metres North to a LatLong
Note that this assumes a flat earth model away from poles, so it's possible to create stupid values. |
double |
bearingTo(LatLong destination)
Get the bearing in degree to this latlong to another latlong.
|
LatLong |
clone() |
double |
distanceToMetres(LatLong destination)
Calculate the distance from this positions to some other
position in metres.
|
double |
distanceToMetresX(LatLong destination)
Calculate the distance in metres along the X coordinate from the lat long to
some other lat long.
|
double |
distanceToMetresY(LatLong destination)
Calculate the distance in metres along the Y coordinate from the lat long to
some other lat long.
|
double |
distanceToMiles(LatLong destination)
Calculate the distance from this positions to some other
position in miles.
|
static java.lang.String |
doubleDegrees2StringDegs(double latlong) |
static java.lang.String |
doubleDegrees2StringMins(double latlong) |
boolean |
equals(LatLong ll) |
java.lang.String |
formatLatitude()
formats the latitude string
|
static java.lang.String |
formatLatitude(double latlong)
convert a double decimal degrees into a formatted latlong string
|
java.lang.String |
formatLongitude()
formats the longitude as a string
|
static java.lang.String |
formatLongitude(double latlong)
convert a double decimal degrees into a formatted latlong string
|
double |
getCrossTrackError(LatLong latLong1,
LatLong latLong2)
Clculate the perpendicular distance from this LatLong
to a line joining latLong1 and latLong2
|
static java.awt.datatransfer.DataFlavor |
getDataFlavor() |
static double |
getDecimalMinutes(double latLong) |
static int |
getFormatStyle() |
double |
getHeight() |
static int |
getIntegerMinutes(double latLong) |
double |
getLatitude() |
double |
getLongitude() |
static LatLong |
getMean(LatLong[] lls) |
static LatLong |
getPastedValue() |
static double |
getSeconds(double latLong) |
static int |
getSignedDegrees(double latLong) |
java.lang.Object |
getTransferData(java.awt.datatransfer.DataFlavor flavor) |
java.awt.datatransfer.DataFlavor[] |
getTransferDataFlavors() |
boolean |
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor) |
static void |
setFormatStyle(int formatStyle) |
void |
setHeight(double height) |
void |
setLatitude(double latitude) |
void |
setLongitude(double longitude) |
java.lang.String |
toString() |
LatLong |
travelDistanceMeters(double trueHeading,
double distance) |
LatLong |
TravelDistanceMiles(double trueHeading,
double distance) |
static LatLong |
valueOfString(java.lang.String string)
must be separated by comma, then see valueOfSubstring
|
static java.lang.Double |
valueOfSubstring(java.lang.String angleString)
must contain degree sign °
-5° S will produce a north value
if neither N, S or - will assume positive
57°19.800' N or 10°48.000' W
|
public static final transient java.lang.String deg
public static final transient double MetersPerMile
public static final int FORMAT_DECIMALMINUTES
public static final int FORMAT_MINUTESSECONDS
public LatLong(double latitude, double longitude)
public LatLong(double latitude, double longitude, double height)
public LatLong()
public LatLong(java.lang.String string) throws java.lang.NullPointerException
LatLong
- java.lang.NullPointerException
public static int getFormatStyle()
public static java.awt.datatransfer.DataFlavor getDataFlavor()
public static void setFormatStyle(int formatStyle)
formatStyle
- The formatStyle to set.public LatLong clone()
clone
in class java.lang.Object
public double getLatitude()
public void setLatitude(double latitude)
latitude
- The latitude to set.public double getLongitude()
public void setLongitude(double longitude)
longitude
- The longitude to set.public java.lang.String formatLatitude()
public static java.lang.String formatLatitude(double latlong)
latlong
- public static LatLong valueOfString(java.lang.String string)
string
- public static java.lang.Double valueOfSubstring(java.lang.String angleString)
string
- public java.lang.String formatLongitude()
public static java.lang.String formatLongitude(double latlong)
latlong
- public static java.lang.String doubleDegrees2StringDegs(double latlong)
public static java.lang.String doubleDegrees2StringMins(double latlong)
public static int getSignedDegrees(double latLong)
public static double getDecimalMinutes(double latLong)
public static int getIntegerMinutes(double latLong)
public static double getSeconds(double latLong)
public LatLong travelDistanceMeters(double trueHeading, double distance)
trueHeading
- Heading relative to True North -degreesdistance
- Distance to travel in meters.public LatLong TravelDistanceMiles(double trueHeading, double distance)
trueHeading
- Heading relative to True North- degreesdistance
- Distance to travel in nautical miles.public LatLong addDistanceMeters(double addX, double addY)
addX
- distance to travel East in metresaddY
- distance to travel North in metrespublic double distanceToMiles(LatLong destination)
destination
- destiantion positionpublic double distanceToMetres(LatLong destination)
destination
- destiantion positionpublic double distanceToMetresX(LatLong destination)
destination
- destination coordinatepublic double distanceToMetresY(LatLong destination)
destination
- destination coordinatepublic boolean equals(LatLong ll)
public double bearingTo(LatLong destination)
destination
- destination lat longpublic double getCrossTrackError(LatLong latLong1, LatLong latLong2)
public double getHeight()
public void setHeight(double height)
height
- the height to setpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException
getTransferData
in interface java.awt.datatransfer.Transferable
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors
in interface java.awt.datatransfer.Transferable
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
isDataFlavorSupported
in interface java.awt.datatransfer.Transferable
public static LatLong getPastedValue()