]> git.mxchange.org Git - flightgear.git/blobdiff - src/Navaids/procedure.cxx
NasalCanvas: Clean up and expose Element node ghost
[flightgear.git] / src / Navaids / procedure.cxx
index be3df320436af163ed363a62f647e8e0df78e297..94afcdd2c69b3cd9f9e6a64dff5696ad0e650705 100644 (file)
@@ -49,6 +49,14 @@ Approach::Approach(const string& aIdent, ProcedureType ty) :
 {
 
 }
+    
+Approach* Approach::createTempApproach(const std::string& aIdent, FGRunway* aRunway, const WayptVec& aPath)
+{
+    Approach* app = new Approach(aIdent, PROCEDURE_APPROACH_RNAV);
+    app->setRunway(aRunway);
+    app->setPrimaryAndMissed(aPath, WayptVec());
+    return app;
+}
 
 void Approach::setRunway(FGRunwayRef aRwy)
 {
@@ -118,7 +126,9 @@ bool Approach::route(WayptRef aIAF, WayptVec& aWps)
 bool Approach::routeFromVectors(WayptVec& aWps)
 {
   aWps.insert(aWps.end(), _primary.begin(), _primary.end());
-  aWps.push_back(new RunwayWaypt(_runway, NULL));
+  RunwayWaypt* rwy = new RunwayWaypt(_runway, NULL);
+  rwy->setFlag(WPT_APPROACH);
+  aWps.push_back(rwy);
   aWps.insert(aWps.end(), _missed.begin(), _missed.end());
   return true;
 }
@@ -150,7 +160,7 @@ bool ArrivalDeparture::isForRunway(const FGRunway* aWay) const
   }
   
   FGRunwayRef r(const_cast<FGRunway*>(aWay));
-  return (_runways.count(r));
+  return (_runways.count(r) > 0);
 }
 
 RunwayVec ArrivalDeparture::runways() const
@@ -327,6 +337,19 @@ bool SID::route(FGRunwayRef aWay, Transition* trans, WayptVec& aPath)
 
   return true;
 }
+    
+SID* SID::createTempSID(const std::string& aIdent, FGRunway* aRunway, const WayptVec& aPath)
+{
+// flip waypoints since SID stores them reversed
+    WayptVec path;
+    std::back_insert_iterator<WayptVec> bi(path);
+    std::reverse_copy(aPath.begin(), aPath.end(), bi);
+    
+    SID* sid = new SID(aIdent, aRunway->airport());
+    sid->setCommon(path);
+    sid->addRunway(aRunway);
+    return sid;
+}
 
 ////////////////////////////////////////////////////////////////////////////