]> git.mxchange.org Git - simgear.git/blobdiff - simgear/route/waypoint.cxx
Step #1 towards abandoning the original point lighting scheme in favor of
[simgear.git] / simgear / route / waypoint.cxx
index 0ab3b5f9cc1101011d8b6d4a8cc46f7ab5996d74..286fe1cc5f1c708347c4c75bab1879543e0e79d9 100644 (file)
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
+#ifdef HAVE_CONFIG_H
+#  include <simgear_config.h>
+#endif
 
 #include <simgear/math/polar3d.hxx>
 #include <simgear/math/sg_geodesy.hxx>
 
 // Constructor
 SGWayPoint::SGWayPoint( const double lon, const double lat, const double alt,
-                       const modetype m, const string s ) {
+                       const modetype m, const string s, const string n ) {
     target_lon = lon;
     target_lat = lat;
     target_alt = alt;
     mode = m;
     id = s;
-}
-
-
-SGWayPoint::SGWayPoint() {
-    SGWayPoint( 0.0, 0.0, 0.0, WGS84, "" );
+    name = n;
 }
 
 
@@ -55,15 +54,15 @@ SGWayPoint::~SGWayPoint() {
 void SGWayPoint::CourseAndDistance( const double cur_lon,
                                    const double cur_lat,
                                    const double cur_alt,
-                                   double *course, double *distance ) const {
+                                   double *course, double *dist ) const {
     if ( mode == WGS84 ) {
        double reverse;
        geo_inverse_wgs_84( cur_alt, cur_lat, cur_lon, target_lat, target_lon,
-                           course, &reverse, distance );
+                           course, &reverse, dist );
     } else if ( mode == SPHERICAL ) {
        Point3D current( cur_lon * SGD_DEGREES_TO_RADIANS, cur_lat * SGD_DEGREES_TO_RADIANS, 0.0 );
        Point3D target( target_lon * SGD_DEGREES_TO_RADIANS, target_lat * SGD_DEGREES_TO_RADIANS, 0.0 );
-       calc_gc_course_dist( current, target, course, distance );
+       calc_gc_course_dist( current, target, course, dist );
        *course = 360.0 - *course * SGD_RADIANS_TO_DEGREES;
     } else if ( mode == CARTESIAN ) {
        double dx = target_lon - cur_lon;
@@ -75,15 +74,15 @@ void SGWayPoint::CourseAndDistance( const double cur_lon,
        while ( *course > 360.0 ) {
            *course -= 360.0;
        }
-       *distance = sqrt( dx * dx + dy * dy );
+       *dist = sqrt( dx * dx + dy * dy );
     }
 }
 
 // Calculate course and distances between two waypoints
 void SGWayPoint::CourseAndDistance( const SGWayPoint &wp,
-                       double *course, double *distance ) const {
+                       double *course, double *dist ) const {
     CourseAndDistance( wp.get_target_lon(),
                       wp.get_target_lat(),
                       wp.get_target_alt(),
-                      course, distance );
+                      course, dist );
 }