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
class HardSurfaceFilter : public AirportFilter
{
public:
- HardSurfaceFilter(double minLengthFt);
+ HardSurfaceFilter(double minLengthFt = -1);
virtual bool passAirport(FGAirport* aApt) const;
{
_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 {
{
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);
_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),
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));
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'
bool requireHardSurface() const { return _requireHardSurface; }
- double minRunwayLengthFt() const { return _minRunwayLengthFt; }
-
bool cdiDeflectionIsAngular() const { return (_cdiMaxDeflectionNm <= 0.0); }
double cdiDeflectionLinearPeg() const
*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);
{
public:
AirportInfoFilter() : type(FGPositioned::AIRPORT) {
+ minRunwayLengthFt = fgGetDouble("/sim/navdb/min-runway-length-ft", 0.0);
}
bool fromArg(naRef arg)
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