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;
result, dummyAz2);
return result;
}
+
+bool FGRunway::isHardSurface() const
+{
+ return ((_surface_code == 1) || (_surface_code == 2));
+}
+
{
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,
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.
*/
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
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
/**
* 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;
// 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 {
_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:
_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:
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(
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);
}