#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) :
- FGPositioned(aGuid, FGPositioned::PARKING, "", pos),
- index(index),
+FGTaxiNode::FGTaxiNode(int index, const SGGeod& pos, bool aOnRunway, int aHoldType) :
+ FGPositioned(TRANSIENT_ID, FGPositioned::PARKING, "", pos),
+ m_index(index),
isOnRunway(aOnRunway),
- holdType(aHoldType)
+ holdType(aHoldType),
+ m_isPushback(false)
{
}
// ignored for the moment
}
-double FGTaxiNode::getElevationFt(double refelev)
+double FGTaxiNode::getElevationFt()
{
-#if 0
- double elevF = elevation();
- 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);
- }
+ const SGGeod& pos = geod();
+ if( pos.getElevationFt() == 0.0)
+ {
+ SGGeod center2 = pos;
+ 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 = pos;
+ newPos.setElevationM(elevationEnd);
+ // this will call modifyPosition to update mPosition
+ modifyPosition(newPos);
}
-#endif
- return mPosition.getElevationFt();
+ }
+
+ return pos.getElevationFt();
}
-double FGTaxiNode::getElevationM(double refelev)
+int FGTaxiNode::getIndex() const
{
- return geod().getElevationM();
+ return m_index;
}
-FGTaxiSegment* FGTaxiNode::getArcTo(FGTaxiNode* aEnd) const
+void FGTaxiNode::setIsPushback()
{
- BOOST_FOREACH(FGTaxiSegment* arc, next) {
- if (arc->getEnd() == aEnd) {
- return arc;
- }
- }
-
- return NULL;
+ m_isPushback = true;
+}
+
+double FGTaxiNode::getElevationM()
+{
+ return getElevationFt() * SG_FEET_TO_METER;
}