]> git.mxchange.org Git - flightgear.git/blob - src/Navaids/fixlist.hxx
d0b32eb80468e122bc54b2c909593b429965312a
[flightgear.git] / src / Navaids / fixlist.hxx
1 // fixlist.hxx -- fix list 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_FIXLIST_HXX
25 #define _FG_FIXLIST_HXX
26
27
28 #include <simgear/compiler.h>
29 #include <simgear/misc/sg_path.hxx>
30
31 #include <map>
32 #include <vector>
33 #include <string>
34
35 #include "fix.hxx"
36
37 using std::multimap;
38 using std::vector;
39 using std::string;
40
41 // fix names may be globally non-unique.  Allow for this.
42 typedef multimap < string, FGFix > fix_map_type;
43 typedef fix_map_type::iterator fix_map_iterator;
44 typedef fix_map_type::const_iterator fix_map_const_iterator;
45
46 class FGIdentOrdering; // FIXME, currently declared in Airports/simple.hxx
47
48 class FGFixList {
49
50     fix_map_type fixlist;
51
52 public:
53
54     FGFixList();
55     ~FGFixList();
56
57     // load the navaids and build the map
58     bool init( SGPath path );
59
60     // query the database for the specified fix
61     bool query( const string& ident, FGFix *f );
62
63     const FGFix* search(const string& ident);
64
65     // Find fix of requested type with closest exact or following ident
66     // (by ACSII values) to that supplied (ie. a lower-bound lookup).
67     // Supplying true for exact forces only exact matches to be returned (similar to above function)
68     // Returns NULL if no match found.
69     const FGFix* findFirstByIdent( const string& ident, FGIdentOrdering* aOrder = NULL);
70
71     // query the database for the specified fix, lon and lat are
72     // in degrees, elev is in meters
73     bool query_and_offset( const string& ident, double lon, double lat,
74                            double elev, FGFix *f, double *heading,
75                            double *dist );
76
77     // Return a pointer to the master fixlist
78     inline const fix_map_type* getFixList() { return(&fixlist); }
79 };
80
81
82 #endif // _FG_FIXLIST_HXX