X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNavaids%2Fawynet.hxx;h=4aa424d999e33833cec102a9d890a5e58822085b;hb=487546c848ad5559760b4de4aa36f19b9b8627a7;hp=a2f4dd6987f28b08bc2fdf9a77103990b8f44730;hpb=10ebe0628568e0377f2a6fd6c8c1926d53280c92;p=flightgear.git diff --git a/src/Navaids/awynet.hxx b/src/Navaids/awynet.hxx old mode 100755 new mode 100644 index a2f4dd698..4aa424d99 --- a/src/Navaids/awynet.hxx +++ b/src/Navaids/awynet.hxx @@ -17,37 +17,32 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. // // $Id$ #ifndef _AIRWAYNETWORK_HXX_ #define _AIRWAYNETWORK_HXX_ -#include STL_STRING -#include +#include +#include #include #include #include -SG_USING_STD(string); -SG_USING_STD(map); -SG_USING_STD(set); -SG_USING_STD(vector); -SG_USING_STD(fstream); - -#include #include //#include "parking.hxx" class FGAirway; // forward reference +class SGPath; +class SGGeod; -typedef vector FGAirwayVector; -typedef vector FGAirwayPointerVector; -typedef vector::iterator FGAirwayVectorIterator; -typedef vector::iterator FGAirwayPointerVectorIterator; +typedef std::vector FGAirwayVector; +typedef std::vector FGAirwayPointerVector; +typedef std::vector::iterator FGAirwayVectorIterator; +typedef std::vector::iterator FGAirwayPointerVectorIterator; /************************************************************************************** * class FGNode @@ -55,40 +50,35 @@ typedef vector::iterator FGAirwayPointerVectorIterator; class FGNode { private: - string ident; - double lat; - double lon; + std::string ident; + SGGeod geod; + SGVec3d cart; // cached cartesian position int index; FGAirwayPointerVector next; // a vector to all the segments leaving from this node public: FGNode(); - FGNode(double lt, double ln, int idx, string id) { lat = lt; lon = ln; index = idx; ident = id;}; + FGNode(const SGGeod& aPos, int idx, std::string id); 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 addAirway(FGAirway *segment) { next.push_back(segment); }; - double getLatitude() { return lat;}; - double getLongitude(){ return lon;}; - + const SGGeod& getPosition() {return geod;} + const SGVec3d& getCart() { return cart; } int getIndex() { return index; }; - string getIdent() { return ident; }; + std::string getIdent() { return ident; }; FGNode *getAddress() { return this;}; FGAirwayPointerVectorIterator getBeginRoute() { return next.begin(); }; FGAirwayPointerVectorIterator getEndRoute() { return next.end(); }; - bool matches(string ident, double lat, double lon); + bool matches(std::string ident, const SGGeod& aPos); }; -typedef vector FGNodeVector; -typedef vector::iterator FGNodeVectorIterator; +typedef std::vector FGNodeVector; +typedef std::vector::iterator FGNodeVectorIterator; -typedef map < string, FGNode *> node_map; +typedef std::map < std::string, FGNode *> node_map; typedef node_map::iterator node_map_iterator; typedef node_map::const_iterator const_node_map_iterator; @@ -99,8 +89,8 @@ typedef node_map::const_iterator const_node_map_iterator; class FGAirway { private: - string startNode; - string endNode; + std::string startNode; + std::string endNode; double length; FGNode *start; FGNode *end; @@ -108,37 +98,37 @@ private: int type; // 1=low altitude; 2=high altitude airway int base; // base altitude int top; // top altitude - string name; + std::string name; public: FGAirway(); FGAirway(FGNode *, FGNode *, int); void setIndex (int val) { index = val; }; - void setStartNodeRef (string val) { startNode = val; }; - void setEndNodeRef (string val) { endNode = val; }; + void setStartNodeRef (std::string val) { startNode = val; }; + void setEndNodeRef (std::string val) { endNode = val; }; void setStart(node_map *nodes); void setEnd (node_map *nodes); void setType (int tp) { type = tp;}; void setBase (int val) { base = val;}; void setTop (int val) { top = val;}; - void setName (string val) { name = val;}; + void setName (std::string val) { name = val;}; void setTrackDistance(); FGNode * getEnd() { return end;}; double getLength() { if (length == 0) setTrackDistance(); return length; }; int getIndex() { return index; }; - string getName() { return name; }; + std::string getName() { return name; }; }; -typedef vector intVec; -typedef vector::iterator intVecIterator; -typedef vector::const_iterator constIntVecIterator; +typedef std::vector intVec; +typedef std::vector::iterator intVecIterator; +typedef std::vector::const_iterator constIntVecIterator; class FGAirRoute { @@ -158,10 +148,10 @@ public: void add(const FGAirRoute &other); void add(int node) {nodes.push_back(node);}; - friend istream& operator >> (istream& in, FGAirRoute& r); + friend std::istream& operator >> (std::istream& in, FGAirRoute& r); }; -inline istream& operator >> ( istream& in, FGAirRoute& r ) +inline std::istream& operator >> ( std::istream& in, FGAirRoute& r ) { int node; in >> node; @@ -170,8 +160,8 @@ inline istream& operator >> ( istream& in, FGAirRoute& r ) return in; } -typedef vector AirRouteVector; -typedef vector::iterator AirRouteVectorIterator; +typedef std::vector AirRouteVector; +typedef std::vector::iterator AirRouteVectorIterator; /************************************************************************************** * class FGAirwayNetwork @@ -192,6 +182,7 @@ private: public: FGAirwayNetwork(); + ~FGAirwayNetwork(); //void addNode (const FGNode& node); //void addNodes (FGParkingVec *parkings); @@ -199,12 +190,12 @@ public: void init(); bool exists() { return hasNetwork; }; - int findNearestNode(double lat, double lon); + int findNearestNode(const SGGeod& aPos); FGNode *findNode(int idx); FGAirRoute findShortestRoute(int start, int end); void trace(FGNode *, int, int, double dist); - void load(SGPath path); + void load(const SGPath& path); }; #endif