1 // runways.hxx -- a simple class to manage airport runway info 2 // 3 // Written by Curtis Olson, started August 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_RUNWAYS_HXX 25 #define _FG_RUNWAYS_HXX 26 27 #include <simgear/compiler.h> 28 29 #include <Navaids/procedure.hxx> 30 #include "runwaybase.hxx" 31 #include "airports_fwd.hxx" 32 33 class FGRunway : public FGRunwayBase 34 { 35 PositionedID _airport; 36 PositionedID _reciprocal; 37 double _displ_thresh; 38 double _stopway; 39 PositionedID _ils; 40 public: isType(FGPositioned::Type ty)41 static bool isType(FGPositioned::Type ty) 42 { return (ty == FGPositioned::RUNWAY); } 43 44 FGRunway(PositionedID aGuid, 45 PositionedID aAirport, const std::string& rwy_no, 46 const SGGeod& aGeod, 47 const double heading, const double length, 48 const double width, 49 const double displ_thresh, 50 const double stopway, 51 const int surface_code); 52 53 /** 54 * given a runway identifier (06, 18L, 31R) compute the identifier for the 55 * reciprocal heading runway (24, 36R, 13L) string. 56 */ 57 static std::string reverseIdent(const std::string& aRunayIdent); 58 59 /** 60 * score this runway according to the specified weights. Used by 61 * FGAirport::findBestRunwayForHeading 62 */ 63 double score(double aLengthWt, double aWidthWt, double aSurfaceWt, double aIlsWt) const; 64 65 /** 66 * Get the runway beginning point - this is syntatic sugar, equivalent to 67 * calling pointOnCenterline(0.0); 68 */ 69 SGGeod begin() const; 70 71 /** 72 * Get the (possibly displaced) threshold point. 73 */ 74 SGGeod threshold() const; 75 76 /** 77 * Get the 'far' end - this is equivalent to calling 78 * pointOnCenterline(lengthFt()); 79 */ 80 SGGeod end() const; 81 displacedThresholdM() const82 double displacedThresholdM() const 83 { return _displ_thresh; } 84 stopwayM() const85 double stopwayM() const 86 { return _stopway; } 87 88 /** 89 * Airport this runway is located at 90 */ 91 FGAirport* airport() const; 92 93 FGNavRecord* ILS() const; 94 95 /** 96 * retrieve the associated glideslope transmitter, if one is defined. 97 */ 98 FGNavRecord* glideslope() const; 99 setILS(PositionedID nav)100 void setILS(PositionedID nav) { _ils = nav; } 101 102 FGRunway* reciprocalRunway() const; 103 104 void setReciprocalRunway(PositionedID other); 105 106 /** 107 * Get SIDs (DPs) associated with this runway 108 */ 109 flightgear::SIDList getSIDs() const; 110 111 /** 112 * Get STARs associared with this runway 113 */ 114 flightgear::STARList getSTARs() const; 115 116 117 flightgear::ApproachList getApproaches 118 ( 119 flightgear::ProcedureType type = flightgear::PROCEDURE_INVALID 120 ) const; 121 122 void updateThreshold(const SGGeod& newThreshold, 123 double newHeading, 124 double newDisplacedThreshold, 125 double newStopway); 126 }; 127 128 class FGHelipad : public FGRunwayBase 129 { 130 public: isType(FGPositioned::Type ty)131 static bool isType(FGPositioned::Type ty) 132 { return (ty == FGPositioned::HELIPAD); } 133 134 FGHelipad(PositionedID aGuid, 135 PositionedID aAirport, const std::string& rwy_no, 136 const SGGeod& aGeod, 137 const double heading, const double length, 138 const double width, 139 const int surface_code); 140 }; 141 142 143 #endif // _FG_RUNWAYS_HXX 144