]> git.mxchange.org Git - flightgear.git/blob - src/Navaids/navrecord.hxx
bind the sky disable cutoff distance to a property
[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 #define FG_NAV_DEFAULT_RANGE 50 // nm
32 #define FG_LOC_DEFAULT_RANGE 18 // nm
33 #define FG_DME_DEFAULT_RANGE 50 // nm
34 #define 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 _name;                // verbose name in nav database
50     FGRunway* mRunway;        // associated runway, if there is one
51
52     bool serviceable;           // for failure modeling
53
54   /**
55    * Helper to init data when a navrecord is associated with an airport
56    */
57   void initAirportRelation();
58   
59   void alignLocaliserWithRunway(double aThreshold);
60   
61   void readAirportSceneryData();
62   void processSceneryILS(SGPropertyNode* aILSNode);
63 public:
64   inline ~FGNavRecord(void) {}
65
66     FGNavRecord(Type type, const std::string& ident, const std::string& name,
67       const SGGeod& aPos,
68       int freq, int range, double multiuse);
69     
70     inline double get_lon() const { return longitude(); } // degrees
71     inline double get_lat() const { return latitude(); } // degrees
72     inline double get_elev_ft() const { return elevation(); }
73         
74     inline int get_freq() const { return freq; }
75     inline int get_range() const { return range; }
76     inline double get_multiuse() const { return multiuse; }
77     inline void set_multiuse( double m ) { multiuse = m; }
78     inline const char *get_ident() const { return ident().c_str(); }
79
80     inline bool get_serviceable() const { return serviceable; }
81     inline const char *get_trans_ident() const { return get_ident(); }
82
83   virtual const std::string& name() const
84   { return _name; }
85   
86   /**
87    * Retrieve the runway this navaid is associated with (for ILS/LOC/GS)
88    */
89   FGRunway* runway() const { return mRunway; }
90   
91   virtual flightgear::PositionedBinding* createBinding(SGPropertyNode* nd) const;
92
93   /**
94    * return the localizer width, in degrees
95    * computation is based up ICAO stdandard width at the runway threshold
96    * see implementation for further details.
97    */
98   double localizerWidth() const;
99   
100   void bindToNode(SGPropertyNode* nd) const;
101   void unbindFromNode(SGPropertyNode* nd) const;
102 };
103
104 class FGTACANRecord : public SGReferenced {
105
106     std::string channel;                
107     int freq;
108      
109 public:
110     
111      FGTACANRecord(void);
112     inline ~FGTACANRecord(void) {}
113
114     inline const std::string& get_channel() const { return channel; }
115     inline int get_freq() const { return freq; }
116     friend std::istream& operator>> ( std::istream&, FGTACANRecord& );
117     };
118
119 #endif // _FG_NAVRECORD_HXX