]> git.mxchange.org Git - flightgear.git/blob - src/Airports/dynamics.hxx
Remove the StaticLeaf visitor methods.
[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
37 //typedef vector<float> DoubleVec;
38 //typedef vector<float>::iterator DoubleVecIterator;
39
40 class FGAirport;
41
42
43 class FGAirportDynamics {
44
45 private:
46   FGAirport* _ap;
47
48   FGParkingVec        parkings;
49   FGRunwayPreference  rwyPrefs;
50   FGStartupController startupController;
51   FGGroundNetwork     groundNetwork;
52   FGTowerController   towerController;
53
54   time_t lastUpdate;
55   string prevTrafficType;
56   stringVec landing;
57   stringVec takeoff;
58   stringVec milActive, comActive, genActive, ulActive;
59   stringVec *currentlyActive;
60   intVec freqAwos;     // </AWOS>
61   intVec freqUnicom;   // </UNICOM>
62   intVec freqClearance;// </CLEARANCE>
63   intVec freqGround;   // </GROUND>
64   intVec freqTower;    // </TOWER>
65   intVec freqApproach; // </APPROACH>
66
67   string atisInformation;
68
69   string chooseRunwayFallback();
70   bool innerGetActiveRunway(const string &trafficType, int action, string &runway, double heading);
71   string chooseRwyByHeading(stringVec rwys, double heading);
72 public:
73   FGAirportDynamics(FGAirport* ap);
74   FGAirportDynamics(const FGAirportDynamics &other);
75   ~FGAirportDynamics();
76
77   void addAwosFreq     (int val) { freqAwos.push_back(val);      };
78   void addUnicomFreq   (int val) { freqUnicom.push_back(val);    };
79   void addClearanceFreq(int val) { freqClearance.push_back(val); };
80   void addGroundFreq   (int val) { freqGround.push_back(val);    };
81   void addTowerFreq    (int val) { freqTower.push_back(val);     };
82   void addApproachFreq (int val) { freqApproach.push_back(val);  };
83
84   void init();
85   double getLongitude() const; 
86   // Returns degrees
87   double getLatitude()  const; 
88   // Returns ft
89   double getElevation() const; 
90   const string& getId() const; 
91   
92   void getActiveRunway(const string& trafficType, int action, string& runway, double heading);
93
94   void addParking(FGParking& park);
95   bool getAvailableParking(double *lat, double *lon, 
96                            double *heading, int *gate, double rad, const string& fltype, 
97                            const string& acType, const string& airline);
98   void getParking         (int id, double *lat, double* lon, double *heading);
99   FGParking *getParking(int i);
100   void releaseParking(int id);
101   string getParkingName(int i); 
102   int getNrOfParkings() { return parkings.size(); };
103   //FGAirport *getAddress() { return this; };
104   //const string &getName() const { return _name;};
105   // Returns degrees
106
107
108   // ATC related functions. 
109   FGStartupController *getStartupController() { return &startupController; };
110   FGGroundNetwork     *getGroundNetwork()     { return &groundNetwork; };
111   FGTowerController   *getTowerController()   { return &towerController; };
112
113   const string& getAtisInformation() { return atisInformation; };
114   int getGroundFrequency(int leg); //{ return freqGround.size() ? freqGround[0] : 0; };
115
116   void setRwyUse(const FGRunwayPreference& ref);
117 };
118
119
120
121 #endif