X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNavaids%2Fairways.hxx;h=6942f30741175ee5e17c3b0b59f5ce49ea2f1854;hb=f11201d3d93d70d610e32496e363dc7e851e86c5;hp=f29ecbb20557da1ed515c49f35dad5919ff37891;hpb=02fb83c774020633cb62e3b8154337510bed1de3;p=flightgear.git diff --git a/src/Navaids/airways.hxx b/src/Navaids/airways.hxx index f29ecbb20..6942f3074 100644 --- a/src/Navaids/airways.hxx +++ b/src/Navaids/airways.hxx @@ -24,8 +24,9 @@ #include #include +#include -class FGPositioned; +class SGPath; typedef SGSharedPtr 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 AdjacencyMap; - AdjacencyMap _graph; - - typedef std::vector AdjacentWaypointVec; - - typedef std::map 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 findClosestNode(const SGGeod& aGeod); + + /** + * cache which positioned items are in this network + */ + typedef std::map 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; };