]> git.mxchange.org Git - flightgear.git/commitdiff
Standard property to ignore unusably short runways in NavDB.
authorJames Turner <zakalawe@mac.com>
Wed, 16 May 2012 15:51:39 +0000 (16:51 +0100)
committerJames Turner <zakalawe@mac.com>
Wed, 16 May 2012 15:51:39 +0000 (16:51 +0100)
Default values should match existing behaviour. Set
/sim/navdb/min-runway-length-ft to skip short runways
in GPS / Map / ND / Nasal queries.

src/Airports/simple.cxx
src/Airports/simple.hxx
src/GUI/MapWidget.cxx
src/Instrumentation/NavDisplay.cxx
src/Instrumentation/gps.cxx
src/Instrumentation/gps.hxx
src/Scripting/NasalPositioned.cxx

index af3945a61e88aa519c1751e1d0e25f32a8785abe..2065c907eaa6a74c91d512860f44433f96790ea1 100644 (file)
@@ -329,6 +329,9 @@ FGAirport* FGAirport::findClosest(const SGGeod& aPos, double aCuttofNm, Filter*
 FGAirport::HardSurfaceFilter::HardSurfaceFilter(double minLengthFt) :
   mMinLengthFt(minLengthFt)
 {
+  if (minLengthFt < 0.0) {
+    mMinLengthFt = fgGetDouble("/sim/navdb/min-runway-length-ft", 0.0);
+  }
 }
       
 bool FGAirport::HardSurfaceFilter::passAirport(FGAirport* aApt) const
index 6995e6976e1972cf5a65105e0bc3e2bbcfed825b..dfa83657057a8d0bc1da7cb7c07f8c44e7f6b4a8 100644 (file)
@@ -161,7 +161,7 @@ public:
      class HardSurfaceFilter : public AirportFilter
      {
      public:
-       HardSurfaceFilter(double minLengthFt);
+       HardSurfaceFilter(double minLengthFt = -1);
        
        virtual bool passAirport(FGAirport* aApt) const;
        
index 5a53ffe7f889d6f7ab9385dd6ef89ad6dacd84c3..ba4174086ea64dea7c217aeb4aaa666f828603c5 100644 (file)
@@ -887,7 +887,7 @@ public:
   {
     _heliports = nd->getBoolValue("show-heliports", false);
     _hardRunwaysOnly = nd->getBoolValue("hard-surfaced-airports", true);
-    _minLengthFt = nd->getDoubleValue("min-runway-length-ft", 2000.0);
+    _minLengthFt = fgGetDouble("/sim/navdb/min-runway-length-ft", 2000);
   }
 
   virtual FGPositioned::Type maxType() const {
index 2528a7ef4c574a20da9ece748eea3734c8953424..003b40dc0a79323a68c5a82ec9c4038926aee7f9 100644 (file)
@@ -947,7 +947,7 @@ void NavDisplay::findItems()
 {
     if (!_cachedItemsValid) {
         Filter filt;
-        filt.minRunwayLengthFt = 2000;
+        filt.minRunwayLengthFt = fgGetDouble("/sim/navdb/min-runway-length-ft", 2000);
         _itemsInRange = FGPositioned::findWithinRange(_pos, _rangeNm, &filt);
         _cachedItemsValid = true;
         _cachedPos = SGVec3d::fromGeod(_pos);
index 4d7b79b4f52a817d0cbb306808493a6bfec8c3f9..e9a91dcaafb3e10328c477427362c70805304e9f 100644 (file)
@@ -201,7 +201,6 @@ GPS::Config::Config() :
   _turnRate(3.0), // degrees-per-second, so 180 degree turn takes 60 seconds
   _overflightArmDistance(1.0),
   _waypointAlertTime(30.0),
-  _minRunwayLengthFt(0.0),
   _requireHardSurface(true),
   _cdiMaxDeflectionNm(3.0), // linear mode, 3nm at the peg
   _driveAutopilot(true),
@@ -215,7 +214,6 @@ void GPS::Config::bind(GPS* aOwner, SGPropertyNode* aCfg)
   aOwner->tie(aCfg, "turn-rate-deg-sec", SGRawValuePointer<double>(&_turnRate));
   aOwner->tie(aCfg, "turn-anticipation", SGRawValuePointer<bool>(&_enableTurnAnticipation));
   aOwner->tie(aCfg, "wpt-alert-time", SGRawValuePointer<double>(&_waypointAlertTime));
-  aOwner->tie(aCfg, "min-runway-length-ft", SGRawValuePointer<double>(&_minRunwayLengthFt));
   aOwner->tie(aCfg, "hard-surface-runways-only", SGRawValuePointer<bool>(&_requireHardSurface));
   aOwner->tie(aCfg, "cdi-max-deflection-nm", SGRawValuePointer<double>(&_cdiMaxDeflectionNm));
   aOwner->tie(aCfg, "drive-autopilot", SGRawValuePointer<bool>(&_driveAutopilot));
@@ -1439,7 +1437,7 @@ FGPositioned::Type GPS::SearchFilter::maxType() const
 FGPositioned::Filter* GPS::createFilter(FGPositioned::Type aTy)
 {
   if (aTy == FGPositioned::AIRPORT) {
-    return new FGAirport::HardSurfaceFilter(_config.minRunwayLengthFt());
+    return new FGAirport::HardSurfaceFilter();
   }
   
   // if we were passed INVALID, assume it means 'all types interesting to a GPS'
index 3ee14100e4467dddec5407922d10edb4278c0476..21cd461662d4404e32b62146d40bcfbf812133b0 100644 (file)
@@ -134,8 +134,6 @@ private:
 
       bool requireHardSurface() const      { return _requireHardSurface; }
 
-      double minRunwayLengthFt() const     { return _minRunwayLengthFt; }
-
       bool cdiDeflectionIsAngular() const  { return (_cdiMaxDeflectionNm <= 0.0); }
 
       double cdiDeflectionLinearPeg() const
index 53a3a41e7eca335acf7d5daa6508c702bfaef641..8f54c14dfabffdb6968a08b9ab7b2f6f9153b3e7 100644 (file)
@@ -344,8 +344,15 @@ static const char* airportGhostGetMember(naContext c, void* g, naRef field, naRe
     *out = naNum(apt->getMetar());
   } else if (!strcmp(fieldName, "runways")) {
     *out = naNewHash(c);
+    double minLengthFt = fgGetDouble("/sim/navdb/min-runway-length-ft");
     for(unsigned int r=0; r<apt->numRunways(); ++r) {
       FGRunway* rwy(apt->getRunwayByIndex(r));
+      
+    // ignore unusably short runways
+      if (rwy->lengthFt() < minLengthFt) {
+        continue;
+      }
+      
       naRef rwyid = stringToNasal(c, rwy->ident());
       naRef rwydata = ghostForRunway(c, rwy);
       naHash_set(*out, rwyid, rwydata);
@@ -918,6 +925,7 @@ class AirportInfoFilter : public FGAirport::AirportFilter
 {
 public:
   AirportInfoFilter() : type(FGPositioned::AIRPORT) {
+    minRunwayLengthFt = fgGetDouble("/sim/navdb/min-runway-length-ft", 0.0);
   }
   
   bool fromArg(naRef arg)
@@ -939,8 +947,21 @@ public:
   virtual FGPositioned::Type maxType() const {
     return type;
   }
+    
+  virtual bool pass(FGPositioned* aPos) const
+  {
+    FGAirport* apt = (FGAirport*) aPos;
+    if ((apt->type() == FGPositioned::AIRPORT) && 
+        !apt->hasHardRunwayOfLengthFt(minRunwayLengthFt)) 
+    {
+      return false;
+    }
+
+    return true;
+  }
   
   FGPositioned::Type type;
+  double minRunwayLengthFt;
 };
 
 // Returns data hash for particular or nearest airport of a <type>, or nil