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