//
// Written by Curtis Olson, started August 2000.
//
-// Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org
+// Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
-#ifndef _RUNWAYS_HXX
-#define _RUNWAYS_HXX
-
-
-#ifndef __cplusplus
-# error This library requires C++
-#endif
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#ifndef _FG_RUNWAYS_HXX
+#define _FG_RUNWAYS_HXX
#include <simgear/compiler.h>
-#include STL_STRING
+#include <string>
#include <vector>
-// Forward declarations.
-class c4_Storage;
-class c4_View;
-
-SG_USING_STD(string);
-SG_USING_STD(vector);
-
-
-class FGRunway {
-
-public:
-
- string id;
- string rwy_no;
-
- double lon;
- double lat;
- double heading;
- double length;
- double width;
-
- string surface_flags;
- string end1_flags;
- string end2_flags;
-
-public:
-
- FGRunway() {}
- ~FGRunway() {}
-
-};
-
-class FGRunways {
-
-private:
-
- c4_Storage *storage;
- c4_View *vRunway;
- int next_index;
-
+class FGRunway
+{
public:
-
- // Constructor
- FGRunways( const string& file );
-
- // Destructor
- ~FGRunways();
-
- // search for the specified apt id.
- // 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.
- bool search( const string& aptid, FGRunway* runway );
- bool search( const string& aptid, const string& rwyno, FGRunway* runway );
-
- // 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
- string search( const string& aptid, const int tgt_hdg );
-
- FGRunway search( const string& aptid );
- bool next( FGRunway* runway );
- FGRunway next();
-};
-
-
-class FGRunwaysUtil {
-public:
- typedef vector< FGRunway > container;
- typedef container::iterator iterator;
- typedef container::const_iterator const_iterator;
-
-private:
- container runways;
-
-public:
-
- // Constructor
- FGRunwaysUtil();
-
- // Destructor
- ~FGRunwaysUtil();
-
- // load the data
- int load( const string& file );
-
- // save the data in metakit format
- bool dump_mk4( const string& file );
-
- // search for the specified id.
- // Returns true if successful, otherwise returns false.
- // On success, runway data is returned thru "runway" pointer.
- // "runway" is not changed if "id" is not found.
- // bool search( const string& id, FGRunway* runway ) const;
- // FGRunway search( const string& id ) const;
+ FGRunway();
+
+ FGRunway(const std::string& rwy_no,
+ 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,
+ const int surface_code);
+
+ /**
+ * given a runway identifier (06, 18L, 31R) compute the identifier for the
+ * opposite heading runway (24, 36R, 13L) string.
+ */
+ static std::string reverseIdent(const std::string& aRunayIdent);
+
+ /**
+ * score this runway according to the specified weights. Used by
+ * FGAirport::findBestRunwayForHeading
+ */
+ double score(double aLengthWt, double aWidthWt, double aSurfaceWt) const;
+
+ bool isTaxiway() const;
+
+ std::string _rwy_no;
+ std::string _type; // runway / taxiway
+
+ double _lon;
+ double _lat;
+ double _heading;
+ double _length;
+ double _width;
+ double _displ_thresh1;
+ double _displ_thresh2;
+ double _stopway1;
+ double _stopway2;
+
+ int _surface_code;
};
+typedef std::vector<FGRunway> FGRunwayVector;
-#endif // _RUNWAYS_HXX
+#endif // _FG_RUNWAYS_HXX