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;
|
2004-05-28 05:24:54 +00:00
|
|
|
typedef nav_list_type::iterator nav_list_iterator;
|
|
|
|
typedef nav_list_type::const_iterator nav_list_const_iterator;
|
2000-04-21 04:19:22 +00:00
|
|
|
|
2008-12-25 23:11:43 +00:00
|
|
|
typedef std::map < int, nav_list_type > nav_map_type;
|
2004-05-28 05:24:54 +00:00
|
|
|
typedef nav_map_type::iterator nav_map_iterator;
|
|
|
|
typedef nav_map_type::const_iterator nav_map_const_iterator;
|
2000-04-21 04:19:22 +00:00
|
|
|
|
2004-05-28 05:24:54 +00:00
|
|
|
class FGNavList {
|
|
|
|
|
2005-10-01 09:56:53 +00:00
|
|
|
nav_list_type carrierlist;
|
2000-04-21 04:19:22 +00:00
|
|
|
nav_map_type navaids;
|
2006-07-10 07:59:20 +00:00
|
|
|
|
2003-01-25 20:45:39 +00:00
|
|
|
// Given a point and a list of stations, return the closest one to
|
|
|
|
// the specified point.
|
2008-12-25 23:11:43 +00:00
|
|
|
FGNavRecord *findNavFromList( const SGGeod &aircraft,
|
2004-05-28 16:24:43 +00:00
|
|
|
const nav_list_type &stations );
|
2006-07-10 07:59:20 +00:00
|
|
|
|
2000-04-21 04:19:22 +00:00
|
|
|
public:
|
|
|
|
|
2000-04-21 16:42:01 +00:00
|
|
|
FGNavList();
|
|
|
|
~FGNavList();
|
2000-04-21 04:19:22 +00:00
|
|
|
|
2004-05-28 05:24:54 +00:00
|
|
|
// initialize the nav list
|
|
|
|
bool init();
|
|
|
|
|
|
|
|
// add an entry
|
|
|
|
bool add( FGNavRecord *n );
|
2000-04-21 04:19:22 +00:00
|
|
|
|
2005-10-22 13:37:13 +00:00
|
|
|
/** Query the database for the specified station. It is assumed
|
|
|
|
* that there will be multiple stations with matching frequencies
|
2008-12-25 23:11:43 +00:00
|
|
|
* so a position must be specified.
|
2006-07-10 07:59:20 +00:00
|
|
|
*/
|
2008-12-25 23:11:43 +00:00
|
|
|
FGNavRecord *findByFreq( double freq, const SGGeod& position);
|
2006-07-10 07:59:20 +00:00
|
|
|
|
2003-01-25 20:45:39 +00:00
|
|
|
// Given an Ident and optional freqency, return the first matching
|
|
|
|
// station.
|
2008-12-25 23:11:43 +00:00
|
|
|
FGNavRecord *findByIdentAndFreq( const std::string& ident,
|
2004-05-28 05:24:54 +00:00
|
|
|
const double freq = 0.0 );
|
|
|
|
|
2005-10-01 09:56:53 +00:00
|
|
|
// given a frequency returns the first matching entry
|
|
|
|
FGNavRecord *findStationByFreq( double frequency );
|
2000-04-21 04:19:22 +00:00
|
|
|
};
|
|
|
|
|
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
|