diff --git a/Nasal/weather-utility.nas b/Nasal/weather-utility.nas index f11af508d..90e735e61 100644 --- a/Nasal/weather-utility.nas +++ b/Nasal/weather-utility.nas @@ -70,7 +70,6 @@ var initialize = func { var ground_term_Node = props.globals.getNode("/environment/terminator-relative-position-m" , 1); ground_term_Node.setDoubleValue(60000); - # ################## listeners #################### # setlistener("/environment/sea/surface/wind-speed-kt", func (n) { @@ -111,7 +110,7 @@ var initialize = func { }, 1, 0);# end listener - + print("weather util initialized ..."); loop(); @@ -157,3 +156,26 @@ setlistener("sim/signals/fdm-initialized", initialize); # end +### +# Adjust snow line to match METAR +# + +var snowLineDefault = 3200; + +_setlistener("/environment/metar/valid", func { + var snowCover = getprop("/environment/metar/snow-cover"); + var snowLine = getprop("/environment/snow-level-m"); + + # Put the snow line slightly below the station's elevation, + # so the station is completely covered with snow + var stationElev = getprop("/environment/metar/station-elevation-ft") * globals.FT2M - 50; + + if (snowCover == 1){ + if (stationElev > snowLineDefault) { snowLine = snowLineDefault; } + if ((stationElev <= snowLineDefault) and (snowLine > stationElev)) { snowLine = stationElev; } + } + setprop("/environment/snow-level-m",snowLine); +}); + +# +### \ No newline at end of file diff --git a/gui/dialogs/rendering.xml b/gui/dialogs/rendering.xml index 23a0678a6..461992151 100644 --- a/gui/dialogs/rendering.xml +++ b/gui/dialogs/rendering.xml @@ -418,81 +418,6 @@ - - hbox - - - left - - /sim/rendering/shaders/quality-level - - - - true - - - - - hbox - right - - - - - - /sim/rendering/shaders/quality-level - - /sim/rendering/shaders/crop - /sim/rendering/shaders/landmass - /sim/rendering/shaders/transition - /sim/rendering/shaders/urban - - - - - - - snow-level - - - /sim/rendering/shaders/quality-level - - /sim/rendering/shaders/crop - /sim/rendering/shaders/landmass - /sim/rendering/shaders/transition - /sim/rendering/shaders/urban - - - - 0.0 - 5000.0 - /environment/snow-level-m - - dialog-apply - snow-level - - - - - left - - - /sim/rendering/shaders/quality-level - - /sim/rendering/shaders/crop - /sim/rendering/shaders/landmass - /sim/rendering/shaders/transition - /sim/rendering/shaders/urban - - - - - %.fm - true - /environment/snow-level-m - - - hbox diff --git a/gui/dialogs/weather.xml b/gui/dialogs/weather.xml index 103f8a145..9a2eef8e5 100644 --- a/gui/dialogs/weather.xml +++ b/gui/dialogs/weather.xml @@ -416,7 +416,7 @@ - hbox + vbox fill table @@ -424,23 +424,18 @@ 0 0 - - /sim/gui/dialogs/weather-scenario/state - - - - - 0 - 1 - - - /sim/gui/dialogs/weather-scenario/state + left + + + /sim/gui/dialogs/weather-scenario/state + 1 + - 1 - 0 + 0 + 1 true fill /environment/rain-norm @@ -455,6 +450,19 @@ + + + 1 + 0 + + left + + + /sim/gui/dialogs/weather-scenario/state + 1 + + + 1 @@ -478,7 +486,7 @@ 0 3 - + /sim/gui/dialogs/weather-scenario/state @@ -501,19 +509,93 @@ pressure-sea-level-inhg - - + + + 2 0 - 3 - 30 - + + + /sim/rendering/shaders/quality-level + + /sim/rendering/shaders/crop + /sim/rendering/shaders/landmass + /sim/rendering/shaders/transition + /sim/rendering/shaders/urban + + + + + + + snow-level + 2 + 1 + + + /sim/rendering/shaders/quality-level + + /sim/rendering/shaders/crop + /sim/rendering/shaders/landmass + /sim/rendering/shaders/transition + /sim/rendering/shaders/urban + + + + -425.0 + 5000.0 + true + /environment/snow-level-m + + dialog-apply + snow-level + + + + + 2 + 2 + + + /sim/rendering/shaders/quality-level + + /sim/rendering/shaders/crop + /sim/rendering/shaders/landmass + /sim/rendering/shaders/transition + /sim/rendering/shaders/urban + + + + + %.fm + true + /environment/snow-level-m + - + true + + + + + + /sim/gui/dialogs/weather-scenario/state + 1 + + + + + left + + 1.0 + 0.6 + 0.6 + + +