# include <config.h>
#endif
+#include <simgear/compiler.h>
+
+#include STL_STRING
+
+FG_USING_STD(string);
+
class SGWayPoint {
public:
enum modetype {
- LATLON = 0,
- XY = 1,
+ WGS84 = 0,
+ SPHERICAL = 1,
+ CARTESIAN = 2
};
private:
modetype mode;
- double lon;
- double lat;
+ double target_lon;
+ double target_lat;
+ double target_alt;
+ double distance;
+
+ string id;
public:
SGWayPoint();
- SGWayPoint( const double _lon, const double _lat );
- SGWayPoint( const double _lon, const double _lat, const modetype _mode );
+ SGWayPoint( const double lon, const double lat, const double alt,
+ const modetype m = WGS84, const string s = "" );
~SGWayPoint();
+ // 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.
+ void CourseAndDistance( const double cur_lon, const double cur_lat,
+ const double cur_alt,
+ double *course, double *distance ) const;
+
+ // Calculate course and distances between two waypoints
+ void CourseAndDistance( const SGWayPoint &wp,
+ double *course, double *distance ) const;
+
inline modetype get_mode() const { return mode; }
- inline double get_lon() const { return lon; }
- inline double get_lat() const { return lat; }
+ inline double get_target_lon() const { return target_lon; }
+ inline double get_target_lat() const { return target_lat; }
+ inline double get_target_alt() const { return target_alt; }
+ inline double get_distance() const { return distance; }
+ inline string get_id() const { return id; }
+
+ inline void set_distance( double d ) { distance = d; }
};