1 // This program is free software; you can redistribute it and/or
2 // modify it under the terms of the GNU General Public License as
3 // published by the Free Software Foundation; either version 2 of the
4 // License, or (at your option) any later version.
6 // This program is distributed in the hope that it will be useful, but
7 // WITHOUT ANY WARRANTY; without even the implied warranty of
8 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 // General Public License for more details.
11 // You should have received a copy of the GNU General Public License
12 // along with this program; if not, write to the Free Software
13 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include <simgear/compiler.h>
23 #include <simgear/math/sg_geodesy.hxx>
29 typedef vector<FGTaxiSegment*> FGTaxiSegmentVector;
30 typedef FGTaxiSegmentVector::iterator FGTaxiSegmentVectorIterator;
32 bool sortByHeadingDiff(FGTaxiSegment *a, FGTaxiSegment *b);
33 bool sortByLength (FGTaxiSegment *a, FGTaxiSegment *b);
34 double processPosition(const string& pos);
45 FGTaxiSegmentVector next; // a vector of pointers to all the segments leaving from this node
47 // used in way finding
49 FGTaxiNode* previousNode;
50 FGTaxiSegment* previousSeg;
65 FGTaxiNode(const FGTaxiNode &other) :
69 isOnRunway(other.isOnRunway),
70 holdType(other.holdType),
72 pathScore(other.pathScore),
73 previousNode(other.previousNode),
74 previousSeg(other.previousSeg)
78 FGTaxiNode &operator =(const FGTaxiNode &other)
83 isOnRunway = other.isOnRunway;
84 holdType = other.holdType;
86 pathScore = other.pathScore;
87 previousNode = other.previousNode;
88 previousSeg = other.previousSeg;
92 void setIndex(int idx) { index = idx; };
93 void setLatitude (double val) { lat = val; };
94 void setLongitude(double val) { lon = val; };
95 void setLatitude (const string& val) { lat = processPosition(val); };
96 void setLongitude(const string& val) { lon = processPosition(val); };
97 void addSegment(FGTaxiSegment *segment) { next.push_back(segment); };
98 void setHoldPointType(int val) { holdType = val; };
99 void setOnRunway(bool val) { isOnRunway = val; };
101 void setPathScore (double val) { pathScore = val; };
102 void setPreviousNode(FGTaxiNode *val) { previousNode = val; };
103 void setPreviousSeg (FGTaxiSegment *val) { previousSeg = val; };
105 FGTaxiNode *getPreviousNode() { return previousNode; };
106 FGTaxiSegment *getPreviousSegment() { return previousSeg; };
108 double getPathScore() { return pathScore; };
109 double getLatitude() { return lat;};
110 double getLongitude(){ return lon;};
112 SGGeod geod() const { return SGGeod::fromDeg(lon, lat); }
114 int getIndex() { return index; };
115 int getHoldPointType() { return holdType; };
116 bool getIsOnRunway() { return isOnRunway; };
118 FGTaxiNode *getAddress() { return this;};
119 FGTaxiSegmentVectorIterator getBeginRoute() { return next.begin(); };
120 FGTaxiSegmentVectorIterator getEndRoute() { return next.end(); };
121 bool operator<(const FGTaxiNode &other) const { return index < other.index; };
123 void sortEndSegments(bool);
127 typedef vector<FGTaxiNode*> FGTaxiNodeVector;
128 typedef FGTaxiNodeVector::iterator FGTaxiNodeVectorIterator;