]> git.mxchange.org Git - flightgear.git/blob - src/Airports/dynamics.hxx
Merge branch 'next' into durk-atc
[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
26 #ifndef __cplusplus
27 # error This library requires C++
28 #endif
29
30 #include <simgear/xml/easyxml.hxx>
31
32 #include <ATC/trafficcontrol.hxx>
33 #include "parking.hxx"
34 #include "groundnetwork.hxx"
35 #include "runwayprefs.hxx"
36 #include "sidstar.hxx"
37
38 //typedef vector<float> DoubleVec;
39 //typedef vector<float>::iterator DoubleVecIterator;
40
41 class FGAirport;
42
43
44 class FGAirportDynamics {
45
46 private:
47   FGAirport* _ap;
48
49   FGParkingVec         parkings;
50   FGRunwayPreference   rwyPrefs;
51   FGSidStar            SIDs;
52   FGStartupController  startupController;
53   FGGroundNetwork      groundNetwork;
54   FGTowerController    towerController;
55   FGApproachController approachController;
56
57   time_t lastUpdate;
58   string prevTrafficType;
59   stringVec landing;
60   stringVec takeoff;
61   stringVec milActive, comActive, genActive, ulActive;
62   stringVec *currentlyActive;
63   intVec freqAwos;     // </AWOS>
64   intVec freqUnicom;   // </UNICOM>
65   intVec freqClearance;// </CLEARANCE>
66   intVec freqGround;   // </GROUND>
67   intVec freqTower;    // </TOWER>
68   intVec freqApproach; // </APPROACH>
69
70   string atisInformation;
71
72   string chooseRunwayFallback();
73   bool innerGetActiveRunway(const string &trafficType, int action, string &runway, double heading);
74   string chooseRwyByHeading(stringVec rwys, double heading);
75
76     double elevation;
77
78 public:
79   FGAirportDynamics(FGAirport* ap);
80   FGAirportDynamics(const FGAirportDynamics &other);
81   ~FGAirportDynamics();
82
83   void addAwosFreq     (int val) { freqAwos.push_back(val);      };
84   void addUnicomFreq   (int val) { freqUnicom.push_back(val);    };
85   void addClearanceFreq(int val) { freqClearance.push_back(val); };
86   void addGroundFreq   (int val) { freqGround.push_back(val);    };
87   void addTowerFreq    (int val) { freqTower.push_back(val);     };
88   void addApproachFreq (int val) { freqApproach.push_back(val);  };
89
90   void init();
91   double getLongitude() const; 
92   // Returns degrees
93   double getLatitude()  const; 
94   // Returns ft
95   double getElevation() const; 
96   const string& getId() const; 
97   
98   void getActiveRunway(const string& trafficType, int action, string& runway, double heading);
99
100   void addParking(FGParking& park);
101   bool getAvailableParking(double *lat, double *lon, 
102                            double *heading, int *gate, double rad, const string& fltype, 
103                            const string& acType, const string& airline);
104   void getParking         (int id, double *lat, double* lon, double *heading);
105   FGParking *getParking(int i);
106   void releaseParking(int id);
107   string getParkingName(int i); 
108   int getNrOfParkings() { return parkings.size(); };
109   //FGAirport *getAddress() { return this; };
110   //const string &getName() const { return _name;};
111   // Returns degrees
112
113   // Departure / Arrival procedures
114   FGSidStar * getSIDs() { return &SIDs; };
115   FGAIFlightPlan * getSID(string activeRunway, double heading);
116
117
118   // ATC related functions. 
119   FGStartupController    *getStartupController()    { return &startupController; };
120   FGGroundNetwork        *getGroundNetwork()        { return &groundNetwork; };
121   FGTowerController      *getTowerController()      { return &towerController; };
122   FGApproachController   *getApproachController()   { return &approachController; };
123
124   const string& getAtisInformation() { return atisInformation; };
125   int getGroundFrequency (unsigned leg); //{ return freqGround.size() ? freqGround[0] : 0; };
126   int getTowerFrequency  (unsigned nr);
127   void setRwyUse(const FGRunwayPreference& ref);
128 };
129
130
131
132 #endif