-/******************************************************************************
- * FGAirportList
- *****************************************************************************/
-
-// Populates a list of subdirectories of $FG_ROOT/Airports/AI so that
-// the add() method doesn't have to try opening 2 XML files in each of
-// thousands of non-existent directories. FIXME: should probably add
-// code to free this list after parsing of apt.dat is finished;
-// non-issue at the moment, however, as there are no AI subdirectories
-// in the base package.
-//
-// Note: 2005/12/23: This is probably not necessary anymore, because I'm
-// Switching to runtime airport dynamics loading (DT).
-FGAirportList::FGAirportList()
-{
-// ulDir* d;
-// ulDirEnt* dent;
-// SGPath aid( globals->get_fg_root() );
-// aid.append( "/Airports/AI" );
-// if((d = ulOpenDir(aid.c_str())) == NULL)
-// return;
-// while((dent = ulReadDir(d)) != NULL) {
-// SG_LOG( SG_GENERAL, SG_DEBUG, "Dent: " << dent->d_name );
-// ai_dirs.insert(dent->d_name);
-// }
-// ulCloseDir(d);
-}
-
-
-FGAirportList::~FGAirportList( void )
-{
- for (unsigned int i = 0; i < airports_array.size(); ++i) {
- delete airports_array[i];
- }
-}
-
-
-// add an entry to the list
-FGAirport* FGAirportList::add( const string &id, const SGGeod& location, const SGGeod& tower_location,
- const string &name, bool has_metar, bool is_airport, bool is_seaport,
- bool is_heliport)
-{
- FGAirport* a = new FGAirport(id, location, tower_location, name, has_metar,
- is_airport, is_seaport, is_heliport);
-
- airports_by_id[a->getId()] = a;
- // try and read in an auxilary file
-
- airports_array.push_back( a );
- SG_LOG( SG_GENERAL, SG_BULK, "Adding " << id << " pos = " << location.getLongitudeDeg()
- << ", " << location.getLatitudeDeg() << " elev = " << location.getElevationFt() );
-
- return a;
-}
-
-
-// search for the specified id
-FGAirport* FGAirportList::search( const string& id)
-{
- airport_map_iterator itr = airports_by_id.find(id);
- return (itr == airports_by_id.end() ? NULL : itr->second);
-}
-
-// wrap an FGIdentOrdering in an STL-compatible functor. not the most
-// efficent / pretty thing in the world, but avoids template nastiness in the
-// headers, and we're only doing O(log(N)) comparisoms per search
-class orderingFunctor
-{
-public:
- orderingFunctor(FGIdentOrdering* aOrder) :
- mOrdering(aOrder)
- { assert(aOrder); }
-
- bool operator()(const airport_map::value_type& aA, const std::string& aB) const
- {
- return mOrdering->compare(aA.first,aB);
- }
-
- bool operator()(const std::string& aA, const airport_map::value_type& aB) const
- {
- return mOrdering->compare(aA, aB.first);
- }
-
- bool operator()(const airport_map::value_type& aA, const airport_map::value_type& aB) const
- {
- return mOrdering->compare(aA.first, aB.first);
- }
-
-private:
- FGIdentOrdering* mOrdering;
-};
-
-const FGAirport* FGAirportList::findFirstById(const std::string& aIdent, FGIdentOrdering* aOrder)