]> git.mxchange.org Git - flightgear.git/blobdiff - src/Navaids/mkrbeacons.cxx
Removed FGEnvironmentMgr as a special case in globals, initialization,
[flightgear.git] / src / Navaids / mkrbeacons.cxx
index 861e2093fd1aa992b48277cab69f03df9a6ab9c8..57f2fcd6eb8340164bb21a407223f367026b3142 100644 (file)
 
 
 // constructor
-FGBeacon::FGBeacon() {
-    FGBeacon( 0, 0, 0, NOBEACON );
+FGMkrBeacon::FGMkrBeacon() {
+    FGMkrBeacon( 0, 0, 0, NOBEACON );
 }
 
-FGBeacon::FGBeacon( double _lon, double _lat, double _elev,
+FGMkrBeacon::FGMkrBeacon( double _lon, double _lat, double _elev,
                    fgMkrBeacType _type ) {
     lon = _lon;
     lat = _lat;
     elev = _elev;
     type = _type;
 
-    Point3D pos = sgGeodToCart(Point3D(lon * DEG_TO_RAD, lat * DEG_TO_RAD, 0));
+    Point3D pos = sgGeodToCart(Point3D(lon * SGD_DEGREES_TO_RADIANS, lat * SGD_DEGREES_TO_RADIANS, 0));
     // cout << "pos = " << pos << endl;
     x = pos.x();
     y = pos.y();
@@ -44,7 +44,7 @@ FGBeacon::FGBeacon( double _lon, double _lat, double _elev,
 }
 
 // destructor
-FGBeacon::~FGBeacon() {
+FGMkrBeacon::~FGMkrBeacon() {
 }
 
 
@@ -67,7 +67,7 @@ bool FGMarkerBeacons::init() {
 
 
 // real add a marker beacon
-bool FGMarkerBeacons::real_add( const int master_index, const FGBeacon& b ) {
+bool FGMarkerBeacons::real_add( const int master_index, const FGMkrBeacon& b ) {
     // cout << "Master index = " << master_index << endl;
     beacon_map[master_index].push_back( b );
     
@@ -77,7 +77,7 @@ bool FGMarkerBeacons::real_add( const int master_index, const FGBeacon& b ) {
 
 // front end for add a marker beacon
 bool FGMarkerBeacons::add( double lon, double lat, double elev,
-                          FGBeacon::fgMkrBeacType type ) {
+                          FGMkrBeacon::fgMkrBeacType type ) {
     double diff;
 
     int lonidx = (int)lon;
@@ -97,7 +97,7 @@ bool FGMarkerBeacons::add( double lon, double lat, double elev,
     latidx += 90;
 
     int master_index = lonidx * 1000 + latidx;
-    FGBeacon b( lon, lat, elev, type );
+    FGMkrBeacon b( lon, lat, elev, type );
 
     // add to the actual bucket
     real_add( master_index, b );
@@ -133,7 +133,7 @@ bool FGMarkerBeacons::add( double lon, double lat, double elev,
 
 // returns marker beacon type if we are over a marker beacon, NOBEACON
 // otherwise
-FGBeacon::fgMkrBeacType FGMarkerBeacons::query( double lon, double lat,
+FGMkrBeacon::fgMkrBeacType FGMarkerBeacons::query( double lon, double lat,
                                                double elev ) {
     double diff;
 
@@ -160,7 +160,7 @@ FGBeacon::fgMkrBeacType FGMarkerBeacons::query( double lon, double lat,
     beacon_list_iterator current = beacons.begin();
     beacon_list_iterator last = beacons.end();
 
-    Point3D aircraft = sgGeodToCart(Point3D(lon*DEG_TO_RAD, lat*DEG_TO_RAD, 0));
+    Point3D aircraft = sgGeodToCart(Point3D(lon*SGD_DEGREES_TO_RADIANS, lat*SGD_DEGREES_TO_RADIANS, 0));
 
     double min_dist = 999999999.0;
 
@@ -174,8 +174,8 @@ FGBeacon::fgMkrBeacType FGMarkerBeacons::query( double lon, double lat,
 
        double d = aircraft.distance3Dsquared( station ); // meters^2
        // cout << "  distance = " << d << " (" 
-       //      << FG_ILS_DEFAULT_RANGE * NM_TO_METER 
-       //         * FG_ILS_DEFAULT_RANGE * NM_TO_METER
+       //      << FG_ILS_DEFAULT_RANGE * SG_NM_TO_METER 
+       //         * FG_ILS_DEFAULT_RANGE * SG_NM_TO_METER
        //      << ")" << endl;
 
        // cout << "  range = " << sqrt(d) << endl;
@@ -184,9 +184,9 @@ FGBeacon::fgMkrBeacType FGMarkerBeacons::query( double lon, double lat,
            min_dist = d;
        }
 
-       // cout << "elev = " << elev * METER_TO_FEET
+       // cout << "elev = " << elev * SG_METER_TO_FEET
        //      << " current->get_elev() = " << current->get_elev() << endl;
-       double delev = elev * METER_TO_FEET - current->get_elev();
+       double delev = elev * SG_METER_TO_FEET - current->get_elev();
 
        // max range is the area under r = 2.4 * alt or r^2 = 4000^2 - alt^2
        // whichever is smaller.  The intersection point is 1538 ...
@@ -198,22 +198,22 @@ FGBeacon::fgMkrBeacType FGMarkerBeacons::query( double lon, double lat,
        } else {
            maxrange2 = 0.0;
        }
-       maxrange2 *= FEET_TO_METER * FEET_TO_METER; // convert to meter^2
+       maxrange2 *= SG_FEET_TO_METER * SG_FEET_TO_METER; // convert to meter^2
        // cout << "delev = " << delev << " maxrange = " << maxrange << endl;
 
        // match up to twice the published range so we can model
        // reduced signal strength
        if ( d < maxrange2 ) {
-           cout << "lon = " << lon << " lat = " << lat
-                << "  closest beacon = " << sqrt( min_dist ) << endl;
+           // cout << "lon = " << lon << " lat = " << lat
+           //      << "  closest beacon = " << sqrt( min_dist ) << endl;
            return current->get_type();
        }
     }
 
-    cout << "lon = " << lon << " lat = " << lat
-         << "  closest beacon = " << sqrt( min_dist ) << endl;
+    // cout << "lon = " << lon << " lat = " << lat
+    //      << "  closest beacon = " << sqrt( min_dist ) << endl;
 
-    return FGBeacon::NOBEACON;
+    return FGMkrBeacon::NOBEACON;
 }