]> git.mxchange.org Git - flightgear.git/blob - src/Main/bfi.hxx
58cac3145041a0b3663cd971b4ccc83f1470cac4
[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 time_t getTimeGMT ();
55   static bool getHUDVisible ();
56   static bool getPanelVisible ();
57
58   static void setFlightModel (int flightModel);
59   static void setTimeGMT (time_t time);
60   static void setHUDVisible (bool hudVisible);
61   static void setPanelVisible (bool panelVisible);
62
63
64                                 // Position
65   static double getLatitude ();
66   static double getLongitude ();
67   static double getAltitude ();
68
69   static void setLatitude (double latitude);
70   static void setLongitude (double longitude);
71   static void setAltitude (double altitude);
72
73
74                                 // Attitude
75   static double getHeading ();
76   static double getPitch ();
77   static double getRoll ();
78
79   static void setHeading (double heading);
80   static void setPitch (double pitch);
81   static void setRoll (double roll);
82
83
84                                 // Velocities
85   static double getAirspeed ();
86   static double getSideSlip ();
87   static double getVerticalSpeed ();
88   static double getSpeedNorth ();
89   static double getSpeedEast ();
90   static double getSpeedDown ();
91
92   static void setSpeedNorth (double speed);
93   static void setSpeedEast (double speed);
94   static void setSpeedDown (double speed);
95
96
97                                 // Controls
98   static double getThrottle ();
99   static double getFlaps ();
100   static double getAileron ();
101   static double getRudder ();
102   static double getElevator ();
103   static double getElevatorTrim ();
104   static double getBrake ();
105
106   static void setThrottle (double throttle);
107   static void setFlaps (double flaps);
108   static void setAileron (double aileron);
109   static void setRudder (double rudder);
110   static void setElevator (double elevator);
111   static void setElevatorTrim (double trim);
112   static void setBrake (double brake);
113
114
115                                 // Autopilot
116   static bool getAPAltitudeLock ();
117   static double getAPAltitude ();
118   static bool getAPHeadingLock ();
119   static double getAPHeading ();
120
121   static void setAPAltitudeLock (bool lock);
122   static void setAPAltitude (double altitude);
123   static void setAPHeadingLock (bool lock);
124   static void setAPHeading (double heading);
125
126
127                                 // GPS
128   static const string getTargetAirport ();
129   static bool getGPSLock ();
130   static double getGPSTargetLatitude ();
131   static double getGPSTargetLongitude ();
132
133   static void setTargetAirport (const string &targetAirport);
134   static void setGPSLock (bool lock);
135   static void setGPSTargetLatitude (double latitude);
136   static void setGPSTargetLongitude (double longitude);
137
138
139                                 // Weather
140   static double getVisibility ();
141
142   static void setVisibility (double visiblity);
143
144                                 // Time (this varies with time) huh, huh
145   static double getMagVar (); 
146   static double getMagDip (); 
147
148
149 private:
150                                 // Will cause a linking error if invoked.
151   FGBFI ();
152
153   static void reinit ();
154   static void needReinit () { _needReinit = true; }
155   static bool _needReinit;
156 };
157
158 // end of bfi.hxx