Standard property to ignore unusably short runways in NavDB.
Default values should match existing behaviour. Set /sim/navdb/min-runway-length-ft to skip short runways in GPS / Map / ND / Nasal queries.
This commit is contained in:
parent
8f10fff8dc
commit
ffac5ff889
7 changed files with 28 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -161,7 +161,7 @@ public:
|
|||
class HardSurfaceFilter : public AirportFilter
|
||||
{
|
||||
public:
|
||||
HardSurfaceFilter(double minLengthFt);
|
||||
HardSurfaceFilter(double minLengthFt = -1);
|
||||
|
||||
virtual bool passAirport(FGAirport* aApt) const;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue