-// Constructor
-FGFixList::FGFixList( void ) {
-}
-
-
-// Destructor
-FGFixList::~FGFixList( void ) {
-}
-
-
-// load the navaids and build the map
-bool FGFixList::init( SGPath path ) {
- fixlist.erase( fixlist.begin(), fixlist.end() );
-
- 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;
-
- FGFix* fix = new FGFix(ident, SGGeod::fromDeg(lon, lat));
- fixlist.insert(std::make_pair(fix->ident(), fix));
- in >> skipcomment;
- }
- return true;
-}
-
-
-// query the database for the specified fix, lon and lat are in
-// degrees, elev is in meters
-bool FGFixList::query( const string& ident, FGFix* &fix ) {
- fix_map_const_iterator it = fixlist.find(ident);
- if ( it != fixlist.end() ) {
- fix = it->second;
- return true;
- } else {
- return false;
- }
-}
-
-
-// query the database for the specified fix, lon and lat are in
-// degrees, elev is in meters
-bool FGFixList::query_and_offset( const string& ident, double lon, double lat,
- double elev, FGFix* &fix, double *heading,
- double *dist )
-{
- std::pair<fix_map_const_iterator, fix_map_const_iterator> range = fixlist.equal_range(ident);
-
- if (range.first == range.second) {
- return false;
- }