FlightGear next
navrecord.hxx
Go to the documentation of this file.
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"
32
33#include <simgear/props/propsfwd.hxx>
34#include <simgear/timing/timestamp.hxx>
35
36const double FG_NAV_DEFAULT_RANGE = 50; // nm
37const double FG_LOC_DEFAULT_RANGE = 18; // nm
38const double FG_DME_DEFAULT_RANGE = 50; // nm
39const double FG_TACAN_DEFAULT_RANGE = 250; // nm
40const double FG_NAV_MAX_RANGE = 300; // nm
41
43{
44
45 int freq;
46 int range;
47 double multiuse; // can be slaved variation of VOR
48 // (degrees) or localizer heading
49 // (degrees) or dme bias (nm)
50
51 std::string mName; // verbose name in nav database
52 PositionedID mRunway; // associated runway, if there is one
53 PositionedID mColocated; // Colocated DME at a navaid (ILS, VOR, TACAN, NDB)
54
55 protected:
56 mutable bool serviceable; // for failure modeling
57
58 public:
59 static bool isType(FGPositioned::Type ty)
60 { return (ty >= FGPositioned::NDB) && (ty <= FGPositioned::DME); }
61
63 Type type,
64 const std::string& ident,
65 const std::string& name,
66 const SGGeod& aPos,
67 int freq,
68 int range,
69 double multiuse,
70 PositionedID aRunway );
71
72 inline double get_lon() const { return longitude(); } // degrees
73 inline double get_lat() const { return latitude(); } // degrees
74 inline double get_elev_ft() const { return elevation(); }
75
76 inline int get_freq() const { return freq; }
77 inline int get_range() const { return range; }
78 inline double get_multiuse() const { return multiuse; }
79 inline void set_multiuse( double m ) { multiuse = m; }
80 inline const char *get_ident() const { return ident().c_str(); }
81
82 inline bool get_serviceable() const { return serviceable; }
83 inline const char *get_trans_ident() const { return get_ident(); }
84
85 virtual const std::string& name() const
86 { return mName; }
87
91 FGRunwayRef runway() const;
92
98 double localizerWidth() const;
99
105 double glideSlopeAngleDeg() const;
106
107 void bindToNode(SGPropertyNode* nd) const;
108 void unbindFromNode(SGPropertyNode* nd) const;
109
110 void setColocatedDME(PositionedID other);
111
112 bool hasDME() const;
113
115
116 bool isVORTAC() const;
117
118 void updateFromXML(const SGGeod& geod, double heading);
119};
120
126 public FGNavRecord
127{
128 public:
130 {
131 return (ty == MOBILE_TACAN);
132 }
133
135 Type type,
136 const std::string& ident,
137 const std::string& name,
138 const SGGeod& aPos,
139 int freq,
140 int range,
141 double multiuse,
142 PositionedID aRunway );
143
144 virtual const SGGeod& geod() const;
145 virtual const SGVec3d& cart() const;
146
147 void updateVehicle();
148 void updatePos();
149
150 void clearVehicle();
151
152protected:
154 SGPropertyNode_ptr _vehicle_node;
155 double _initial_elevation_ft; // Elevation as given in the config file
156};
157
158class FGTACANRecord : public SGReferenced {
159
160 std::string channel;
161 int freq;
162
163public:
164
165 FGTACANRecord(void);
166 inline ~FGTACANRecord(void) {}
167
168 inline const std::string& get_channel() const { return channel; }
169 inline int get_freq() const { return freq; }
170 friend std::istream& operator>> ( std::istream&, FGTACANRecord& );
171 };
172
173#endif // _FG_NAVRECORD_HXX
SGSharedPtr< FGRunway > FGRunwayRef
virtual const SGGeod & geod() const
virtual const SGVec3d & cart() const
The cartesian position associated with this object.
FGMobileNavRecord(PositionedID aGuid, Type type, const std::string &ident, const std::string &name, const SGGeod &aPos, int freq, int range, double multiuse, PositionedID aRunway)
double _initial_elevation_ft
static bool isType(FGPositioned::Type ty)
SGTimeStamp _last_vehicle_update
SGPropertyNode_ptr _vehicle_node
int get_freq() const
Definition navrecord.hxx:76
int get_range() const
Definition navrecord.hxx:77
void unbindFromNode(SGPropertyNode *nd) const
FGNavRecord(PositionedID aGuid, Type type, const std::string &ident, const std::string &name, const SGGeod &aPos, int freq, int range, double multiuse, PositionedID aRunway)
Definition navrecord.cxx:44
bool get_serviceable() const
Definition navrecord.hxx:82
static bool isType(FGPositioned::Type ty)
Definition navrecord.hxx:59
const char * get_ident() const
Definition navrecord.hxx:80
double get_lat() const
Definition navrecord.hxx:73
void bindToNode(SGPropertyNode *nd) const
void set_multiuse(double m)
Definition navrecord.hxx:79
double get_elev_ft() const
Definition navrecord.hxx:74
const char * get_trans_ident() const
Definition navrecord.hxx:83
double get_lon() const
Definition navrecord.hxx:72
void setColocatedDME(PositionedID other)
bool hasDME() const
Definition navrecord.cxx:96
virtual const std::string & name() const
Return the name of this positioned.
Definition navrecord.hxx:85
double get_multiuse() const
Definition navrecord.hxx:78
double glideSlopeAngleDeg() const
extract the glide slope angle, in degrees, from the multiuse field Return 0.0 for non-GS navaids (inc...
PositionedID colocatedDME() const
double localizerWidth() const
return the localizer width, in degrees computation is based up ICAO stdandard width at the runway thr...
Definition navrecord.cxx:63
bool serviceable
Definition navrecord.hxx:56
FGRunwayRef runway() const
Retrieve the runway this navaid is associated with (for ILS/LOC/GS)
Definition navrecord.cxx:58
void updateFromXML(const SGGeod &geod, double heading)
bool isVORTAC() const
FGPositioned(PositionedID aGuid, Type ty, const std::string &aIdent, const SGGeod &aPos)
double longitude() const
virtual const SGGeod & geod() const
double latitude() const
@ DME
important that DME & TACAN are adjacent to keep the TacanFilter efficient - DMEs are proxies for TACA...
double elevation() const
Type type() const
const std::string & ident() const
~FGTACANRecord(void)
int get_freq() const
FGTACANRecord(void)
friend std::istream & operator>>(std::istream &, FGTACANRecord &)
const std::string & get_channel() const
const char * name
const double FG_TACAN_DEFAULT_RANGE
Definition navrecord.hxx:39
const double FG_NAV_MAX_RANGE
Definition navrecord.hxx:40
const double FG_DME_DEFAULT_RANGE
Definition navrecord.hxx:38
const double FG_NAV_DEFAULT_RANGE
Definition navrecord.hxx:36
const double FG_LOC_DEFAULT_RANGE
Definition navrecord.hxx:37
int64_t PositionedID