From 335584e29c5049d38cab1ae01ef1ecc5333c93f1 Mon Sep 17 00:00:00 2001 From: jmt Date: Wed, 24 Dec 2008 04:58:36 +0000 Subject: [PATCH] Remove the FGIdentOrdering cruft from FGAirport; now handled by FGPositioned. --- src/Airports/simple.cxx | 46 ------------------------------- src/Airports/simple.hxx | 22 --------------- src/Instrumentation/dclgps.cxx | 49 ---------------------------------- 3 files changed, 117 deletions(-) diff --git a/src/Airports/simple.cxx b/src/Airports/simple.cxx index 1dc6b7d76..f99b963f3 100644 --- a/src/Airports/simple.cxx +++ b/src/Airports/simple.cxx @@ -344,52 +344,6 @@ FGAirport* FGAirportList::search( const string& 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) -{ - airport_map_iterator itr; - if (aOrder) { - orderingFunctor func(aOrder); - itr = std::lower_bound(airports_by_id.begin(),airports_by_id.end(), aIdent, func); - } else { - itr = airports_by_id.lower_bound(aIdent); - } - - if (itr == airports_by_id.end()) { - return NULL; - } - - return itr->second; -} - // search for the airport nearest the specified position FGAirport* FGAirportList::search(double lon_deg, double lat_deg, double max_range) { diff --git a/src/Airports/simple.hxx b/src/Airports/simple.hxx index a37524318..eb14d386c 100644 --- a/src/Airports/simple.hxx +++ b/src/Airports/simple.hxx @@ -146,15 +146,6 @@ public: virtual bool pass(FGAirport*) { return true; } }; -class FGIdentOrdering { -public: - virtual ~FGIdentOrdering() - { ; } - - virtual bool compare(const std::string& aA, const std::string& aB) const - { return aA < aB; } -}; - typedef std::map < std::string, FGAirport* > airport_map; typedef airport_map::iterator airport_map_iterator; typedef airport_map::const_iterator const_airport_map_iterator; @@ -186,14 +177,6 @@ public: // Returns NULL if unsucessfull. FGAirport* search( const std::string& id ); - // Search for the next airport in ASCII sequence to the supplied id. - // eg. id = "KDC" or "KDCA" would both return "KDCA". - // NOTE: Numbers come prior to A-Z in ASCII sequence so id = "LD" would return "LD57", not "LDDP" - // optional ordering can make letters come before numbers - // Implementation assumes airport codes are unique. - // Returns NULL if unsucessfull. - const FGAirport* findFirstById(const std::string& aIdent, FGIdentOrdering* aOrder = NULL); - // search for the airport closest to the specified position // (currently a linear inefficient search so it's probably not // best to use this at runtime.) An FGAirportSearchFilter class @@ -212,11 +195,6 @@ public: */ const FGAirport *getAirport( unsigned int index ) const; - /** - * Return a pointer to the raw airport list - */ - inline const airport_list* getAirportList() { return (&airports_array); } - /** * Mark the specified airport record as not having metar */ diff --git a/src/Instrumentation/dclgps.cxx b/src/Instrumentation/dclgps.cxx index 35141c9dc..3156c55ac 100644 --- a/src/Instrumentation/dclgps.cxx +++ b/src/Instrumentation/dclgps.cxx @@ -1035,55 +1035,6 @@ void DCLGPS::CreateFlightPlan(GPSFlightPlan* fp, vector ids, vector