2004-05-28 05:24:54 +00:00
|
|
|
// navrecord.hxx -- generic vor/dme/ndb class
|
|
|
|
//
|
|
|
|
// Written by Curtis Olson, started May 2004.
|
|
|
|
//
|
2004-11-19 22:10:41 +00:00
|
|
|
// Copyright (C) 2004 Curtis L. Olson - http://www.flightgear.org/~curt
|
2004-05-28 05:24:54 +00:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
2006-02-21 01:16:04 +00:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-05-28 05:24:54 +00:00
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _FG_NAVRECORD_HXX
|
|
|
|
#define _FG_NAVRECORD_HXX
|
|
|
|
|
2008-08-03 14:34:42 +00:00
|
|
|
#include <iosfwd>
|
2004-05-28 05:24:54 +00:00
|
|
|
|
2013-03-06 00:04:18 +00:00
|
|
|
#include "navaids_fwd.hxx"
|
2008-09-12 08:46:15 +00:00
|
|
|
#include "positioned.hxx"
|
2013-03-06 00:04:18 +00:00
|
|
|
#include <Airports/airports_fwd.hxx>
|
2007-10-20 08:36:21 +00:00
|
|
|
|
2014-03-02 00:34:04 +00:00
|
|
|
#include <simgear/props/propsfwd.hxx>
|
2014-03-01 19:18:02 +00:00
|
|
|
#include <simgear/timing/timestamp.hxx>
|
|
|
|
|
2012-08-27 23:26:36 +00:00
|
|
|
const double FG_NAV_DEFAULT_RANGE = 50; // nm
|
|
|
|
const double FG_LOC_DEFAULT_RANGE = 18; // nm
|
|
|
|
const double FG_DME_DEFAULT_RANGE = 50; // nm
|
2014-03-02 15:52:00 +00:00
|
|
|
const double FG_TACAN_DEFAULT_RANGE = 250; // nm
|
2012-08-27 23:26:36 +00:00
|
|
|
const double FG_NAV_MAX_RANGE = 300; // nm
|
2004-05-28 05:24:54 +00:00
|
|
|
|
2008-09-12 08:46:15 +00:00
|
|
|
class FGNavRecord : public FGPositioned
|
|
|
|
{
|
2004-05-28 05:24:54 +00:00
|
|
|
|
|
|
|
int freq;
|
|
|
|
int range;
|
|
|
|
double multiuse; // can be slaved variation of VOR
|
|
|
|
// (degrees) or localizer heading
|
|
|
|
// (degrees) or dme bias (nm)
|
|
|
|
|
2014-03-01 19:18:02 +00:00
|
|
|
std::string mName; // verbose name in nav database
|
|
|
|
PositionedID mRunway; // associated runway, if there is one
|
|
|
|
PositionedID mColocated; // Colocated DME at a navaid (ILS, VOR, TACAN, NDB)
|
|
|
|
|
|
|
|
protected:
|
|
|
|
mutable bool serviceable; // for failure modeling
|
|
|
|
|
|
|
|
public:
|
|
|
|
FGNavRecord( PositionedID aGuid,
|
|
|
|
Type type,
|
|
|
|
const std::string& ident,
|
|
|
|
const std::string& name,
|
|
|
|
const SGGeod& aPos,
|
|
|
|
int freq,
|
|
|
|
int range,
|
|
|
|
double multiuse,
|
|
|
|
PositionedID aRunway );
|
2004-05-28 05:24:54 +00:00
|
|
|
|
2008-09-12 08:46:15 +00:00
|
|
|
inline double get_lon() const { return longitude(); } // degrees
|
|
|
|
inline double get_lat() const { return latitude(); } // degrees
|
|
|
|
inline double get_elev_ft() const { return elevation(); }
|
2008-12-25 23:11:43 +00:00
|
|
|
|
2004-05-28 05:24:54 +00:00
|
|
|
inline int get_freq() const { return freq; }
|
|
|
|
inline int get_range() const { return range; }
|
|
|
|
inline double get_multiuse() const { return multiuse; }
|
2004-05-28 16:24:43 +00:00
|
|
|
inline void set_multiuse( double m ) { multiuse = m; }
|
2008-09-12 08:46:15 +00:00
|
|
|
inline const char *get_ident() const { return ident().c_str(); }
|
2008-12-25 23:11:43 +00:00
|
|
|
|
2005-10-26 09:03:49 +00:00
|
|
|
inline bool get_serviceable() const { return serviceable; }
|
2011-10-12 09:06:01 +00:00
|
|
|
inline const char *get_trans_ident() const { return get_ident(); }
|
2004-05-28 05:24:54 +00:00
|
|
|
|
2015-11-12 00:10:06 +00:00
|
|
|
virtual const std::string& name() const
|
|
|
|
{ return mName; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve the runway this navaid is associated with (for ILS/LOC/GS)
|
|
|
|
*/
|
|
|
|
FGRunwayRef runway() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* return the localizer width, in degrees
|
|
|
|
* computation is based up ICAO stdandard width at the runway threshold
|
|
|
|
* see implementation for further details.
|
|
|
|
*/
|
|
|
|
double localizerWidth() const;
|
|
|
|
|
|
|
|
void bindToNode(SGPropertyNode* nd) const;
|
|
|
|
void unbindFromNode(SGPropertyNode* nd) const;
|
|
|
|
|
|
|
|
void setColocatedDME(PositionedID other);
|
|
|
|
bool hasDME();
|
|
|
|
|
|
|
|
bool isVORTAC() const;
|
|
|
|
|
2013-11-21 17:39:05 +00:00
|
|
|
void updateFromXML(const SGGeod& geod, double heading);
|
2004-05-28 05:24:54 +00:00
|
|
|
};
|
|
|
|
|
2014-03-01 19:18:02 +00:00
|
|
|
/**
|
|
|
|
* A mobile navaid, aka. a navaid which can change its position (eg. a mobile
|
|
|
|
* TACAN)
|
|
|
|
*/
|
|
|
|
class FGMobileNavRecord:
|
|
|
|
public FGNavRecord
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FGMobileNavRecord( PositionedID aGuid,
|
|
|
|
Type type,
|
|
|
|
const std::string& ident,
|
|
|
|
const std::string& name,
|
|
|
|
const SGGeod& aPos,
|
|
|
|
int freq,
|
|
|
|
int range,
|
|
|
|
double multiuse,
|
|
|
|
PositionedID aRunway );
|
|
|
|
|
|
|
|
virtual const SGGeod& geod() const;
|
|
|
|
virtual const SGVec3d& cart() const;
|
|
|
|
|
2014-03-02 00:34:04 +00:00
|
|
|
void updateVehicle();
|
2014-03-01 19:18:02 +00:00
|
|
|
void updatePos();
|
|
|
|
|
|
|
|
protected:
|
2014-03-02 00:34:04 +00:00
|
|
|
SGTimeStamp _last_vehicle_update;
|
|
|
|
SGPropertyNode_ptr _vehicle_node;
|
|
|
|
double _initial_elevation_ft; // Elevation as given in the config file
|
2014-03-01 19:18:02 +00:00
|
|
|
};
|
|
|
|
|
2007-10-20 08:36:21 +00:00
|
|
|
class FGTACANRecord : public SGReferenced {
|
2004-05-28 05:24:54 +00:00
|
|
|
|
2008-07-25 18:38:29 +00:00
|
|
|
std::string channel;
|
2005-10-01 09:56:53 +00:00
|
|
|
int freq;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2008-08-03 14:34:42 +00:00
|
|
|
FGTACANRecord(void);
|
2005-10-01 09:56:53 +00:00
|
|
|
inline ~FGTACANRecord(void) {}
|
|
|
|
|
2008-07-25 18:38:29 +00:00
|
|
|
inline const std::string& get_channel() const { return channel; }
|
2005-10-01 09:56:53 +00:00
|
|
|
inline int get_freq() const { return freq; }
|
2008-06-02 21:09:51 +00:00
|
|
|
friend std::istream& operator>> ( std::istream&, FGTACANRecord& );
|
2005-10-01 09:56:53 +00:00
|
|
|
};
|
|
|
|
|
2004-05-28 05:24:54 +00:00
|
|
|
#endif // _FG_NAVRECORD_HXX
|