X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Froute%2Fwaypoint.cxx;h=73669037e0f82d7d2fdb730ef1c5d54663e052c5;hb=7bdb530440d1dadc991f305edb1b70ec85f27451;hp=189bc59bb38a0f3b117d8e7744e3939ab755083a;hpb=29fb8e0f7492916aadabf85d9834350e62c97ec1;p=simgear.git diff --git a/simgear/route/waypoint.cxx b/simgear/route/waypoint.cxx index 189bc59b..73669037 100644 --- a/simgear/route/waypoint.cxx +++ b/simgear/route/waypoint.cxx @@ -24,7 +24,6 @@ # include #endif -#include #include #include "waypoint.hxx" @@ -33,21 +32,23 @@ using std::string; // Constructor SGWayPoint::SGWayPoint( const double lon, const double lat, const double alt, - const modetype m, const string& s, const string& n ) : - mode(m), + const modetype, const string& s, const string& n ) : pos(SGGeod::fromDegM(lon, lat, alt)), - distance(0.0), id(s), - name(n) + name(n), + _distance(0.0), + _track(0.0), + _speed(0.0) { } SGWayPoint::SGWayPoint(const SGGeod& geod, const string& s, const string& n ) : - mode(WGS84), pos(geod), - distance(0.0), id(s), - name(n) + name(n), + _distance(0.0), + _track(0.0), + _speed(0.0) { } @@ -56,15 +57,8 @@ SGWayPoint::~SGWayPoint() { } void SGWayPoint::CourseAndDistance(const SGGeod& cur, double& course, double& dist ) const { - if ( mode == WGS84 ) { - double reverse; - SGGeodesy::inverse(cur, pos, course, reverse, dist); - } else if ( mode == SPHERICAL ) { - Point3D currentPoint(cur.getLongitudeRad(), cur.getLatitudeRad(), 0.0 ); - Point3D targetPoint(pos.getLongitudeRad(), pos.getLatitudeRad(), 0.0 ); - calc_gc_course_dist( currentPoint, targetPoint, &course, &dist ); - course = 360.0 - course * SGD_RADIANS_TO_DEGREES; - } + double reverse; + SGGeodesy::inverse(cur, pos, course, reverse, dist); } // Calculate course and distances. For WGS84 and SPHERICAL