2 #include "groundnetwork.hxx"
8 #include <Main/globals.hxx>
9 #include <Scenery/scenery.hxx>
13 /*****************************************************************************
14 * Helper function for parsing position string
15 ****************************************************************************/
16 double processPosition(const string &pos)
25 prefix= subs.substr(0,1);
26 if (prefix == string("S") || (prefix == string("W")))
28 subs = subs.substr(1, subs.length());
29 degree = subs.substr(0, subs.find(" ",0));
30 decimal = subs.substr(subs.find(" ",0), subs.length());
33 //cerr << sign << " "<< degree << " " << decimal << endl;
34 value = sign * (atof(degree.c_str()) + atof(decimal.c_str())/60.0);
35 //cerr << value <<endl;
40 //bool sortByHeadingDiff(FGTaxiSegment *a, FGTaxiSegment *b) {
41 // return a->hasSmallerHeadingDiff(*b);
44 bool sortByLength(FGTaxiSegment *a, FGTaxiSegment *b) {
45 return a->getLength() > b->getLength();
48 /**************************************************************************
50 *************************************************************************/
51 void FGTaxiNode::setElevation(double val)
53 geod.setElevationM(val);
56 void FGTaxiNode::setLatitude (double val)
58 geod.setLatitudeDeg(val);
61 void FGTaxiNode::setLongitude(double val)
63 geod.setLongitudeDeg(val);
66 void FGTaxiNode::setLatitude (const string& val)
68 geod.setLatitudeDeg(processPosition(val));
71 void FGTaxiNode::setLongitude(const string& val)
73 geod.setLongitudeDeg(processPosition(val));
76 double FGTaxiNode::getElevationFt(double refelev)
78 double elevF = geod.getElevationFt();
79 double elevationEnd = 0;
80 if ((elevF == 0) || (elevF == refelev)) {
81 SGGeod center2 = geod;
82 FGScenery * local_scenery = globals->get_scenery();
83 center2.setElevationM(SG_MAX_ELEVATION_M);
84 if (local_scenery->get_elevation_m( center2, elevationEnd, NULL )) {
85 geod.setElevationM(elevationEnd);
88 //cerr << "Returning elevation : " << geod.getElevationM() << ". Ref elev (feet) = " << refelev << endl;
89 return geod.getElevationFt();
92 double FGTaxiNode::getElevationM(double refelev)
94 //double refelevFt = refelev * SG_METER_TO_FEET;
95 //double retval = getElevationFt(refelevFt);
96 //cerr << "Returning elevation : " << geod.getElevationM() << ". Ref elev (meters) = " << refelev << endl;
97 return geod.getElevationM();