]> git.mxchange.org Git - flightgear.git/blob - src/Main/bfi.hxx
A couple more cloud tweaks.
[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 #include <simgear/compiler.h>
27
28 FG_USING_NAMESPACE(std);
29
30
31 /**
32  * Big Flat Interface
33  *
34  * This class implements the Facade design pattern (GOF p.185) to provide
35  * a single, (deceptively) simple flat interface for the FlightGear
36  * subsystems.  
37  *
38  * To help cut down on interdependence, subsystems should
39  * use the BFI whenever possible for inter-system communication.
40  *
41  * TODO:
42  * - add selectors to switch the current plane, throttle, brake, etc.
43  * - add more autopilot settings
44  */
45 class FGBFI
46 {
47 public:
48
49                                 // Reinit if necessary.
50   static void update ();
51
52                                 // Simulation
53   static int getFlightModel ();
54   static const string getAircraft ();
55   static const string getAircraftDir ();
56   static time_t getTimeGMT ();
57   static bool getHUDVisible ();
58   static bool getPanelVisible ();
59
60   static void setFlightModel (int flightModel);
61   static void setAircraft (const string &aircraft);
62   static void setAircraftDir (const string &aircraftDir);
63   static void setTimeGMT (time_t time);
64   static void setHUDVisible (bool hudVisible);
65   static void setPanelVisible (bool panelVisible);
66
67
68                                 // Position
69   static double getLatitude ();
70   static double getLongitude ();
71   static double getAltitude ();
72   static double getAGL ();
73
74   static void setLatitude (double latitude);
75   static void setLongitude (double longitude);
76   static void setAltitude (double altitude);
77
78
79                                 // Attitude
80   static double getHeading ();    // true heading
81   static double getHeadingMag (); // exact magnetic heading
82   static double getPitch ();
83   static double getRoll ();
84
85   static void setHeading (double heading);
86   static void setPitch (double pitch);
87   static void setRoll (double roll);
88
89
90                                 // Velocities
91   static double getAirspeed ();
92   static double getSideSlip ();
93   static double getVerticalSpeed ();
94   static double getSpeedNorth ();
95   static double getSpeedEast ();
96   static double getSpeedDown ();
97
98   static void setSpeedNorth (double speed);
99   static void setSpeedEast (double speed);
100   static void setSpeedDown (double speed);
101
102
103                                 // Controls
104   static double getThrottle ();
105   static double getFlaps ();
106   static double getAileron ();
107   static double getRudder ();
108   static double getElevator ();
109   static double getElevatorTrim ();
110   static double getBrake ();
111
112   static void setThrottle (double throttle);
113   static void setFlaps (double flaps);
114   static void setAileron (double aileron);
115   static void setRudder (double rudder);
116   static void setElevator (double elevator);
117   static void setElevatorTrim (double trim);
118   static void setBrake (double brake);
119
120
121                                 // Autopilot
122   static bool getAPAltitudeLock ();
123   static double getAPAltitude ();
124   static bool getAPHeadingLock ();
125   static double getAPHeadingMag ();
126
127   static void setAPAltitudeLock (bool lock);
128   static void setAPAltitude (double altitude);
129   static void setAPHeadingLock (bool lock);
130   static void setAPHeadingMag (double heading);
131
132   static bool getAPNAV1Lock ();
133   static void setAPNAV1Lock (bool lock);
134
135                                 // Radio Navigation
136   static double getNAV1Freq ();
137   static double getNAV1AltFreq ();
138   static double getNAV1Radial ();
139   static double getNAV1SelRadial ();
140   static double getNAV1DistDME ();
141   static bool getNAV1InRange ();
142   static bool getNAV1DMEInRange ();
143
144   static double getNAV2Freq ();
145   static double getNAV2AltFreq ();
146   static double getNAV2Radial ();
147   static double getNAV2SelRadial ();
148   static double getNAV2DistDME ();
149   static bool getNAV2InRange ();
150   static bool getNAV2DMEInRange ();
151
152   static double getADFFreq ();
153   static double getADFAltFreq ();
154   static double getADFRotation ();
155
156   static void setNAV1Freq (double freq);
157   static void setNAV1AltFreq (double freq);
158   static void setNAV1SelRadial (double radial);
159
160   static void setNAV2Freq (double freq);
161   static void setNAV2AltFreq (double freq);
162   static void setNAV2SelRadial (double radial);
163
164   static void setADFFreq (double freq);
165   static void setADFAltFreq (double freq);
166   static void setADFRotation (double rot);
167
168                                 // GPS
169   static const string getTargetAirport ();
170   static bool getGPSLock ();
171   static double getGPSTargetLatitude ();
172   static double getGPSTargetLongitude ();
173
174   static void setTargetAirport (const string &targetAirport);
175   static void setGPSLock (bool lock);
176   static void setGPSTargetLatitude (double latitude);
177   static void setGPSTargetLongitude (double longitude);
178
179
180                                 // Weather
181   static double getVisibility ();
182   static bool getClouds ();
183   static double getCloudsASL ();
184
185   static void setVisibility (double visiblity);
186   static void setClouds (bool clouds);
187   static void setCloudsASL (double cloudsASL);
188
189
190                                 // Time (this varies with time) huh, huh
191   static double getMagVar (); 
192   static double getMagDip (); 
193
194
195 private:
196                                 // Will cause a linking error if invoked.
197   FGBFI ();
198
199   static void reinit ();
200   static void needReinit () { _needReinit = true; }
201   static bool _needReinit;
202 };
203
204 // end of bfi.hxx