X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FEnvironment%2Fenvironment_ctrl.hxx;h=75a8a00a74db1bacf598a338b1bea780802b7cca;hb=79e48829da50e0103e81684896b8287bfe23cc96;hp=d50dba79ed562d2d6007c431ae96729cb19ae73d;hpb=ce69eb8e79e6de9cbdf6c4187ad4524c4ce642c9;p=flightgear.git diff --git a/src/Environment/environment_ctrl.hxx b/src/Environment/environment_ctrl.hxx index d50dba79e..75a8a00a7 100644 --- a/src/Environment/environment_ctrl.hxx +++ b/src/Environment/environment_ctrl.hxx @@ -24,6 +24,7 @@ #define _ENVIRONMENT_CTRL_HXX #include +#include #ifdef SG_HAVE_STD_INCLUDES # include @@ -31,6 +32,10 @@ # include #endif +#include + +SG_USING_STD(vector); + class SGPropertyNode; #include "environment.hxx" @@ -40,7 +45,7 @@ class SGPropertyNode; /** * Interface to control environment information for a specific location. */ -class FGEnvironmentCtrl +class FGEnvironmentCtrl : public SGSubsystem { public: @@ -61,9 +66,6 @@ public: virtual double getLatitudeDeg () const { return _lat_deg; } virtual double getElevationFt () const { return _elev_ft; } - virtual void init () = 0; - virtual void update (int dt) = 0; - protected: FGEnvironment * _environment; @@ -85,7 +87,7 @@ public: virtual ~FGUserDefEnvironmentCtrl (); virtual void init (); - virtual void update (int dt); + virtual void update (double dt); private: @@ -97,4 +99,38 @@ private: }; + + +/** + * Interplation controller using user-supplied parameters. + */ +class FGInterpolateEnvironmentCtrl : public FGEnvironmentCtrl +{ +public: + FGInterpolateEnvironmentCtrl (); + virtual ~FGInterpolateEnvironmentCtrl (); + + virtual void init (); + virtual void reinit (); + virtual void update (double delta_time_sec); + +private: + + struct bucket { + double altitude_ft; + FGEnvironment environment; + bool operator< (const bucket &b) const; + }; + + void read_table (const SGPropertyNode * node, vector &table); + void do_interpolate (vector &table, double altitude_ft, + FGEnvironment * environment); + + FGEnvironment env1, env2; // temporaries + + vector _boundary_table; + vector _aloft_table; +}; + + #endif // _ENVIRONMENT_CTRL_HXX