Allow distinguishing un-towered airports.
This commit is contained in:
parent
5043bf0966
commit
e5df6e6d4a
2 changed files with 11 additions and 16 deletions
|
@ -680,6 +680,16 @@ void FGAirport::validateTowerData() const
|
||||||
if (towers.empty()) {
|
if (towers.empty()) {
|
||||||
mHasTower = false;
|
mHasTower = false;
|
||||||
mTowerPosition = geod(); // use airport position
|
mTowerPosition = geod(); // use airport position
|
||||||
|
|
||||||
|
// offset the tower position away from the runway centerline, if
|
||||||
|
// airport has a single runway. Offset by eight times the runway width,
|
||||||
|
// an entirely guessed figure.
|
||||||
|
if (numRunways() <= 2) {
|
||||||
|
FGRunway* runway = getRunwayByIndex(0);
|
||||||
|
double hdg = runway->headingDeg() + 90;
|
||||||
|
mTowerPosition = SGGeodesy::direct(geod(), hdg, runway->widthM() * 8);
|
||||||
|
}
|
||||||
|
|
||||||
// increase tower elevation by 20 metres above the field elevation
|
// increase tower elevation by 20 metres above the field elevation
|
||||||
mTowerPosition.setElevationM(geod().getElevationM() + 20.0);
|
mTowerPosition.setElevationM(geod().getElevationM() + 20.0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -159,9 +159,7 @@ public:
|
||||||
double lat = atof( token[1].c_str() );
|
double lat = atof( token[1].c_str() );
|
||||||
double lon = atof( token[2].c_str() );
|
double lon = atof( token[2].c_str() );
|
||||||
double elev = atof( token[3].c_str() );
|
double elev = atof( token[3].c_str() );
|
||||||
tower = SGGeod::fromDegFt(lon, lat, elev + last_apt_elev);
|
tower = SGGeod::fromDegFt(lon, lat, elev + last_apt_elev);
|
||||||
got_tower = true;
|
|
||||||
|
|
||||||
cache->insertTower(currentAirportID, tower);
|
cache->insertTower(currentAirportID, tower);
|
||||||
} else if ( line_id == 19 ) {
|
} else if ( line_id == 19 ) {
|
||||||
// windsock entry (ignore)
|
// windsock entry (ignore)
|
||||||
|
@ -207,7 +205,6 @@ private:
|
||||||
double rwy_lon_accum;
|
double rwy_lon_accum;
|
||||||
double last_rwy_heading;
|
double last_rwy_heading;
|
||||||
int rwy_count;
|
int rwy_count;
|
||||||
bool got_tower;
|
|
||||||
string last_apt_id;
|
string last_apt_id;
|
||||||
double last_apt_elev;
|
double last_apt_elev;
|
||||||
SGGeod tower;
|
SGGeod tower;
|
||||||
|
@ -238,17 +235,6 @@ private:
|
||||||
double lat = rwy_lat_accum / (double)rwy_count;
|
double lat = rwy_lat_accum / (double)rwy_count;
|
||||||
double lon = rwy_lon_accum / (double)rwy_count;
|
double lon = rwy_lon_accum / (double)rwy_count;
|
||||||
|
|
||||||
if (!got_tower) {
|
|
||||||
// tower height hard coded for now...
|
|
||||||
const float tower_height = 50.0f;
|
|
||||||
// make a little off the heading for 1 runway airports...
|
|
||||||
float fudge_lon = fabs(sin(last_rwy_heading * SGD_DEGREES_TO_RADIANS)) * .003f;
|
|
||||||
float fudge_lat = .003f - fudge_lon;
|
|
||||||
tower = SGGeod::fromDegFt(lon + fudge_lon, lat + fudge_lat, last_apt_elev + tower_height);
|
|
||||||
|
|
||||||
cache->insertTower(currentAirportID, tower);
|
|
||||||
}
|
|
||||||
|
|
||||||
SGGeod pos(SGGeod::fromDegFt(lon, lat, last_apt_elev));
|
SGGeod pos(SGGeod::fromDegFt(lon, lat, last_apt_elev));
|
||||||
cache->updatePosition(currentAirportID, pos);
|
cache->updatePosition(currentAirportID, pos);
|
||||||
|
|
||||||
|
@ -264,7 +250,6 @@ private:
|
||||||
finishAirport();
|
finishAirport();
|
||||||
|
|
||||||
last_apt_elev = elev;
|
last_apt_elev = elev;
|
||||||
got_tower = false;
|
|
||||||
|
|
||||||
string name;
|
string name;
|
||||||
// build the name
|
// build the name
|
||||||
|
|
Loading…
Add table
Reference in a new issue