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., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifndef _FG_NAVLIST_HXX
25 #define _FG_NAVLIST_HXX
28 #include <simgear/compiler.h>
29 #include <simgear/misc/sg_path.hxx>
35 #include "navrecord.hxx"
43 typedef vector < FGNavRecord* > nav_list_type;
44 typedef vector < FGTACANRecord* > tacan_list_type;
45 typedef nav_list_type::iterator nav_list_iterator;
46 typedef nav_list_type::const_iterator nav_list_const_iterator;
48 typedef map < int, nav_list_type > nav_map_type;
49 typedef map < int, tacan_list_type > tacan_map_type;
50 typedef nav_map_type::iterator nav_map_iterator;
51 typedef nav_map_type::const_iterator nav_map_const_iterator;
53 typedef map < string, nav_list_type > nav_ident_map_type;
54 typedef nav_ident_map_type::iterator nav_ident_map_iterator;
55 typedef map < string, tacan_list_type > tacan_ident_map_type;
59 //nav_list_type navlist; // DCL - this doesn't appear to be used any more
60 // and can probably be removed.
61 nav_list_type carrierlist;
63 nav_map_type navaids_by_tile;
64 nav_ident_map_type ident_navaids;
66 // Given a point and a list of stations, return the closest one to
67 // the specified point.
68 FGNavRecord *findNavFromList( const Point3D &aircraft,
69 const nav_list_type &stations );
76 // initialize the nav list
80 bool add( FGNavRecord *n );
81 //bool add( FGTACANRecord *r );
83 /** Query the database for the specified station. It is assumed
84 * that there will be multiple stations with matching frequencies
85 * so a position must be specified. Lon and lat are in radians,
88 FGNavRecord *findByFreq( double freq, double lon, double lat, double elev );
90 // locate closest item in the DB matching the requested ident
91 FGNavRecord *findByIdent( const char* ident, const double lon, const double lat );
93 // Find items of requested type with closest exact or subsequent ident
94 // (by ASCII code value) to that supplied.
95 // Supplying true for exact forces only exact matches to be returned (similar to above function)
96 // Returns an empty list if no match found - calling function should check for this!
97 nav_list_type findFirstByIdent( string ident, fg_nav_types type, bool exact = false );
99 // Given an Ident and optional freqency, return the first matching
101 FGNavRecord *findByIdentAndFreq( const char* ident,
102 const double freq = 0.0 );
104 // returns the closest entry to the give lon/lat/elev
105 FGNavRecord *findClosest( double lon_rad, double lat_rad, double elev_m, fg_nav_types type = FG_NAV_ANY );
107 // given a frequency returns the first matching entry
108 FGNavRecord *findStationByFreq( double frequency );
110 inline const nav_map_type& get_navaids() const { return navaids; }
115 tacan_list_type channellist;
116 //nav_list_type carrierlist;
117 tacan_map_type channels;
118 //nav_map_type navaids_by_tile;
119 tacan_ident_map_type ident_channels;
121 // Given a point and a list of stations, return the closest one to
122 // the specified point.
123 /*FGNavRecord *findNavFromList( const Point3D &aircraft,
124 const nav_list_type &stations );*/
131 // initialize the TACAN list
136 bool add( FGTACANRecord *r );
138 // Given a TACAN Channel, return the appropriate frequency.
139 FGTACANRecord *findByChannel( const string& channel );
143 #endif // _FG_NAVLIST_HXX