2007-07-15 14:08:31 +00:00
|
|
|
#include "gnnode.hxx"
|
|
|
|
|
2012-09-25 00:31:17 +01:00
|
|
|
#include <boost/foreach.hpp>
|
|
|
|
|
|
|
|
#include "groundnetwork.hxx"
|
2011-10-09 00:25:04 +02:00
|
|
|
|
2012-10-01 17:18:36 +01:00
|
|
|
#include <Navaids/NavDataCache.hxx>
|
2011-10-09 00:25:04 +02:00
|
|
|
#include <Main/globals.hxx>
|
|
|
|
#include <Scenery/scenery.hxx>
|
|
|
|
|
2012-10-01 17:18:36 +01:00
|
|
|
using namespace flightgear;
|
|
|
|
|
2007-07-15 14:08:31 +00:00
|
|
|
/**************************************************************************
|
|
|
|
* FGTaxiNode
|
|
|
|
*************************************************************************/
|
|
|
|
|
2012-10-01 17:18:36 +01:00
|
|
|
FGTaxiNode::FGTaxiNode(PositionedID aGuid, const SGGeod& pos, bool aOnRunway, int aHoldType) :
|
2012-09-25 00:31:17 +01:00
|
|
|
FGPositioned(aGuid, FGPositioned::PARKING, "", pos),
|
|
|
|
isOnRunway(aOnRunway),
|
|
|
|
holdType(aHoldType)
|
2009-06-09 19:39:18 +00:00
|
|
|
{
|
2012-09-25 00:31:17 +01:00
|
|
|
|
2009-06-09 19:39:18 +00:00
|
|
|
}
|
|
|
|
|
2012-09-25 00:31:17 +01:00
|
|
|
FGTaxiNode::~FGTaxiNode()
|
2009-06-09 19:39:18 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-09-25 00:31:17 +01:00
|
|
|
void FGTaxiNode::setElevation(double val)
|
2009-06-09 19:39:18 +00:00
|
|
|
{
|
2012-09-25 00:31:17 +01:00
|
|
|
// ignored for the moment
|
2009-06-09 19:39:18 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 17:18:36 +01:00
|
|
|
double FGTaxiNode::getElevationFt()
|
2011-10-09 00:25:04 +02:00
|
|
|
{
|
2012-10-01 17:18:36 +01:00
|
|
|
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 )) {
|
|
|
|
|
2012-11-10 14:48:00 +00:00
|
|
|
SGGeod newPos = mPosition;
|
|
|
|
newPos.setElevationM(elevationEnd);
|
|
|
|
// this will call modifyPosition to update mPosition
|
2012-12-23 23:32:53 +00:00
|
|
|
NavDataCache* cache = NavDataCache::instance();
|
|
|
|
NavDataCache::Transaction txn(cache);
|
|
|
|
cache->updatePosition(guid(), newPos);
|
|
|
|
txn.commit();
|
2011-10-09 00:25:04 +02:00
|
|
|
}
|
2012-10-01 17:18:36 +01:00
|
|
|
}
|
|
|
|
|
2012-09-25 00:31:17 +01:00
|
|
|
return mPosition.getElevationFt();
|
2011-10-09 00:25:04 +02:00
|
|
|
}
|
2011-09-03 11:26:17 +02:00
|
|
|
|
2012-10-01 17:18:36 +01:00
|
|
|
double FGTaxiNode::getElevationM()
|
2011-10-09 00:25:04 +02:00
|
|
|
{
|
2012-10-01 17:18:36 +01:00
|
|
|
return getElevationFt() * SG_FEET_TO_METER;
|
2011-10-09 00:25:04 +02:00
|
|
|
}
|