]> git.mxchange.org Git - flightgear.git/blobdiff - src/Navaids/airways.hxx
MapWidget: make partially use of the new colocated DME information.
[flightgear.git] / src / Navaids / airways.hxx
index f29ecbb20557da1ed515c49f35dad5919ff37891..6942f30741175ee5e17c3b0b59f5ce49ea2f1854 100644 (file)
@@ -24,8 +24,9 @@
 #include <vector>
 
 #include <Navaids/route.hxx>
+#include <Navaids/positioned.hxx>
 
-class FGPositioned;
+class SGPath;
 typedef SGSharedPtr<FGPositioned> FGPositionedRef; 
 
 namespace flightgear {
@@ -35,13 +36,13 @@ struct SearchContext;
 class AdjacentWaypoint;
 class InAirwayFilter;
 
-class Airway : public Route
+class Airway
 {
 public:
   virtual std::string ident() const
   { return _ident; }
   
-  static void load();
+  static void load(const SGPath& path);
   
   /**
    * Track a network of airways
@@ -53,7 +54,6 @@ public:
     friend class Airway;
     friend class InAirwayFilter;
     
-    
   
     /**
      * Principal routing algorithm. Attempts to find the best route beween
@@ -65,26 +65,21 @@ public:
      */
     bool route(WayptRef aFrom, WayptRef aTo, WayptVec& aPath);
   private:    
-    void addEdge(Airway* aWay, const SGGeod& aStartPos, 
+    void addEdge(int aWay, const SGGeod& aStartPos,
                 const std::string& aStartIdent, 
                 const SGGeod& aEndPos, const std::string& aEndIdent);
   
-    Airway* findAirway(const std::string& aName, double aTop, double aBase);
-    
-    typedef std::multimap<FGPositioned*, AdjacentWaypoint*> AdjacencyMap;
-    AdjacencyMap _graph;
-    
-    typedef std::vector<AdjacentWaypoint*> AdjacentWaypointVec;
-
-    typedef std::map<std::string, Airway*> AirwayDict;
-    AirwayDict _airways;
+    int findAirway(const std::string& aName, double aTop, double aBase);
 
+    bool cleanGeneratedPath(WayptRef aFrom, WayptRef aTo, WayptVec& aPath,
+                            bool exactTo, bool exactFrom);
+      
     bool search2(FGPositionedRef aStart, FGPositionedRef aDest, WayptVec& aRoute);
   
     /**
      * Test if a positioned item is part of this airway network or not.
      */
-    bool inNetwork(const FGPositioned* aRef) const;
+    bool inNetwork(PositionedID pos) const;
     
     /**
      * Find the closest node on the network, to the specified waypoint
@@ -103,7 +98,16 @@ public:
     /**
      * Overloaded version working with a raw SGGeod
      */
+  
     std::pair<FGPositionedRef, bool> findClosestNode(const SGGeod& aGeod);
+    
+    /**
+     * cache which positioned items are in this network
+     */
+    typedef std::map<PositionedID, bool> NetworkMembershipDict;
+    mutable NetworkMembershipDict _inNetworkCache;
+    
+    int _networkID;
   };
 
 
@@ -115,15 +119,9 @@ private:
 
   friend class Network;
   
-  static Network* static_highLevel;
-  static Network* static_lowLevel;
-  
   std::string _ident;
   double _topAltitudeFt;
   double _bottomAltitudeFt;
-
-  // high-level vs low-level flag
-  // ... ?
   
   WayptVec _elements;
 };