2 // simple.cxx -- a really simplistic class to manage airport ID,
3 // lat, lon of the center of one of it's runways, and
6 // Written by Curtis Olson, started April 1998.
8 // Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu
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.
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.
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.
30 #include <simgear/compiler.h>
32 #include <simgear/debug/logstream.hxx>
33 #include <simgear/misc/sgstream.hxx>
40 SG_USING_NAMESPACE(std);
41 SG_USING_STD(istream);
45 operator >> ( istream& in, FGAirport& a )
48 in >> junk >> a.id >> a.latitude >> a.longitude >> a.elevation
51 char name[256]; // should never be longer than this, right? :-)
52 in.getline( name, 256 );
59 FGAirportList::FGAirportList( const string& file ) {
60 SG_LOG( SG_GENERAL, SG_DEBUG, "Reading simple airport list: " << file );
62 // open the specified file for reading
63 sg_gzifstream in( file );
64 if ( !in.is_open() ) {
65 SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << file );
76 airports2.push_back(&airports[a.id]);
82 // search for the specified id
83 FGAirport FGAirportList::search( const string& id) {
89 FGAirportList::~FGAirportList( void ) {
93 FGAirportList::size () const
95 return airports2.size();
99 FGAirportList::getAirport (int index) const
101 return airports2[index];