2000-04-21 16:42:01 +00:00
|
|
|
// navlist.hxx -- navaids management class
|
2000-04-21 04:19:22 +00:00
|
|
|
//
|
|
|
|
// Written by Curtis Olson, started April 2000.
|
|
|
|
//
|
2004-11-19 22:10:41 +00:00
|
|
|
// Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
|
2000-04-21 04:19:22 +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.
|
2000-04-21 04:19:22 +00:00
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
|
2000-04-21 16:42:01 +00:00
|
|
|
#ifndef _FG_NAVLIST_HXX
|
|
|
|
#define _FG_NAVLIST_HXX
|
2000-04-21 04:19:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include <simgear/compiler.h>
|
2008-12-25 23:11:43 +00:00
|
|
|
|
2007-10-20 08:36:21 +00:00
|
|
|
#include <simgear/structure/SGSharedPtr.hxx>
|
2000-04-21 04:19:22 +00:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
2008-07-25 18:38:29 +00:00
|
|
|
#include <string>
|
2000-04-21 04:19:22 +00:00
|
|
|
|
2004-05-28 05:24:54 +00:00
|
|
|
#include "navrecord.hxx"
|
2000-04-21 04:19:22 +00:00
|
|
|
|
2008-12-25 23:11:43 +00:00
|
|
|
// forward decls
|
|
|
|
class SGGeod;
|
2006-07-10 07:59:20 +00:00
|
|
|
|
|
|
|
// FGNavList ------------------------------------------------------------------
|
|
|
|
|
2007-10-20 08:36:21 +00:00
|
|
|
typedef SGSharedPtr<FGNavRecord> nav_rec_ptr;
|
2008-12-25 23:11:43 +00:00
|
|
|
typedef std::vector < nav_rec_ptr > nav_list_type;
|
2006-07-10 07:59:20 +00:00
|
|
|
|
2012-08-27 23:26:36 +00:00
|
|
|
class FGNavList
|
|
|
|
{
|
2000-04-21 04:19:22 +00:00
|
|
|
public:
|
2012-04-24 21:12:56 +00:00
|
|
|
class TypeFilter : public FGPositioned::Filter
|
|
|
|
{
|
|
|
|
public:
|
2013-03-06 00:04:18 +00:00
|
|
|
TypeFilter( const FGPositioned::Type type = FGPositioned::INVALID );
|
|
|
|
TypeFilter( const FGPositioned::Type minType,
|
|
|
|
const FGPositioned::Type maxType );
|
2012-04-24 21:12:56 +00:00
|
|
|
|
2013-03-06 00:04:18 +00:00
|
|
|
/**
|
|
|
|
* Construct from string containing type
|
|
|
|
*
|
|
|
|
* @param type One of "fix"|"vor"|"ndb"|"ils"|"dme"|"tacan"|"any"
|
|
|
|
*/
|
|
|
|
bool fromTypeString(const std::string& type);
|
2012-08-27 23:26:36 +00:00
|
|
|
|
2013-03-06 00:04:18 +00:00
|
|
|
virtual FGPositioned::Type minType() const { return _mintype; }
|
|
|
|
virtual FGPositioned::Type maxType() const { return _maxtype; }
|
2012-08-27 23:26:36 +00:00
|
|
|
|
|
|
|
protected:
|
2012-04-24 21:12:56 +00:00
|
|
|
FGPositioned::Type _mintype;
|
|
|
|
FGPositioned::Type _maxtype;
|
|
|
|
};
|
2012-08-27 23:26:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
filter matching VOR & ILS/LOC transmitters
|
|
|
|
*/
|
|
|
|
static TypeFilter* navFilter();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* filter matching ILS/LOC transmitter
|
|
|
|
*/
|
|
|
|
static TypeFilter* locFilter();
|
|
|
|
|
|
|
|
static TypeFilter* ndbFilter();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Filter returning TACANs and VORTACs
|
|
|
|
*/
|
|
|
|
static TypeFilter* tacanFilter();
|
|
|
|
|
|
|
|
|
|
|
|
static TypeFilter* carrierFilter();
|
|
|
|
|
|
|
|
/** Query the database for the specified station. It is assumed
|
|
|
|
* that there will be multiple stations with matching frequencies
|
|
|
|
* so a position must be specified.
|
|
|
|
*/
|
2013-03-06 22:21:29 +00:00
|
|
|
static FGNavRecordRef findByFreq( double freq, const SGGeod& position,
|
2012-08-27 23:26:36 +00:00
|
|
|
TypeFilter* filter = NULL);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Overloaded version above - no positioned supplied so can be used with
|
|
|
|
* mobile TACANs which have no valid position. The first match is
|
|
|
|
* returned only.
|
|
|
|
*/
|
2013-03-06 22:21:29 +00:00
|
|
|
static FGNavRecordRef findByFreq( double freq, TypeFilter* filter = NULL);
|
2012-08-27 23:26:36 +00:00
|
|
|
|
|
|
|
static nav_list_type findAllByFreq( double freq, const SGGeod& position,
|
|
|
|
TypeFilter* filter = NULL);
|
|
|
|
|
|
|
|
// Given an Ident and optional frequency and type ,
|
|
|
|
// return a list of matching stations.
|
|
|
|
static nav_list_type findByIdentAndFreq( const std::string& ident,
|
|
|
|
const double freq,
|
|
|
|
TypeFilter* filter = NULL);
|
2006-07-10 07:59:20 +00:00
|
|
|
|
2012-08-27 23:26:36 +00:00
|
|
|
// Given an Ident and optional frequency and type ,
|
|
|
|
// return a list of matching stations sorted by distance to the given position
|
|
|
|
static nav_list_type findByIdentAndFreq( const SGGeod & position,
|
|
|
|
const std::string& ident, const double freq = 0.0,
|
|
|
|
TypeFilter* filter = NULL);
|
|
|
|
|
|
|
|
};
|
2006-07-10 07:59:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
// FGTACANList ----------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2007-10-20 08:36:21 +00:00
|
|
|
typedef SGSharedPtr<FGTACANRecord> tacan_rec_ptr;
|
2008-12-25 23:11:43 +00:00
|
|
|
typedef std::vector < tacan_rec_ptr > tacan_list_type;
|
|
|
|
typedef std::map < int, tacan_list_type > tacan_map_type;
|
|
|
|
typedef std::map < std::string, tacan_list_type > tacan_ident_map_type;
|
2006-07-10 07:59:20 +00:00
|
|
|
|
2005-10-01 09:56:53 +00:00
|
|
|
class FGTACANList {
|
|
|
|
|
|
|
|
tacan_list_type channellist;
|
|
|
|
tacan_map_type channels;
|
|
|
|
tacan_ident_map_type ident_channels;
|
2006-07-10 07:59:20 +00:00
|
|
|
|
2005-10-01 09:56:53 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
FGTACANList();
|
|
|
|
~FGTACANList();
|
|
|
|
|
|
|
|
// initialize the TACAN list
|
|
|
|
bool init();
|
2000-04-21 04:19:22 +00:00
|
|
|
|
2005-10-01 09:56:53 +00:00
|
|
|
// add an entry
|
|
|
|
bool add( FGTACANRecord *r );
|
2006-07-10 07:59:20 +00:00
|
|
|
|
|
|
|
// Given a TACAN Channel, return the appropriate frequency.
|
2008-12-25 23:11:43 +00:00
|
|
|
FGTACANRecord *findByChannel( const std::string& channel );
|
2005-10-01 09:56:53 +00:00
|
|
|
|
2006-07-10 07:59:20 +00:00
|
|
|
|
2005-10-01 09:56:53 +00:00
|
|
|
};
|
2000-04-21 16:42:01 +00:00
|
|
|
#endif // _FG_NAVLIST_HXX
|