]> git.mxchange.org Git - flightgear.git/blob - src/Navaids/navrecord.hxx
MapWidget: silence compiler warning
[flightgear.git] / src / Navaids / navrecord.hxx
1 // navrecord.hxx -- generic vor/dme/ndb class
2 //
3 // Written by Curtis Olson, started May 2004.
4 //
5 // Copyright (C) 2004  Curtis L. Olson - http://www.flightgear.org/~curt
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 // $Id$
22
23
24 #ifndef _FG_NAVRECORD_HXX
25 #define _FG_NAVRECORD_HXX
26
27 #include <iosfwd>
28
29 #include "navaids_fwd.hxx"
30 #include "positioned.hxx"
31 #include <Airports/airports_fwd.hxx>
32
33 const double FG_NAV_DEFAULT_RANGE = 50; // nm
34 const double FG_LOC_DEFAULT_RANGE = 18; // nm
35 const double FG_DME_DEFAULT_RANGE = 50; // nm
36 const double FG_NAV_MAX_RANGE = 300;    // nm
37
38 class FGNavRecord : public FGPositioned 
39 {
40
41     int freq;
42     int range;
43     double multiuse;            // can be slaved variation of VOR
44                                 // (degrees) or localizer heading
45                                 // (degrees) or dme bias (nm)
46
47     std::string mName;                // verbose name in nav database
48     PositionedID mRunway;        // associated runway, if there is one
49     PositionedID mColocated;     // Colocated DME at a navaid (ILS, VOR, TACAN, NDB)
50     bool serviceable;           // for failure modeling
51
52 public:
53   FGNavRecord(PositionedID aGuid, Type type, const std::string& ident,
54               const std::string& name,
55               const SGGeod& aPos,
56               int freq, int range, double multiuse,
57               PositionedID aRunway);
58     
59     inline double get_lon() const { return longitude(); } // degrees
60     inline double get_lat() const { return latitude(); } // degrees
61     inline double get_elev_ft() const { return elevation(); }
62         
63     inline int get_freq() const { return freq; }
64     inline int get_range() const { return range; }
65     inline double get_multiuse() const { return multiuse; }
66     inline void set_multiuse( double m ) { multiuse = m; }
67     inline const char *get_ident() const { return ident().c_str(); }
68
69     inline bool get_serviceable() const { return serviceable; }
70     inline const char *get_trans_ident() const { return get_ident(); }
71
72   virtual const std::string& name() const
73   { return mName; }
74   
75   /**
76    * Retrieve the runway this navaid is associated with (for ILS/LOC/GS)
77    */
78   FGRunwayRef runway() const;
79   
80   /**
81    * return the localizer width, in degrees
82    * computation is based up ICAO stdandard width at the runway threshold
83    * see implementation for further details.
84    */
85   double localizerWidth() const;
86   
87   void bindToNode(SGPropertyNode* nd) const;
88   void unbindFromNode(SGPropertyNode* nd) const;
89
90   void setColocatedDME(PositionedID other);
91   bool hasDME();
92     
93     void updateFromXML(const SGGeod& geod, double heading);
94 };
95
96 class FGTACANRecord : public SGReferenced {
97
98     std::string channel;                
99     int freq;
100      
101 public:
102     
103      FGTACANRecord(void);
104     inline ~FGTACANRecord(void) {}
105
106     inline const std::string& get_channel() const { return channel; }
107     inline int get_freq() const { return freq; }
108     friend std::istream& operator>> ( std::istream&, FGTACANRecord& );
109     };
110
111 #endif // _FG_NAVRECORD_HXX