X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Froute%2Fwaypoint.cxx;h=f9a9ab0b517cf0526cb480783aeab99468bd072b;hb=6d1d3173fef50d38244a652543dab3e275193533;hp=697eb37458e4f59bfb53ce8dfbd50a3c3de514d0;hpb=03a7d72a62eb3f2a15242146b7b43ac54ab1fa44;p=simgear.git diff --git a/simgear/route/waypoint.cxx b/simgear/route/waypoint.cxx index 697eb374..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 @@ -81,5 +76,5 @@ void SGWayPoint::CourseAndDistance( const double cur_lon, // Calculate course and distances between two waypoints void SGWayPoint::CourseAndDistance( const SGWayPoint &wp, double *course, double *dist ) const { - CourseAndDistance( wp.get_target(), course, dist ); + CourseAndDistance( wp.get_target(), *course, *dist ); }