]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/runways.hxx
Another clean-up iteration: FGAirportList::search is gone, replaced by two
[flightgear.git] / src / Airports / runways.hxx
index 34c884531c26a81d91e56bf239dc2ffc7c1bcbfb..8e40f9e76936a1c48837b3cd1ba81b8c001ec199 100644 (file)
 
 #include <simgear/compiler.h>
 
+#include <simgear/math/sg_geodesy.hxx>
+
+#include "Navaids/positioned.hxx"
+
 #include <string>
-#include <vector>
 
-class FGRunway
-{
+// forward decls
+class FGAirport;
+
+class FGRunway : public FGPositioned
+{  
+  FGAirport* _airport; ///< owning airport
+  bool _reciprocal;
+  double _heading;
+  double _length;
+  double _width;
+  double _displ_thresh;
+  double _stopway;
+  
+  /** surface, as defined by:
+   * http://www.x-plane.org/home/robinp/Apt810.htm#RwySfcCodes
+   */
+  int _surface_code;
+  
 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;
 
+  /**
+   * 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 _reciprocal; }
+
+  /**
+   * Test if this is a taxiway or not
+   */
   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;
-
-    std::string _lighting_flags;
-    int _surface_code;
-    std::string _shoulder_code;
-    int _marking_code;
-    double _smoothness;
-    bool   _dist_remaining;
+  /**
+   * Get the runway threshold point - this is syntatic sugar, equivalent to
+   * calling pointOnCenterline(0.0);
+   */
+  SGGeod threshold() const;
+  
+  /**
+   * Get the (possibly displaced) threshold point.
+   */
+  SGGeod displacedThreshold() const;
+  
+  /**
+   * Get the opposite threshold - this is equivalent to calling
+   * pointOnCenterline(lengthFt());
+   */
+  SGGeod reverseThreshold() const;
+  
+  /**
+   * Retrieve a position on the extended runway centerline. Positive values
+   * are in the direction of the runway heading, negative values are in the
+   * opposited direction. 0.0 corresponds to the (non-displaced) threshold
+   */
+  SGGeod pointOnCenterline(double aOffset) const;
+  
+  /**
+   * Runway length in ft
+   */
+  double lengthFt() const
+  { return _length; }
+  
+  double lengthM() const
+  { return _length * SG_FEET_TO_METER; }
+  
+  double widthFt() const
+  { return _width; }
+  
+  double widthM() const
+  { return _width * SG_FEET_TO_METER; }
+  
+  double displacedThresholdM() const
+  { return _displ_thresh * SG_FEET_TO_METER; }
+  
+  double stopwayM() const
+  { return _stopway * SG_FEET_TO_METER; }
+  
+  /**
+   * Runway heading in degrees.
+   */
+  double headingDeg() const
+  { return _heading; }
+  
+  /**
+   * 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; }
+  
+  /**
+   * Predicate to test if this runway has a hard surface. For the moment, this
+   * means concrete or asphalt
+   */
+  bool isHardSurface() const;
+  
+  /**
+   * Retrieve runway surface code, as define in Robin Peel's data
+   */
+  int surface() const 
+  { return _surface_code; }
 };
 
-typedef std::vector<FGRunway> FGRunwayVector;
-
 #endif // _FG_RUNWAYS_HXX