1
0
Fork 0

Adjust snow line based on METAR. Snow level is only adjusted when METAR reports snow below the user set altitude.

This commit is contained in:
Gijs de Rooy 2011-12-06 20:39:05 +01:00
parent 729e3b2e36
commit f852529e56
3 changed files with 127 additions and 98 deletions

View file

@ -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);
});
#
###

View file

@ -418,81 +418,6 @@
</group>
</group>
<group>
<layout>hbox</layout>
<text>
<label>Other</label>
<halign>left</halign>
<enable>
<property>/sim/rendering/shaders/quality-level</property>
</enable>
</text>
<hrule>
<stretch>true</stretch>
</hrule>
</group>
<group>
<layout>hbox</layout>
<halign>right</halign>
<text>
<label>Snow line</label>
<enable>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<or>
<property>/sim/rendering/shaders/crop</property>
<property>/sim/rendering/shaders/landmass</property>
<property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shaders/urban</property>
</or>
</and>
</enable>
</text>
<slider>
<name>snow-level</name>
<enable>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<or>
<property>/sim/rendering/shaders/crop</property>
<property>/sim/rendering/shaders/landmass</property>
<property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shaders/urban</property>
</or>
</and>
</enable>
<min>0.0</min>
<max>5000.0</max>
<property>/environment/snow-level-m</property>
<binding>
<command>dialog-apply</command>
<object-name>snow-level</object-name>
</binding>
</slider>
<text>
<halign>left</halign>
<enable>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<or>
<property>/sim/rendering/shaders/crop</property>
<property>/sim/rendering/shaders/landmass</property>
<property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shaders/urban</property>
</or>
</and>
</enable>
<label>12345678</label>
<format>%.fm</format>
<live>true</live>
<property>/environment/snow-level-m</property>
</text>
</group>
<group>
<layout>hbox</layout>
<text>

View file

@ -416,7 +416,7 @@
</group>
<group>
<layout>hbox</layout>
<layout>vbox</layout>
<halign>fill</halign>
<group>
<layout>table</layout>
@ -424,23 +424,18 @@
<row>0</row>
<col>0</col>
<label>Rain</label>
<enable>
<property>/sim/gui/dialogs/weather-scenario/state</property>
</enable>
</text>
<text>
<row>0</row>
<col>1</col>
<label>Snow</label>
<enable>
<property>/sim/gui/dialogs/weather-scenario/state</property>
<halign>left</halign>
<enable>
<equals>
<property>/sim/gui/dialogs/weather-scenario/state</property>
<value type="int">1</value>
</equals>
</enable>
</text>
<slider>
<row>1</row>
<col>0</col>
<row>0</row>
<col>1</col>
<live>true</live>
<halign>fill</halign>
<property>/environment/rain-norm</property>
@ -455,6 +450,19 @@
</equals>
</enable>
</slider>
<text>
<row>1</row>
<col>0</col>
<label>Snow</label>
<halign>left</halign>
<enable>
<equals>
<property>/sim/gui/dialogs/weather-scenario/state</property>
<value type="int">1</value>
</equals>
</enable>
</text>
<slider>
<row>1</row>
@ -478,7 +486,7 @@
<row>0</row>
<col>3</col>
<label>QNH (inHg)</label>
<enable>
<enable>
<property>/sim/gui/dialogs/weather-scenario/state</property>
</enable>
</text>
@ -501,19 +509,93 @@
<object-name>pressure-sea-level-inhg</object-name>
</binding>
</input>
<empty>
<text>
<label>Snow line</label>
<row>2</row>
<col>0</col>
<colspan>3</colspan>
<pref-height>30</pref-height>
</empty>
<enable>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<or>
<property>/sim/rendering/shaders/crop</property>
<property>/sim/rendering/shaders/landmass</property>
<property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shaders/urban</property>
</or>
</and>
</enable>
</text>
<slider>
<name>snow-level</name>
<row>2</row>
<col>1</col>
<enable>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<or>
<property>/sim/rendering/shaders/crop</property>
<property>/sim/rendering/shaders/landmass</property>
<property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shaders/urban</property>
</or>
</and>
</enable>
<min>-425.0</min>
<max>5000.0</max>
<live>true</live>
<property>/environment/snow-level-m</property>
<binding>
<command>dialog-apply</command>
<object-name>snow-level</object-name>
</binding>
</slider>
<text>
<row>2</row>
<col>2</col>
<enable>
<and>
<property>/sim/rendering/shaders/quality-level</property>
<or>
<property>/sim/rendering/shaders/crop</property>
<property>/sim/rendering/shaders/landmass</property>
<property>/sim/rendering/shaders/transition</property>
<property>/sim/rendering/shaders/urban</property>
</or>
</and>
</enable>
<label>12345678</label>
<format>%.fm</format>
<live>true</live>
<property>/environment/snow-level-m</property>
</text>
</group>
<empty>
<stretch>true</stretch>
</empty>
<text>
<visible>
<not>
<equals>
<property>/sim/gui/dialogs/weather-scenario/state</property>
<value type="int">1</value>
</equals>
</not>
</visible>
<label>Disable METAR to manually edit weather settings.</label>
<halign>left</halign>
<color>
<red>1.0</red>
<green>0.6</green>
<blue>0.6</blue>
</color>
</text>
</group>
</group>
<!-- Precipitation End -->