]> git.mxchange.org Git - flightgear.git/blob - src/Airports/gnnode.hxx
- Added ultra-light traffic is now a separate traffic class that can have its
[flightgear.git] / src / Airports / gnnode.hxx
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.
5 //
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.
10 //
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.
14 //
15
16 #ifndef _GN_NODE_HXX_
17 #define _GN_NODE_HXX_
18
19 #include <vector>
20 #include <string>
21 #include <simgear/compiler.h>
22
23 SG_USING_STD(string);
24 SG_USING_STD(vector);
25
26 class FGTaxiSegment;
27 typedef vector<FGTaxiSegment*>  FGTaxiSegmentVector;
28 typedef FGTaxiSegmentVector::iterator FGTaxiSegmentVectorIterator;
29
30 bool sortByHeadingDiff(FGTaxiSegment *a, FGTaxiSegment *b);
31 bool sortByLength     (FGTaxiSegment *a, FGTaxiSegment *b);
32 double processPosition(const string& pos);
33
34 class FGTaxiNode 
35 {
36 private:
37   double lat;
38   double lon;
39   int index;
40   FGTaxiSegmentVector next; // a vector of pointers to all the segments leaving from this node
41   
42 public:
43   FGTaxiNode();
44   FGTaxiNode(double, double, int);
45
46   void setIndex(int idx)                  { index = idx;};
47   void setLatitude (double val)           { lat = val;};
48   void setLongitude(double val)           { lon = val;};
49   void setLatitude (const string& val)           { lat = processPosition(val);  };
50   void setLongitude(const string& val)           { lon = processPosition(val);  };
51   void addSegment(FGTaxiSegment *segment) { next.push_back(segment); };
52   
53   double getLatitude() { return lat;};
54   double getLongitude(){ return lon;};
55
56   int getIndex() { return index; };
57   FGTaxiNode *getAddress() { return this;};
58   FGTaxiSegmentVectorIterator getBeginRoute() { return next.begin(); };
59   FGTaxiSegmentVectorIterator getEndRoute()   { return next.end();   }; 
60   bool operator<(const FGTaxiNode &other) const { return index < other.index; };
61
62   void sortEndSegments(bool);
63
64   // used in way finding
65   double pathscore;
66   FGTaxiNode* previousnode;
67   FGTaxiSegment* previousseg;
68   
69 };
70
71 typedef vector<FGTaxiNode*> FGTaxiNodeVector;
72 typedef FGTaxiNodeVector::iterator FGTaxiNodeVectorIterator;
73
74 #endif