FlightGear next
navlist.hxx
Go to the documentation of this file.
1// navlist.hxx -- navaids management class
2//
3// Written by Curtis Olson, started April 2000.
4//
5// Copyright (C) 2000 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_NAVLIST_HXX
25#define _FG_NAVLIST_HXX
26
27
28#include <simgear/compiler.h>
29
30#include <simgear/structure/SGSharedPtr.hxx>
31
32#include <map>
33#include <vector>
34#include <string>
35
36#include "navrecord.hxx"
37
38// forward decls
39class SGGeod;
40
41// FGNavList ------------------------------------------------------------------
42
43typedef SGSharedPtr<FGNavRecord> nav_rec_ptr;
44typedef std::vector < nav_rec_ptr > nav_list_type;
45
47{
48public:
50 {
51 public:
55
61 bool fromTypeString(const std::string& type);
62
63 virtual FGPositioned::Type minType() const { return _mintype; }
64 virtual FGPositioned::Type maxType() const { return _maxtype; }
65
66 protected:
69 };
70
74 static TypeFilter* navFilter();
75
79 static TypeFilter* locFilter();
80
81 static TypeFilter* ndbFilter();
82
86 static TypeFilter* tacanFilter();
87
88
90
95 static FGNavRecordRef findByFreq( double freq, const SGGeod& position,
96 TypeFilter* filter = nullptr);
97
103 static FGNavRecordRef findByFreq( double freq, TypeFilter* filter = NULL);
104
105 static nav_list_type findAllByFreq( double freq, const SGGeod& position,
106 TypeFilter* filter = NULL);
107
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,
111 const double freq,
112 TypeFilter* filter = NULL);
113
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);
119
120 };
121
122
123// FGTACANList ----------------------------------------------------------------
124
125
126typedef SGSharedPtr<FGTACANRecord> tacan_rec_ptr;
127typedef std::vector < tacan_rec_ptr > tacan_list_type;
128typedef std::map < int, tacan_list_type > tacan_map_type;
129typedef std::map < std::string, tacan_list_type > tacan_ident_map_type;
130
132
133 tacan_list_type channellist;
134 tacan_map_type channels;
135 tacan_ident_map_type ident_channels;
136
137public:
138
139 FGTACANList();
140 ~FGTACANList();
141
142 // initialize the TACAN list
143 bool init();
144
145 // add an entry
146 bool add( FGTACANRecord *r );
147
148 // Given a TACAN Channel, return the appropriate frequency.
149 FGTACANRecord *findByChannel(const std::string& channel);
150
151 // Given a TACAN Channel, return the appropriate frequency.
152 FGTACANRecord *findByFrequency(int frequency_kHz);
153
154
155};
156#endif // _FG_NAVLIST_HXX
virtual FGPositioned::Type minType() const
Definition navlist.hxx:63
TypeFilter(const FGPositioned::Type type=FGPositioned::INVALID)
Definition navlist.cxx:95
virtual FGPositioned::Type maxType() const
Definition navlist.hxx:64
FGPositioned::Type _mintype
Definition navlist.hxx:67
bool fromTypeString(const std::string &type)
Construct from string containing type.
Definition navlist.cxx:114
FGPositioned::Type _maxtype
Definition navlist.hxx:68
static TypeFilter * locFilter()
filter matching ILS/LOC transmitter
Definition navlist.cxx:157
static FGNavRecordRef findByFreq(double freq, const SGGeod &position, TypeFilter *filter=nullptr)
Query the database for the specified station.
Definition navlist.cxx:187
static TypeFilter * ndbFilter()
Definition navlist.cxx:163
static TypeFilter * navFilter()
filter matching VOR & ILS/LOC transmitters
Definition navlist.cxx:169
static nav_list_type findAllByFreq(double freq, const SGGeod &position, TypeFilter *filter=NULL)
Definition navlist.cxx:244
static nav_list_type findByIdentAndFreq(const std::string &ident, const double freq, TypeFilter *filter=NULL)
static TypeFilter * mobileTacanFilter()
Definition navlist.cxx:181
static TypeFilter * tacanFilter()
Filter returning TACANs and VORTACs.
Definition navlist.cxx:175
Predicate class to support custom filtering of FGPositioned queries Default implementation of this pa...
bool init()
Definition navlist.cxx:309
bool add(FGTACANRecord *r)
Definition navlist.cxx:316
FGTACANRecord * findByFrequency(int frequency_kHz)
Definition navlist.cxx:328
FGTACANRecord * findByChannel(const std::string &channel)
Definition navlist.cxx:341
SGSharedPtr< FGNavRecord > FGNavRecordRef
std::vector< nav_rec_ptr > nav_list_type
Definition navlist.hxx:44
std::map< std::string, tacan_list_type > tacan_ident_map_type
Definition navlist.hxx:129
SGSharedPtr< FGTACANRecord > tacan_rec_ptr
Definition navlist.hxx:126
std::vector< tacan_rec_ptr > tacan_list_type
Definition navlist.hxx:127
std::map< int, tacan_list_type > tacan_map_type
Definition navlist.hxx:128
SGSharedPtr< FGNavRecord > nav_rec_ptr
Definition navlist.hxx:43