]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/runways.hxx
Merge branch 'next' of gitorious.org:fg/flightgear into next
[flightgear.git] / src / Airports / runways.hxx
index 34c884531c26a81d91e56bf239dc2ffc7c1bcbfb..e6f97ea95d7790c30898fbcd6e4ec9c7a5bc865d 100644 (file)
 
 #include <simgear/compiler.h>
 
-#include <string>
-#include <vector>
+#include <Airports/runwaybase.hxx>
 
-class FGRunway
+// forward decls
+class FGAirport;
+class FGNavRecord;
+class SGPropertyNode;
+
+class FGRunway : public FGRunwayBase
 {
+  FGAirport* _airport;
+  bool _isReciprocal;
+  FGRunway* _reciprocal;
+  double _displ_thresh;
+  double _stopway;
+  FGNavRecord* _ils;
 public:
-  FGRunway();
   
-  FGRunway(const std::string& id, const std::string& rwy_no,
-            const double longitude, const double latitude,
+  FGRunway(FGAirport* aAirport, const std::string& rwy_no,
+            const SGGeod& aGeod,
             const double heading, const double length,
             const double width,
-            const double displ_thresh1, const double displ_thresh2,
-            const double stopway1, const double stopway2,
-            const std::string& lighting_flags, const int surface_code,
-            const std::string& shoulder_code, const int marking_code,
-            const double smoothness, const bool dist_remaining);
+            const double displ_thresh,
+            const double stopway,
+            const int surface_code,
+            const bool reciprocal);
   
   /**
    * given a runway identifier (06, 18L, 31R) compute the identifier for the
-   * opposite heading runway (24, 36R, 13L) string.
+   * reciprocal 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 _id;
-    std::string _rwy_no;
-    std::string _type;                // runway / taxiway
-
-    double _lon;
-    double _lat;
-    double _heading;
-    double _length;
-    double _width;
-    double _displ_thresh1;
-    double _displ_thresh2;
-    double _stopway1;
-    double _stopway2;
+  /**
+   * Test if this runway is the reciprocal. This allows users who iterate
+   * over runways to avoid counting runways twice, if desired.
+   */
+  bool isReciprocal() const
+  { return _isReciprocal; }
 
-    std::string _lighting_flags;
-    int _surface_code;
-    std::string _shoulder_code;
-    int _marking_code;
-    double _smoothness;
-    bool   _dist_remaining;
+  /**
+   * Get the runway begining point - this is syntatic sugar, equivalent to
+   * calling pointOnCenterline(0.0);
+   */
+  SGGeod begin() const;
+  
+  /**
+   * Get the (possibly displaced) threshold point.
+   */
+  SGGeod threshold() const;
+  
+  /**
+   * Get the 'far' end - this is equivalent to calling
+   * pointOnCenterline(lengthFt());
+   */
+  SGGeod end() const;
+  
+  double displacedThresholdM() const
+  { return _displ_thresh * SG_FEET_TO_METER; }
+  
+  double stopwayM() const
+  { return _stopway * SG_FEET_TO_METER; }
+  
+  /**
+   * Airport this runway is located at
+   */
+  FGAirport* airport() const
+  { return _airport; }
+  
+  // FIXME - should die once airport / runway creation is cleaned up
+  void setAirport(FGAirport* aAirport)
+  { _airport = aAirport; }
+  
+  FGNavRecord* ILS() const { return _ils; }
+  void setILS(FGNavRecord* nav) { _ils = nav; }
+  
+  FGRunway* reciprocalRunway() const
+  { return _reciprocal; }
+  void setReciprocalRunway(FGRunway* other);
+  
+  /**
+   * Helper to process property data loaded from an ICAO.threshold.xml file
+   */
+  void processThreshold(SGPropertyNode* aThreshold);
 };
 
-typedef std::vector<FGRunway> FGRunwayVector;
-
 #endif // _FG_RUNWAYS_HXX