]> git.mxchange.org Git - flightgear.git/commitdiff
Alasdair Campbell's ILS patch allowing us to fly both ILS approaches if both
authorcurt <curt>
Tue, 30 Oct 2001 17:45:11 +0000 (17:45 +0000)
committercurt <curt>
Tue, 30 Oct 2001 17:45:11 +0000 (17:45 +0000)
ends of the same runway share the same frequency.  This is probably the best
we can do until we impliment some sort of operator interface to manually set
which end is active (like is done in real life.)

src/Navaids/ilslist.cxx

index cf8c9e55fb22b6f56b92e5f968b34361bac76991..eb9247f0a82385bf09fc56093275bd0d106a3fcf 100644 (file)
@@ -162,8 +162,27 @@ bool FGILSList::query( double lon, double lat, double elev, double freq,
        // reduced signal strength
        if ( d < (2* FG_ILS_DEFAULT_RANGE * SG_NM_TO_METER 
                  * 2 * FG_ILS_DEFAULT_RANGE * SG_NM_TO_METER) ) {
-           *ils = *current;
-           return true;
+
+            // Get our bearing from this station.
+            double reciprocal_bearing, dummy;
+            double a_lat_deg = lat * SGD_RADIANS_TO_DEGREES;
+            double a_lon_deg = lon * SGD_RADIANS_TO_DEGREES;
+            // Locator beam direction
+            double s_ils_deg = current->get_locheading() - 180.0;
+            if ( s_ils_deg < 0.0 ) { s_ils_deg += 360.0; }
+            double angle_to_beam_deg;
+
+            // printf("**ALI geting geo_inverse_wgs_84 with elev = %.2f, a.lat = %.2f, a.lon = %.2f,
+            // s.lat = %.2f, s.lon = %.2f\n", elev,a_lat_deg,a_lon_deg,current->get_loclat(),current->get_loclon());
+
+            geo_inverse_wgs_84( elev, current->get_loclat(),
+                                current->get_loclon(), a_lat_deg, a_lon_deg,
+                                &reciprocal_bearing, &dummy, &dummy );
+            angle_to_beam_deg = fabs(reciprocal_bearing - s_ils_deg);
+            if ( angle_to_beam_deg < 90.0 ) {
+                *ils = *current;
+                return true;
+            }
        }
     }