]> git.mxchange.org Git - flightgear.git/blob - src/Airports/runways.hxx
Update MSVC 7.1 project file : annunciator removed
[flightgear.git] / src / Airports / runways.hxx
1 // runways.hxx -- a simple class to manage airport runway info
2 //
3 // Written by Curtis Olson, started August 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_RUNWAYS_HXX
25 #define _FG_RUNWAYS_HXX
26
27
28 #ifndef __cplusplus                                                          
29 # error This library requires C++
30 #endif                                   
31
32
33 #ifdef HAVE_CONFIG_H
34 #  include <config.h>
35 #endif
36
37 #include <simgear/compiler.h>
38
39 #include STL_STRING
40 #include <map>
41
42 SG_USING_STD(string);
43 SG_USING_STD(multimap);
44
45
46 struct ltstr {
47     bool operator()(const string& s1, const string& s2) const {
48         return s1 < s2;
49     }
50 };
51
52
53 struct FGRunway {
54
55     string _id;
56     string _rwy_no;
57     string _type;                // runway / taxiway
58
59     double _lon;
60     double _lat;
61     double _heading;
62     double _length;
63     double _width;
64     double _displ_thresh1;
65     double _displ_thresh2;
66     double _stopway1;
67     double _stopway2;
68
69     string _lighting_flags;
70     int _surface_code;
71     string _shoulder_code;
72     int _marking_code;
73     double _smoothness;
74     bool   _dist_remaining;
75 };
76
77 typedef multimap < string, FGRunway, ltstr > runway_map;
78 typedef runway_map::iterator runway_map_iterator;
79 typedef runway_map::const_iterator const_runway_map_iterator;
80
81 class FGRunwayList {
82
83 private:
84
85     runway_map runways;
86     runway_map_iterator current;
87
88 public:
89
90     // Constructor (new)
91     FGRunwayList() {}
92
93     // Destructor
94     ~FGRunwayList();
95
96     // add an entry to the list
97     void add( const string& id, const string& rwy_no,
98               const double longitude, const double latitude,
99               const double heading, const double length, const double width,
100               const double displ_thresh1, const double displ_thresh2,
101               const double stopway1, const double stopway2,
102               const string& lighting_flags, const int surface_code,
103               const string& shoulder_code, const int marking_code,
104               const double smoothness, const bool dist_remaining );
105
106     // search for the specified apt id.
107     // Returns true if successful, otherwise returns false.
108     // On success, runway data is returned thru "runway" pointer.
109     // "runway" is not changed if "apt" is not found.
110     bool search( const string& aptid, FGRunway* runway );
111     bool search( const string& aptid, const string& rwyno, FGRunway* runway );
112
113     // DCL - search for runway closest to desired heading in degrees
114     bool search( const string& aptid, const int hdg, FGRunway* runway );
115
116     // Return the runway number of the runway closest to a given heading
117     string search( const string& aptid, const int tgt_hdg );
118
119     FGRunway search( const string& aptid );
120     bool next( FGRunway* runway );
121     FGRunway next();
122 };
123
124
125 #endif // _FG_RUNWAYS_HXX