#include STL_STRING
#include <map>
+#include <vector>
SG_USING_STD(string);
SG_USING_STD(map);
+SG_USING_STD(vector);
-class FGAirport {
-
-public:
+struct FGAirport {
string id;
double longitude;
double elevation;
string code;
string name;
-
-public:
-
- FGAirport( const string& name = "",
- double lon = 0.0,
- double lat = 0.0,
- double ele = 0.0 )
- : id(name), longitude(lon), latitude(lat), elevation(ele) {}
-
- bool operator < ( const FGAirport& a ) const {
- return id < a.id;
- }
-
+ bool has_metar;
};
typedef map < string, FGAirport > airport_map;
typedef airport_map::iterator airport_map_iterator;
typedef airport_map::const_iterator const_airport_map_iterator;
+typedef vector < FGAirport * > airport_list;
+
class FGAirportList {
private:
- airport_map airports;
+ airport_map airports_by_id;
+ airport_list airports_array;
public:
// Constructor
- FGAirportList( const string& file );
+ FGAirportList( const string &airport_file, const string &metar_file );
// Destructor
~FGAirportList();
// On success, airport data is returned thru "airport" pointer.
// "airport" is not changed if "apt" is not found.
FGAirport search( const string& id );
+
+ // 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.) If with_metar is true, then only
+ // return station id's marked as having metar data.
+ FGAirport search( double lon_deg, double lat_deg, bool with_metar );
+
+
+ /**
+ * Return the number of airports in the list.
+ */
+ int size() const;
+
+
+ /**
+ * Return a specific airport, by position.
+ */
+ const FGAirport *getAirport( int index ) const;
+
+
+ /**
+ * Mark the specified airport record as not having metar
+ */
+ void no_metar( const string &id );
+
};