com.metsci.glimpse.util.geo
Class LatLonGeo

java.lang.Object
  extended by com.metsci.glimpse.util.geo.LatLonGeo
All Implemented Interfaces:
java.io.Serializable

public class LatLonGeo
extends java.lang.Object
implements java.io.Serializable

Author:
osborn
See Also:
Serialized Form

Field Summary
static DatumSphere defaultDatum
           
static LatLonFormat defaultFormat
           
 
Constructor Summary
LatLonGeo(double northLatDeg, double eastLonDeg)
          Constructs and initializes a LatLonGeo at the given coordinates.
LatLonGeo(double northLatDeg, double eastLonDeg, double altitude)
          Constructs and initializes a LatLonGeo at the given coordinates.
 
Method Summary
 LatLonGeo displacedBy(DistanceAzimuth distAzimuth)
           
 LatLonGeo displacedBy(DistanceAzimuth distAzimuth, Datum datum)
           
 LatLonGeo displacedBy(double dist, double azimuth)
          Same as displacedBy(double, double, Datum), only the default datum is used instead of a user-supplied datum.
 LatLonGeo displacedBy(double dist, double azimuth, Datum datum)
           Returns a newly constructed LatLonGeo generated by displacing this LatLonGeo a specified distance along a geodesic at the given azimuth.
 boolean equals(java.lang.Object obj)
           
 java.lang.String format(java.lang.String componentFormat)
           
 java.lang.String formatDeg(java.lang.String componentFormat)
           
 java.lang.String formatRad(java.lang.String componentFormat)
           
static LatLonGeo fromDeg(double northLat, double eastLon)
          Constructs and initializes a LatLonGeo at the given coordinates.
static LatLonGeo fromDeg(double northLat, double eastLon, double altitude)
          Constructs and initializes a LatLonGeo at the given coordinates.
static LatLonGeo fromDeg(int northLatHours, double northLatMinutes, int eastLonHours, double eastLonMinutes)
          Constructs and initializes a LatLonGeo at the given coordinates.
static LatLonGeo fromEnu(Vector3d enuPoint, LatLonGeo refPoint, Datum datum)
          Constructs and initializes a LatLonGeo based on the given (east,north,up) coordinates in a local tangent plane coordinate system that is tangent to Earth at the given reference point.
static LatLonGeo fromRad(double northLat, double eastLon)
          Constructs and initializes a LatLonGeo at the given coordinates.
static LatLonGeo fromRad(double northLat, double eastLon, double altitude)
          Constructs and initializes a LatLonGeo at the given coordinates.
 double getAltitude()
           
 double getAzimuthFrom(LatLonGeo from)
           
 double getAzimuthFrom(LatLonGeo from, Datum datum)
           
 double getAzimuthTo(LatLonGeo to)
           
 double getAzimuthTo(LatLonGeo to, Datum datum)
           
 DistanceAzimuth getDistanceAzimuthTo(LatLonGeo to)
           
 DistanceAzimuth getDistanceAzimuthTo(LatLonGeo to, Datum datum)
           
 double getDistanceTo(LatLonGeo to)
           
 double getDistanceTo(LatLonGeo to, Datum datum)
           
 double getLatDeg()
           
 double getLatRad()
           
 double getLonDeg()
           
 double getLonRad()
           
 int hashCode()
           
static double normalizeAnglePi(double rad)
          Normalizes an angle to lie within [-π,π) radians.
static double normalizeLat(double latRad)
          Normalizes a latitude to be in the range [-π/2,π/2] radians.
static double normalizeLon(double lonRad)
          Normalizes a longitude to be in the range [-π,π) radians.
 Vector3d toEnu(LatLonGeo refPoint, Datum datum)
          Creates an (east,north,up) representation of this point on the plane tangent to Earth at the given reference point.
 LatLonRect toLatLonRect(Datum datum)
          Treats this LatLonGeo as an ECEF-g coordinate in the given Datum for the purpose of converting it to an ECEF-r coordinate in the form of a newly constructed LatLonRect.
 java.lang.String toString()
           
 java.lang.String toString(LatLonFormat latLonFormat)
           
 LatLonGeo withAltitude(double altitude)
          Returns a newly constructed LatLonGeo with a new altitude but same latitude and same longitude as the current LatLonGeo.
 LatLonGeo withGeocentricLatitudeOn(Datum d)
          Returns a newly constructed LatLonGeo with a geocentric latitude based on interpreting the latitude in this LatLonGeo as geodetic.
 LatLonGeo withGeodeticLatitudeOn(Datum d)
          Returns a newly constructed LatLonGeo with a geodetic latitude based on interpreting the latitude in this LatLonGeo as geocentric.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

defaultFormat

public static final LatLonFormat defaultFormat

defaultDatum

public static final DatumSphere defaultDatum
Constructor Detail

LatLonGeo

public LatLonGeo(double northLatDeg,
                 double eastLonDeg)
Constructs and initializes a LatLonGeo at the given coordinates. Altitude will default to 0.

Parameters:
northLatDeg - north latitude in degrees of the newly constructed LatLonGeo
eastLonDeg - east longitude in degrees of the newly constructed LatLonGeo

LatLonGeo

public LatLonGeo(double northLatDeg,
                 double eastLonDeg,
                 double altitude)
Constructs and initializes a LatLonGeo at the given coordinates.

Parameters:
northLatDeg - north latitude in degrees of the newly constructed LatLonGeo
eastLonDeg - east longitude in degrees of the newly constructed LatLonGeo
altitude - altitude in system units of the newly constructed LatLonGeo
See Also:
fromDeg(double,double,double), fromDeg(double,double), fromRad(double,double,double), fromRad(double,double)
Method Detail

fromDeg

public static LatLonGeo fromDeg(int northLatHours,
                                double northLatMinutes,
                                int eastLonHours,
                                double eastLonMinutes)
Constructs and initializes a LatLonGeo at the given coordinates.

Parameters:
northLatHours - hours of north latitude (degrees) in new LatLonGeo
northLatMinutes - minutes of north latitude (degrees) in new LatLonGeo
eastLonHours - hours of east longitude (degrees) in new LatLonGeo
eastLonMinutes - minutes of east longitude (degrees) in new LatLonGeo

fromDeg

public static LatLonGeo fromDeg(double northLat,
                                double eastLon,
                                double altitude)
Constructs and initializes a LatLonGeo at the given coordinates.

Parameters:
northLat - north latitude in degrees of the newly constructed LatLonGeo
eastLon - east longitude in degrees of the newly constructed LatLonGeo
altitude - altitude in system units of the newly constructed LatLonGeo

fromDeg

public static LatLonGeo fromDeg(double northLat,
                                double eastLon)
Constructs and initializes a LatLonGeo at the given coordinates. Altitude will default to 0.

Parameters:
northLat - north latitude in degrees of the newly constructed LatLonGeo
eastLon - east longitude in degrees of the newly constructed LatLonGeo

fromRad

public static LatLonGeo fromRad(double northLat,
                                double eastLon,
                                double altitude)
Constructs and initializes a LatLonGeo at the given coordinates.

Parameters:
northLat - north latitude in radians of the newly constructed LatLonGeo
eastLon - east longitude in radians of the newly constructed LatLonGeo
altitude - altitude in system units of the newly constructed LatLonGeo

fromRad

public static LatLonGeo fromRad(double northLat,
                                double eastLon)
Constructs and initializes a LatLonGeo at the given coordinates. Altitude will default to 0.

Parameters:
northLat - north latitude in radians of the newly constructed LatLonGeo
eastLon - east longitude in radians of the newly constructed LatLonGeo

fromEnu

public static final LatLonGeo fromEnu(Vector3d enuPoint,
                                      LatLonGeo refPoint,
                                      Datum datum)
Constructs and initializes a LatLonGeo based on the given (east,north,up) coordinates in a local tangent plane coordinate system that is tangent to Earth at the given reference point.

Parameters:
enuPoint - (east,north,up) coordinates of point to be converted, in system units
refPoint - local tangent plane point of tangency
datum - underlying datum used for calculations

toLatLonRect

public LatLonRect toLatLonRect(Datum datum)
Treats this LatLonGeo as an ECEF-g coordinate in the given Datum for the purpose of converting it to an ECEF-r coordinate in the form of a newly constructed LatLonRect. The new LatLonRect is formed by calling Datum.toLatLonRect(LatLonGeo) on this LatLonGeo.

NOTE: The latitude and longitude may be treated as geocentric or geodetic depending on the Datum used.

Parameters:
datum - Datum used to construct the new LatLonRect
See Also:
Datum.toLatLonRect(LatLonGeo)

toEnu

public final Vector3d toEnu(LatLonGeo refPoint,
                            Datum datum)
Creates an (east,north,up) representation of this point on the plane tangent to Earth at the given reference point. See Datum.toEnu(LatLonRect, LatLonGeo).


getAltitude

public double getAltitude()
Returns:
altitude above surface

getLatRad

public double getLatRad()
Returns:
north latitude in radians

getLonRad

public double getLonRad()
Returns:
east longitude in radians

getLatDeg

public double getLatDeg()
Returns:
north latitude in degrees

getLonDeg

public double getLonDeg()
Returns:
east longitude in degrees

withAltitude

public LatLonGeo withAltitude(double altitude)
Returns a newly constructed LatLonGeo with a new altitude but same latitude and same longitude as the current LatLonGeo.

Parameters:
altitude - altitude of the newly constructed LatLonGeo

withGeodeticLatitudeOn

public LatLonGeo withGeodeticLatitudeOn(Datum d)
Returns a newly constructed LatLonGeo with a geodetic latitude based on interpreting the latitude in this LatLonGeo as geocentric. Longitude and altitude will remain the same. See Datum.toGeodeticLatitude(LatLonGeo).

Parameters:
d - Datum defines the spheroid used for projecting the latitude
Returns:
newly constructed LatLonGeo with a geodetic latitude

withGeocentricLatitudeOn

public LatLonGeo withGeocentricLatitudeOn(Datum d)
Returns a newly constructed LatLonGeo with a geocentric latitude based on interpreting the latitude in this LatLonGeo as geodetic. Longitude and altitude will remain the same. See Datum.toGeocentricLatitude(LatLonGeo).

Parameters:
d - Datum defines the spheroid used for projecting the latitude
Returns:
newly constructed LatLonGeo with a geocentric latitude

displacedBy

public LatLonGeo displacedBy(double dist,
                             double azimuth,
                             Datum datum)

Returns a newly constructed LatLonGeo generated by displacing this LatLonGeo a specified distance along a geodesic at the given azimuth. If the datum is a sphere the geodesic is a great circle.

This method calls Datum.displace(LatLonGeo, double, double) on the supplied datum using this LatLonGeo as the initial point.

Parameters:
dist - distance to displace the current LatLonGeo
azimuth - initial azimuth of displacement direction
datum - underlying datum to use for the displacement
Returns:
a newly constructed LatLonGeo that has been displaced by the specified distance

displacedBy

public LatLonGeo displacedBy(double dist,
                             double azimuth)
Same as displacedBy(double, double, Datum), only the default datum is used instead of a user-supplied datum.


displacedBy

public LatLonGeo displacedBy(DistanceAzimuth distAzimuth,
                             Datum datum)

displacedBy

public LatLonGeo displacedBy(DistanceAzimuth distAzimuth)

getDistanceAzimuthTo

public DistanceAzimuth getDistanceAzimuthTo(LatLonGeo to,
                                            Datum datum)

getDistanceAzimuthTo

public DistanceAzimuth getDistanceAzimuthTo(LatLonGeo to)

getDistanceTo

public double getDistanceTo(LatLonGeo to,
                            Datum datum)

getDistanceTo

public double getDistanceTo(LatLonGeo to)

getAzimuthTo

public double getAzimuthTo(LatLonGeo to,
                           Datum datum)

getAzimuthTo

public double getAzimuthTo(LatLonGeo to)

getAzimuthFrom

public double getAzimuthFrom(LatLonGeo from,
                             Datum datum)

getAzimuthFrom

public double getAzimuthFrom(LatLonGeo from)

normalizeLon

public static final double normalizeLon(double lonRad)
Normalizes a longitude to be in the range [-π,π) radians.

Warning: This method produces a near-infinite loop if argument is a very large value.


normalizeLat

public static final double normalizeLat(double latRad)
Normalizes a latitude to be in the range [-π/2,π/2] radians.

Warning: This method produces a near-infinite loop if argument is a very large value.


normalizeAnglePi

public static final double normalizeAnglePi(double rad)
Normalizes an angle to lie within [-π,π) radians.


format

public java.lang.String format(java.lang.String componentFormat)

formatDeg

public java.lang.String formatDeg(java.lang.String componentFormat)

formatRad

public java.lang.String formatRad(java.lang.String componentFormat)

toString

public java.lang.String toString(LatLonFormat latLonFormat)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2012 Metron, Inc.. All Rights Reserved.