X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FEnvironment%2Fenvironment.hxx;h=048b17992885e77182bba414b6c7e13bf58bb950;hb=474789269b7656509f62339c17e62a55b6157d43;hp=f485c16f96317f21a1f6482c1357afb0893dc2da;hpb=ac20cb7768a8c7e2c02b9f03b62193f155ae0670;p=flightgear.git diff --git a/src/Environment/environment.hxx b/src/Environment/environment.hxx index f485c16f9..048b17992 100644 --- a/src/Environment/environment.hxx +++ b/src/Environment/environment.hxx @@ -16,26 +16,16 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // -// $Id$ - #ifndef _ENVIRONMENT_HXX #define _ENVIRONMENT_HXX #include -#include - -#include
- -#ifdef SG_HAVE_STD_INCLUDES -# include -#else -# include -#endif - +#include +#include "tiedpropertylist.hxx" /** * Model the natural environment. @@ -45,48 +35,109 @@ * * This class should eventually move to SimGear. */ -class FGEnvironment : public FGSubsystem +class FGEnvironment { public: FGEnvironment(); + FGEnvironment (const FGEnvironment &environment); virtual ~FGEnvironment(); + + FGEnvironment & operator = ( const FGEnvironment & other ); + + virtual void read (const SGPropertyNode * node); + virtual void Tie( SGPropertyNode_ptr base, bool setArchivable = true ); + virtual void Untie(); - virtual void init (); - virtual void bind (); - virtual void unbind (); - virtual void update (int dt); - - inline virtual double get_visibility_m () const { return visibility_m; } - inline virtual double get_wind_from_heading_deg () const { - return wind_from_heading_deg; - } - inline virtual double get_wind_speed_kt () const { return wind_speed_kt; } - inline virtual double get_wind_from_north_fps () const { - return wind_from_north_fps; - } - inline virtual double get_wind_from_east_fps () const { - return wind_from_east_fps; - } - inline virtual double get_wind_from_down_fps () const { - return wind_from_down_fps; - } + virtual double get_visibility_m () const; + + virtual double get_temperature_sea_level_degc () const; + virtual double get_temperature_degc () const; + virtual double get_temperature_degf () const; + virtual double get_dewpoint_sea_level_degc () const; + virtual double get_dewpoint_degc () const; + virtual double get_pressure_sea_level_inhg () const; + virtual double get_pressure_inhg () const; + virtual double get_density_slugft3 () const; + + virtual double get_relative_humidity () const; + virtual double get_density_tropo_avg_kgm3 () const; + virtual double get_altitude_half_to_sun_m () const; + virtual double get_altitude_tropo_top_m () const; + + virtual double get_wind_from_heading_deg () const; + virtual double get_wind_speed_kt () const; + virtual double get_wind_from_north_fps () const; + virtual double get_wind_from_east_fps () const; + virtual double get_wind_from_down_fps () const; + + virtual double get_turbulence_magnitude_norm () const; + virtual double get_turbulence_rate_hz () const; virtual void set_visibility_m (double v); + + virtual void set_temperature_sea_level_degc (double t); + virtual void set_temperature_degc (double t); + virtual void set_dewpoint_sea_level_degc (double d); + virtual void set_dewpoint_degc (double d); + virtual void set_pressure_sea_level_inhg (double p); + virtual void set_pressure_inhg (double p); + virtual void set_wind_from_heading_deg (double h); virtual void set_wind_speed_kt (double s); virtual void set_wind_from_north_fps (double n); virtual void set_wind_from_east_fps (double e); virtual void set_wind_from_down_fps (double d); -private: + virtual void set_turbulence_magnitude_norm (double t); + virtual void set_turbulence_rate_hz (double t); + + virtual double get_elevation_ft () const; + virtual void set_elevation_ft (double elevation_ft); + virtual void set_altitude_half_to_sun_m (double alt); + virtual void set_altitude_tropo_top_m (double alt); + virtual bool set_live_update(bool live_update); + + + FGEnvironment & interpolate (const FGEnvironment & env2, double fraction, FGEnvironment * result) const; +private: + virtual void copy (const FGEnvironment &environment); + void _init(); void _recalc_hdgspd (); + + void _recalc_sl_temperature (); + void _recalc_sl_dewpoint (); + void _recalc_sl_pressure (); + + void _recalc_density_tropo_avg_kgm3 (); void _recalc_ne (); + void _recalc_alt_dewpoint (); + void _recalc_density (); + void _recalc_relative_humidity (); + void _recalc_alt_pt (); + double elevation_ft; double visibility_m; + // Atmosphere + double temperature_sea_level_degc; + double temperature_degc; + double dewpoint_sea_level_degc; + double dewpoint_degc; + double pressure_sea_level_inhg; + double pressure_inhg; + double density_slugft3; + + double density_tropo_avg_kgm3; + double relative_humidity; + double altitude_half_to_sun_m; + double altitude_tropo_top_m; + + double turbulence_magnitude_norm; + double turbulence_rate_hz; + double wind_from_heading_deg; double wind_speed_kt; @@ -94,13 +145,9 @@ private: double wind_from_east_fps; double wind_from_down_fps; - // Do these belong here? - GLfloat fog_exp_density; - GLfloat fog_exp2_density; + bool live_update; + TiedPropertyList _tiedProperties; }; -// FIXME: move to FGGlobals. -extern FGEnvironment current_environment; - #endif // _ENVIRONMENT_HXX