]> git.mxchange.org Git - flightgear.git/blob - src/Airports/gnnode.hxx
Thomas Foerster: Made FGParking a subclass of FGTaxiNode
[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 double processPosition(const string& pos);
31
32 class FGTaxiNode 
33 {
34 private:
35   double lat;
36   double lon;
37   int index;
38   FGTaxiSegmentVector next; // a vector of pointers to all the segments leaving from this node
39   
40 public:
41   FGTaxiNode();
42   FGTaxiNode(double, double, int);
43
44   void setIndex(int idx)                  { index = idx;};
45   void setLatitude (double val)           { lat = val;};
46   void setLongitude(double val)           { lon = val;};
47   void setLatitude (const string& val)           { lat = processPosition(val);  };
48   void setLongitude(const string& val)           { lon = processPosition(val);  };
49   void addSegment(FGTaxiSegment *segment) { next.push_back(segment); };
50   
51   double getLatitude() { return lat;};
52   double getLongitude(){ return lon;};
53
54   int getIndex() { return index; };
55   FGTaxiNode *getAddress() { return this;};
56   FGTaxiSegmentVectorIterator getBeginRoute() { return next.begin(); };
57   FGTaxiSegmentVectorIterator getEndRoute()   { return next.end();   }; 
58   bool operator<(const FGTaxiNode &other) const { return index < other.index; };
59
60   void sortEndSegments(bool);
61
62   // used in way finding
63   double pathscore;
64   FGTaxiNode* previousnode;
65   FGTaxiSegment* previousseg;
66   
67 };
68
69 typedef vector<FGTaxiNode*> FGTaxiNodeVector;
70 typedef FGTaxiNodeVector::iterator FGTaxiNodeVectorIterator;
71
72 #endif