X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Froute%2Fwaypoint.cxx;h=f9a9ab0b517cf0526cb480783aeab99468bd072b;hb=7fe40bce86ebd460d06ae8e76d3c64a6c9d58379;hp=189bc59bb38a0f3b117d8e7744e3939ab755083a;hpb=29fb8e0f7492916aadabf85d9834350e62c97ec1;p=simgear.git diff --git a/simgear/route/waypoint.cxx b/simgear/route/waypoint.cxx index 189bc59b..f9a9ab0b 100644 --- a/simgear/route/waypoint.cxx +++ b/simgear/route/waypoint.cxx @@ -33,21 +33,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 +58,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