]> git.mxchange.org Git - flightgear.git/blob - src/Navaids/navrecord.hxx
Whoops, work-around for #926 correctly.
[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 "positioned.hxx"
30
31 const double FG_NAV_DEFAULT_RANGE = 50; // nm
32 const double FG_LOC_DEFAULT_RANGE = 18; // nm
33 const double FG_DME_DEFAULT_RANGE = 50; // nm
34 const double FG_NAV_MAX_RANGE = 300;    // nm
35
36 // forward decls
37 class FGRunway;
38 class SGPropertyNode;
39
40 class FGNavRecord : public FGPositioned 
41 {
42
43     int freq;
44     int range;
45     double multiuse;            // can be slaved variation of VOR
46                                 // (degrees) or localizer heading
47                                 // (degrees) or dme bias (nm)
48
49     std::string mName;                // verbose name in nav database
50     PositionedID mRunway;        // associated runway, if there is one
51
52     bool serviceable;           // for failure modeling
53
54   void processSceneryILS(SGPropertyNode* aILSNode);
55 public:
56   FGNavRecord(PositionedID aGuid, Type type, const std::string& ident,
57               const std::string& name,
58               const SGGeod& aPos,
59               int freq, int range, double multiuse,
60               PositionedID aRunway);
61     
62     inline double get_lon() const { return longitude(); } // degrees
63     inline double get_lat() const { return latitude(); } // degrees
64     inline double get_elev_ft() const { return elevation(); }
65         
66     inline int get_freq() const { return freq; }
67     inline int get_range() const { return range; }
68     inline double get_multiuse() const { return multiuse; }
69     inline void set_multiuse( double m ) { multiuse = m; }
70     inline const char *get_ident() const { return ident().c_str(); }
71
72     inline bool get_serviceable() const { return serviceable; }
73     inline const char *get_trans_ident() const { return get_ident(); }
74
75   virtual const std::string& name() const
76   { return mName; }
77   
78   /**
79    * Retrieve the runway this navaid is associated with (for ILS/LOC/GS)
80    */
81   FGRunway* runway() const;
82   
83   /**
84    * return the localizer width, in degrees
85    * computation is based up ICAO stdandard width at the runway threshold
86    * see implementation for further details.
87    */
88   double localizerWidth() const;
89   
90   void bindToNode(SGPropertyNode* nd) const;
91   void unbindFromNode(SGPropertyNode* nd) const;
92 };
93
94 class FGTACANRecord : public SGReferenced {
95
96     std::string channel;                
97     int freq;
98      
99 public:
100     
101      FGTACANRecord(void);
102     inline ~FGTACANRecord(void) {}
103
104     inline const std::string& get_channel() const { return channel; }
105     inline int get_freq() const { return freq; }
106     friend std::istream& operator>> ( std::istream&, FGTACANRecord& );
107     };
108
109 #endif // _FG_NAVRECORD_HXX