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 - http://www.flightgear.org/~curt
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #ifndef _FG_RUNWAYS_HXX
25 #define _FG_RUNWAYS_HXX
27 #include <simgear/compiler.h>
29 #include <simgear/math/sg_geodesy.hxx>
31 #include "Navaids/positioned.hxx"
38 class FGRunway : public FGPositioned
40 FGAirport* _airport; ///< owning airport
51 FGRunway(FGAirport* aAirport, const std::string& rwy_no,
53 const double heading, const double length,
55 const double displ_thresh,
57 const int surface_code,
58 const bool reciprocal);
61 * given a runway identifier (06, 18L, 31R) compute the identifier for the
62 * reciprocal heading runway (24, 36R, 13L) string.
64 static std::string reverseIdent(const std::string& aRunayIdent);
67 * score this runway according to the specified weights. Used by
68 * FGAirport::findBestRunwayForHeading
70 double score(double aLengthWt, double aWidthWt, double aSurfaceWt) const;
73 * Test if this runway is the reciprocal. This allows users who iterate
74 * over runways to avoid counting runways twice, if desired.
76 bool isReciprocal() const
77 { return _reciprocal; }
80 * Test if this is a taxiway or not
82 bool isTaxiway() const;
85 * Get the runway threshold point - this is syntatic sugar, equivalent to
86 * calling pointOnCenterline(0.0);
88 SGGeod threshold() const;
91 * Get the (possibly displaced) threshold point.
93 SGGeod displacedThreshold() const;
96 * Get the opposite threshold - this is equivalent to calling
97 * pointOnCenterline(lengthFt());
99 SGGeod reverseThreshold() const;
102 * Retrieve a position on the extended runway centerline. Positive values
103 * are in the direction of the runway heading, negative values are in the
104 * opposited direction. 0.0 corresponds to the (non-displaced) threshold
106 SGGeod pointOnCenterline(double aOffset) const;
109 * Runway length in ft
111 double lengthFt() const
114 double lengthM() const
115 { return _length * SG_FEET_TO_METER; }
117 double widthFt() const
120 double widthM() const
121 { return _width * SG_FEET_TO_METER; }
123 double displacedThresholdM() const
124 { return _displ_thresh * SG_FEET_TO_METER; }
126 double stopwayM() const
127 { return _stopway * SG_FEET_TO_METER; }
130 * Runway heading in degrees.
132 double headingDeg() const
136 * Airport this runway is located at
138 FGAirport* airport() const
141 // FIXME - should die once airport / runway creation is cleaned up
142 void setAirport(FGAirport* aAirport)
143 { _airport = aAirport; }
146 * Predicate to test if this runway has a hard surface. For the moment, this
147 * means concrete or asphalt
149 bool isHardSurface() const;
152 * Retrieve runway surface code, as define in Robin Peel's data
155 { return _surface_code; }
158 #endif // _FG_RUNWAYS_HXX