]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/runways.cxx
Merge branch 'next' into durk-atc
[flightgear.git] / src / Airports / runways.cxx
index c076d8cfc1ff0f44d5f3233742256abab563ca01..c3e48ecbbd67325b2993498d3f893fe002124b00 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <cstdio>              // sprintf()
 #include <cstdlib>             // atoi()
+#include <cassert>
 
 #include <simgear/compiler.h>
 
@@ -36,6 +37,9 @@
 
 #include "runways.hxx"
 
+#include <Airports/simple.hxx>
+#include <Navaids/procedure.hxx>
+
 using std::string;
 
 static std::string cleanRunwayNo(const std::string& aRwyNo)
@@ -151,9 +155,8 @@ void FGRunway::processThreshold(SGPropertyNode* aThreshold)
   _displ_thresh = aThreshold->getDoubleValue("displ-m") * SG_METER_TO_FEET;
   _stopway = aThreshold->getDoubleValue("stopw-m") * SG_METER_TO_FEET;
   
-  // compute the new runway center, based on the threshold lat/lon, length,
-  // and any displaced threshold.
-  double offsetFt = (0.5 * _length) - _displ_thresh;
+  // compute the new runway center, based on the threshold lat/lon and length,
+  double offsetFt = (0.5 * _length);
   SGGeod newCenter;
   double dummy;
   SGGeodesy::direct(newThreshold, _heading, offsetFt * SG_FEET_TO_METER, newCenter, dummy);
@@ -168,3 +171,30 @@ void FGRunway::setReciprocalRunway(FGRunway* other)
   _reciprocal = other;
 }
 
+std::vector<flightgear::SID*> FGRunway::getSIDs()
+{
+  std::vector<flightgear::SID*> result;
+  for (unsigned int i=0; i<_airport->numSIDs(); ++i) {
+    flightgear::SID* s = _airport->getSIDByIndex(i);
+    if (s->isForRunway(this)) {
+      result.push_back(s);
+    }
+  } // of SIDs at the airport iteration
+  
+  return result;
+}
+
+std::vector<flightgear::STAR*> FGRunway::getSTARs()
+{
+  std::vector<flightgear::STAR*> result;
+  for (unsigned int i=0; i<_airport->numSTARs(); ++i) {
+    flightgear::STAR* s = _airport->getSTARByIndex(i);
+    if (s->isForRunway(this)) {
+      result.push_back(s);
+    }
+  } // of STARs at the airport iteration
+  
+  return result;
+}
+
+