]> git.mxchange.org Git - flightgear.git/blob - src/Main/bfi.hxx
ef514f0c2d5a22d9ec8ee12b82d21ef0d27c86dd
[flightgear.git] / src / Main / bfi.hxx
1 // bfi.hxx - Big Flat Interface
2 //
3 // Written by David Megginson, started February, 2000.
4 //
5 // Copyright (C) 2000  David Megginson - david@megginson.com
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23 #include <time.h>
24 #include <string>
25
26 FG_USING_NAMESPACE(std);
27
28
29 /**
30  * Big Flat Interface
31  *
32  * This class implements the Facade design pattern (GOF p.185) to provide
33  * a single, (deceptively) simple flat interface for the FlightGear
34  * subsystems.  
35  *
36  * To help cut down on interdependence, subsystems should
37  * use the BFI whenever possible for inter-system communication.
38  *
39  * TODO:
40  * - add selectors to switch the current plane, throttle, brake, etc.
41  * - add more autopilot settings
42  */
43 class FGBFI
44 {
45 public:
46
47                                 // Reinit if necessary.
48   static void update ();
49
50                                 // Simulation
51   static int getFlightModel ();
52   static time_t getTimeGMT ();
53   static bool getHUDVisible ();
54   static bool getPanelVisible ();
55
56   static void setFlightModel (int flightModel);
57   static void setTimeGMT (time_t time);
58   static void setHUDVisible (bool hudVisible);
59   static void setPanelVisible (bool panelVisible);
60
61
62                                 // Position
63   static double getLatitude ();
64   static double getLongitude ();
65   static double getAltitude ();
66
67   static void setLatitude (double latitude);
68   static void setLongitude (double longitude);
69   static void setAltitude (double altitude);
70
71
72                                 // Attitude
73   static double getHeading ();
74   static double getPitch ();
75   static double getRoll ();
76
77   static void setHeading (double heading);
78   static void setPitch (double pitch);
79   static void setRoll (double roll);
80
81
82                                 // Velocities
83   static double getAirspeed ();
84   static double getSideSlip ();
85   static double getVerticalSpeed ();
86   static double getSpeedNorth ();
87   static double getSpeedEast ();
88   static double getSpeedDown ();
89
90   static void setSpeedNorth (double speed);
91   static void setSpeedEast (double speed);
92   static void setSpeedDown (double speed);
93
94
95                                 // Controls
96   static double getThrottle ();
97   static double getFlaps ();
98   static double getAileron ();
99   static double getRudder ();
100   static double getElevator ();
101   static double getElevatorTrim ();
102   static double getBrake ();
103
104   static void setThrottle (double throttle);
105   static void setFlaps (double flaps);
106   static void setAileron (double aileron);
107   static void setRudder (double rudder);
108   static void setElevator (double elevator);
109   static void setElevatorTrim (double trim);
110   static void setBrake (double brake);
111
112
113                                 // Autopilot
114   static bool getAPAltitudeLock ();
115   static double getAPAltitude ();
116   static bool getAPHeadingLock ();
117   static double getAPHeading ();
118
119   static void setAPAltitudeLock (bool lock);
120   static void setAPAltitude (double altitude);
121   static void setAPHeadingLock (bool lock);
122   static void setAPHeading (double heading);
123
124
125                                 // GPS
126   static const string getTargetAirport ();
127   static bool getGPSLock ();
128   static double getGPSTargetLatitude ();
129   static double getGPSTargetLongitude ();
130
131   static void setTargetAirport (const string &targetAirport);
132   static void setGPSLock (bool lock);
133   static void setGPSTargetLatitude (double latitude);
134   static void setGPSTargetLongitude (double longitude);
135
136
137                                 // Weather
138   static double getVisibility ();
139
140   static void setVisibility (double visiblity);
141
142                                 // Time (this varies with time) huh, huh
143   static double getMagVar (); 
144   static double getMagDip (); 
145
146
147 private:
148                                 // Will cause a linking error if invoked.
149   FGBFI ();
150
151   static void reinit ();
152   static void needReinit () { _needReinit = true; }
153   static bool _needReinit;
154 };
155
156 // end of bfi.hxx