#ifndef _GN_NODE_HXX_
#define _GN_NODE_HXX_
-#include <vector>
-#include <string>
-
#include <simgear/compiler.h>
-#include <simgear/math/sg_geodesy.hxx>
-
-using std::string;
-using std::vector;
-
-class FGTaxiSegment;
-typedef vector<FGTaxiSegment*> FGTaxiSegmentVector;
-typedef FGTaxiSegmentVector::iterator FGTaxiSegmentVectorIterator;
+#include <simgear/structure/SGSharedPtr.hxx>
-bool sortByHeadingDiff(FGTaxiSegment *a, FGTaxiSegment *b);
-bool sortByLength (FGTaxiSegment *a, FGTaxiSegment *b);
-double processPosition(const string& pos);
+#include <Navaids/positioned.hxx>
-class FGTaxiNode
+class FGTaxiNode : public FGPositioned
{
-private:
- double lat;
- double lon;
- int index;
-
+protected:
bool isOnRunway;
int holdType;
- FGTaxiSegmentVector next; // a vector of pointers to all the segments leaving from this node
-
- // used in way finding
- double pathScore;
- FGTaxiNode* previousNode;
- FGTaxiSegment* previousSeg;
-
-public:
- FGTaxiNode() :
- lat (0.0),
- lon (0.0),
- index(0),
- isOnRunway(false),
- holdType(0),
- pathScore(0),
- previousNode(0),
- previousSeg(0)
-{
-};
-
- FGTaxiNode(const FGTaxiNode &other) :
- lat(other.lat),
- lon(other.lon),
- index(other.index),
- isOnRunway(other.isOnRunway),
- holdType(other.holdType),
- next(other.next),
- pathScore(other.pathScore),
- previousNode(other.previousNode),
- previousSeg(other.previousSeg)
-{
-};
-
-FGTaxiNode &operator =(const FGTaxiNode &other)
-{
- lat = other.lat;
- lon = other.lon;
- index = other.index;
- isOnRunway = other.isOnRunway;
- holdType = other.holdType;
- next = other.next;
- pathScore = other.pathScore;
- previousNode = other.previousNode;
- previousSeg = other.previousSeg;
- return *this;
-};
-
- void setIndex(int idx) { index = idx; };
- void setLatitude (double val) { lat = val; };
- void setLongitude(double val) { lon = val; };
- void setLatitude (const string& val) { lat = processPosition(val); };
- void setLongitude(const string& val) { lon = processPosition(val); };
- void addSegment(FGTaxiSegment *segment) { next.push_back(segment); };
- void setHoldPointType(int val) { holdType = val; };
- void setOnRunway(bool val) { isOnRunway = val; };
-
- void setPathScore (double val) { pathScore = val; };
- void setPreviousNode(FGTaxiNode *val) { previousNode = val; };
- void setPreviousSeg (FGTaxiSegment *val) { previousSeg = val; };
-
- FGTaxiNode *getPreviousNode() { return previousNode; };
- FGTaxiSegment *getPreviousSegment() { return previousSeg; };
-
- double getPathScore() { return pathScore; };
- double getLatitude() { return lat;};
- double getLongitude(){ return lon;};
-
- SGGeod geod() const { return SGGeod::fromDeg(lon, lat); }
-
- int getIndex() { return index; };
- int getHoldPointType() { return holdType; };
- bool getIsOnRunway() { return isOnRunway; };
-
- FGTaxiNode *getAddress() { return this;};
- FGTaxiSegmentVectorIterator getBeginRoute() { return next.begin(); };
- FGTaxiSegmentVectorIterator getEndRoute() { return next.end(); };
- bool operator<(const FGTaxiNode &other) const { return index < other.index; };
-
- void sortEndSegments(bool);
+public:
+ FGTaxiNode(PositionedID aGuid, const SGGeod& pos, bool aOnRunway, int aHoldType);
+ virtual ~FGTaxiNode();
+
+ void setElevation(double val);
+
+ double getElevationM ();
+ double getElevationFt();
+
+ PositionedID getIndex() const { return guid(); };
+ int getHoldPointType() const { return holdType; };
+ bool getIsOnRunway() const { return isOnRunway; };
};
-typedef vector<FGTaxiNode*> FGTaxiNodeVector;
+typedef SGSharedPtr<FGTaxiNode> FGTaxiNode_ptr;
+typedef std::vector<FGTaxiNode_ptr> FGTaxiNodeVector;
typedef FGTaxiNodeVector::iterator FGTaxiNodeVectorIterator;
#endif