X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FAirports%2Frunways.cxx;h=c3e48ecbbd67325b2993498d3f893fe002124b00;hb=e16f772e54216b0088ca9cb3f3b0fb062be8bfdb;hp=c3686bcaca481d9763759b40394628c81e24ee3b;hpb=b1e2b7ee207f3150df99264a7d3816cfb964648a;p=flightgear.git diff --git a/src/Airports/runways.cxx b/src/Airports/runways.cxx index c3686bcac..c3e48ecbb 100644 --- a/src/Airports/runways.cxx +++ b/src/Airports/runways.cxx @@ -27,14 +27,19 @@ #include // sprintf() #include // atoi() +#include #include #include + #include #include "runways.hxx" +#include +#include + using std::string; static std::string cleanRunwayNo(const std::string& aRwyNo) @@ -70,7 +75,8 @@ FGRunway::FGRunway(FGAirport* aAirport, const string& aIdent, bool reciprocal) : FGRunwayBase(RUNWAY, cleanRunwayNo(aIdent), aGeod, heading, length, width, surface_code, true), _airport(aAirport), - _reciprocal(reciprocal), + _isReciprocal(reciprocal), + _reciprocal(NULL), _displ_thresh(displ_thresh), _stopway(stopway), _ils(NULL) @@ -140,4 +146,55 @@ SGGeod FGRunway::threshold() const void FGRunway::processThreshold(SGPropertyNode* aThreshold) { assert(ident() == aThreshold->getStringValue("rwy")); + + double lon = aThreshold->getDoubleValue("lon"), + lat = aThreshold->getDoubleValue("lat"); + SGGeod newThreshold(SGGeod::fromDegM(lon, lat, mPosition.getElevationM())); + + _heading = aThreshold->getDoubleValue("hdg-deg"); + _displ_thresh = aThreshold->getDoubleValue("displ-m") * SG_METER_TO_FEET; + _stopway = aThreshold->getDoubleValue("stopw-m") * SG_METER_TO_FEET; + + // compute the new runway center, based on the threshold lat/lon and length, + double offsetFt = (0.5 * _length); + SGGeod newCenter; + double dummy; + SGGeodesy::direct(newThreshold, _heading, offsetFt * SG_FEET_TO_METER, newCenter, dummy); + mPosition = newCenter; +} + +void FGRunway::setReciprocalRunway(FGRunway* other) +{ + assert(_reciprocal==NULL); + assert((other->_reciprocal == NULL) || (other->_reciprocal == this)); + + _reciprocal = other; } + +std::vector FGRunway::getSIDs() +{ + std::vector result; + for (unsigned int i=0; i<_airport->numSIDs(); ++i) { + flightgear::SID* s = _airport->getSIDByIndex(i); + if (s->isForRunway(this)) { + result.push_back(s); + } + } // of SIDs at the airport iteration + + return result; +} + +std::vector FGRunway::getSTARs() +{ + std::vector result; + for (unsigned int i=0; i<_airport->numSTARs(); ++i) { + flightgear::STAR* s = _airport->getSTARByIndex(i); + if (s->isForRunway(this)) { + result.push_back(s); + } + } // of STARs at the airport iteration + + return result; +} + +