1 // runways.hxx -- a simple class to manage airport runway info
3 // Written by Curtis Olson, started August 2000.
5 // Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org
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.
29 # error This library requires C++
37 #include <simgear/compiler.h>
39 #ifdef SG_HAVE_STD_INCLUDES
41 #elif defined( SG_HAVE_NATIVE_SGI_COMPILERS )
42 # include <iostream.h>
43 #elif defined( __BORLANDC__ )
53 #define NDEBUG // she don't work without it.
66 #if ! defined( SG_HAVE_NATIVE_SGI_COMPILERS )
67 SG_USING_STD(istream);
96 operator >> ( istream& in, FGRunway& a )
100 return in >> a.rwy_no >> a.lat >> a.lon >> a.heading >> a.length >> a.width
101 >> a.surface_flags >> a.end1_flags >> tmp >> tmp >> a.end2_flags
117 FGRunways( const string& file );
122 // search for the specified apt id.
123 // Returns true if successful, otherwise returns false.
124 // On success, runway data is returned thru "runway" pointer.
125 // "runway" is not changed if "apt" is not found.
126 bool search( const string& aptid, FGRunway* runway );
127 bool search( const string& aptid, const string& rwyno, FGRunway* runway );
129 // DCL - search for runway closest to desired heading in degrees
130 bool search( const string& aptid, const int hdg, FGRunway* runway );
132 // Return the runway number of the runway closest to a given heading
133 string search( const string& aptid, const int tgt_hdg );
135 FGRunway search( const string& aptid );
136 bool next( FGRunway* runway );
141 class FGRunwaysUtil {
143 typedef vector< FGRunway > container;
144 typedef container::iterator iterator;
145 typedef container::const_iterator const_iterator;
159 int load( const string& file );
161 // save the data in metakit format
162 bool dump_mk4( const string& file );
164 // search for the specified id.
165 // Returns true if successful, otherwise returns false.
166 // On success, runway data is returned thru "runway" pointer.
167 // "runway" is not changed if "id" is not found.
168 // bool search( const string& id, FGRunway* runway ) const;
169 // FGRunway search( const string& id ) const;
173 #endif // _RUNWAYS_HXX