Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

GeoPos Class Reference
[Data classes]

Position class using ECEF coordinates. More...

#include <GeoPos.h>

Inheritance diagram for GeoPos:

Vector3 BaseType List of all members.

Public Methods

 GeoPos ()
 Default constructor.

 GeoPos (Vector3 const &v)
 Copy constructor from a standard vector.

 GeoPos (GeoPos const &g)
 Copy constructor.

const GeoPos & operator= (Vector3 const &v)
 Copy operator.

const GeoPos & operator= (GeoPos const &g)
 Copy operator.

virtual ~GeoPos ()
 Destructor.

double getSlantRange (GeoPos const &) const
 Get the absolute distance between two points in ECEF coordinates.

void getSurfaceDistance (GeoPos const &, double &distance, double &bearing) const
 Get the distance between to points along the surface of the reference ellipsoid.

void getShellDistance (GeoPos const &, double &distance, double &bearing) const
 Get the distance between two points along the surface of the reference ellipsoid, including altitude.

void getLocalFrame (Vector3 &localX, Vector3 &localY, Vector3 &localZ) const
 Get a local cartesian coordinate frame.

void getLLA (double &lat, double &lon, double &alt) const
 Get the current latitude, longitude, and altitude relative to the reference ellipsoid.

void setLLA (double lat, double lon, double alt=0.0)
 Set the position using latitude, longitude, and altitude.

double getLongitude () const
 Get the current latitude.

double getLatitude () const
 Get the current longitude.

double getAltitude () const
 Get the current altitude.

void _updateLLA () const
 Internal method to update latitude, longitude, and altitude.

void getUTM (double &northing, double &easting, char &zone, char &designator) const
 Get the current position in UTM coordinates.

void setUTM (double northing, double easting, char zone, char designator, double alt=0.0)
 Set the current position from UTM coordinates.

void setUTM (double northing, double easting, const char *zone, double alt=0.0)
 Set the current position from UTM coordinates.

double getNorthing () const
 Get the UTM northing coordinate for the current position.

double getEasting () const
 Get the UTM easting coordinate for the current position.

int getZoneNumber () const
 Get the UTM zone number for the current position.

char getZoneLetter () const
 Get the UTM zone letter for the current position.

void _updateUTM () const
 Internal method to update UTM northing, easting, and zone.

void setReferenceEllipsoid (ReferenceEllipsoid const &=GeoRef::WGS84)
 Set the reference ellipsoid used for LLA and UTM conversions.

ReferenceEllipsoid const & getReferenceEllipsoid () const
 Get the current reference ellipsoid.

void setDirty ()
 Set flags to indicate that the underlying ECEF vector has changed.

virtual std::string asString () const
 String representation.

virtual std::string typeString () const
 Return a string representation of the type.

void parseXML (const char *)
 Set the current position from XML character data.

virtual void serialize (Archive &)
 Serialize to or from a data archive.

bool operator== (const Vector3 &v) const
 Test for equality with another vectors.

bool operator!= (const Vector3 &v) const
 Test for inequality with another vectors.

void set (double x_, double y_, double z_)
 Set the vector components.

double & operator[] (int i)
 Get a reference to vector component by numeric index.

double operator[] (int i) const
 Get the value of a vector component by numeric index.

double & x ()
 Get a reference to the x-component.

double x () const
 Get the value of the x-component.

double & y ()
 Get a reference to the y-component.

double y () const
 Get the value of the y-component.

double & z ()
 Get a reference to the z-component.

double z () const
 Get the value of the z-component.

bool valid () const
 Test if all components are valid floating point values.

bool isNaN () const
 Test if any components are NaN (not-a-number).

bool isZero () const
double operator * (const Vector3 &rhs) const
 Compute the dot product with another vector.

const Vector3 operator * (double rhs) const
 Multiply by a scalar.

const Vector3 operator^ (const Vector3 &rhs) const
 Compute the cross product with another vector.

Vector3operator *= (double rhs)
 Unary multiply by a scalar.

const Vector3 operator/ (double rhs) const
 Divide by a scalar.

Vector3operator/= (double rhs)
 Unary divide by a scalar.

const Vector3 operator+ (const Vector3 &rhs) const
 Binary vector addition.

Vector3operator+= (const Vector3 &rhs)
 Unary vector addition.

const Vector3 operator- (const Vector3 &rhs) const
 Binary vector subtraction.

const Vector3 operator- () const
 Negation operator; returns the negative of the vector.

Vector3operator-= (const Vector3 &rhs)
 Unary vector subtraction.

double length () const
 Get the length of the vector = sqrt(v*v).

double length2 () const
 Get the length squared of the vector = v*v.

double normalize ()
 Normalize the vector so that it has length unity.

const Vector3 normalized () const
 Get a unit vector in the direction of this vector.

Matrix3 starMatrix () const
 Compute the star matrix of this vector.

void bound (Vector3 &min, Vector3 &max)
 Update bounding vectors.

std::vector< double > getElements () const
 Get the components of this vector as a std::vector<double>.

void setElements (std::vector< double > const &v)
 Set the components of this vector from a std::vector<double>.

virtual void convertXML ()
 Convert XML data to internal format prior to serialization.


Static Public Methods

char _getUTMDesignator (double lat)
 Internal class method to get the UTM zone letter for a given latitude.


Static Public Attributes

const Vector3 ZERO
 Null vector.

const Vector3 XAXIS
 Unit vector along the x-axis.

const Vector3 YAXIS
 Unit vector along the y-axis.

const Vector3 ZAXIS
 Unit vector along the z-axis.


Protected Methods

void iterateECEF (double p, double z, double x, double y, int iter=0) const
 Compute ECEF from LLA.


Protected Attributes

double _lat
 geodetic latitude

double _lon
 longitude

double _alt
 altitude above reference ellipse

bool _stale_lla
 lla needs update

bool _stale_utm
 utm needs update

double _northing
 utm northing

double _easting
 utm easting

char _zone
 utm zone

char _designator
 utm designator

ReferenceEllipsoid const * _ref
 reference ellipsoid

double _x
 The x component.

double _y
 The y component.

double _z
 The z component.


Friends

Vector3 operator * (double lhs, const Vector3 &rhs)
 Multiply a vector by a scalar on the left.

double dot (const Vector3 &a, const Vector3 &b)
 Compute the dot product of two vectors.

const Vector3 cross (const Vector3 &a, const Vector3 &b)
 Compute the cross product of two vectors.

SIMDATA_EXPORT std::ostream & operator<< (std::ostream &output, const Vector3 &vec)
 Format to an output string.


Detailed Description

Position class using ECEF coordinates.

Extends a cartesian 3-vector to Earth-Centered, Earth-Fixed (ECEF) coordinates. Helper methods are provided for lazy conversion to and from Geodetic and UTM coordinates using a standard reference ellipsoid.

Due to subclassing of Vector3, modifications of the ECEF vector do not automatically set the dirty flags used for lazy evaluations of other coordinate representations. After calculations that modify the underlying ECEF vector, you *must* call setDirty() manually to ensure that subsequent conversions to Geodetic and UTM coordinates function properly.

Deprecated:
Use LLA, UTM, and/or ECEF instead.


Constructor & Destructor Documentation

GeoPos::GeoPos   [inline]
 

Default constructor.

The WGS84 reference ellipsoid will be set implicity, and the position will be set to (0, 0, 0) --- the center of the Earth.

GeoPos::GeoPos Vector3 const &    v [inline]
 

Copy constructor from a standard vector.

The WGS84 reference ellipsoid will be set implicity.

GeoPos::GeoPos GeoPos const &    g [inline]
 

Copy constructor.

The new GeoPos will use the same reference ellipsoid as the source.

virtual GeoPos::~GeoPos   [inline, virtual]
 

Destructor.


Member Function Documentation

char GeoPos::_getUTMDesignator double    lat [static]
 

Internal class method to get the UTM zone letter for a given latitude.

Parameters:
lat  latitude in radians

void GeoPos::_updateLLA  
 

Internal method to update latitude, longitude, and altitude.

You do not need to call this directly.

void GeoPos::_updateUTM  
 

Internal method to update UTM northing, easting, and zone.

You do not need to call this directly.

virtual std::string GeoPos::asString   const [inline, virtual]
 

String representation.

Reimplemented from Vector3.

void Vector3::bound Vector3   min,
Vector3   max
[inline, inherited]
 

Update bounding vectors.

The components of min and max are updated to contain the corresponding components of this vector.

void BaseType::convertXML   [virtual, inherited]
 

Convert XML data to internal format prior to serialization.

This method is currently only called by the XML parser for Object classes. If another BaseType class requires this method, a call must be added to the appropriate XML handler in the parser.

double GeoPos::getAltitude   const [inline]
 

Get the current altitude.

Returns:
altitude relative to the reference ellipse (in meters)

double GeoPos::getEasting   const [inline]
 

Get the UTM easting coordinate for the current position.

std::vector<double> Vector3::getElements   const [inline, inherited]
 

Get the components of this vector as a std::vector<double>.

double GeoPos::getLatitude   const [inline]
 

Get the current longitude.

Returns:
longitude in radians

void GeoPos::getLLA double &    lat,
double &    lon,
double &    alt
const
 

Get the current latitude, longitude, and altitude relative to the reference ellipsoid.

Returns:
lat latitude in radians lon longitude in radians alt altitude relative to the reference ellipse (in meters)

void GeoPos::getLocalFrame Vector3   localX,
Vector3   localY,
Vector3   localZ
const
 

Get a local cartesian coordinate frame.

Returns:
localX a unit vector, tangent to the reference ellipsoid, pointing east localY a unit vector, tangent to the reference ellipsoid, pointing north localZ a nuti vector, normal to the reference ellipsoid

double GeoPos::getLongitude   const [inline]
 

Get the current latitude.

Returns:
latitude in radians

double GeoPos::getNorthing   const [inline]
 

Get the UTM northing coordinate for the current position.

ReferenceEllipsoid const& GeoPos::getReferenceEllipsoid   const [inline]
 

Get the current reference ellipsoid.

void GeoPos::getShellDistance GeoPos const &   ,
double &    distance,
double &    bearing
const
 

Get the distance between two points along the surface of the reference ellipsoid, including altitude.

This method is very similar to getSurfaceDistance, but includes the altitude difference between the two points in an approximate way that can be used both at close range and globally.

Returns:
distance a combined geodesic and altitude distance bearing the bearing to the specified point (in radians relative to true north)

double GeoPos::getSlantRange GeoPos const &    const
 

Get the absolute distance between two points in ECEF coordinates.

This is the normal cartesian distance between two points; the curvature of the ellipsoid is not involved.

void GeoPos::getSurfaceDistance GeoPos const &   ,
double &    distance,
double &    bearing
const
 

Get the distance between to points along the surface of the reference ellipsoid.

Both points are projected to altitude = 0, and the distance calculated along a geodesic path of the reference ellipsoid.

Returns:
distance the geodesic distance bearing the bearing to the specified point (in radians relative to true north)

void GeoPos::getUTM double &    northing,
double &    easting,
char &    zone,
char &    designator
const
 

Get the current position in UTM coordinates.

Returns:
northing UTM northing easting UTM easting zone UTM zone designator UTM zone letter

char GeoPos::getZoneLetter   const [inline]
 

Get the UTM zone letter for the current position.

int GeoPos::getZoneNumber   const [inline]
 

Get the UTM zone number for the current position.

bool Vector3::isNaN   const [inline, inherited]
 

Test if any components are NaN (not-a-number).

bool Vector3::isZero   const [inline, inherited]
 

void GeoPos::iterateECEF double    p,
double    z,
double    x,
double    y,
int    iter = 0
const [protected]
 

Compute ECEF from LLA.

double Vector3::length   const [inline, inherited]
 

Get the length of the vector = sqrt(v*v).

double Vector3::length2   const [inline, inherited]
 

Get the length squared of the vector = v*v.

double Vector3::normalize   [inline, inherited]
 

Normalize the vector so that it has length unity.

Returns:
The original length of the vector.

const Vector3 Vector3::normalized   const [inline, inherited]
 

Get a unit vector in the direction of this vector.

const Vector3 Vector3::operator * double    rhs const [inline, inherited]
 

Multiply by a scalar.

double Vector3::operator * const Vector3   rhs const [inline, inherited]
 

Compute the dot product with another vector.

Vector3& Vector3::operator *= double    rhs [inline, inherited]
 

Unary multiply by a scalar.

bool Vector3::operator!= const Vector3   v const [inline, inherited]
 

Test for inequality with another vectors.

const Vector3 Vector3::operator+ const Vector3   rhs const [inline, inherited]
 

Binary vector addition.

Vector3& Vector3::operator+= const Vector3   rhs [inline, inherited]
 

Unary vector addition.

const Vector3 Vector3::operator-   const [inline, inherited]
 

Negation operator; returns the negative of the vector.

const Vector3 Vector3::operator- const Vector3   rhs const [inline, inherited]
 

Binary vector subtraction.

Vector3& Vector3::operator-= const Vector3   rhs [inline, inherited]
 

Unary vector subtraction.

const Vector3 Vector3::operator/ double    rhs const [inline, inherited]
 

Divide by a scalar.

Vector3& Vector3::operator/= double    rhs [inline, inherited]
 

Unary divide by a scalar.

GeoPos const & GeoPos::operator= GeoPos const &    g
 

Copy operator.

The reference ellipsoid is also copied.

GeoPos const & GeoPos::operator= Vector3 const &    v
 

Copy operator.

The reference ellipsoid will not be modified.

Reimplemented from Vector3.

bool Vector3::operator== const Vector3   v const [inline, inherited]
 

Test for equality with another vectors.

double Vector3::operator[] int    i const [inline, inherited]
 

Get the value of a vector component by numeric index.

The index starts at zero (=x), and an IndexException is thrown for invalid indices.

Returns:
The value of the specified component.

double& Vector3::operator[] int    i [inline, inherited]
 

Get a reference to vector component by numeric index.

The index starts at zero (=x), and an IndexException is thrown for invalid indices.

Returns:
A reference to the specified component.

const Vector3 Vector3::operator^ const Vector3   rhs const [inline, inherited]
 

Compute the cross product with another vector.

void GeoPos::parseXML const char *    [virtual]
 

Set the current position from XML character data.

  • ECEF coordinate format (x, y, z): x.x x.x x.x
  • LLA coordinate format (lat, lon, alt): G x.x x.x x.x
  • LLA coordinate format 2 (lat, lon, alt): G x'x"x.x x'x"x.x x.x
  • UTM coordinate format (northing, easting, zone, alt): G x.x x.x zone x.x @n where 'zone' is an integer followed by a UTM latitude designator, such as "10T".
Note that the letters preceeding all formats other than ECEF are required.

Todo:
  • use different prefix letters for LLA and UTM
  • allow the source reference ellipsoid to be specified

Reimplemented from Vector3.

void GeoPos::serialize Archive   [virtual]
 

Serialize to or from a data archive.

Reimplemented from Vector3.

void Vector3::set double    x_,
double    y_,
double    z_
[inline, inherited]
 

Set the vector components.

void GeoPos::setDirty   [inline]
 

Set flags to indicate that the underlying ECEF vector has changed.

Call this method after any computations that modify the ECEF vector to ensure that LLA and UTM coordinates will be updated correctly.

void Vector3::setElements std::vector< double > const &    v [inline, inherited]
 

Set the components of this vector from a std::vector<double>.

void GeoPos::setLLA double    lat,
double    lon,
double    alt = 0.0
 

Set the position using latitude, longitude, and altitude.

Parameters:
lat  latitude in radians
lon  longitude in radians
alt  altitude in meters

void GeoPos::setReferenceEllipsoid ReferenceEllipsoid const &    = GeoRef::WGS84
 

Set the reference ellipsoid used for LLA and UTM conversions.

The default ellipsoid is WGS-84. The reference ellipsoid can be specified independently for each GeoPos instance, but mixing results from different ellipsoids is not recommended.

void GeoPos::setUTM double    northing,
double    easting,
const char *    zone,
double    alt = 0.0
 

Set the current position from UTM coordinates.

Parameters:
northing  UTM northing
easting  UTM easting
zone  UTM zone (e.g. "10T")
alt  altitude above the reference ellipse (in meters)

void GeoPos::setUTM double    northing,
double    easting,
char    zone,
char    designator,
double    alt = 0.0
 

Set the current position from UTM coordinates.

Parameters:
northing  UTM northing
easting  UTM easting
zone  UTM zone
designator  UTM zone letter
alt  altitude above the reference ellipse (in meters)

Matrix3 Vector3::starMatrix   [inherited]
 

Compute the star matrix of this vector.

virtual std::string GeoPos::typeString   const [inline, virtual]
 

Return a string representation of the type.

Reimplemented from Vector3.

bool Vector3::valid   const [inline, inherited]
 

Test if all components are valid floating point values.

double Vector3::x   const [inline, inherited]
 

Get the value of the x-component.

double& Vector3::x   [inline, inherited]
 

Get a reference to the x-component.

double Vector3::y   const [inline, inherited]
 

Get the value of the y-component.

double& Vector3::y   [inline, inherited]
 

Get a reference to the y-component.

double Vector3::z   const [inline, inherited]
 

Get the value of the z-component.

double& Vector3::z   [inline, inherited]
 

Get a reference to the z-component.


Friends And Related Function Documentation

const Vector3 cross const Vector3   a,
const Vector3   b
[friend, inherited]
 

Compute the cross product of two vectors.

double dot const Vector3   a,
const Vector3   b
[friend, inherited]
 

Compute the dot product of two vectors.

Vector3 operator * double    lhs,
const Vector3   rhs
[friend, inherited]
 

Multiply a vector by a scalar on the left.

SIMDATA_EXPORT std::ostream& operator<< std::ostream &    os,
const Vector3   v
[friend, inherited]
 

Format to an output string.


Member Data Documentation

double GeoPos::_alt [protected]
 

altitude above reference ellipse

char GeoPos::_designator [protected]
 

utm designator

double GeoPos::_easting [protected]
 

utm easting

double GeoPos::_lat [protected]
 

geodetic latitude

double GeoPos::_lon [protected]
 

longitude

double GeoPos::_northing [protected]
 

utm northing

ReferenceEllipsoid const* GeoPos::_ref [protected]
 

reference ellipsoid

bool GeoPos::_stale_lla [protected]
 

lla needs update

bool GeoPos::_stale_utm [protected]
 

utm needs update

double Vector3::_x [protected, inherited]
 

The x component.

double Vector3::_y [protected, inherited]
 

The y component.

double Vector3::_z [protected, inherited]
 

The z component.

char GeoPos::_zone [protected]
 

utm zone

const Vector3 Vector3::XAXIS [static, inherited]
 

Unit vector along the x-axis.

const Vector3 Vector3::YAXIS [static, inherited]
 

Unit vector along the y-axis.

const Vector3 Vector3::ZAXIS [static, inherited]
 

Unit vector along the z-axis.

NAMESPACE_SIMDATA const Vector3 Vector3::ZERO [static, inherited]
 

Null vector.


The documentation for this class was generated from the following files:
SimData version pre-0.4.0. For more information on SimData, visit the SimData Homepage.

Generated on Tue Oct 14 12:06:41 2003, using Doxygen 1.2.18.

[SF.net]