FlightGear next
gnnode.cxx
Go to the documentation of this file.
1#include "config.h"
2
3#include <Main/globals.hxx>
5#include <Scenery/scenery.hxx>
6
7#include "gnnode.hxx"
8#include "groundnetwork.hxx"
9
10using namespace flightgear;
11
12
13/**************************************************************************
14 * FGTaxiNode
15 *************************************************************************/
16
17FGTaxiNode::FGTaxiNode(FGPositioned::Type ty, int index, const SGGeod& pos,
18 bool aOnRunway, int aHoldType,
19 const std::string& ident) : FGPositioned(NavDataCache::instance()->createTransientID(), ty, ident, pos),
20 m_index(index),
21 isOnRunway(aOnRunway),
22 holdType(aHoldType),
23 m_isPushback(false)
24{
25}
26
28{
29 // ignored for the moment
30}
31
33{
34 const SGGeod& pos = geod();
35 if (pos.getElevationFt() == 0.0) {
36 SGGeod center2 = pos;
37 FGScenery* local_scenery = globals->get_scenery();
38 center2.setElevationM(SG_MAX_ELEVATION_M);
39 if (local_scenery) {
40 double elevationEnd = -100;
41 if (local_scenery->get_elevation_m(center2, elevationEnd, NULL)) {
42 SGGeod newPos = pos;
43 newPos.setElevationM(elevationEnd);
44 // this will call modifyPosition to update mPosition
45 modifyPosition(newPos);
46 }
47 } else {
48 SG_LOG(SG_TERRAIN, SG_ALERT, "Terrain not inited");
49 }
50 }
51
52 return pos.getElevationFt();
53}
54
56{
57 return m_index;
58}
59
61{
62 m_isPushback = true;
63}
64
66{
67 return getElevationFt() * SG_FEET_TO_METER;
68}
FGPositioned(PositionedID aGuid, Type ty, const std::string &aIdent, const SGGeod &aPos)
friend class flightgear::NavDataCache
void modifyPosition(const SGGeod &newPos)
virtual const SGGeod & geod() const
const std::string & ident() const
bool get_elevation_m(const SGGeod &geod, double &alt, const simgear::BVHMaterial **material, const osg::Node *butNotFrom=0)
Compute the elevation of the scenery at geodetic latitude lat, geodetic longitude lon and not higher ...
Definition scenery.cxx:527
const int holdType
Definition gnnode.hxx:19
double getElevationFt()
Definition gnnode.cxx:32
FGTaxiNode(FGPositioned::Type ty, int index, const SGGeod &pos, bool aOnRunway, int aHoldType, const std::string &ident={})
Definition gnnode.cxx:17
void setIsPushback()
Definition gnnode.cxx:60
void setElevation(double val)
Definition gnnode.cxx:27
bool m_isPushback
Definition gnnode.hxx:20
double getElevationM()
Definition gnnode.cxx:65
const bool isOnRunway
Definition gnnode.hxx:18
int getIndex() const
Definition gnnode.cxx:55
const int m_index
Definition gnnode.hxx:16
FGGlobals * globals
Definition globals.cxx:142
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
Definition Addon.cxx:53