]> git.mxchange.org Git - flightgear.git/blob - src/Airports/runwaybase.hxx
Update FGRunway to process information from threshold.xml files.
[flightgear.git] / src / Airports / runwaybase.hxx
1 // runwaybase.hxx -- represent a runway or taxiway
2 //
3 // Written by James Turner, started December 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_RUNWAY_BASE_HXX
25 #define _FG_RUNWAY_BASE_HXX
26
27 #include <simgear/compiler.h>
28
29 #include <simgear/math/sg_geodesy.hxx>
30
31 #include <Navaids/positioned.hxx>
32
33 #include <string>
34
35 /**
36  * @class The base class for runways and taxiways. At present, FGTaxiway is
37  * a direct instantiation of this class.
38  */
39 class FGRunwayBase : public FGPositioned
40 {    
41 public:
42   FGRunwayBase(Type aTy, const std::string& aIdent,
43             const SGGeod& aGeod,
44             const double heading, const double length,
45             const double width,
46             const int surface_code,
47             bool index);
48             
49   /**
50    * Retrieve a position on the extended centerline. Positive values
51    * are in the direction of the runway heading, negative values are in the
52    * opposited direction. 0.0 corresponds to the (non-displaced) threshold
53    */
54   SGGeod pointOnCenterline(double aOffset) const;
55   
56   double lengthFt() const
57   { return _length; }
58   
59   double lengthM() const
60   { return _length * SG_FEET_TO_METER; }
61   
62   double widthFt() const
63   { return _width; }
64   
65   double widthM() const
66   { return _width * SG_FEET_TO_METER; }
67   
68    /**
69    * Runway heading in degrees.
70    */
71   double headingDeg() const
72   { return _heading; }
73   
74   /**
75    * Predicate to test if this runway has a hard surface. For the moment, this
76    * means concrete or asphalt
77    */
78   bool isHardSurface() const;
79   
80   /**
81    * Retrieve runway surface code, as define in Robin Peel's data
82    */
83   int surface() const 
84   { return _surface_code; }
85   
86 protected:
87   double _heading;
88   double _length;
89   double _width;
90
91   /** surface, as defined by:
92    * http://www.x-plane.org/home/robinp/Apt810.htm#RwySfcCodes
93    */
94   int _surface_code;
95 };
96
97 // for the moment, taxiways are simply a concrete RunwayBase
98 class FGTaxiway : public FGRunwayBase
99 {
100 public:
101   FGTaxiway(const std::string& aIdent,
102             const SGGeod& aGeod,
103             const double heading, const double length,
104             const double width,
105             const int surface_code);
106 };
107
108 #endif // _FG_RUNWAY_BASE_HXX