dtTerrain::GeoCoordinates Class Reference

This class is intended to represent cartesian and geographic coordinates. More...

#include <geocoordinates.h>

List of all members.

Public Member Functions

 GeoCoordinates ()
 Constructs the coordinate system.
bool operator== (const GeoCoordinates &rhs) const
 Compares the two coordinate's cartesian location.
bool operator< (const GeoCoordinates &rhs) const
 Performs a less than comparison on this coordinate's cartesian location with that of the other.
void SetLatitude (int degrees, int minutes=0, int seconds=0)
 Sets the latitude of this coordinate.
void SetLatitude (double decimalDegrees)
 Sets the latitude of this coordinate.
double GetLatitude () const
 Gets the latitude origin of this coordinate.
void GetLatitude (int &degrees, int &minutes, int &seconds)
 Gets the latitude origin of this coordinate.
void SetLongitude (int degrees, int minutes=0, int seconds=0)
 Sets the longitude of this coordinate.
void SetLongitude (double decimalDegrees)
 Sets the longitude of this coordinate.
double GetLongitude () const
 Gets the longitude origin of this coordinate.
void GetLongitude (int &degrees, int &minutes, int &seconds)
 Gets the longitude origin of this coordinate.
void SetAltitude (double alt)
 Sets the altitude of this coordinate.
double GetAltitude () const
 Gets this coordinate's altitude.
void SetCartesianPoint (const osg::Vec3 &newLocation)
 Sets the location of this coordinate in cartesian space.
const osg::Vec3 & GetCartesianPoint ()
 Gets this coordinate's location in cartesian space.
void GetCartesianPoint (osg::Vec3 &point)
std::string ToString ()
std::string ToStringAll ()

Static Public Member Functions

static void SetOrigin (const GeoCoordinates &geoOrigin)
static void GetOrigin (GeoCoordinates &geoOrigin)

Static Public Attributes

static const double EQUATORIAL_RADIUS = 6378137.0
 Equatorial Radius in meters. (WGS84).
static const double POLAR_RADIUS = 6356752.3142451794975639668
 Polar Radius in meters. (WGS84).
static const double FLATTENING = 1.0/298.257223563
 Flattening coefficient in meters. (WGS84).

Protected Member Functions

void GetRawCartesianPoint (osg::Vec3d &point)

Protected Attributes

osg::Vec3 mCartesianPoint
 Cached version of this coordinate sytems's origin in cartesian space.
double mLatitude
 Latitude origin in decimal degrees.
double mLongitude
 Longitude origin in decimal degrees.
double mAltitude
 Elevation origin.
bool mUpdateCartesianPoint
 Flag to indicate the cartesian origin needs to be updated.

Static Protected Attributes

static osg::Vec3d gOriginOffset
static GeoCoordinates geoOrigin


Detailed Description

This class is intended to represent cartesian and geographic coordinates.

The conversion between latitude and longitude to cartesian is rudimentary at best. Altitude is arbitrary. Future versions of this class should use a proper geodetic representation of latitude, longitude, and altitude but for now, this will suffice.


Constructor & Destructor Documentation

dtTerrain::GeoCoordinates::GeoCoordinates (  ) 

Constructs the coordinate system.


Member Function Documentation

bool dtTerrain::GeoCoordinates::operator== ( const GeoCoordinates rhs  )  const [inline]

Compares the two coordinate's cartesian location.

Returns:
True if they are equal, false otherwise.

bool dtTerrain::GeoCoordinates::operator< ( const GeoCoordinates rhs  )  const [inline]

Performs a less than comparison on this coordinate's cartesian location with that of the other.

Parameters:
rhs The other coordinate the check against.
Returns:
True if this is less than the other.

void dtTerrain::GeoCoordinates::SetLatitude ( int  degrees,
int  minutes = 0,
int  seconds = 0 
)

Sets the latitude of this coordinate.

This is stored internally as decimal degrees.

Parameters:
degrees Latitude degrees ranges from -90 (south pole) to +90 (north pole). If degrees is out of this range, an OUT_OF_BOUNDS exception is thrown.
minutes Ranges from 0 - 59. If minutes is out of this range, an OUT_OF_BOUNDS exception is thrown.
seconds Ranges from 0 - 59. If seconds is out of this range, an OUT_OF_BOUNDS exception is thrown.

void dtTerrain::GeoCoordinates::SetLatitude ( double  decimalDegrees  )  [inline]

Sets the latitude of this coordinate.

Parameters:
decimalDegrees The new latitude in decimal degrees.

double dtTerrain::GeoCoordinates::GetLatitude (  )  const [inline]

Gets the latitude origin of this coordinate.

Returns:
The latitude in decimal degrees.

void dtTerrain::GeoCoordinates::GetLatitude ( int &  degrees,
int &  minutes,
int &  seconds 
)

Gets the latitude origin of this coordinate.

Parameters:
degrees Stores the latitude degrees.
minutes Stores the latitude minutes.
seconds Stores the latitude seconds.

void dtTerrain::GeoCoordinates::SetLongitude ( int  degrees,
int  minutes = 0,
int  seconds = 0 
)

Sets the longitude of this coordinate.

This is stored internally as decimal degrees.

Parameters:
degrees Longitude degrees ranges from -180 (180 degrees west) to +180 (180 degrees east). If degrees is out of this range, an OUT_OF_BOUNDS exception is thrown.
minutes Ranges from 0 - 59. If minutes is out of this range, an OUT_OF_BOUNDS exception is thrown.
seconds Ranges from 0 - 59. If seconds is out of this range, an OUT_OF_BOUNDS exception is thrown.

void dtTerrain::GeoCoordinates::SetLongitude ( double  decimalDegrees  )  [inline]

Sets the longitude of this coordinate.

Parameters:
decimalDegrees The new longitude in decimal degrees.

double dtTerrain::GeoCoordinates::GetLongitude (  )  const [inline]

Gets the longitude origin of this coordinate.

Returns:
The longitude in decimal degrees.

void dtTerrain::GeoCoordinates::GetLongitude ( int &  degrees,
int &  minutes,
int &  seconds 
)

Gets the longitude origin of this coordinate.

Parameters:
degrees Stores the latitude degrees.
minutes Stores the latitude minutes.
seconds Stores the latitude seconds.

void dtTerrain::GeoCoordinates::SetAltitude ( double  alt  )  [inline]

Sets the altitude of this coordinate.

Parameters:
alt Altitude. The interpretation of this value is application specific for the time being. Future versions of this class should represent altitude using as the height above the reference (WGS84) ellipsoid.

double dtTerrain::GeoCoordinates::GetAltitude (  )  const [inline]

Gets this coordinate's altitude.

Returns:
The current altitude.

void dtTerrain::GeoCoordinates::SetCartesianPoint ( const osg::Vec3 &  newLocation  ) 

Sets the location of this coordinate in cartesian space.

Parameters:
newLocation The new location in cartesian coordinates.
Note:
Internally, this origin in cartesian space is also converted to latitude, longitude coordinates.

const osg::Vec3 & dtTerrain::GeoCoordinates::GetCartesianPoint (  ) 

Gets this coordinate's location in cartesian space.

Returns:
A 3D point in cartesian space. (meters).
Note:
If the origin was previously set via any of the geocentric methods, the origin in cartesian space is calculated and cached as required.

void dtTerrain::GeoCoordinates::GetCartesianPoint ( osg::Vec3 &  point  ) 

void dtTerrain::GeoCoordinates::SetOrigin ( const GeoCoordinates geoOrigin  )  [static]

void dtTerrain::GeoCoordinates::GetOrigin ( GeoCoordinates geoOrigin  )  [static]

std::string dtTerrain::GeoCoordinates::ToString (  ) 

std::string dtTerrain::GeoCoordinates::ToStringAll (  ) 

void dtTerrain::GeoCoordinates::GetRawCartesianPoint ( osg::Vec3d &  point  )  [protected]


Member Data Documentation

const double dtTerrain::GeoCoordinates::EQUATORIAL_RADIUS = 6378137.0 [static]

Equatorial Radius in meters. (WGS84).

const double dtTerrain::GeoCoordinates::POLAR_RADIUS = 6356752.3142451794975639668 [static]

Polar Radius in meters. (WGS84).

const double dtTerrain::GeoCoordinates::FLATTENING = 1.0/298.257223563 [static]

Flattening coefficient in meters. (WGS84).

osg::Vec3 dtTerrain::GeoCoordinates::mCartesianPoint [protected]

Cached version of this coordinate sytems's origin in cartesian space.

double dtTerrain::GeoCoordinates::mLatitude [protected]

Latitude origin in decimal degrees.

double dtTerrain::GeoCoordinates::mLongitude [protected]

Longitude origin in decimal degrees.

double dtTerrain::GeoCoordinates::mAltitude [protected]

Elevation origin.

bool dtTerrain::GeoCoordinates::mUpdateCartesianPoint [protected]

Flag to indicate the cartesian origin needs to be updated.

osg::Vec3d dtTerrain::GeoCoordinates::gOriginOffset [static, protected]

GeoCoordinates dtTerrain::GeoCoordinates::geoOrigin [static, protected]


http://www.delta3d.org
2.0.0 generated 14 Feb 2008