| 1 | /* |
| 2 | * SPDX-FileCopyrightText: (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt |
| 3 | * SPDX_FileComment: a simple class to manage airport runway info |
| 4 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #pragma once |
| 8 | |
| 9 | #include <simgear/compiler.h> |
| 10 | |
| 11 | #include "runwaybase.hxx" |
| 12 | #include <Navaids/procedure.hxx> |
| 13 | |
| 14 | class FGRunway : public FGRunwayBase |
| 15 | { |
| 16 | PositionedID _reciprocal; |
| 17 | double _displ_thresh; |
| 18 | double _stopway; |
| 19 | PositionedID _ils; |
| 20 | public: |
| 21 | static bool isType(FGPositioned::Type ty) |
| 22 | { return (ty == FGPositioned::RUNWAY); } |
| 23 | |
| 24 | FGRunway(PositionedID aGuid, |
| 25 | PositionedID aAirport, const std::string& rwy_no, |
| 26 | const SGGeod& aGeod, |
| 27 | const double heading, const double length, |
| 28 | const double width, |
| 29 | const double displ_thresh, |
| 30 | const double stopway, |
| 31 | const int surface_code); |
| 32 | |
| 33 | /** |
| 34 | * given a runway identifier (06, 18L, 31R) compute the identifier for the |
| 35 | * reciprocal heading runway (24, 36R, 13L) string. |
| 36 | */ |
| 37 | static std::string reverseIdent(const std::string& aRunayIdent); |
| 38 | |
| 39 | /** |
| 40 | * score this runway according to the specified weights. Used by |
| 41 | * FGAirport::findBestRunwayForHeading |
| 42 | */ |
| 43 | double score(double aLengthWt, double aWidthWt, double aSurfaceWt, double aIlsWt) const; |
| 44 | |
| 45 | /** |
| 46 | * Get the runway beginning point - this is syntatic sugar, equivalent to |
| 47 | * calling pointOnCenterline(0.0); |
| 48 | */ |
| 49 | SGGeod begin() const; |
| 50 | |
| 51 | /** |
| 52 | * Get the (possibly displaced) threshold point. |
| 53 | */ |
| 54 | SGGeod threshold() const; |
| 55 | |
| 56 | /** |
| 57 | * Retrieve a position on the extended centerline. Positive values |
| 58 | * are in the direction of the runway heading, negative values are in the |
| 59 | * opposited direction. 0.0 corresponds to the possibly threshold |
| 60 | */ |
| 61 | SGGeod pointOnCenterlineDisplaced(double aOffset) const; |
| 62 | |
| 63 | /** |
| 64 | * Get the 'far' end - this is equivalent to calling |
| 65 | * pointOnCenterline(lengthFt()); |
| 66 | */ |
| 67 | SGGeod end() const; |
| 68 | |
| 69 | double displacedThresholdM() const |
| 70 | { return _displ_thresh; } |
| 71 | |
| 72 | double stopwayM() const |
| 73 | { return _stopway; } |
| 74 | |
| 75 | |
| 76 | FGNavRecord* ILS() const; |
| 77 | |
| 78 | /** |
| 79 | * retrieve the associated glideslope transmitter, if one is defined. |
| 80 | */ |
| 81 | FGNavRecord* glideslope() const; |
| 82 | |
| 83 | void setILS(PositionedID nav) { _ils = nav; } |
| 84 | |
| 85 | FGRunway* reciprocalRunway() const; |
| 86 | |
| 87 | void setReciprocalRunway(PositionedID other); |
| 88 | |
| 89 | /** |
| 90 | * Get SIDs (DPs) associated with this runway |
| 91 | */ |
| 92 | flightgear::SIDList getSIDs() const; |
| 93 | |
| 94 | /** |
| 95 | * Get STARs associared with this runway |
| 96 | */ |
| 97 | flightgear::STARList getSTARs() const; |
| 98 | |
| 99 | |
| 100 | flightgear::ApproachList getApproaches |
| 101 | ( |
| 102 | flightgear::ProcedureType type = flightgear::PROCEDURE_INVALID |
| 103 | ) const; |
| 104 | |
| 105 | void updateThreshold(const SGGeod& newThreshold, |
| 106 | double newHeading, |
| 107 | double newDisplacedThreshold, |
| 108 | double newStopway); |
| 109 | }; |
| 110 | |
| 111 | class FGHelipad : public FGRunwayBase |
| 112 | { |
| 113 | public: |
| 114 | static bool isType(FGPositioned::Type ty) |
| 115 | { return (ty == FGPositioned::HELIPAD); } |
| 116 | |
| 117 | FGHelipad(PositionedID aGuid, |
| 118 | PositionedID aAirport, const std::string& rwy_no, |
| 119 | const SGGeod& aGeod, |
| 120 | const double heading, const double length, |
| 121 | const double width, |
| 122 | const int surface_code); |
| 123 | }; |