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 "parking.hxx"
33 #include "groundnetwork.hxx"
34 #include "runwayprefs.hxx"
35 #include "trafficcontrol.hxx"
38 class FGAirportDynamics : public XMLVisitor {
41 double _longitude; // degrees
42 double _latitude; // degrees
43 double _elevation; // ft
46 FGParkingVec parkings;
47 FGRunwayPreference rwyPrefs;
48 FGGroundNetwork groundNetwork;
49 FGTowerController towerController;
52 string prevTrafficType;
55 stringVec currentlyActive;
57 // Experimental keep a running average of wind dir and speed to prevent
58 // Erratic runway changes.
59 // Note: I should add these to the copy constructor and assigment operator to be
61 double avWindHeading [10];
62 double avWindSpeed [10];
64 string chooseRunwayFallback();
67 FGAirportDynamics(double, double, double, string);
68 FGAirportDynamics(const FGAirportDynamics &other);
73 double getLongitude() const { return _longitude;};
75 double getLatitude() const { return _latitude; };
77 double getElevation() const { return _elevation;};
79 void getActiveRunway(const string& trafficType, int action, string& runway);
80 bool getAvailableParking(double *lat, double *lon,
81 double *heading, int *gate, double rad, const string& fltype,
82 const string& acType, const string& airline);
83 void getParking (int id, double *lat, double* lon, double *heading);
84 FGParking *getParking(int i);
85 void releaseParking(int id);
86 string getParkingName(int i);
87 //FGAirport *getAddress() { return this; };
88 //const string &getName() const { return _name;};
91 FGGroundNetwork *getGroundNetwork() { return &groundNetwork; };
92 FGTowerController *getTowerController() { return &towerController; };
95 void setRwyUse(const FGRunwayPreference& ref);
97 // Some overloaded virtual XMLVisitor members
98 virtual void startXML ();
99 virtual void endXML ();
100 virtual void startElement (const char * name, const XMLAttributes &atts);
101 virtual void endElement (const char * name);
102 virtual void data (const char * s, int len);
103 virtual void pi (const char * target, const char * data);
104 virtual void warning (const char * message, int line, int column);
105 virtual void error (const char * message, int line, int column);