]> git.mxchange.org Git - flightgear.git/blobdiff - src/Navaids/nav.hxx
Roy Vegard Ovesen:
[flightgear.git] / src / Navaids / nav.hxx
index 8bb913743233d559586c99e0a48d3afe4ed183e2..4f27e6216475b429ce771fe90a0f3406a605e472 100644 (file)
 
 #ifdef SG_HAVE_STD_INCLUDES
 #  include <istream>
-#elif defined( SG_HAVE_NATIVE_SGI_COMPILERS )
-#  include <iostream.h>
 #elif defined( __BORLANDC__ ) || (__APPLE__)
 #  include <iostream>
 #else
 #  include <istream.h>
 #endif
 
-#if ! defined( SG_HAVE_NATIVE_SGI_COMPILERS )
 SG_USING_STD(istream);
-#endif
 
 
 class FGNav {
 
     char type;
     double lon, lat;
-    double elev;
+    double elev_ft;
     double x, y, z;
     int freq;
     int range;
@@ -72,7 +68,7 @@ public:
     inline char get_type() const { return type; }
     inline double get_lon() const { return lon; }
     inline double get_lat() const { return lat; }
-    inline double get_elev() const { return elev; }
+    inline double get_elev_ft() const { return elev_ft; }
     inline double get_x() const { return x; }
     inline double get_y() const { return y; }
     inline double get_z() const { return z; }
@@ -83,15 +79,6 @@ public:
     inline string get_trans_ident() { return trans_ident; }
     inline double get_magvar () const { return magvar; }
 
-    /* inline void set_type( char t ) { type = t; }
-    inline void set_lon( double l ) { lon = l; }
-    inline void set_lat( double l ) { lat = l; }
-    inline void set_elev( double e ) { elev = e; }
-    inline void set_freq( int f ) { freq = f; }
-    inline void set_range( int r ) { range = r; }
-    inline void set_dme( bool b ) { dme = b; }
-    inline void set_ident( char *i ) { strncpy( ident, i, 5 ); } */
-
     friend istream& operator>> ( istream&, FGNav& );
 };
 
@@ -100,7 +87,7 @@ inline
 FGNav::FGNav(void) :
     type(0),
     lon(0.0), lat(0.0),
-    elev(0.0),
+    elev_ft(0.0),
     x(0.0), y(0.0), z(0.0),
     freq(0),
     range(0),
@@ -134,7 +121,7 @@ operator >> ( istream& in, FGNav& n )
     if ( n.type == '[' )
       return in >> skipeol;
 
-    in >> n.lat >> n.lon >> n.elev >> f >> n.range 
+    in >> n.lat >> n.lon >> n.elev_ft >> f >> n.range 
        >> c >> n.ident >> magvar_s;
 
     n.freq = (int)(f*100.0 + 0.5);
@@ -148,12 +135,12 @@ operator >> ( istream& in, FGNav& n )
     // cout << "Calculating magvar for navaid " << n.ident << endl;
     if (magvar_s == "XXX") {
        // default to mag var as of 1990-01-01 (Julian 2447892.5)
-       // cout << "lat = " << n.lat << " lon = " << n.lon << " elev = " 
-       //      << n.elev << " JD = " 
+       // cout << "lat = " << n.lat << " lon = " << n.lon << " elev_ft = " 
+       //      << n.elev_ft << " JD = " 
        //      << julian_date << endl;
        n.magvar = sgGetMagVar( n.lon * SGD_DEGREES_TO_RADIANS,
                                 n.lat * SGD_DEGREES_TO_RADIANS,
-                                n.elev * SG_FEET_TO_METER,
+                                n.elev_ft * SG_FEET_TO_METER,
                                 julian_date )
             * SGD_RADIANS_TO_DEGREES;
        // cout << "Default variation at " << n.lon << ',' << n.lat
@@ -180,7 +167,7 @@ operator >> ( istream& in, FGNav& n )
     // cout << n.ident << " " << n.magvar << endl;
 
     // generate cartesian coordinates
-    Point3D geod( n.lon * SGD_DEGREES_TO_RADIANS, n.lat * SGD_DEGREES_TO_RADIANS, n.elev );
+    Point3D geod( n.lon * SGD_DEGREES_TO_RADIANS, n.lat * SGD_DEGREES_TO_RADIANS, n.elev_ft * SG_FEET_TO_METER );
     Point3D cart = sgGeodToCart( geod );
     n.x = cart.x();
     n.y = cart.y();