A class to manage waypoints. More...
#include <waypoint.hxx>
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 |
A class to manage waypoints.
Definition at line 42 of file waypoint.hxx.
enum SGWayPoint::modetype |
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.
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.
lon | destination longitude | |
lat | destination latitude | |
alt | target altitude | |
mode | type of coordinates/math to use | |
s | waypoint identifier | |
n | waypoint name |
void SGWayPoint::CourseAndDistance | ( | const SGWayPoint & | wp, | |
double * | course, | |||
double * | dist | |||
) | const |
Calculate course and distances between a specified starting waypoint and this waypoint.
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.
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.
Definition at line 143 of file waypoint.hxx.
const std::string& SGWayPoint::get_id | ( | ) | const [inline] |
Definition at line 158 of file waypoint.hxx.
const std::string& SGWayPoint::get_name | ( | ) | const [inline] |
Definition at line 161 of file waypoint.hxx.
double SGWayPoint::get_target_alt | ( | ) | const [inline] |
Definition at line 129 of file waypoint.hxx.
double SGWayPoint::get_target_lat | ( | ) | const [inline] |
Definition at line 126 of file waypoint.hxx.
double SGWayPoint::get_target_lon | ( | ) | const [inline] |
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.
d | distance |
Definition at line 149 of file waypoint.hxx.