]> git.mxchange.org Git - flightgear.git/blobdiff - src/Navaids/routePath.cxx
Prepare and implement reinit methods for instruments
[flightgear.git] / src / Navaids / routePath.cxx
index ee67effb52c1c58c23ad1c9bae52bd5814b28d66..160407528c6fadc75a1ace30098abf996b7df821 100644 (file)
@@ -12,6 +12,7 @@
 #include <Main/globals.hxx>
 #include <Airports/runways.hxx>
 #include <Navaids/waypoint.hxx>
+#include <Navaids/FlightPlan.hxx>
 #include <Navaids/positioned.hxx>
 
 namespace flightgear {
@@ -53,11 +54,24 @@ double pointsKnownDistanceFromGC(const SGGeoc& a, const SGGeoc&b, const SGGeoc&
 
 RoutePath::RoutePath(const flightgear::WayptVec& wpts) :
   _waypts(wpts)
+{
+  commonInit();
+}
+
+RoutePath::RoutePath(const flightgear::FlightPlan* fp)
+{
+  for (int l=0; l<fp->numLegs(); ++l) {
+    _waypts.push_back(fp->legAtIndex(l)->waypoint());
+  }
+  commonInit();
+}
+
+void RoutePath::commonInit()
 {
   _pathClimbFPM = 1200;
   _pathDescentFPM = 800;
   _pathIAS = 190; 
-  _pathTurnRate = 3.0; // 3 deg/sec = 180def/min = standard rate turn
+  _pathTurnRate = 3.0; // 3 deg/sec = 180def/min = standard rate turn  
 }
 
 SGGeodVec RoutePath::pathForIndex(int index) const