From b73413d52edf12419563b63f5c8d8371d005ca5c Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Sun, 22 Nov 2020 19:29:35 +0100 Subject: [PATCH] =?UTF-8?q?Part=202:=20Work=20towards=20the=20option=20of?= =?UTF-8?q?=20interpolating=20between=20climate=20tiles=20by=20combining?= =?UTF-8?q?=20all=20climate=20related=20ground=20level=20parameters=20in?= =?UTF-8?q?=20one=20structure=20and=20calculating=20the=20sea=20level=20ti?= =?UTF-8?q?le=20from=20the=20(not=20yet=20interpolated)=20ground=20level?= =?UTF-8?q?=20tile.=20Read=20the=20elevelation=20of=20the=20climate=20tile?= =?UTF-8?q?=20from=20the=20k=C3=B6ppen=20database=20image=20which=20now=20?= =?UTF-8?q?contains=20the=20climate=20class=20in=20the=20red=20channel=20a?= =?UTF-8?q?nd=20the=20ground=20elevation=20in=20the=20green=20channel.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Environment/climate.hxx | 72 ++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/src/Environment/climate.hxx b/src/Environment/climate.hxx index 5474426cb..c950bfd6b 100644 --- a/src/Environment/climate.hxx +++ b/src/Environment/climate.hxx @@ -41,6 +41,25 @@ class FGLight; #define MAX_CLIMATE_CLASSES 32 class FGClimate : public SGSubsystem { +private: + struct _ground_tile { + SGGeod pos; + + double elevation_m = 0.0; + double temperature = -99999.0; + double temperature_mean = -99999.0; + double temperature_water = -99999.0; + double relative_humidity = -99999.0; + double precipitation_annual = -99999.0; + double precipitation = -99999.0; + bool has_autumn = false; + + double dewpoint = -99999.0; + double pressure = 0.0; + + } _ground_tile; + using ClimateTile = struct _ground_tile; + public: FGClimate(); virtual ~FGClimate() = default; @@ -58,22 +77,23 @@ public: double get_wetness() { return _wetness; } double get_lichen_cover() { return _lichen_cover; } - double get_relative_humidity_pct() { return _relative_humidity_gl; } - double get_relative_humidity_sl_pct() { return _relative_humidity_sl; } - double get_pressure_hpa() { return _pressure_gl; } - double get_pressure_sl_hpa() { return _pressure_sl; } - double get_dewpoint_degc() { return _dewpoint_gl; } - double get_dewpoint_sl_degc() { return _dewpoint_sl; } - double get_temperature_degc() { return _temperature_gl; } - double get_temperature_sl_degc() { return _temperature_sl; } - double get_temperature_mean_degc() { return _temperature_mean_gl; } - double get_temperature_mean_sl_degc() { return _temperature_mean_sl; } - double get_temperature_water_degc() { return _temperature_water; } - double get_temperature_seawater_degc() { return _temperature_seawater; } - double get_precipitation_month() { return _precipitation; } + double get_relative_humidity_pct() { return _gl.relative_humidity; } + double get_relative_humidity_sea_level_pct() { return _sl.relative_humidity; } + double get_pressure_hpa() { return _gl.pressure; } + double get_pressure_sea_leevel_hpa() { return _sl.pressure; } + double get_dewpoint_degc() { return _gl.dewpoint; } + double get_dewpoint_sl_degc() { return _sl.dewpoint; } + double get_temperature_degc() { return _gl.temperature; } + double get_temperature_sea_leevel_degc() { return _sl.temperature; } + double get_temperature_mean_degc() { return _gl.temperature_mean; } + double get_temperature_mean_sea_level_degc() { return _sl.temperature_mean; } + double get_temperature_water_degc() { return _gl.temperature_water; } + double get_temperature_seawater_degc() { return _sl.temperature_water; } + double get_precipitation_month() { return _gl.precipitation; } + double get_precipitation_annual() { return _gl.precipitation_annual; } + double get_wind_mps() { return _wind_speed; } double get_wind_direction_deg() { return _wind_direction; } - double get_precipitation_annual() { return _precipitation_annual; } bool getEnvironmentUpdate() const { return _environment_adjust; } void setEnvironmentUpdate(bool value); @@ -126,7 +146,6 @@ private: SGPropertyNode_ptr _metarSnowLevelNode; SGPropertyNode_ptr _positionLatitudeNode; SGPropertyNode_ptr _positionLongitudeNode; - SGPropertyNode_ptr _ground_elev_node; osg::ref_ptr image; double _image_width = 0; @@ -142,7 +161,6 @@ private: double _adj_latitude_deg = 0.0; // viewer lat adjusted for sun lat double _adj_longitude_deg = 0.0; // viewer lat adjusted for sun lon - double _elevation_m = 0.0; double _daytime = 0.0; double _day_noon = 1.0; double _day_light = 1.0; @@ -150,9 +168,9 @@ private: double _season_transistional = 0.0; double _seasons_year = 0.0; double _is_autumn = -99999.0; - bool _has_autumn = false; - int _code = 0; // Köppen-Geiger classicfication + // Köppen-Geiger classicfications + ClimateTile _tiles[3][3]; // environment bool _environment_adjust = false; // enable automatic adjestments @@ -164,23 +182,13 @@ private: double _lichen_cover = -99999.0; // 0.0 = none, 1.0 = mossy // weather + int _code = 0; // Köppen-Geiger classicfication + ClimateTile _gl; // ground level parameters + + ClimateTile _sl; // sea level parameters bool _weather_update = false; // enable weather updates - double _relative_humidity_sl = -99999.0;// 0.0 = dry, 1.0 is fully humid - double _relative_humidity_gl = -99999.0; - double _pressure_gl = 0.0; // ground level air pressure in hPa - double _pressure_sl = 0.0; // sea level air pressure in hPa double _wind_speed = 0.0; // wind in meters per second double _wind_direction = -99999.0; // wind direction in degrees - double _dewpoint_gl = -99999.0; - double _dewpoint_sl = -99999.0; - double _temperature_gl = -99999.0; // ground level temperature in deg. C. - double _temperature_sl = -99999.0; // seal level temperature in deg. C. - double _temperature_mean_gl = -99999.0; // mean temperature in deg. C. - double _temperature_mean_sl = -99999.0; // mean temperature at sea level - double _temperature_water = -99999.0; // mean temperature of water - double _temperature_seawater = -99999.0; // mean temperature of sea water - double _precipitation = -99999.0; // minimal avg. precipitation in mm/month - double _precipitation_annual = -99999.0; // global char _metar[256] = ""; };