]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/gnnode.cxx
toggle fullscreen: also adapt GUI plane when resizing
[flightgear.git] / src / Airports / gnnode.cxx
index 41e746305cde34e123f89d50559c41a9e670cf52..1f0e13d26077c6cf22632db834f76599083cd5df 100644 (file)
@@ -4,16 +4,18 @@
 
 #include "groundnetwork.hxx"
 
+#include <Navaids/NavDataCache.hxx>
 #include <Main/globals.hxx>
 #include <Scenery/scenery.hxx>
 
+using namespace flightgear;
+
 /**************************************************************************
  * FGTaxiNode
  *************************************************************************/
 
-FGTaxiNode::FGTaxiNode(PositionedID aGuid, int index, const SGGeod& pos, bool aOnRunway, int aHoldType) :
+FGTaxiNode::FGTaxiNode(PositionedID aGuid, const SGGeod& pos, bool aOnRunway, int aHoldType) :
   FGPositioned(aGuid, FGPositioned::PARKING, "", pos),
-  index(index),
   isOnRunway(aOnRunway),
   holdType(aHoldType)
 {
@@ -29,35 +31,26 @@ void FGTaxiNode::setElevation(double val)
   // ignored for the moment
 }
 
-double FGTaxiNode::getElevationFt(double refelev)
+double FGTaxiNode::getElevationFt()
 {
-    double elevF = elevation();
-#if 0
-    double elevationEnd = 0;
-    if ((elevF == 0) || (elevF == refelev)) {
-        SGGeod center2 = mPosition;
-        FGScenery * local_scenery = globals->get_scenery();
-        center2.setElevationM(SG_MAX_ELEVATION_M);
-        if (local_scenery->get_elevation_m( center2, elevationEnd, NULL )) {
-            geod.setElevationM(elevationEnd);
-        }
+  if (mPosition.getElevationFt() == 0.0) {
+    SGGeod center2 = mPosition;
+    FGScenery* local_scenery = globals->get_scenery();
+    center2.setElevationM(SG_MAX_ELEVATION_M);
+    double elevationEnd = -100;
+    if (local_scenery->get_elevation_m( center2, elevationEnd, NULL )) {
+      
+      SGGeod newPos = mPosition;
+      newPos.setElevationM(elevationEnd);
+    // this will call modifyPosition to update mPosition
+      NavDataCache::instance()->updatePosition(guid(), newPos);
     }
-#endif
+  }
+  
   return mPosition.getElevationFt();
 }
 
-double FGTaxiNode::getElevationM(double refelev)
+double FGTaxiNode::getElevationM()
 {
-    return geod().getElevationM();
-}
-
-FGTaxiSegment* FGTaxiNode::getArcTo(FGTaxiNode* aEnd) const
-{
-  BOOST_FOREACH(FGTaxiSegment* arc, next) {
-    if (arc->getEnd() == aEnd) {
-      return arc;
-    }
-  }
-  
-  return NULL;
+  return getElevationFt() * SG_FEET_TO_METER;
 }