1 // navlist.hxx -- navaids management class
3 // Written by Curtis Olson, started April 2000.
5 // Copyright (C) 2000 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_NAVLIST_HXX
25 #define _FG_NAVLIST_HXX
28 #include <simgear/compiler.h>
30 #include <simgear/structure/SGSharedPtr.hxx>
36 #include "navrecord.hxx"
41 // FGNavList ------------------------------------------------------------------
43 typedef SGSharedPtr<FGNavRecord> nav_rec_ptr;
44 typedef std::vector < nav_rec_ptr > nav_list_type;
49 class TypeFilter : public FGPositioned::Filter
52 TypeFilter( const FGPositioned::Type type = FGPositioned::INVALID );
53 TypeFilter( const FGPositioned::Type minType,
54 const FGPositioned::Type maxType );
57 * Construct from string containing type
59 * @param type One of "fix"|"vor"|"ndb"|"ils"|"dme"|"tacan"|"any"
61 bool fromTypeString(const std::string& type);
63 virtual FGPositioned::Type minType() const { return _mintype; }
64 virtual FGPositioned::Type maxType() const { return _maxtype; }
67 FGPositioned::Type _mintype;
68 FGPositioned::Type _maxtype;
72 filter matching VOR & ILS/LOC transmitters
74 static TypeFilter* navFilter();
77 * filter matching ILS/LOC transmitter
79 static TypeFilter* locFilter();
81 static TypeFilter* ndbFilter();
84 * Filter returning TACANs and VORTACs
86 static TypeFilter* tacanFilter();
89 static TypeFilter* carrierFilter();
91 /** Query the database for the specified station. It is assumed
92 * that there will be multiple stations with matching frequencies
93 * so a position must be specified.
95 static FGNavRecordRef findByFreq( double freq, const SGGeod& position,
96 TypeFilter* filter = NULL);
99 * Overloaded version above - no positioned supplied so can be used with
100 * mobile TACANs which have no valid position. The first match is
103 static FGNavRecordRef findByFreq( double freq, TypeFilter* filter = NULL);
105 static nav_list_type findAllByFreq( double freq, const SGGeod& position,
106 TypeFilter* filter = NULL);
108 // Given an Ident and optional frequency and type ,
109 // return a list of matching stations.
110 static nav_list_type findByIdentAndFreq( const std::string& ident,
112 TypeFilter* filter = NULL);
114 // Given an Ident and optional frequency and type ,
115 // return a list of matching stations sorted by distance to the given position
116 static nav_list_type findByIdentAndFreq( const SGGeod & position,
117 const std::string& ident, const double freq = 0.0,
118 TypeFilter* filter = NULL);
123 // FGTACANList ----------------------------------------------------------------
126 typedef SGSharedPtr<FGTACANRecord> tacan_rec_ptr;
127 typedef std::vector < tacan_rec_ptr > tacan_list_type;
128 typedef std::map < int, tacan_list_type > tacan_map_type;
129 typedef std::map < std::string, tacan_list_type > tacan_ident_map_type;
133 tacan_list_type channellist;
134 tacan_map_type channels;
135 tacan_ident_map_type ident_channels;
142 // initialize the TACAN list
146 bool add( FGTACANRecord *r );
148 // Given a TACAN Channel, return the appropriate frequency.
149 FGTACANRecord *findByChannel( const std::string& channel );
153 #endif // _FG_NAVLIST_HXX