]> git.mxchange.org Git - flightgear.git/blob - src/Airports/dynamics.hxx
Compilation error fixes following merge with next.
[flightgear.git] / src / Airports / dynamics.hxx
1 // dynamics.hxx - a class to manage the higher order airport ground activities
2 // Written by Durk Talsma, started December 2004.
3 //
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of the
8 // License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 //
19 // $Id$
20
21
22 #ifndef _AIRPORT_DYNAMICS_HXX_
23 #define _AIRPORT_DYNAMICS_HXX_
24
25 #include <ATC/trafficcontrol.hxx>
26 #include "parking.hxx"
27 #include "groundnetwork.hxx"
28 #include "runwayprefs.hxx"
29 #include "sidstar.hxx"
30
31 // forward decls
32 class FGAirport;
33 class FGEnvironment;
34
35 class FGAirportDynamics {
36
37 private:
38   FGAirport* _ap;
39
40   FGParkingVec         parkings;
41   FGRunwayPreference   rwyPrefs;
42   FGSidStar            SIDs;
43   FGStartupController  startupController;
44   FGGroundNetwork      groundNetwork;
45   FGTowerController    towerController;
46   FGApproachController approachController;
47
48   time_t lastUpdate;
49   std::string prevTrafficType;
50   stringVec landing;
51   stringVec takeoff;
52   stringVec milActive, comActive, genActive, ulActive;
53   stringVec *currentlyActive;
54   intVec freqAwos;     // </AWOS>
55   intVec freqUnicom;   // </UNICOM>
56   intVec freqClearance;// </CLEARANCE>
57   intVec freqGround;   // </GROUND>
58   intVec freqTower;    // </TOWER>
59   intVec freqApproach; // </APPROACH>
60
61   int atisSequenceIndex;
62   double atisSequenceTimeStamp;
63   
64   std::string chooseRunwayFallback();
65   bool innerGetActiveRunway(const std::string &trafficType, int action, std::string &runway, double heading);
66   std::string chooseRwyByHeading(stringVec rwys, double heading);
67
68   double elevation;
69
70 public:
71   FGAirportDynamics(FGAirport* ap);
72   ~FGAirportDynamics();
73
74   void addAwosFreq     (int val) { freqAwos.push_back(val);      };
75   void addUnicomFreq   (int val) { freqUnicom.push_back(val);    };
76   void addClearanceFreq(int val) { freqClearance.push_back(val); };
77   void addGroundFreq   (int val) { freqGround.push_back(val);    };
78   void addTowerFreq    (int val) { freqTower.push_back(val);     };
79   void addApproachFreq (int val) { freqApproach.push_back(val);  };
80
81   void init();
82   double getLongitude() const; 
83   // Returns degrees
84   double getLatitude()  const; 
85   // Returns ft
86   double getElevation() const; 
87   const string& getId() const; 
88   
89   void getActiveRunway(const string& trafficType, int action, string& runway, double heading);
90
91   void addParking(FGParking& park);
92   bool getAvailableParking(double *lat, double *lon, 
93                            double *heading, int *gate, double rad, const string& fltype, 
94                            const string& acType, const string& airline);
95   void getParking         (int id, double *lat, double* lon, double *heading);
96   FGParking *getParking(int i);
97   void releaseParking(int id);
98   string getParkingName(int i); 
99   int getNrOfParkings() { return parkings.size(); };
100   //FGAirport *getAddress() { return this; };
101   //const string &getName() const { return _name;};
102   // Returns degrees
103
104   // Departure / Arrival procedures
105   FGSidStar * getSIDs() { return &SIDs; };
106   FGAIFlightPlan * getSID(string activeRunway, double heading);
107
108
109   // ATC related functions. 
110   FGStartupController    *getStartupController()    { return &startupController; };
111   FGGroundNetwork        *getGroundNetwork()        { return &groundNetwork; };
112   FGTowerController      *getTowerController()      { return &towerController; };
113   FGApproachController   *getApproachController()   { return &approachController; };
114
115   int getGroundFrequency(unsigned leg);
116   int getTowerFrequency  (unsigned nr);
117   
118   /// get current ATIS sequence letter
119   const std::string getAtisSequence();
120
121   /// get the current ATIS sequence number, updating it if necessary
122   int updateAtisSequence(int interval, bool forceUpdate);
123
124   void setRwyUse(const FGRunwayPreference& ref);
125 };
126
127
128
129 #endif