]> git.mxchange.org Git - flightgear.git/blob - src/Airports/dynamics.hxx
Adding some more intelligence to the AI system step 2: Added a system to
[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 "parking.hxx"
33 #include "groundnetwork.hxx"
34 #include "runwayprefs.hxx"
35
36
37 class FGAirportDynamics : public XMLVisitor {
38
39 private:
40   double _longitude;    // degrees
41   double _latitude;     // degrees
42   double _elevation;    // ft
43   string _id;
44
45   FGParkingVec parkings;
46   FGRunwayPreference rwyPrefs;
47   FGGroundNetwork groundNetwork;
48
49   time_t lastUpdate;
50   string prevTrafficType;
51   stringVec landing;
52   stringVec takeoff;
53   stringVec currentlyActive;
54
55   // Experimental keep a running average of wind dir and speed to prevent
56   // Erratic runway changes. 
57   // Note: I should add these to the copy constructor and assigment operator to be
58   // constistent
59   double avWindHeading [10];
60   double avWindSpeed   [10];
61
62   string chooseRunwayFallback();
63
64 public:
65   FGAirportDynamics(double, double, double, string);
66   FGAirportDynamics(const FGAirportDynamics &other);
67   ~FGAirportDynamics();
68
69
70   void init();
71   double getLongitude() const { return _longitude;};
72   // Returns degrees
73   double getLatitude()  const { return _latitude; };
74   // Returns ft
75   double getElevation() const { return _elevation;};
76   
77   void getActiveRunway(const string& trafficType, int action, string& runway);
78   bool getAvailableParking(double *lat, double *lon, 
79                            double *heading, int *gate, double rad, const string& fltype, 
80                            const string& acType, const string& airline);
81   void getParking         (int id, double *lat, double* lon, double *heading);
82   FGParking *getParking(int i);
83   void releaseParking(int id);
84   string getParkingName(int i); 
85   //FGAirport *getAddress() { return this; };
86   //const string &getName() const { return _name;};
87   // Returns degrees
88
89  FGGroundNetwork* getGroundNetwork() { return &groundNetwork; };
90   
91
92   void setRwyUse(const FGRunwayPreference& ref);
93
94  // Some overloaded virtual XMLVisitor members
95   virtual void startXML (); 
96   virtual void endXML   ();
97   virtual void startElement (const char * name, const XMLAttributes &atts);
98   virtual void endElement (const char * name);
99   virtual void data (const char * s, int len);
100   virtual void pi (const char * target, const char * data);
101   virtual void warning (const char * message, int line, int column);
102   virtual void error (const char * message, int line, int column);
103 };
104
105
106
107 #endif