X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAirports%2Fapt_loader.cxx;h=34cccff20cf7ce6f52618e2c3088215c4ded2fb3;hb=386aefe69358ce41a11c9afeb8f56e26758fe56b;hp=0cb01f3bb4d6c32945f568a1b452d4973f6cedb8;hpb=14a09673b958e197ce4450c7e4a5b3da55170d3d;p=flightgear.git diff --git a/src/Airports/apt_loader.cxx b/src/Airports/apt_loader.cxx index 0cb01f3bb..34cccff20 100644 --- a/src/Airports/apt_loader.cxx +++ b/src/Airports/apt_loader.cxx @@ -39,13 +39,18 @@ #include #include #include +#include #include #include "simple.hxx" #include "runways.hxx" #include "pavement.hxx" -#include +#if ENABLE_ATCDCL +# include +#else + #include +#endif #include @@ -75,6 +80,8 @@ public: last_apt_type("") {} + + void parseAPT(const string &aptdb_file, FGCommList *comm_list) { sg_gzifstream in( aptdb_file ); @@ -155,7 +162,9 @@ public: } else if ( line_id == 0 ) { // ?? } else if ( line_id == 50 ) { + parseATISLine(comm_list, simgear::strutils::split(line)); + } else if ( line_id >= 51 && line_id <= 56 ) { // other frequency entries (ignore) } else if ( line_id == 110 ) { @@ -229,7 +238,6 @@ private: SGGeod pos(SGGeod::fromDegFt(lon, lat, last_apt_elev)); FGAirport* apt = new FGAirport(last_apt_id, pos, tower, last_apt_name, false, fptypeFromRobinType(atoi(last_apt_type.c_str()))); - apt->setRunwaysAndTaxiways(runways, taxiways, pavements); } @@ -305,6 +313,9 @@ private: displ_thresh2, stopway2, surface_code, true); runways.push_back(reciprocal); + + rwy->setReciprocalRunway(reciprocal); + reciprocal->setReciprocalRunway(rwy); } } @@ -354,6 +365,9 @@ private: pos, heading_2, length, width, displ_thresh2, stopway2, surface_code, true); runways.push_back(reciprocal); + + rwy->setReciprocalRunway(reciprocal); + reciprocal->setReciprocalRunway(rwy); } void parseWaterRunwayLine850(const vector& token) @@ -392,6 +406,9 @@ private: pos, heading_2, length, width, 0.0, 0.0, 13, true); runways.push_back(reciprocal); + + rwy->setReciprocalRunway(reciprocal); + reciprocal->setReciprocalRunway(rwy); } void parseHelipadLine850(const vector& token) @@ -452,7 +469,7 @@ private: pvt->addNode(pos, num == 113); } } - + void parseATISLine(FGCommList *comm_list, const vector& token) { if ( rwy_count <= 0 ) { @@ -469,6 +486,7 @@ private: // 50 11770 AWOS 3 // This code parallels code found in "operator>>" in ATC.hxx; // FIXME: unify the code. +#if ENABLE_ATCDCL ATCData a; a.geod = SGGeod::fromDegFt(rwy_lon_accum / (double)rwy_count, rwy_lat_accum / (double)rwy_count, last_apt_elev); @@ -487,6 +505,8 @@ private: SGBucket bucket(a.geod); int bucknum = bucket.gen_index(); comm_list->commlist_bck[bucknum].push_back(a); +#else +#endif #if 0 SG_LOG( SG_GENERAL, SG_ALERT, "Loaded ATIS/AWOS for airport: " << a.ident @@ -496,8 +516,10 @@ private: << " type: " << a.type ); #endif } + }; + // Load the airport data base from the specified aptdb file. The // metar file is used to mark the airports as having metar available // or not. @@ -506,9 +528,7 @@ bool fgAirportDBLoad( const string &aptdb_file, { APTLoader ld; - ld.parseAPT(aptdb_file, comm_list); - // // Load the metar.dat file and update apt db with stations that // have metar data.