]> git.mxchange.org Git - flightgear.git/commitdiff
Fix runway elevations when threshold.xml is used.
authorJames Turner <jmt@Bishop.local>
Tue, 1 Jan 2013 20:58:42 +0000 (20:58 +0000)
committerJames Turner <jmt@Bishop.local>
Tue, 1 Jan 2013 20:58:42 +0000 (20:58 +0000)
SGGeodesy::direct doesn't preserve elevations, oops.

src/Airports/runwaybase.cxx
src/Navaids/NavDataCache.cxx

index e3e1bf02390ce14426f86c1458a66cc8929246f5..9bcee4e42f80b759374ebe1b46eb7a0865cd32c2 100644 (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;
index ded6d6edf27ec3c6c629492fb8759a9950199c4b..6b102f2fbde6e0389699f1349f39bc62da214aa9 100644 (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);
 }