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_
27 # error This library requires C++
30 #include <simgear/xml/easyxml.hxx>
32 #include <ATC/trafficcontrol.hxx>
33 #include "parking.hxx"
34 #include "groundnetwork.hxx"
35 #include "runwayprefs.hxx"
36 #include "sidstar.hxx"
38 //typedef vector<float> DoubleVec;
39 //typedef vector<float>::iterator DoubleVecIterator;
44 class FGAirportDynamics {
49 FGParkingVec parkings;
50 FGRunwayPreference rwyPrefs;
52 FGStartupController startupController;
53 FGGroundNetwork groundNetwork;
54 FGTowerController towerController;
55 FGApproachController approachController;
58 string prevTrafficType;
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>
70 string atisInformation;
72 string chooseRunwayFallback();
73 bool innerGetActiveRunway(const string &trafficType, int action, string &runway, double heading);
74 string chooseRwyByHeading(stringVec rwys, double heading);
76 FGAirportDynamics(FGAirport* ap);
77 FGAirportDynamics(const FGAirportDynamics &other);
80 void addAwosFreq (int val) { freqAwos.push_back(val); };
81 void addUnicomFreq (int val) { freqUnicom.push_back(val); };
82 void addClearanceFreq(int val) { freqClearance.push_back(val); };
83 void addGroundFreq (int val) { freqGround.push_back(val); };
84 void addTowerFreq (int val) { freqTower.push_back(val); };
85 void addApproachFreq (int val) { freqApproach.push_back(val); };
88 double getLongitude() const;
90 double getLatitude() const;
92 double getElevation() const;
93 const string& getId() const;
95 void getActiveRunway(const string& trafficType, int action, string& runway, double heading);
97 void addParking(FGParking& park);
98 bool getAvailableParking(double *lat, double *lon,
99 double *heading, int *gate, double rad, const string& fltype,
100 const string& acType, const string& airline);
101 void getParking (int id, double *lat, double* lon, double *heading);
102 FGParking *getParking(int i);
103 void releaseParking(int id);
104 string getParkingName(int i);
105 int getNrOfParkings() { return parkings.size(); };
106 //FGAirport *getAddress() { return this; };
107 //const string &getName() const { return _name;};
110 // Departure / Arrival procedures
111 FGSidStar * getSIDs() { return &SIDs; };
112 FGAIFlightPlan * getSID(string activeRunway, double heading);
115 // ATC related functions.
116 FGStartupController *getStartupController() { return &startupController; };
117 FGGroundNetwork *getGroundNetwork() { return &groundNetwork; };
118 FGTowerController *getTowerController() { return &towerController; };
119 FGApproachController *getApproachController() { return &approachController; };
121 const string& getAtisInformation() { return atisInformation; };
122 int getGroundFrequency(unsigned leg); //{ return freqGround.size() ? freqGround[0] : 0; };
124 void setRwyUse(const FGRunwayPreference& ref);