]> git.mxchange.org Git - flightgear.git/blob - src/Airports/runwaybase.hxx
Merge branch 'next' of gitorious.org:fg/flightgear into next
[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   SGGeod pointOffCenterline(double aOffset, double lateralOffset) const;
56   
57   double lengthFt() const
58   { return _length; }
59   
60   double lengthM() const
61   { return _length * SG_FEET_TO_METER; }
62   
63   double widthFt() const
64   { return _width; }
65   
66   double widthM() const
67   { return _width * SG_FEET_TO_METER; }
68   
69    /**
70    * Runway heading in degrees.
71    */
72   double headingDeg() const
73   { return _heading; }
74   
75   /**
76    * Predicate to test if this runway has a hard surface. For the moment, this
77    * means concrete or asphalt
78    */
79   bool isHardSurface() const;
80   
81   /**
82    * Retrieve runway surface code, as define in Robin Peel's data
83    */
84   int surface() const 
85   { return _surface_code; }
86   
87 protected:
88     
89   double _heading;
90   double _length;
91   double _width;
92
93   /** surface, as defined by:
94    * http://www.x-plane.org/home/robinp/Apt810.htm#RwySfcCodes
95    */
96   int _surface_code;
97 };
98
99 // for the moment, taxiways are simply a concrete RunwayBase
100 class FGTaxiway : public FGRunwayBase
101 {
102 public:
103   FGTaxiway(const std::string& aIdent,
104             const SGGeod& aGeod,
105             const double heading, const double length,
106             const double width,
107             const int surface_code);
108 };
109
110 #endif // _FG_RUNWAY_BASE_HXX