X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNavaids%2Ffixlist.cxx;h=2dc8806eab1dfaacb45ea7c1790c7a441b031bf6;hb=6bf47cd248ed388e6a4dd3ffa2d00977b00b62fb;hp=1f685e193fa719b98a8a14904e9e99c303116e59;hpb=1e71177e7c1e9622d2346f168c9fdd479ad1a7cf;p=flightgear.git diff --git a/src/Navaids/fixlist.cxx b/src/Navaids/fixlist.cxx index 1f685e193..2dc8806ea 100644 --- a/src/Navaids/fixlist.cxx +++ b/src/Navaids/fixlist.cxx @@ -33,47 +33,43 @@ #include #include "fixlist.hxx" -#include "Navaids/fix.hxx" -#include "Airports/simple.hxx" +#include +#include -FGFix::FGFix(const std::string& aIdent, const SGGeod& aPos) : - FGPositioned(FIX, aIdent, aPos) +FGFix::FGFix(PositionedID aGuid, const std::string& aIdent, const SGGeod& aPos) : + FGPositioned(aGuid, FIX, aIdent, aPos) { } -// Constructor -FGFixList::FGFixList( void ) { -} - - -// Destructor -FGFixList::~FGFixList( void ) { -} - -// load the navaids and build the map -bool FGFixList::init(const SGPath& path ) { - sg_gzifstream in( path.str() ); - if ( !in.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << path.str() ); - exit(-1); - } - - // toss the first two lines of the file - in >> skipeol; - in >> skipeol; - - // read in each remaining line of the file - while ( ! in.eof() ) { - double lat, lon; - string ident; - in >> lat >> lon >> ident; - if (lat > 95) break; +namespace flightgear +{ + +void loadFixes(const SGPath& path) +{ + sg_gzifstream in( path.str() ); + if ( !in.is_open() ) { + SG_LOG( SG_NAVAID, SG_ALERT, "Cannot open file: " << path.str() ); + exit(-1); + } + + // toss the first two lines of the file + in >> skipeol; + in >> skipeol; + + NavDataCache* cache = NavDataCache::instance(); + + // read in each remaining line of the file + while ( ! in.eof() ) { + double lat, lon; + std::string ident; + in >> lat >> lon >> ident; + if (lat > 95) break; + + cache->insertFix(ident, SGGeod::fromDeg(lon, lat)); + in >> skipcomment; + } - // fix gets added to the FGPositioned spatial indices, so we don't need - // to hold onto it here. - new FGFix(ident, SGGeod::fromDeg(lon, lat)); - in >> skipcomment; - } - return true; } + +} // of namespace flightgear;