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