1 // navrecord.hxx -- generic vor/dme/ndb class
3 // Written by Curtis Olson, started May 2004.
5 // Copyright (C) 2004 Curtis L. Olson - http://www.flightgear.org/~curt
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.
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.
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.
24 #ifndef _FG_NAVRECORD_HXX
25 #define _FG_NAVRECORD_HXX
29 #include "positioned.hxx"
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
36 // FIXME - get rid of these, and use the real enum directly
37 #define FG_NAV_VOR FGPositioned::VOR
38 #define FG_NAV_NDB FGPositioned::NDB
39 #define FG_NAV_ILS FGPositioned::ILS
40 #define FG_NAV_ANY FGPositioned::INVALID
42 typedef FGPositioned::Type fg_nav_types;
47 class FGNavRecord : public FGPositioned
52 double multiuse; // can be slaved variation of VOR
53 // (degrees) or localizer heading
54 // (degrees) or dme bias (nm)
56 std::string name; // verbose name in nav database
57 std::string apt_id; // corresponding airport id
60 bool serviceable; // for failure modeling
61 std::string trans_ident; // for failure modeling
64 * Helper to init data when a navrecord is associated with an airport
66 void initAirportRelation();
68 void alignLocaliserWithRunway(FGRunway* aRunway, double aThreshold);
70 inline ~FGNavRecord(void) {}
72 static FGNavRecord* createFromStream(std::istream& aStream);
74 FGNavRecord(Type type, const std::string& ident, const std::string& name,
76 int freq, int range, double multiuse);
78 inline double get_lon() const { return longitude(); } // degrees
79 inline double get_lat() const { return latitude(); } // degrees
80 inline double get_elev_ft() const { return elevation(); }
82 const SGGeod& get_pos() const { return geod(); }
83 SGVec3d get_cart() const;
85 Type get_fg_type() const { return type(); }
87 inline int get_freq() const { return freq; }
88 inline int get_range() const { return range; }
89 inline double get_multiuse() const { return multiuse; }
90 inline void set_multiuse( double m ) { multiuse = m; }
91 inline const char *get_ident() const { return ident().c_str(); }
92 inline const std::string& get_name() const { return name; }
93 inline const std::string& get_apt_id() const { return apt_id; }
94 inline bool get_serviceable() const { return serviceable; }
95 inline const char *get_trans_ident() const { return trans_ident.c_str(); }
100 class FGTACANRecord : public SGReferenced {
108 inline ~FGTACANRecord(void) {}
110 inline const std::string& get_channel() const { return channel; }
111 inline int get_freq() const { return freq; }
112 friend std::istream& operator>> ( std::istream&, FGTACANRecord& );
115 #endif // _FG_NAVRECORD_HXX