X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAirports%2Frunways.cxx;h=3eb853823e4d39f0927fcba599c71f3d08750217;hb=8b57675aef4930245a964816469be922e3004287;hp=fc70d8384237883cf6920471a80d7f7eb75d0576;hpb=8a756eee5404eefbe88d0899439366b50e491c2a;p=flightgear.git diff --git a/src/Airports/runways.cxx b/src/Airports/runways.cxx index fc70d8384..3eb853823 100644 --- a/src/Airports/runways.cxx +++ b/src/Airports/runways.cxx @@ -30,6 +30,8 @@ #include +#include + #include #include "runways.hxx" @@ -69,9 +71,11 @@ 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) + _stopway(stopway), + _ils(NULL) { } @@ -135,3 +139,31 @@ SGGeod FGRunway::threshold() const return pointOnCenterline(_displ_thresh * SG_FEET_TO_METER); } +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; +} +