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(PositionedID aGuid, 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 
48   /**
49    * Retrieve a position on the extended centerline. Positive values
50    * are in the direction of the runway heading, negative values are in the
51    * opposited direction. 0.0 corresponds to the (non-displaced) threshold
52    */
53   SGGeod pointOnCenterline(double aOffset) const;
54   SGGeod pointOffCenterline(double aOffset, double lateralOffset) const;
55 
lengthFt() const56   double lengthFt() const
57   { return _length * SG_METER_TO_FEET; }
58 
lengthM() const59   double lengthM() const
60   { return _length; }
61 
widthFt() const62   double widthFt() const
63   { return _width * SG_METER_TO_FEET; }
64 
widthM() const65   double widthM() const
66   { return _width; }
67 
68    /**
69    * Runway heading in degrees.
70    */
headingDeg() const71   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    */
surface() const83   int surface() const
84   { return _surface_code; }
85 
86   /**
87    * Retrieve runway surface name, as define in Robin Peel's data
88    */
89   static const char * surfaceName( int surface_code );
surfaceName()90   const char * surfaceName() { return surfaceName( _surface_code ); }
91 
92 protected:
93 
94   double _heading;
95   double _length;
96   double _width;
97 
98   /** surface, as defined by:
99    * http://www.x-plane.org/home/robinp/Apt810.htm#RwySfcCodes
100    */
101   int _surface_code;
102 };
103 
104 // for the moment, taxiways are simply a concrete RunwayBase
105 class FGTaxiway : public FGRunwayBase
106 {
107 public:
108   FGTaxiway(PositionedID aGuid,
109             const std::string& aIdent,
110             const SGGeod& aGeod,
111             const double heading, const double length,
112             const double width,
113             const int surface_code);
114 };
115 
116 #endif // _FG_RUNWAY_BASE_HXX
117