]> git.mxchange.org Git - flightgear.git/blob - src/Navaids/navrecord.hxx
Port more airport/navaid methods to cppbind
[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
50     bool serviceable;           // for failure modeling
51
52   void processSceneryILS(SGPropertyNode* aILSNode);
53 public:
54   FGNavRecord(PositionedID aGuid, Type type, const std::string& ident,
55               const std::string& name,
56               const SGGeod& aPos,
57               int freq, int range, double multiuse,
58               PositionedID aRunway);
59     
60     inline double get_lon() const { return longitude(); } // degrees
61     inline double get_lat() const { return latitude(); } // degrees
62     inline double get_elev_ft() const { return elevation(); }
63         
64     inline int get_freq() const { return freq; }
65     inline int get_range() const { return range; }
66     inline double get_multiuse() const { return multiuse; }
67     inline void set_multiuse( double m ) { multiuse = m; }
68     inline const char *get_ident() const { return ident().c_str(); }
69
70     inline bool get_serviceable() const { return serviceable; }
71     inline const char *get_trans_ident() const { return get_ident(); }
72
73   virtual const std::string& name() const
74   { return mName; }
75   
76   /**
77    * Retrieve the runway this navaid is associated with (for ILS/LOC/GS)
78    */
79   FGRunway* runway() const;
80   
81   /**
82    * return the localizer width, in degrees
83    * computation is based up ICAO stdandard width at the runway threshold
84    * see implementation for further details.
85    */
86   double localizerWidth() const;
87   
88   void bindToNode(SGPropertyNode* nd) const;
89   void unbindFromNode(SGPropertyNode* nd) const;
90 };
91
92 class FGTACANRecord : public SGReferenced {
93
94     std::string channel;                
95     int freq;
96      
97 public:
98     
99      FGTACANRecord(void);
100     inline ~FGTACANRecord(void) {}
101
102     inline const std::string& get_channel() const { return channel; }
103     inline int get_freq() const { return freq; }
104     friend std::istream& operator>> ( std::istream&, FGTACANRecord& );
105     };
106
107 #endif // _FG_NAVRECORD_HXX