SGWayPoint Class Reference

A class to manage waypoints. More...

#include <waypoint.hxx>

List of all members.

Public Types

enum  modetype
 

Waypoint mode.

More...

Public Member Functions

 SGWayPoint (const double lon=0.0, const double lat=0.0, const double alt=0.0, const modetype m=WGS84, const std::string &s="", const std::string &n="")
 Construct a waypoint.
 SGWayPoint (const SGGeod &pos, const std::string &s, const std::string &n)
 Construct from a geodetic position, in WGS84 coordinates.
 ~SGWayPoint ()
 Destructor.
void CourseAndDistance (const double cur_lon, const double cur_lat, const double cur_alt, double *course, double *dist) const
 Calculate course and distances.
void CourseAndDistance (const SGWayPoint &wp, double *course, double *dist) const
 Calculate course and distances between a specified starting waypoint and this waypoint.
double get_target_lon () const
double get_target_lat () const
double get_target_alt () const
double get_distance () const
 This value is not calculated by this class.
void set_distance (double d)
 Set the waypoint distance value to a value of our choice.
const std::string & get_id () const
const std::string & get_name () const

Detailed Description

A class to manage waypoints.

Definition at line 42 of file waypoint.hxx.


Member Enumeration Documentation

Waypoint mode.

WGS84 requests all bearing and distance math be done assuming a WGS84 ellipsoid world. This is the most expensive computationally, but also the most accurate. SPHERICAL requests all bearing and distance math be done assuming the world is a perfect sphere. This is less compuntationally expensive than using wgs84 math and still a fairly good approximation of the real world, especially over shorter distances.

Definition at line 56 of file waypoint.hxx.


Constructor & Destructor Documentation

SGWayPoint::SGWayPoint ( const double  lon = 0.0,
const double  lat = 0.0,
const double  alt = 0.0,
const modetype  m = WGS84,
const std::string &  s = "",
const std::string &  n = "" 
)

Construct a waypoint.

Parameters:
lon destination longitude
lat destination latitude
alt target altitude
mode type of coordinates/math to use
s waypoint identifier
n waypoint name

Member Function Documentation

void SGWayPoint::CourseAndDistance ( const SGWayPoint wp,
double *  course,
double *  dist 
) const

Calculate course and distances between a specified starting waypoint and this waypoint.

Parameters:
wp (in) original waypoint
course (out) heading from current location to this waypoint
dist (out) distance from current location to this waypoint

Definition at line 77 of file waypoint.cxx.

void SGWayPoint::CourseAndDistance ( const double  cur_lon,
const double  cur_lat,
const double  cur_alt,
double *  course,
double *  dist 
) const

Calculate course and distances.

For WGS84 and SPHERICAL coordinates lat, lon, and course are in degrees, alt and distance are in meters. For CARTESIAN coordinates x = lon, y = lat. Course is in degrees and distance is in what ever units x and y are in.

Parameters:
cur_lon (in) current longitude
cur_lat (in) current latitude
cur_alt (in) current altitude
course (out) heading from current location to this waypoint
dist (out) distance from current location to this waypoint

Definition at line 69 of file waypoint.cxx.

double SGWayPoint::get_distance (  )  const [inline]

This value is not calculated by this class.

It is simply a placeholder for the user to stash a distance value. This is useful when you stack waypoints together into a route. You can calculate the distance from the previous waypoint once and save it here. Adding up all the distances here plus the distance to the first waypoint gives you the total route length. Note, you must update this value yourself, this is for your convenience only.

Returns:
waypoint distance holder (what ever the user has stashed here)

Definition at line 143 of file waypoint.hxx.

const std::string& SGWayPoint::get_id (  )  const [inline]
Returns:
waypoint id

Definition at line 158 of file waypoint.hxx.

const std::string& SGWayPoint::get_name (  )  const [inline]
Returns:
waypoint name

Definition at line 161 of file waypoint.hxx.

double SGWayPoint::get_target_alt (  )  const [inline]
Returns:
waypoint altitude

Definition at line 129 of file waypoint.hxx.

double SGWayPoint::get_target_lat (  )  const [inline]
Returns:
waypoint latitude

Definition at line 126 of file waypoint.hxx.

double SGWayPoint::get_target_lon (  )  const [inline]
Returns:
waypoint longitude

Definition at line 123 of file waypoint.hxx.

void SGWayPoint::set_distance ( double  d  )  [inline]

Set the waypoint distance value to a value of our choice.

Parameters:
d distance

Definition at line 149 of file waypoint.hxx.


The documentation for this class was generated from the following files:

Generated on 23 Feb 2010 for SimGear by  doxygen 1.6.1