]> git.mxchange.org Git - flightgear.git/commitdiff
Tony's patches to allow you to position yourself at an offset from the
authorcurt <curt>
Fri, 2 Mar 2001 23:27:22 +0000 (23:27 +0000)
committercurt <curt>
Fri, 2 Mar 2001 23:27:22 +0000 (23:27 +0000)
default location (i.e. end of the runway.)  This allows you to start
up on final and things like that.

src/Main/fg_init.cxx
src/Main/options.cxx

index 0c506726ffdb49e812378c8c4a30e6d03bf56aa9..d7a384760461cc2b9b754f8b93efddc3ae36dc73 100644 (file)
@@ -330,9 +330,24 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
            "runway =  " << found_r.lon << ", " << found_r.lat
            << " length = " << found_r.length * FEET_TO_METER * 0.5 
            << " heading = " << azimuth );
+    
     geo_direct_wgs_84 ( 0, found_r.lat, found_r.lon, 
                        azimuth, found_r.length * FEET_TO_METER * 0.5 - 5.0,
                        &lat2, &lon2, &az2 );
+
+    if ( fabs( fgGetDouble("/sim/startup/offset-distance") ) > FG_EPSILON ) {
+       double olat, olon;
+       double odist = fgGetDouble("/sim/startup/offset-distance");
+       odist *= NM_TO_METER;
+       double oaz = azimuth;
+       if ( fabs(fgGetDouble("/sim/startup/offset-azimuth")) > FG_EPSILON ) {
+           oaz = fgGetDouble("/sim/startup/offset-azimuth") + 180;
+       }
+       while ( oaz >= 360.0 ) { oaz -= 360.0; }
+       geo_direct_wgs_84 ( 0, lat2, lon2, oaz, odist, &olat, &olon, &az2 );
+       lat2=olat;
+       lon2=olon;
+    }
     fgSetDouble("/position/longitude",  lon2 );
     fgSetDouble("/position/latitude",  lat2 );
     fgSetDouble("/orientation/heading", heading );
index 8503dc40e43efd43e5ec0f131c282e5a3f19133c..69cbb6d6dfafafa0532bd6b2d98f44d2a0e1ff51 100644 (file)
@@ -565,6 +565,10 @@ parse_option (const string& arg)
     } else if ( arg.find( "--airport-id=") != string::npos ) {
                                // NB: changed property name!!!
        fgSetString("/sim/startup/airport-id", arg.substr(13));
+    } else if ( arg.find( "--offset-distance=") != string::npos ) {
+       fgSetDouble("/sim/startup/offset-distance", atof(arg.substr(18)));
+    } else if ( arg.find( "--offset-azimuth=") != string::npos ) {
+       fgSetDouble("/sim/startup/offset-azimuth", atof(arg.substr(17))); 
     } else if ( arg.find( "--lon=" ) != string::npos ) {
        fgSetDouble("/position/longitude",
                              parse_degree(arg.substr(6)));
@@ -1060,6 +1064,10 @@ fgUsage ()
     cout << "Initial Position and Orientation:" << endl;
     cout << "\t--airport-id=ABCD:  specify starting postion by airport id" 
         << endl;
+    cout << "\t--offset-distance:  specify distance to threshhold"
+         << " (NM)" << endl; 
+    cout << "\t--offset-azimuth:  specify heading to threshhold (deg) " 
+         << endl;    
     cout << "\t--lon=degrees:  starting longitude in degrees (west = -)" 
         << endl;
     cout << "\t--lat=degrees:  starting latitude in degrees (south = -)"