Debian Codegraph @

src/Airports/runwaybase.hxx

raw symbols SCIP
1 /*
2 * SPDX-FileCopyrightText: (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
3 * SPDX_FileComment: represent a runway or taxiway
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #pragma once
8
9 #include <simgear/compiler.h>
10
11 #include <simgear/math/sg_geodesy.hxx>
12
13 #include <Airports/airports_fwd.hxx>
14 #include <Navaids/positioned.hxx>
15
16 #include <string>
17
18 /**
19 * @class The base class for runways and taxiways. At present, FGTaxiway is
20 * a direct instantiation of this class.
21 */
22 class FGRunwayBase : public FGPositioned
23 {
24 public:
25 FGRunwayBase(PositionedID aGuid, Type aTy, const std::string& aIdent,
26 const SGGeod& aGeod,
27 const double heading, const double length,
28 const double width,
29 const int surface_code,
30 const PositionedID airportId);
31
32 /**
33 * Retrieve a position on the extended centerline. Positive values
34 * are in the direction of the runway heading, negative values are in the
35 * opposited direction. 0.0 corresponds to the (non-displaced) threshold
36 */
37 SGGeod pointOnCenterline(double aOffset) const;
38 SGGeod pointOffCenterline(double aOffset, double lateralOffset) const;
39
40 double lengthFt() const
41 {
42 return _length * SG_METER_TO_FEET; }
43
44 double lengthM() const
45 { return _length; }
46
47 double widthFt() const
48 { return _width * SG_METER_TO_FEET; }
49
50 double widthM() const
51 { return _width; }
52
53 /**
54 * Runway heading in degrees.
55 */
56 double headingDeg() const
57 { return _heading; }
58
59 /**
60 * @brief runway heading in degrees, with local *current* magnetic
61 * variation applied.
62 *
63 * @return double
64 */
65 double magneticHeadingDeg() const;
66
67 /**
68 * Predicate to test if this runway has a hard surface. For the moment, this
69 * means concrete or asphalt
70 */
71 bool isHardSurface() const;
72
73 /**
74 * Retrieve runway surface code, as define in Robin Peel's data
75 */
76 int surface() const
77 { return _surface_code; }
78
79 /**
80 * Retrieve runway surface name, as define in Robin Peel's data
81 */
82 static const char * surfaceName( int surface_code );
83 const char * surfaceName() { return surfaceName( _surface_code ); }
84
85 FGAirportRef airport() const;
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 PositionedID mAirport;
99 };
100
101 // for the moment, taxiways are simply a concrete RunwayBase
102 class FGTaxiway : public FGRunwayBase
103 {
104 public:
105 FGTaxiway(PositionedID aGuid,
106 const std::string& aIdent,
107 const SGGeod& aGeod,
108 const double heading, const double length,
109 const double width,
110 const int surface_code,
111 const PositionedID airportId);
112 };