]> git.mxchange.org Git - flightgear.git/commitdiff
Finish conversion of FGRunway to a real class - all public members are gone.
authorjmt <jmt>
Wed, 24 Dec 2008 15:45:35 +0000 (15:45 +0000)
committerjmt <jmt>
Wed, 24 Dec 2008 15:45:35 +0000 (15:45 +0000)
src/Airports/runways.cxx
src/Airports/runways.hxx
src/Airports/simple.cxx
src/Airports/simple.hxx
src/Instrumentation/KLN89/kln89_page_apt.cxx
src/Instrumentation/mk_viii.cxx
src/Scripting/NasalSys.cxx

index 84c064263d6e28fdc4499dfe85e7b9f98fdb804a..c38d1dc91bc131d62f3c99ae2ce04613ea56b6c5 100644 (file)
@@ -42,6 +42,20 @@ using std::istream;
 using std::multimap;
 using std::string;
 
+/*
+ * surface codes
+ * 1 - asphalt
+ * 2 - concrete
+ * 3 - turf
+ * 4 - dirt
+ * 5 - gravel
+ * 6 - asphalt helipad
+ * 7 - concrete helipad
+ * 8 - turf helipad
+ * 9 - dirt helipad
+ * 12 -  lakebed
+ */
 static FGPositioned::Type runwayTypeFromNumber(const std::string& aRwyNo)
 {
   return (aRwyNo[0] == 'x') ? FGPositioned::TAXIWAY : FGPositioned::RUNWAY;
@@ -168,3 +182,9 @@ SGGeod FGRunway::pointOnCenterline(double aOffset) const
     result, dummyAz2);
   return result;
 }
+
+bool FGRunway::isHardSurface() const
+{
+  return ((_surface_code == 1) || (_surface_code == 2));
+}
+
index a198f492c66186130664bd96d2826a6308a3cf95..7bb21b6b4532d688c2817a1ee07232e1fec5f6ea 100644 (file)
@@ -39,6 +39,13 @@ class FGRunway : public FGPositioned
 {  
   FGAirport* _airport; ///< owning airport
   bool _reciprocal;
+  double _heading;
+  double _length;
+  double _width;
+  double _displ_thresh;
+  double _stopway;
+  int _surface_code;
+  
 public:
   
   FGRunway(FGAirport* aAirport, const std::string& rwy_no,
@@ -113,6 +120,12 @@ public:
   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.
    */
@@ -129,17 +142,17 @@ public:
   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; }
-  
-  double _displ_thresh;
-  double _stopway;
-
-  double _heading;
-  double _length;
-  double _width;
-  
-  int _surface_code;
 };
 
 #endif // _FG_RUNWAYS_HXX
index f99b963f3c553e9225b693931de11805aa04930f..944dfbb80cf1f47a97150f2a222a116ada8c7d3b 100644 (file)
@@ -200,13 +200,8 @@ bool FGAirport::hasHardRunwayOfLengthFt(double aLengthFt) const
     if (rwy->isReciprocal()) {
       continue; // we only care about lengths, so don't do work twice
     }
-    
-    int surface = rwy->surface();
-    if ((surface != 1) && (surface != 2)) {
-      continue; // no hard surface
-    }
-    
-    if (rwy->lengthFt() >= aLengthFt) {
+
+    if (rwy->isHardSurface() && (rwy->lengthFt() >= aLengthFt)) {
       return true; // we're done!
     }
   } // of runways iteration
index eb14d386c31005104c352ad8fb34d498636f6212..7c7445947059da143acae7c8ca3974ee6e13e0bc 100644 (file)
@@ -89,8 +89,6 @@ public:
      /**
      * Useful predicate for FMS/GPS/NAV displays and similar - check if this
      * aiport has a hard-surfaced runway of at least the specified length.
-     * For the moment, hard means asphalt or concrete, not gravel or a
-     * lake bed.
      */
     bool hasHardRunwayOfLengthFt(double aLengthFt) const;
     
index e4212151940376169d77a3cd299fbf610c405f90..62031c760b6bbd7f299c0c6c971bb787eb3b474a 100644 (file)
@@ -204,7 +204,7 @@ void KLN89AptPage::Update(double dt) {
                        // I guess we can make a heuristic guess as to fuel availability from the runway sizes
                        // For now assume that airports with asphalt or concrete runways will have at least 100L,
                        // and that runways over 4000ft will have JET.
-                       if(_aptRwys[0]->_surface_code <= 2) {
+                       if(_aptRwys[0]->surface() <= 2) {
                                if(_aptRwys[0]->lengthFt() >= 4000) {
                                        _kln89->DrawText("JET 100L", 2, 0, 1);
                                } else {
@@ -235,7 +235,7 @@ void KLN89AptPage::Update(double dt) {
                                _kln89->DrawText((_kln89->_altUnits == GPS_ALT_UNITS_FT ? "ft" : "m"), 2, 5, 2);
                                // Surface
                                // TODO - why not store these strings as an array?
-                               switch(_aptRwys[i]->_surface_code) {
+                               switch(_aptRwys[i]->surface()) {
                                case 1:
                                        // Asphalt - fall through
                                case 2:
@@ -283,7 +283,7 @@ void KLN89AptPage::Update(double dt) {
                                _kln89->DrawText((_kln89->_altUnits == GPS_ALT_UNITS_FT ? "ft" : "m"), 2, 5, 0);
                                // Surface
                                // TODO - why not store these strings as an array?
-                               switch(_aptRwys[i]->_surface_code) {
+                               switch(_aptRwys[i]->surface()) {
                                case 1:
                                        // Asphalt - fall through
                                case 2:
index 6990d38a33ac6b9ff185697c3d3aee4ffa8bd393..a310297d63febeea6b0812bec4c10e7905a53c3d 100755 (executable)
@@ -4230,7 +4230,7 @@ MK_VIII::Mode6Handler::update_altitude_callouts ()
 bool
 MK_VIII::Mode6Handler::test_runway (const FGRunway *_runway)
 {
-  if (_runway->_length < mk->conf.runway_database)
+  if (_runway->lengthFt() < mk->conf.runway_database)
     return false;
 
   SGGeod pos(
index 941776b35d6ceee5db9c6971ca85b39f9a95deec..0a10317f94d0f6ebaa57e5f18d23d06b4eee4c55 100644 (file)
@@ -569,8 +569,8 @@ static naRef f_airportinfo(naContext c, naRef me, int argc, naRef* args)
         HASHSET("heading", 7, naNum(rwy->headingDeg()));
         HASHSET("length", 6, naNum(rwy->lengthM()));
         HASHSET("width", 5, naNum(rwy->widthM()));
-        HASHSET("threshold", 9, naNum(rwy->_displ_thresh * SG_FEET_TO_METER));
-        HASHSET("stopway", 7, naNum(rwy->_stopway * SG_FEET_TO_METER));
+        HASHSET("threshold", 9, naNum(rwy->displacedThresholdM()));
+        HASHSET("stopway", 7, naNum(rwy->stopwayM()));
 #undef HASHSET
         naHash_set(rwys, rwyid, rwydata);
     }