]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/runways.hxx
Stefan C. Müller :
[flightgear.git] / src / Airports / runways.hxx
index 6dcf4e76d9370a9d04178551fdaf49102d54103d..996f38045372a5dc3d7c4ae9cd59c9c8486c836c 100644 (file)
 #ifndef _FG_RUNWAYS_HXX
 #define _FG_RUNWAYS_HXX
 
-
-#ifndef __cplusplus                                                          
-# error This library requires C++
-#endif                                   
-
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
 #include <simgear/compiler.h>
 
 #include <string>
-#include <map>
+#include <vector>
 
-SG_USING_STD(string);
-SG_USING_STD(multimap);
-
-
-struct ltstr {
-    bool operator()(const string& s1, const string& s2) const {
-        return s1 < s2;
-    }
-};
-
-
-struct FGRunway {
-
-    string _id;
-    string _rwy_no;
-    string _type;                // runway / taxiway
+class FGRunway
+{
+public:
+  FGRunway();
+  
+  FGRunway(const std::string& rwy_no,
+            const double longitude, const double latitude,
+            const double heading, const double length,
+            const double width,
+            const double displ_thresh1, const double displ_thresh2,
+            const double stopway1, const double stopway2,
+            const int surface_code);
+  
+  /**
+   * given a runway identifier (06, 18L, 31R) compute the identifier for the
+   * opposite heading runway (24, 36R, 13L) string.
+   */
+  static std::string reverseIdent(const std::string& aRunayIdent);
+  
+  /**
+   * score this runway according to the specified weights. Used by
+   * FGAirport::findBestRunwayForHeading
+   */
+  double score(double aLengthWt, double aWidthWt, double aSurfaceWt) const;
+
+  bool isTaxiway() const;
+  
+    std::string _rwy_no;
+    std::string _type;                // runway / taxiway
 
     double _lon;
     double _lat;
@@ -66,60 +69,9 @@ struct FGRunway {
     double _stopway1;
     double _stopway2;
 
-    string _lighting_flags;
     int _surface_code;
-    string _shoulder_code;
-    int _marking_code;
-    double _smoothness;
-    bool   _dist_remaining;
-};
-
-typedef multimap < string, FGRunway, ltstr > runway_map;
-typedef runway_map::iterator runway_map_iterator;
-typedef runway_map::const_iterator const_runway_map_iterator;
-
-class FGRunwayList {
-
-private:
-
-    runway_map runways;
-    runway_map_iterator current;
-
-public:
-
-    // Constructor (new)
-    FGRunwayList() {}
-
-    // Destructor
-    ~FGRunwayList();
-
-    // add an entry to the list
-    void add( const string& id, const string& rwy_no,
-              const double longitude, const double latitude,
-              const double heading, const double length, const double width,
-              const double displ_thresh1, const double displ_thresh2,
-              const double stopway1, const double stopway2,
-              const string& lighting_flags, const int surface_code,
-              const string& shoulder_code, const int marking_code,
-              const double smoothness, const bool dist_remaining );
-
-    // search for the specified apt id.
-    // Returns true if successful, otherwise returns false.
-    // On success, runway data is returned thru "runway" pointer.
-    // "runway" is not changed if "apt" is not found.
-    bool search( const string& aptid, FGRunway* runway );
-    bool search( const string& aptid, const string& rwyno, FGRunway* runway );
-
-    // DCL - search for runway closest to desired heading in degrees
-    bool search( const string& aptid, const int hdg, FGRunway* runway );
-
-    // Return the runway number of the runway closest to a given heading
-    string search( const string& aptid, const int tgt_hdg );
-
-    FGRunway search( const string& aptid );
-    bool next( FGRunway* runway );
-    FGRunway next();
 };
 
+typedef std::vector<FGRunway> FGRunwayVector;
 
 #endif // _FG_RUNWAYS_HXX