2 #include "groundnetwork.hxx"
7 /*****************************************************************************
8 * Helper function for parsing position string
9 ****************************************************************************/
10 double processPosition(const string &pos)
19 prefix= subs.substr(0,1);
20 if (prefix == string("S") || (prefix == string("W")))
22 subs = subs.substr(1, subs.length());
23 degree = subs.substr(0, subs.find(" ",0));
24 decimal = subs.substr(subs.find(" ",0), subs.length());
27 //cerr << sign << " "<< degree << " " << decimal << endl;
28 value = sign * (atof(degree.c_str()) + atof(decimal.c_str())/60.0);
29 //cerr << value <<endl;
34 bool sortByHeadingDiff(FGTaxiSegment *a, FGTaxiSegment *b) {
35 return a->hasSmallerHeadingDiff(*b);
38 bool sortByLength(FGTaxiSegment *a, FGTaxiSegment *b) {
39 return a->getLength() > b->getLength();
42 /**************************************************************************
44 *************************************************************************/
47 void FGTaxiNode::setLatitude (double val)
49 geod.setLatitudeDeg(val);
52 void FGTaxiNode::setLongitude(double val)
54 geod.setLongitudeDeg(val);
57 void FGTaxiNode::setLatitude (const string& val)
59 geod.setLatitudeDeg(processPosition(val));
62 void FGTaxiNode::setLongitude(const string& val)
64 geod.setLongitudeDeg(processPosition(val));
67 void FGTaxiNode::sortEndSegments(bool byLength)
70 sort(next.begin(), next.end(), sortByLength);
72 sort(next.begin(), next.end(), sortByHeadingDiff);