]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/runways.hxx
Code to stop loading of invalid flightplans
[flightgear.git] / src / Airports / runways.hxx
index 8e40f9e76936a1c48837b3cd1ba81b8c001ec199..e795d9ee5c9cc3fcdaea53799ae87a7326a7c54d 100644 (file)
 
 #include <simgear/compiler.h>
 
-#include <simgear/math/sg_geodesy.hxx>
+#include <Navaids/procedure.hxx>
+#include "runwaybase.hxx"
+#include "airports_fwd.hxx"
 
-#include "Navaids/positioned.hxx"
-
-#include <string>
-
-// forward decls
-class FGAirport;
-
-class FGRunway : public FGPositioned
-{  
-  FGAirport* _airport; ///< owning airport
-  bool _reciprocal;
-  double _heading;
-  double _length;
-  double _width;
+class FGRunway : public FGRunwayBase
+{
+  PositionedID _airport;
+  PositionedID _reciprocal;
   double _displ_thresh;
   double _stopway;
-  
-  /** surface, as defined by:
-   * http://www.x-plane.org/home/robinp/Apt810.htm#RwySfcCodes
-   */
-  int _surface_code;
-  
+  PositionedID _ils;
 public:
   
-  FGRunway(FGAirport* aAirport, const std::string& rwy_no,
+  FGRunway(PositionedID aGuid,
+           PositionedID aAirport, const std::string& rwy_no,
             const SGGeod& aGeod,
             const double heading, const double length,
             const double width,
             const double displ_thresh,
             const double stopway,
-            const int surface_code,
-            const bool reciprocal);
+            const int surface_code);
   
   /**
    * given a runway identifier (06, 18L, 31R) compute the identifier for the
@@ -71,92 +58,81 @@ public:
    * score this runway according to the specified weights. Used by
    * FGAirport::findBestRunwayForHeading
    */
-  double score(double aLengthWt, double aWidthWt, double aSurfaceWt) const;
+  double score(double aLengthWt, double aWidthWt, double aSurfaceWt, double aIlsWt) 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;
-  
-  /**
-   * Get the runway threshold point - this is syntatic sugar, equivalent to
+   * Get the runway beginning point - this is syntatic sugar, equivalent to
    * calling pointOnCenterline(0.0);
    */
-  SGGeod threshold() const;
+  SGGeod begin() const;
   
   /**
    * Get the (possibly displaced) threshold point.
    */
-  SGGeod displacedThreshold() const;
+  SGGeod threshold() const;
   
   /**
-   * Get the opposite threshold - this is equivalent to calling
+   * Get the 'far' end - this is equivalent to calling
    * pointOnCenterline(lengthFt());
    */
-  SGGeod reverseThreshold() const;
+  SGGeod end() 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;
+  double displacedThresholdM() const
+  { return _displ_thresh; }
+  
+  double stopwayM() const
+  { return _stopway; }
   
   /**
-   * Runway length in ft
+   * Airport this runway is located at
    */
-  double lengthFt() const
-  { return _length; }
+  FGAirport* airport() const;
   
-  double lengthM() const
-  { return _length * SG_FEET_TO_METER; }
+  FGNavRecord* ILS() const;
   
-  double widthFt() const
-  { return _width; }
+  /**
+   * retrieve the associated glideslope transmitter, if one is defined.
+   */
+  FGNavRecord* glideslope() const;
   
-  double widthM() const
-  { return _width * SG_FEET_TO_METER; }
+  void setILS(PositionedID nav) { _ils = nav; }
   
-  double displacedThresholdM() const
-  { return _displ_thresh * SG_FEET_TO_METER; }
+  FGRunway* reciprocalRunway() const;
   
-  double stopwayM() const
-  { return _stopway * SG_FEET_TO_METER; }
+  void setReciprocalRunway(PositionedID other);
   
   /**
-   * Runway heading in degrees.
+   * Get SIDs (DPs) associated with this runway
    */
-  double headingDeg() const
-  { return _heading; }
+  flightgear::SIDList getSIDs() const;
   
   /**
-   * Airport this runway is located at
-   */
-  FGAirport* airport() const
-  { return _airport; }
+   * Get STARs associared with this runway
+   */ 
+  flightgear::STARList getSTARs() const;
   
-  // 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;
+  flightgear::ApproachList getApproaches
+  (
+    flightgear::ProcedureType type = flightgear::PROCEDURE_INVALID
+  ) const;
   
-  /**
-   * Retrieve runway surface code, as define in Robin Peel's data
-   */
-  int surface() const 
-  { return _surface_code; }
+  void updateThreshold(const SGGeod& newThreshold,
+                       double newHeading,
+                       double newDisplacedThreshold,
+                       double newStopway);
 };
 
+class FGHelipad : public FGRunwayBase
+{
+public:
+    FGHelipad(PositionedID aGuid,
+           PositionedID aAirport, const std::string& rwy_no,
+            const SGGeod& aGeod,
+            const double heading, const double length,
+            const double width,
+            const int surface_code);
+};
+
+
 #endif // _FG_RUNWAYS_HXX