1
0
Fork 0

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.
This commit is contained in:
curt 2001-03-02 23:27:22 +00:00
parent d84c64563b
commit 29dede4c1a
2 changed files with 23 additions and 0 deletions

View 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 );

View 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 = -)"