1
0
Fork 0

Finish conversion of FGRunway to a real class - all public members are gone.

This commit is contained in:
jmt 2008-12-24 15:45:35 +00:00
parent 7d5d756095
commit 02d1b14c1a
7 changed files with 50 additions and 24 deletions

View 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));
}

View 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

View 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

View 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;

View 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:

View file

@ -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(

View 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);
}