From f3dec6a64de2199d0cf86e1ff29f36506f8a6d8d Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 1 Jan 2013 20:58:42 +0000 Subject: [PATCH] Fix runway elevations when threshold.xml is used. SGGeodesy::direct doesn't preserve elevations, oops. --- src/Airports/runwaybase.cxx | 11 ++++------- src/Navaids/NavDataCache.cxx | 9 ++++----- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Airports/runwaybase.cxx b/src/Airports/runwaybase.cxx index e3e1bf023..9bcee4e42 100644 --- a/src/Airports/runwaybase.cxx +++ b/src/Airports/runwaybase.cxx @@ -61,18 +61,15 @@ FGRunwayBase::FGRunwayBase(PositionedID aGuid, Type aTy, const string& aIdent, SGGeod FGRunwayBase::pointOnCenterline(double aOffset) const { - SGGeod result; - double dummyAz2; double halfLengthMetres = lengthM() * 0.5; - SGGeodesy::direct(mPosition, _heading, - aOffset - halfLengthMetres, - result, dummyAz2); + SGGeod result = SGGeodesy::direct(mPosition, _heading, + aOffset - halfLengthMetres); + result.setElevationM(mPosition.getElevationM()); + return result; } - - SGGeod FGRunwayBase::pointOffCenterline(double aOffset, double lateralOffset) const { SGGeod result; diff --git a/src/Navaids/NavDataCache.cxx b/src/Navaids/NavDataCache.cxx index ded6d6edf..6b102f2fb 100644 --- a/src/Navaids/NavDataCache.cxx +++ b/src/Navaids/NavDataCache.cxx @@ -997,7 +997,7 @@ FGPositioned* NavDataCache::NavDataCachePrivate::loadById(sqlite3_int64 rowid) double lat = sqlite3_column_double(loadPositioned, 6); double elev = sqlite3_column_double(loadPositioned, 7); SGGeod pos = SGGeod::fromDegM(lon, lat, elev); - + reset(loadPositioned); switch (ty) { @@ -1562,10 +1562,9 @@ void NavDataCache::updateRunwayThreshold(PositionedID runwayID, const SGGeod &aT // compute the new runway center, based on the threshold lat/lon and length, double offsetFt = (0.5 * d->runwayLengthFt(runwayID)); - SGGeod newCenter; - double dummy; - SGGeodesy::direct(aThreshold, aHeading, offsetFt * SG_FEET_TO_METER, newCenter, dummy); - + SGGeod newCenter= SGGeodesy::direct(aThreshold, aHeading, offsetFt * SG_FEET_TO_METER); + newCenter.setElevationM(aThreshold.getElevationM()); + // now update the positional data updatePosition(runwayID, newCenter); } -- 2.39.5