1
0
Fork 0

Fix runway elevations when threshold.xml is used.

SGGeodesy::direct doesn't preserve elevations, oops.
This commit is contained in:
James Turner 2013-01-01 20:58:42 +00:00
parent f48ad2f20b
commit f3dec6a64d
2 changed files with 8 additions and 12 deletions

View file

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

View file

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