X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAirports%2Frunways.cxx;h=f97cd14e83aee82c4c4dde7e078d2a77362ba50d;hb=2dee4ef14ff449381d11ef2d55d07b2e199677af;hp=fc70d8384237883cf6920471a80d7f7eb75d0576;hpb=0824fe68f3fec838c3d0b8500966560c7397047e;p=flightgear.git diff --git a/src/Airports/runways.cxx b/src/Airports/runways.cxx index fc70d8384..f97cd14e8 100644 --- a/src/Airports/runways.cxx +++ b/src/Airports/runways.cxx @@ -30,6 +30,8 @@ #include +#include + #include #include "runways.hxx" @@ -71,7 +73,8 @@ FGRunway::FGRunway(FGAirport* aAirport, const string& aIdent, _airport(aAirport), _reciprocal(reciprocal), _displ_thresh(displ_thresh), - _stopway(stopway) + _stopway(stopway), + _ils(NULL) { } @@ -135,3 +138,23 @@ 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, length, + // and any displaced threshold. + double offsetFt = (0.5 * _length) - _displ_thresh; + SGGeod newCenter; + double dummy; + SGGeodesy::direct(newThreshold, _heading, offsetFt * SG_FEET_TO_METER, newCenter, dummy); + mPosition = newCenter; +}