]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/gnnode.hxx
Alexis Bory:
[flightgear.git] / src / Airports / gnnode.hxx
index a7627715e8e55190add131526e69edc09bcda447..5902badfbb7cf342df2bab035fa77583983ef6d0 100644 (file)
 #include <string>
 
 #include <simgear/compiler.h>
-#include <simgear/math/sg_geodesy.hxx>
+#include <simgear/structure/SGSharedPtr.hxx>
+
+#include <Navaids/positioned.hxx>
 
 class FGTaxiSegment;
+
 typedef std::vector<FGTaxiSegment*>  FGTaxiSegmentVector;
 typedef FGTaxiSegmentVector::iterator FGTaxiSegmentVectorIterator;
 
 bool sortByHeadingDiff(FGTaxiSegment *a, FGTaxiSegment *b);
 bool sortByLength     (FGTaxiSegment *a, FGTaxiSegment *b);
 
-class FGTaxiNode 
+class FGTaxiNode : public FGPositioned
 {
-private:
-  SGGeod geod;
+protected:
   int index;
 
   bool isOnRunway;
   int  holdType;
   FGTaxiSegmentVector next; // a vector of pointers to all the segments leaving from this node
 
-  // used in way finding
+  // used in way finding - should really move to a dynamic struct
   double pathScore;
   FGTaxiNode* previousNode;
   FGTaxiSegment* previousSeg;
 
-public:
-  FGTaxiNode() :
-      index(0),
-      isOnRunway(false),
-      holdType(0),
-      pathScore(0),
-      previousNode(0),
-      previousSeg(0)
-{
-};
-
-  FGTaxiNode(const FGTaxiNode &other) :
-      geod(other.geod),
-      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)
-{
-   geod          = other.geod;
-   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);
-  void setLongitude(double val);
+public:    
+  FGTaxiNode(PositionedID aGuid, int index, const SGGeod& pos, bool aOnRunway, int aHoldType);
+  virtual ~FGTaxiNode();
+  
   void setElevation(double val);
-  void setLatitude (const std::string& val);
-  void setLongitude(const std::string& 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; };
@@ -98,26 +62,28 @@ FGTaxiNode &operator =(const FGTaxiNode &other)
   FGTaxiSegment *getPreviousSegment() { return previousSeg;  };
 
   double getPathScore() { return pathScore; };
-  double getLatitude() { return geod.getLatitudeDeg();};
-  double getLongitude(){ return geod.getLongitudeDeg();};
-  double getElevation() { return geod.getElevationM();};
-
-  const SGGeod& getGeod() const { return geod; }
-
-  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();   }; 
+  double getElevationM (double refelev);
+  double getElevationFt(double refelev);
+  
+  int getIndex() const { return index; };
+  int getHoldPointType() const { return holdType; };
+  bool getIsOnRunway() const { return isOnRunway; };
+
+  const FGTaxiSegmentVector& arcs() const
+  { return next; }
+  
+  /// find the arg which leads from this node to another.
+  /// returns NULL if no such arc exists.
+  FGTaxiSegment* getArcTo(FGTaxiNode* aEnd) const;
+  
   bool operator<(const FGTaxiNode &other) const { return index < other.index; };
 
-  //void sortEndSegments(bool);
 
 };
 
-typedef std::vector<FGTaxiNode*> FGTaxiNodeVector;
+typedef SGSharedPtr<FGTaxiNode> FGTaxiNode_ptr;
+typedef std::vector<FGTaxiNode_ptr> FGTaxiNodeVector;
 typedef FGTaxiNodeVector::iterator FGTaxiNodeVectorIterator;
 
 #endif