]> git.mxchange.org Git - flightgear.git/blob - src/Airports/runwaybase.cxx
Update FGRunway to process information from threshold.xml files.
[flightgear.git] / src / Airports / runwaybase.cxx
1 // runwaybase.cxx -- a base class for runways and taxiways
2 //
3 // Written by James Turber, started December 2008.
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 #ifdef HAVE_CONFIG_H
25 #  include <config.h>
26 #endif
27
28 #include <simgear/compiler.h>
29
30 #include "runwaybase.hxx"
31
32 using std::string;
33
34 /*
35  * surface codes
36  * 1 - asphalt
37  * 2 - concrete
38  * 3 - turf
39  * 4 - dirt
40  * 5 - gravel
41  * 6 - asphalt helipad
42  * 7 - concrete helipad
43  * 8 - turf helipad
44  * 9 - dirt helipad
45  * 12 -  lakebed
46  */
47
48 FGRunwayBase::FGRunwayBase(Type aTy, const string& aIdent,
49                         const SGGeod& aGeod,
50                         const double heading, const double length,
51                         const double width,
52                         const int surface_code,
53                         bool index) :
54   FGPositioned(aTy, aIdent, aGeod, index)
55 {
56   _heading = heading;
57   _length = length;
58   _width = width;
59   _surface_code = surface_code;
60 }
61
62 SGGeod FGRunwayBase::pointOnCenterline(double aOffset) const
63 {
64   SGGeod result;
65   double dummyAz2;
66   double halfLengthMetres = lengthM() * 0.5;
67   
68   SGGeodesy::direct(mPosition, _heading, 
69     aOffset - halfLengthMetres,
70     result, dummyAz2);
71   return result;
72 }
73
74 bool FGRunwayBase::isHardSurface() const
75 {
76   return ((_surface_code == 1) || (_surface_code == 2));
77 }
78
79 FGTaxiway::FGTaxiway(const string& aIdent,
80                         const SGGeod& aGeod,
81                         const double heading, const double length,
82                         const double width,
83                         const int surface_code) :
84   FGRunwayBase(TAXIWAY, aIdent, aGeod, heading, length, width, surface_code, false)
85 {
86 }