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
48 /** surface, as defined by:
49 * http://www.x-plane.org/home/robinp/Apt810.htm#RwySfcCodes
55 FGRunway(FGAirport* aAirport, const std::string& rwy_no,
57 const double heading, const double length,
59 const double displ_thresh,
61 const int surface_code,
62 const bool reciprocal);
65 * given a runway identifier (06, 18L, 31R) compute the identifier for the
66 * reciprocal heading runway (24, 36R, 13L) string.
68 static std::string reverseIdent(const std::string& aRunayIdent);
71 * score this runway according to the specified weights. Used by
72 * FGAirport::findBestRunwayForHeading
74 double score(double aLengthWt, double aWidthWt, double aSurfaceWt) const;
77 * Test if this runway is the reciprocal. This allows users who iterate
78 * over runways to avoid counting runways twice, if desired.
80 bool isReciprocal() const
81 { return _reciprocal; }
84 * Test if this is a taxiway or not
86 bool isTaxiway() const;
89 * Get the runway threshold point - this is syntatic sugar, equivalent to
90 * calling pointOnCenterline(0.0);
92 SGGeod threshold() const;
95 * Get the (possibly displaced) threshold point.
97 SGGeod displacedThreshold() const;
100 * Get the opposite threshold - this is equivalent to calling
101 * pointOnCenterline(lengthFt());
103 SGGeod reverseThreshold() const;
106 * Retrieve a position on the extended runway centerline. Positive values
107 * are in the direction of the runway heading, negative values are in the
108 * opposited direction. 0.0 corresponds to the (non-displaced) threshold
110 SGGeod pointOnCenterline(double aOffset) const;
113 * Runway length in ft
115 double lengthFt() const
118 double lengthM() const
119 { return _length * SG_FEET_TO_METER; }
121 double widthFt() const
124 double widthM() const
125 { return _width * SG_FEET_TO_METER; }
127 double displacedThresholdM() const
128 { return _displ_thresh * SG_FEET_TO_METER; }
130 double stopwayM() const
131 { return _stopway * SG_FEET_TO_METER; }
134 * Runway heading in degrees.
136 double headingDeg() const
140 * Airport this runway is located at
142 FGAirport* airport() const
145 // FIXME - should die once airport / runway creation is cleaned up
146 void setAirport(FGAirport* aAirport)
147 { _airport = aAirport; }
150 * Predicate to test if this runway has a hard surface. For the moment, this
151 * means concrete or asphalt
153 bool isHardSurface() const;
156 * Retrieve runway surface code, as define in Robin Peel's data
159 { return _surface_code; }
162 #endif // _FG_RUNWAYS_HXX