]> git.mxchange.org Git - flightgear.git/blob - src/Environment/environment_ctrl.hxx
Moved some of the low level scene graph construction code over to simgear.
[flightgear.git] / src / Environment / environment_ctrl.hxx
1 // environment-ctrl.hxx -- controller for environment information.
2 //
3 // Written by David Megginson, started May 2002.
4 //
5 // Copyright (C) 2002  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 #ifndef _ENVIRONMENT_CTRL_HXX
24 #define _ENVIRONMENT_CTRL_HXX
25
26 #include <simgear/compiler.h>
27
28 #ifdef SG_HAVE_STD_INCLUDES
29 #  include <cmath>
30 #else
31 #  include <math.h>
32 #endif
33
34 class SGPropertyNode;
35
36 #include "environment.hxx"
37
38
39 \f
40 /**
41  * Interface to control environment information for a specific location.
42  */
43 class FGEnvironmentCtrl
44 {
45
46 public:
47
48   FGEnvironmentCtrl ();
49   virtual ~FGEnvironmentCtrl ();
50
51   virtual void setEnvironment (FGEnvironment * environment);
52
53   virtual FGEnvironment * getEnvironment () const { return _environment; }
54
55   virtual void setLongitudeDeg (double lon_deg);
56   virtual void setLatitudeDeg (double lat_deg);
57   virtual void setElevationFt (double elev_ft);
58   virtual void setPosition (double lon_deg, double lat_deg, double elev_ft);
59
60   virtual double getLongitudeDeg () const { return _lon_deg; }
61   virtual double getLatitudeDeg () const { return _lat_deg; }
62   virtual double getElevationFt () const { return _elev_ft; }
63
64   virtual void init () = 0;
65   virtual void update (double dt) = 0;
66
67 protected:
68
69   FGEnvironment * _environment;
70   double _lon_deg;
71   double _lat_deg;
72   double _elev_ft;
73
74 };
75
76
77 \f
78 /**
79  * Environment controller using user-supplied parameters.
80  */
81 class FGUserDefEnvironmentCtrl : public FGEnvironmentCtrl
82 {
83 public:
84   FGUserDefEnvironmentCtrl ();
85   virtual ~FGUserDefEnvironmentCtrl ();
86
87   virtual void init ();
88   virtual void update (double dt);
89
90 private:
91
92   SGPropertyNode * _base_wind_speed_node;
93   SGPropertyNode * _gust_wind_speed_node;
94
95   double _current_wind_speed_kt;
96   double _delta_wind_speed_kt;
97
98 };
99
100 #endif // _ENVIRONMENT_CTRL_HXX