]> git.mxchange.org Git - flightgear.git/blob - Airports/simple.hxx
Tweaks for building with native SGI compilers.
[flightgear.git] / Airports / simple.hxx
1 //
2 // simple.hxx -- a really simplistic class to manage airport ID,
3 //                 lat, lon of the center of one of it's runways, and 
4 //                 elevation in feet.
5 //
6 // Written by Curtis Olson, started April 1998.
7 //
8 // Copyright (C) 1998  Curtis L. Olson  - curt@me.umn.edu
9 //
10 // This program is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU General Public License as
12 // published by the Free Software Foundation; either version 2 of the
13 // License, or (at your option) any later version.
14 //
15 // This program is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 // General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program; if not, write to the Free Software
22 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 //
24 // $Id$
25 // (Log is kept at end of this file)
26
27
28 #ifndef _AIRPORTS_HXX
29 #define _AIRPORTS_HXX
30
31
32 #ifndef __cplusplus                                                          
33 # error This library requires C++
34 #endif                                   
35
36
37 #include <Include/compiler.h>
38
39 #include STL_STRING
40 #include <set>
41
42 FG_USING_STD(string);
43 FG_USING_STD(set);
44
45
46 class fgAIRPORT {
47 public:
48     fgAIRPORT( const string& name = "",
49                double lon = 0.0,
50                double lat = 0.0,
51                double ele = 0.0 )
52         : id(name), longitude(lon), latitude(lat), elevation(ele) {}
53
54     bool operator < ( const fgAIRPORT& a ) const {
55         return id < a.id;
56     }
57
58 public:
59     string id;
60     double longitude;
61     double latitude;
62     double elevation;
63 };
64
65 inline istream&
66 operator >> ( istream& in, fgAIRPORT& a )
67 {
68     return in >> a.id >> a.longitude >> a.latitude >> a.elevation;
69 }
70
71 class fgAIRPORTS {
72 public:
73 #ifdef FG_NO_DEFAULT_TEMPLATE_ARGS
74     typedef set< fgAIRPORT, less< fgAIRPORT > > container;
75 #else
76     typedef set< fgAIRPORT > container;
77 #endif
78     typedef container::iterator iterator;
79     typedef container::const_iterator const_iterator;
80
81 private:
82     container airports;
83
84 public:
85
86     // Constructor
87     fgAIRPORTS();
88
89     // Destructor
90     ~fgAIRPORTS();
91
92     // load the data
93     int load( const string& file );
94
95     // search for the specified id.
96     // Returns true if successful, otherwise returns false.
97     // On success, airport data is returned thru "airport" pointer.
98     // "airport" is not changed if "id" is not found.
99     bool search( const string& id, fgAIRPORT* airport ) const;
100     fgAIRPORT search( const string& id ) const;
101 };
102
103
104 #endif /* _AIRPORTS_HXX */
105
106
107 // $Log$
108 // Revision 1.7  1999/03/02 01:02:33  curt
109 // Tweaks for building with native SGI compilers.
110 //
111 // Revision 1.6  1999/02/26 22:08:36  curt
112 // Added initial support for native SGI compilers.
113 //
114 // Revision 1.5  1998/11/02 18:25:34  curt
115 // Check for __CYGWIN__ (b20) as well as __CYGWIN32__ (pre b20 compilers)
116 // Other misc. tweaks.
117 //
118 // Revision 1.4  1998/09/08 21:38:43  curt
119 // Changes by Bernie Bright.
120 //
121 // Revision 1.3  1998/09/01 19:02:54  curt
122 // Changes contributed by Bernie Bright <bbright@c031.aone.net.au>
123 //  - The new classes in libmisc.tgz define a stream interface into zlib.
124 //    I've put these in a new directory, Lib/Misc.  Feel free to rename it
125 //    to something more appropriate.  However you'll have to change the
126 //    include directives in all the other files.  Additionally you'll have
127 //    add the library to Lib/Makefile.am and Simulator/Main/Makefile.am.
128 //
129 //    The StopWatch class in Lib/Misc requires a HAVE_GETRUSAGE autoconf
130 //    test so I've included the required changes in config.tgz.
131 //
132 //    There are a fair few changes to Simulator/Objects as I've moved
133 //    things around.  Loading tiles is quicker but thats not where the delay
134 //    is.  Tile loading takes a few tenths of a second per file on a P200
135 //    but it seems to be the post-processing that leads to a noticeable
136 //    blip in framerate.  I suppose its time to start profiling to see where
137 //    the delays are.
138 //
139 //    I've included a brief description of each archives contents.
140 //
141 // Lib/Misc/
142 //   zfstream.cxx
143 //   zfstream.hxx
144 //     C++ stream interface into zlib.
145 //     Taken from zlib-1.1.3/contrib/iostream/.
146 //     Minor mods for STL compatibility.
147 //     There's no copyright associated with these so I assume they're
148 //     covered by zlib's.
149 //
150 //   fgstream.cxx
151 //   fgstream.hxx
152 //     FlightGear input stream using gz_ifstream.  Tries to open the
153 //     given filename.  If that fails then filename is examined and a
154 //     ".gz" suffix is removed or appended and that file is opened.
155 //
156 //   stopwatch.hxx
157 //     A simple timer for benchmarking.  Not used in production code.
158 //     Taken from the Blitz++ project.  Covered by GPL.
159 //
160 //   strutils.cxx
161 //   strutils.hxx
162 //     Some simple string manipulation routines.
163 //
164 // Simulator/Airports/
165 //   Load airports database using fgstream.
166 //   Changed fgAIRPORTS to use set<> instead of map<>.
167 //   Added bool fgAIRPORTS::search() as a neater way doing the lookup.
168 //   Returns true if found.
169 //
170 // Simulator/Astro/
171 //   Modified fgStarsInit() to load stars database using fgstream.
172 //
173 // Simulator/Objects/
174 //   Modified fgObjLoad() to use fgstream.
175 //   Modified fgMATERIAL_MGR::load_lib() to use fgstream.
176 //   Many changes to fgMATERIAL.
177 //   Some changes to fgFRAGMENT but I forget what!
178 //
179 // Revision 1.2  1998/08/27 17:01:56  curt
180 // Contributions from Bernie Bright <bbright@c031.aone.net.au>
181 // - use strings for fg_root and airport_id and added methods to return
182 //   them as strings,
183 // - inlined all access methods,
184 // - made the parsing functions private methods,
185 // - deleted some unused functions.
186 // - propogated some of these changes out a bit further.
187 //
188 // Revision 1.1  1998/08/25 17:19:14  curt
189 // Moved from ../Main/
190 //
191 // Revision 1.7  1998/07/24 21:39:09  curt
192 // Debugging output tweaks.
193 // Cast glGetString to (char *) to avoid compiler errors.
194 // Optimizations to fgGluLookAt() by Norman Vine.
195 //
196 // Revision 1.6  1998/07/06 21:34:19  curt
197 // Added an enable/disable splash screen option.
198 // Added an enable/disable intro music option.
199 // Added an enable/disable instrument panel option.
200 // Added an enable/disable mouse pointer option.
201 // Added using namespace std for compilers that support this.
202 //
203 // Revision 1.5  1998/06/17 21:35:11  curt
204 // Refined conditional audio support compilation.
205 // Moved texture parameter setup calls to ../Scenery/materials.cxx
206 // #include <string.h> before various STL includes.
207 // Make HUD default state be enabled.
208 //
209 // Revision 1.4  1998/06/03 00:47:14  curt
210 // Updated to compile in audio support if OSS available.
211 // Updated for new version of Steve's audio library.
212 // STL includes don't use .h
213 // Small view optimizations.
214 //
215 // Revision 1.3  1998/06/01 17:54:42  curt
216 // Added Linux audio support.
217 // avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
218 // map stl tweaks.
219 //
220 // Revision 1.2  1998/05/29 20:37:22  curt
221 // Tweaked material properties & lighting a bit in GLUTmain.cxx.
222 // Read airport list into a "map" STL for dynamic list sizing and fast tree
223 // based lookups.
224 //
225 // Revision 1.1  1998/04/25 15:11:11  curt
226 // Added an command line option to set starting position based on airport ID.
227 //
228 //