]> git.mxchange.org Git - flightgear.git/commitdiff
Fix total-distance computation in the route-manager, and expose some additional value...
authorJames Turner <zakalawe@mac.com>
Tue, 27 Mar 2012 20:54:38 +0000 (21:54 +0100)
committerJames Turner <zakalawe@mac.com>
Tue, 27 Mar 2012 20:54:38 +0000 (21:54 +0100)
src/Autopilot/route_mgr.cxx

index 4abd9286f1fec2a99b32f4d6dcfdff2182eac8b7..160fa7bd00b95afeeb669b49af9a0ac4e4b982b2 100644 (file)
@@ -992,6 +992,8 @@ void FGRouteMgr::update_mirror()
   mirror->removeChildren("wp");
   
   int num = numWaypts();
+  double totalDistanceEnroute = 0.0;
+    
   for (int i = 0; i < num; i++) {
     Waypt* wp = _route[i];
     SGPropertyNode *prop = mirror->getChild("wp", i, 1);
@@ -1008,6 +1010,8 @@ void FGRouteMgr::update_mirror()
         next->courseAndDistanceFrom(pos);
       prop->setDoubleValue("leg-bearing-true-deg", crsDist.first);
       prop->setDoubleValue("leg-distance-nm", crsDist.second * SG_METER_TO_NM);
+      prop->setDoubleValue("distance-along-route-nm", totalDistanceEnroute);
+      totalDistanceEnroute += crsDist.second * SG_METER_TO_NM;
     }
     
     if (wp->altitudeRestriction() != RESTRICT_NONE) {
@@ -1049,6 +1053,16 @@ void FGRouteMgr::update_mirror()
   if (rmDlg) {
     rmDlg->updateValues();
   }
+    
+  if (_departure) {
+    departure->setDoubleValue("field-elevation-ft", _departure->getElevation());
+  }
+  
+  if (_destination) {
+    destination->setDoubleValue("field-elevation-ft", _destination->getElevation());
+  }
+  
+  totalDistance->setDoubleValue(totalDistanceEnroute);
 }
 
 // command interface /autopilot/route-manager/input: