1 // dynamics.hxx - a class to manage the higher order airport ground activities
2 // Written by Durk Talsma, started December 2004.
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.
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.
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.
22 #ifndef _AIRPORT_DYNAMICS_HXX_
23 #define _AIRPORT_DYNAMICS_HXX_
25 #include <ATC/trafficcontrol.hxx>
26 #include "parking.hxx"
27 #include "groundnetwork.hxx"
28 #include "runwayprefs.hxx"
29 #include "sidstar.hxx"
35 class FGAirportDynamics {
40 FGParkingVec parkings;
41 FGRunwayPreference rwyPrefs;
43 FGStartupController startupController;
44 FGGroundNetwork groundNetwork;
45 FGTowerController towerController;
46 FGApproachController approachController;
49 std::string prevTrafficType;
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>
61 int atisSequenceIndex;
62 double atisSequenceTimeStamp;
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);
68 FGAirportDynamics(FGAirport* ap);
71 void addAwosFreq (int val) { freqAwos.push_back(val); };
72 void addUnicomFreq (int val) { freqUnicom.push_back(val); };
73 void addClearanceFreq(int val) { freqClearance.push_back(val); };
74 void addGroundFreq (int val) { freqGround.push_back(val); };
75 void addTowerFreq (int val) { freqTower.push_back(val); };
76 void addApproachFreq (int val) { freqApproach.push_back(val); };
79 double getLongitude() const;
81 double getLatitude() const;
83 double getElevation() const;
84 const string& getId() const;
86 void getActiveRunway(const string& trafficType, int action, string& runway, double heading);
88 void addParking(FGParking& park);
89 bool getAvailableParking(double *lat, double *lon,
90 double *heading, int *gate, double rad, const string& fltype,
91 const string& acType, const string& airline);
92 void getParking (int id, double *lat, double* lon, double *heading);
93 FGParking *getParking(int i);
94 void releaseParking(int id);
95 string getParkingName(int i);
96 int getNrOfParkings() { return parkings.size(); };
97 //FGAirport *getAddress() { return this; };
98 //const string &getName() const { return _name;};
101 // Departure / Arrival procedures
102 FGSidStar * getSIDs() { return &SIDs; };
103 FGAIFlightPlan * getSID(string activeRunway, double heading);
106 // ATC related functions.
107 FGStartupController *getStartupController() { return &startupController; };
108 FGGroundNetwork *getGroundNetwork() { return &groundNetwork; };
109 FGTowerController *getTowerController() { return &towerController; };
110 FGApproachController *getApproachController() { return &approachController; };
112 int getGroundFrequency(unsigned leg);
114 /// get current ATIS sequence letter
115 const std::string getAtisSequence();
117 /// get the current ATIS sequence number, updating it if necessary
118 int updateAtisSequence(int interval, bool forceUpdate);
120 void setRwyUse(const FGRunwayPreference& ref);