]> git.mxchange.org Git - flightgear.git/blob - src/Navaids/navrecord.hxx
James Turner: Improved runway management code:
[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 <simgear/math/SGMath.hxx>
30 #include <simgear/structure/SGReferenced.hxx>
31
32 #define FG_NAV_DEFAULT_RANGE 50 // nm
33 #define FG_LOC_DEFAULT_RANGE 18 // nm
34 #define FG_DME_DEFAULT_RANGE 50 // nm
35 #define FG_NAV_MAX_RANGE 300    // nm
36
37 // Shield the rest of FG from possibly changing details of Robins navaid type numbering system.
38 // Currently only the GPS code uses this - extra types (LOC, GS etc) may need to be added
39 // should other FG code choose to use this. 
40 enum fg_nav_types {
41     FG_NAV_VOR,
42     FG_NAV_NDB,
43     FG_NAV_ILS,
44     FG_NAV_ANY
45 };
46
47 class FGNavRecord : public SGReferenced {
48
49     int type;
50     SGGeod pos;                // location in geodetic coords (degrees)
51     SGVec3d cart;              // location in cartesian coords (earth centered)
52     int freq;
53     int range;
54     double multiuse;            // can be slaved variation of VOR
55                                 // (degrees) or localizer heading
56                                 // (degrees) or dme bias (nm)
57
58     std::string ident;          // navaid ident
59     std::string name;                // verbose name in nav database
60     std::string apt_id;              // corresponding airport id
61
62
63     bool serviceable;           // for failure modeling
64     std::string trans_ident;         // for failure modeling
65
66 public:
67     FGNavRecord(void);
68     inline ~FGNavRecord(void) {}
69
70     FGNavRecord(int type, const std::string& ident, const std::string& name, const std::string& airport,
71       double lat, double lon, int freq, int range, double multiuse);
72
73     inline int get_type() const { return type; }
74     
75     fg_nav_types get_fg_type() const;
76     
77     inline double get_lon() const { return pos.getLongitudeDeg(); } // degrees
78     inline void set_lon( double l ) { pos.setLongitudeDeg(l); } // degrees
79     inline double get_lat() const { return pos.getLatitudeDeg(); } // degrees
80     inline void set_lat( double l ) { pos.setLatitudeDeg(l); } // degrees
81     inline double get_elev_ft() const { return pos.getElevationFt(); }
82     inline void set_elev_ft( double e ) { pos.setElevationFt(e); }
83     const SGGeod& get_pos() const { return pos; }
84     const SGVec3d& get_cart() const { return cart; }
85     inline int get_freq() const { return freq; }
86     inline int get_range() const { return range; }
87     inline double get_multiuse() const { return multiuse; }
88     inline void set_multiuse( double m ) { multiuse = m; }
89     inline const char *get_ident() const { return ident.c_str(); }
90     inline const std::string& get_name() const { return name; }
91     inline const std::string& get_apt_id() const { return apt_id; }
92     inline bool get_serviceable() const { return serviceable; }
93     inline const char *get_trans_ident() const { return trans_ident.c_str(); }
94
95     friend std::istream& operator>> ( std::istream&, FGNavRecord& );
96 };
97
98 class FGTACANRecord : public SGReferenced {
99
100     std::string channel;                
101     int freq;
102      
103 public:
104     
105      FGTACANRecord(void);
106     inline ~FGTACANRecord(void) {}
107
108     inline const std::string& get_channel() const { return channel; }
109     inline int get_freq() const { return freq; }
110     friend std::istream& operator>> ( std::istream&, FGTACANRecord& );
111     };
112
113 #endif // _FG_NAVRECORD_HXX