A few tweaks to better handle newest airport data.
This commit is contained in:
parent
2df4726f33
commit
696fa632b4
2 changed files with 39 additions and 20 deletions
src/Airports/GenAirports
|
@ -275,8 +275,11 @@ TGAptSurface::TGAptSurface( const string& path,
|
||||||
} else {
|
} else {
|
||||||
// no, sorry, a nan is not <= 0.0 or >= 0.0
|
// no, sorry, a nan is not <= 0.0 or >= 0.0
|
||||||
SG_LOG(SG_GENERAL, SG_WARN,
|
SG_LOG(SG_GENERAL, SG_WARN,
|
||||||
"leastSquares() failed, aborting().");
|
"leastSquares() nurbs interpolation failed!!!");
|
||||||
exit(-1);
|
char command[256];
|
||||||
|
sprintf( command,
|
||||||
|
"least squares nurbs interpolation failed, using globalInterp() >> last_apt" );
|
||||||
|
system( command );
|
||||||
|
|
||||||
// we could fall back to globalInterp() rather than aborting
|
// we could fall back to globalInterp() rather than aborting
|
||||||
// if we wanted to ...
|
// if we wanted to ...
|
||||||
|
|
|
@ -244,6 +244,7 @@ int main( int argc, char **argv ) {
|
||||||
vector<string> token;
|
vector<string> token;
|
||||||
string last_apt_id = "";
|
string last_apt_id = "";
|
||||||
string last_apt_info = "";
|
string last_apt_info = "";
|
||||||
|
string last_apt_type = "";
|
||||||
string line;
|
string line;
|
||||||
char tmp[2048];
|
char tmp[2048];
|
||||||
|
|
||||||
|
@ -271,7 +272,10 @@ int main( int argc, char **argv ) {
|
||||||
in.getline(tmp, 2048);
|
in.getline(tmp, 2048);
|
||||||
vector<string> vers_token = simgear::strutils::split( tmp );
|
vector<string> vers_token = simgear::strutils::split( tmp );
|
||||||
SG_LOG( SG_GENERAL, SG_INFO, "Data version = " << vers_token[0] );
|
SG_LOG( SG_GENERAL, SG_INFO, "Data version = " << vers_token[0] );
|
||||||
} else if ( token[0] == "1" /* Airport */ ) {
|
} else if ( token[0] == "1" /* Airport */ ||
|
||||||
|
token[0] == "16" /* Seaplane base */ ||
|
||||||
|
token[0] == "17" /* Heliport */ ) {
|
||||||
|
|
||||||
// extract some airport runway info
|
// extract some airport runway info
|
||||||
string rwy;
|
string rwy;
|
||||||
float lat, lon;
|
float lat, lon;
|
||||||
|
@ -306,13 +310,19 @@ int main( int argc, char **argv ) {
|
||||||
// process previous record
|
// process previous record
|
||||||
// process_airport(last_apt_id, runways_list, argv[2]);
|
// process_airport(last_apt_id, runways_list, argv[2]);
|
||||||
try {
|
try {
|
||||||
build_airport( last_apt_id,
|
if ( last_apt_type == "16" /* Seaplane base */ ||
|
||||||
elev * SG_FEET_TO_METER,
|
last_apt_type == "17" /* Heliport */ ) {
|
||||||
runways_list,
|
// skip building heliports and
|
||||||
beacon_list,
|
// seaplane bases
|
||||||
tower_list,
|
} else {
|
||||||
windsock_list,
|
build_airport( last_apt_id,
|
||||||
work_dir, elev_src );
|
elev * SG_FEET_TO_METER,
|
||||||
|
runways_list,
|
||||||
|
beacon_list,
|
||||||
|
tower_list,
|
||||||
|
windsock_list,
|
||||||
|
work_dir, elev_src );
|
||||||
|
}
|
||||||
} catch (sg_exception &e) {
|
} catch (sg_exception &e) {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
"Failed to build airport = "
|
"Failed to build airport = "
|
||||||
|
@ -335,6 +345,8 @@ int main( int argc, char **argv ) {
|
||||||
|
|
||||||
last_apt_id = id;
|
last_apt_id = id;
|
||||||
last_apt_info = line;
|
last_apt_info = line;
|
||||||
|
last_apt_type = token[0];
|
||||||
|
|
||||||
// clear runway list for start of next airport
|
// clear runway list for start of next airport
|
||||||
runways_list.clear();
|
runways_list.clear();
|
||||||
beacon_list.clear();
|
beacon_list.clear();
|
||||||
|
@ -354,15 +366,13 @@ int main( int argc, char **argv ) {
|
||||||
windsock_list.push_back(line);
|
windsock_list.push_back(line);
|
||||||
} else if ( token[0] == "15" ) {
|
} else if ( token[0] == "15" ) {
|
||||||
// ignore custom startup locations
|
// ignore custom startup locations
|
||||||
} else if ( token[0] == "16" ) {
|
|
||||||
// ignore seaplane bases for now
|
|
||||||
} else if ( token[0] == "17" ) {
|
|
||||||
// ignore heliports for now
|
|
||||||
} else if ( token[0] == "50" || token[0] == "51" || token[0] == "52"
|
} else if ( token[0] == "50" || token[0] == "51" || token[0] == "52"
|
||||||
|| token[0] == "53" || token[0] == "54" || token[0] == "55"
|
|| token[0] == "53" || token[0] == "54" || token[0] == "55"
|
||||||
|| token[0] == "56" )
|
|| token[0] == "56" )
|
||||||
{
|
{
|
||||||
// ignore frequency entries
|
// ignore frequency entries
|
||||||
|
} else if ( token[0] == "99" ) {
|
||||||
|
SG_LOG( SG_GENERAL, SG_ALERT, "End of file reached" );
|
||||||
} else {
|
} else {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
"Unknown line in file: " << line );
|
"Unknown line in file: " << line );
|
||||||
|
@ -398,12 +408,18 @@ int main( int argc, char **argv ) {
|
||||||
// process previous record
|
// process previous record
|
||||||
// process_airport(last_apt_id, runways_list, argv[2]);
|
// process_airport(last_apt_id, runways_list, argv[2]);
|
||||||
try {
|
try {
|
||||||
build_airport( last_apt_id, elev * SG_FEET_TO_METER,
|
if ( last_apt_type == "16" /* Seaplane base */ ||
|
||||||
runways_list,
|
last_apt_type == "17" /* Heliport */ ) {
|
||||||
beacon_list,
|
// skip building heliports and
|
||||||
tower_list,
|
// seaplane bases
|
||||||
windsock_list,
|
} else {
|
||||||
work_dir, elev_src );
|
build_airport( last_apt_id, elev * SG_FEET_TO_METER,
|
||||||
|
runways_list,
|
||||||
|
beacon_list,
|
||||||
|
tower_list,
|
||||||
|
windsock_list,
|
||||||
|
work_dir, elev_src );
|
||||||
|
}
|
||||||
} catch (sg_exception &e) {
|
} catch (sg_exception &e) {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
"Failed to build airport = "
|
"Failed to build airport = "
|
||||||
|
|
Loading…
Add table
Reference in a new issue