2000-08-16 01:28:33 +00:00
|
|
|
// runways.hxx -- a simple class to manage airport runway info
|
|
|
|
//
|
|
|
|
// Written by Curtis Olson, started August 2000.
|
|
|
|
//
|
2004-11-19 22:10:41 +00:00
|
|
|
// Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
|
2000-08-16 01:28:33 +00:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
2006-02-21 01:16:04 +00:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2000-08-16 01:28:33 +00:00
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
|
2003-08-29 04:11:23 +00:00
|
|
|
#ifndef _FG_RUNWAYS_HXX
|
|
|
|
#define _FG_RUNWAYS_HXX
|
2000-08-16 01:28:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef __cplusplus
|
|
|
|
# error This library requires C++
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <simgear/compiler.h>
|
|
|
|
|
2008-07-25 18:38:29 +00:00
|
|
|
#include <string>
|
2003-08-29 04:11:23 +00:00
|
|
|
#include <map>
|
2000-08-16 01:28:33 +00:00
|
|
|
|
2008-07-27 16:25:13 +00:00
|
|
|
using std::string;
|
|
|
|
using std::multimap;
|
2000-08-16 01:28:33 +00:00
|
|
|
|
|
|
|
|
2003-08-29 04:11:23 +00:00
|
|
|
struct ltstr {
|
2005-10-25 13:49:55 +00:00
|
|
|
bool operator()(const string& s1, const string& s2) const {
|
2003-08-29 04:11:23 +00:00
|
|
|
return s1 < s2;
|
|
|
|
}
|
|
|
|
};
|
2000-08-16 01:28:33 +00:00
|
|
|
|
|
|
|
|
2003-08-29 04:11:23 +00:00
|
|
|
struct FGRunway {
|
|
|
|
|
2004-12-22 23:57:07 +00:00
|
|
|
string _id;
|
|
|
|
string _rwy_no;
|
|
|
|
string _type; // runway / taxiway
|
|
|
|
|
|
|
|
double _lon;
|
|
|
|
double _lat;
|
|
|
|
double _heading;
|
|
|
|
double _length;
|
|
|
|
double _width;
|
|
|
|
double _displ_thresh1;
|
|
|
|
double _displ_thresh2;
|
|
|
|
double _stopway1;
|
|
|
|
double _stopway2;
|
|
|
|
|
|
|
|
string _lighting_flags;
|
|
|
|
int _surface_code;
|
|
|
|
string _shoulder_code;
|
|
|
|
int _marking_code;
|
|
|
|
double _smoothness;
|
|
|
|
bool _dist_remaining;
|
2000-08-16 01:28:33 +00:00
|
|
|
};
|
|
|
|
|
2003-08-29 04:11:23 +00:00
|
|
|
typedef multimap < string, FGRunway, ltstr > runway_map;
|
|
|
|
typedef runway_map::iterator runway_map_iterator;
|
|
|
|
typedef runway_map::const_iterator const_runway_map_iterator;
|
|
|
|
|
|
|
|
class FGRunwayList {
|
2000-08-16 01:28:33 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2003-08-29 04:11:23 +00:00
|
|
|
runway_map runways;
|
|
|
|
runway_map_iterator current;
|
2000-08-16 01:28:33 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2004-12-22 23:57:07 +00:00
|
|
|
// Constructor (new)
|
|
|
|
FGRunwayList() {}
|
2000-08-16 01:28:33 +00:00
|
|
|
|
|
|
|
// Destructor
|
2003-08-29 04:11:23 +00:00
|
|
|
~FGRunwayList();
|
2000-08-16 01:28:33 +00:00
|
|
|
|
2004-12-22 23:57:07 +00:00
|
|
|
// add an entry to the list
|
2005-10-25 13:49:55 +00:00
|
|
|
void add( const string& id, const string& rwy_no,
|
2004-12-22 23:57:07 +00:00
|
|
|
const double longitude, const double latitude,
|
|
|
|
const double heading, const double length, const double width,
|
|
|
|
const double displ_thresh1, const double displ_thresh2,
|
|
|
|
const double stopway1, const double stopway2,
|
2005-10-25 13:49:55 +00:00
|
|
|
const string& lighting_flags, const int surface_code,
|
|
|
|
const string& shoulder_code, const int marking_code,
|
2004-12-22 23:57:07 +00:00
|
|
|
const double smoothness, const bool dist_remaining );
|
|
|
|
|
2001-05-15 00:00:08 +00:00
|
|
|
// search for the specified apt id.
|
2000-08-16 01:28:33 +00:00
|
|
|
// Returns true if successful, otherwise returns false.
|
|
|
|
// On success, runway data is returned thru "runway" pointer.
|
|
|
|
// "runway" is not changed if "apt" is not found.
|
2001-05-15 00:00:08 +00:00
|
|
|
bool search( const string& aptid, FGRunway* runway );
|
|
|
|
bool search( const string& aptid, const string& rwyno, FGRunway* runway );
|
2001-11-07 17:55:28 +00:00
|
|
|
|
|
|
|
// DCL - search for runway closest to desired heading in degrees
|
|
|
|
bool search( const string& aptid, const int hdg, FGRunway* runway );
|
|
|
|
|
|
|
|
// Return the runway number of the runway closest to a given heading
|
2002-02-15 22:00:49 +00:00
|
|
|
string search( const string& aptid, const int tgt_hdg );
|
2001-11-07 17:55:28 +00:00
|
|
|
|
2001-05-15 00:00:08 +00:00
|
|
|
FGRunway search( const string& aptid );
|
2000-08-16 01:28:33 +00:00
|
|
|
bool next( FGRunway* runway );
|
|
|
|
FGRunway next();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-08-29 04:11:23 +00:00
|
|
|
#endif // _FG_RUNWAYS_HXX
|