#include <vector>
#include <Navaids/route.hxx>
+#include <Navaids/positioned.hxx>
-class FGPositioned;
+class SGPath;
typedef SGSharedPtr<FGPositioned> FGPositionedRef;
namespace flightgear {
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
friend class Airway;
friend class InAirwayFilter;
-
/**
* Principal routing algorithm. Attempts to find the best route beween
*/
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
/**
* 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;
};
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;
};