From 29dede4c1abc14a76c476205ba1377ac82deb3a0 Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 2 Mar 2001 23:27:22 +0000 Subject: [PATCH] Tony's patches to allow you to position yourself at an offset from the 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 | 15 +++++++++++++++ src/Main/options.cxx | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 0c506726f..d7a384760 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -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 ); diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 8503dc40e..69cbb6d6d 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -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 = -)" -- 2.39.5