]> git.mxchange.org Git - flightgear.git/blob - src/Airports/runways.hxx
Thorsten Brehm: GPWS: Fixed permanent blocking of lower prio warnings
[flightgear.git] / src / Airports / runways.hxx
1 // runways.hxx -- a simple class to manage airport runway info
2 //
3 // Written by Curtis Olson, started August 2000.
4 //
5 // Copyright (C) 2000  Curtis L. Olson  - http://www.flightgear.org/~curt
6 //
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.
11 //
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.
16 //
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.
20 //
21 // $Id$
22
23
24 #ifndef _FG_RUNWAYS_HXX
25 #define _FG_RUNWAYS_HXX
26
27 #include <simgear/compiler.h>
28
29 #include <Airports/runwaybase.hxx>
30
31 // forward decls
32 class FGAirport;
33 class FGNavRecord;
34 class SGPropertyNode;
35
36 class FGRunway : public FGRunwayBase
37 {
38   FGAirport* _airport;
39   bool _isReciprocal;
40   FGRunway* _reciprocal;
41   double _displ_thresh;
42   double _stopway;
43   FGNavRecord* _ils;
44 public:
45   
46   FGRunway(FGAirport* aAirport, const std::string& rwy_no,
47             const SGGeod& aGeod,
48             const double heading, const double length,
49             const double width,
50             const double displ_thresh,
51             const double stopway,
52             const int surface_code,
53             const bool reciprocal);
54   
55   /**
56    * given a runway identifier (06, 18L, 31R) compute the identifier for the
57    * reciprocal heading runway (24, 36R, 13L) string.
58    */
59   static std::string reverseIdent(const std::string& aRunayIdent);
60     
61   /**
62    * score this runway according to the specified weights. Used by
63    * FGAirport::findBestRunwayForHeading
64    */
65   double score(double aLengthWt, double aWidthWt, double aSurfaceWt) const;
66
67   /**
68    * Test if this runway is the reciprocal. This allows users who iterate
69    * over runways to avoid counting runways twice, if desired.
70    */
71   bool isReciprocal() const
72   { return _isReciprocal; }
73
74   /**
75    * Get the runway begining point - this is syntatic sugar, equivalent to
76    * calling pointOnCenterline(0.0);
77    */
78   SGGeod begin() const;
79   
80   /**
81    * Get the (possibly displaced) threshold point.
82    */
83   SGGeod threshold() const;
84   
85   /**
86    * Get the 'far' end - this is equivalent to calling
87    * pointOnCenterline(lengthFt());
88    */
89   SGGeod end() const;
90   
91   double displacedThresholdM() const
92   { return _displ_thresh * SG_FEET_TO_METER; }
93   
94   double stopwayM() const
95   { return _stopway * SG_FEET_TO_METER; }
96   
97   /**
98    * Airport this runway is located at
99    */
100   FGAirport* airport() const
101   { return _airport; }
102   
103   // FIXME - should die once airport / runway creation is cleaned up
104   void setAirport(FGAirport* aAirport)
105   { _airport = aAirport; }
106   
107   FGNavRecord* ILS() const { return _ils; }
108   void setILS(FGNavRecord* nav) { _ils = nav; }
109   
110   FGRunway* reciprocalRunway() const
111   { return _reciprocal; }
112   void setReciprocalRunway(FGRunway* other);
113   
114   /**
115    * Helper to process property data loaded from an ICAO.threshold.xml file
116    */
117   void processThreshold(SGPropertyNode* aThreshold);
118 };
119
120 #endif // _FG_RUNWAYS_HXX