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 <Airports/runwaybase.hxx>
36 namespace flightgear {
42 class FGRunway : public FGRunwayBase
44 PositionedID _airport;
46 PositionedID _reciprocal;
52 FGRunway(PositionedID aGuid,
53 PositionedID aAirport, const std::string& rwy_no,
55 const double heading, const double length,
57 const double displ_thresh,
59 const int surface_code,
60 const bool reciprocal);
63 * given a runway identifier (06, 18L, 31R) compute the identifier for the
64 * reciprocal heading runway (24, 36R, 13L) string.
66 static std::string reverseIdent(const std::string& aRunayIdent);
69 * score this runway according to the specified weights. Used by
70 * FGAirport::findBestRunwayForHeading
72 double score(double aLengthWt, double aWidthWt, double aSurfaceWt) const;
75 * Test if this runway is the reciprocal. This allows users who iterate
76 * over runways to avoid counting runways twice, if desired.
78 bool isReciprocal() const
79 { return _isReciprocal; }
82 * Get the runway beginning point - this is syntatic sugar, equivalent to
83 * calling pointOnCenterline(0.0);
88 * Get the (possibly displaced) threshold point.
90 SGGeod threshold() const;
93 * Get the 'far' end - this is equivalent to calling
94 * pointOnCenterline(lengthFt());
98 double displacedThresholdM() const
99 { return _displ_thresh * SG_FEET_TO_METER; }
101 double stopwayM() const
102 { return _stopway * SG_FEET_TO_METER; }
105 * Airport this runway is located at
107 FGAirport* airport() const;
109 FGNavRecord* ILS() const;
112 * retrieve the associated glideslope transmitter, if one is defined.
114 FGNavRecord* glideslope() const;
116 void setILS(PositionedID nav) { _ils = nav; }
118 FGRunway* reciprocalRunway() const;
120 void setReciprocalRunway(PositionedID other);
123 * Get SIDs (DPs) associated with this runway
125 std::vector<flightgear::SID*> getSIDs() const;
128 * Get STARs associared with this runway
130 std::vector<flightgear::STAR*> getSTARs() const;
133 std::vector<flightgear::Approach*> getApproaches() const;
137 #endif // _FG_RUNWAYS_HXX