]> git.mxchange.org Git - flightgear.git/blob - src/Airports/runways.hxx
Prepare and implement reinit methods for instruments
[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 namespace flightgear {
37   class SID;
38   class STAR;
39   class Approach;
40 }
41
42 class FGRunway : public FGRunwayBase
43 {
44   FGAirport* _airport;
45   bool _isReciprocal;
46   FGRunway* _reciprocal;
47   double _displ_thresh;
48   double _stopway;
49   FGNavRecord* _ils;
50 public:
51   
52   FGRunway(FGAirport* aAirport, const std::string& rwy_no,
53             const SGGeod& aGeod,
54             const double heading, const double length,
55             const double width,
56             const double displ_thresh,
57             const double stopway,
58             const int surface_code,
59             const bool reciprocal);
60   
61   /**
62    * given a runway identifier (06, 18L, 31R) compute the identifier for the
63    * reciprocal heading runway (24, 36R, 13L) string.
64    */
65   static std::string reverseIdent(const std::string& aRunayIdent);
66     
67   /**
68    * score this runway according to the specified weights. Used by
69    * FGAirport::findBestRunwayForHeading
70    */
71   double score(double aLengthWt, double aWidthWt, double aSurfaceWt) const;
72
73   /**
74    * Test if this runway is the reciprocal. This allows users who iterate
75    * over runways to avoid counting runways twice, if desired.
76    */
77   bool isReciprocal() const
78   { return _isReciprocal; }
79
80   /**
81    * Get the runway beginning point - this is syntatic sugar, equivalent to
82    * calling pointOnCenterline(0.0);
83    */
84   SGGeod begin() const;
85   
86   /**
87    * Get the (possibly displaced) threshold point.
88    */
89   SGGeod threshold() const;
90   
91   /**
92    * Get the 'far' end - this is equivalent to calling
93    * pointOnCenterline(lengthFt());
94    */
95   SGGeod end() const;
96   
97   double displacedThresholdM() const
98   { return _displ_thresh * SG_FEET_TO_METER; }
99   
100   double stopwayM() const
101   { return _stopway * SG_FEET_TO_METER; }
102   
103   /**
104    * Airport this runway is located at
105    */
106   FGAirport* airport() const
107   { return _airport; }
108   
109   // FIXME - should die once airport / runway creation is cleaned up
110   void setAirport(FGAirport* aAirport)
111   { _airport = aAirport; }
112   
113   FGNavRecord* ILS() const { return _ils; }
114   void setILS(FGNavRecord* nav) { _ils = nav; }
115   
116   FGRunway* reciprocalRunway() const
117   { return _reciprocal; }
118   void setReciprocalRunway(FGRunway* other);
119     
120   /**
121    * Helper to process property data loaded from an ICAO.threshold.xml file
122    */
123   void processThreshold(SGPropertyNode* aThreshold);
124   
125   /**
126    * Get SIDs (DPs) associated with this runway
127    */
128   std::vector<flightgear::SID*> getSIDs() const;
129   
130   /**
131    * Get STARs associared with this runway
132    */ 
133   std::vector<flightgear::STAR*> getSTARs() const;
134   
135   
136   std::vector<flightgear::Approach*> getApproaches() const;
137   
138 };
139
140 #endif // _FG_RUNWAYS_HXX