fix bug 255: add turbulence to weather menu
This commit is contained in:
parent
6750551818
commit
cf1660986d
2 changed files with 256 additions and 0 deletions
|
@ -126,4 +126,36 @@
|
||||||
<filter-time>5</filter-time>
|
<filter-time>5</filter-time>
|
||||||
</filter>
|
</filter>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<name>EnvironmentInterpolator:turbulence-magnitude</name>
|
||||||
|
<enable>
|
||||||
|
<condition>
|
||||||
|
<property>/environment/config/enabled</property>
|
||||||
|
</condition>
|
||||||
|
</enable>
|
||||||
|
<input>
|
||||||
|
<condition>
|
||||||
|
<property>/environment/config/presets/turbulence-magnitude-norm-override</property>
|
||||||
|
</condition>
|
||||||
|
<property>/environment/config/presets/turbulence-magnitude-norm-override</property>
|
||||||
|
</input>
|
||||||
|
<input>/environment/config/interpolated/turbulence/magnitude-norm</input>
|
||||||
|
<output>/environment/turbulence/magnitude-norm</output>
|
||||||
|
<type>exponential</type>
|
||||||
|
<filter-time>1</filter-time>
|
||||||
|
</filter>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<name>EnvironmentInterpolator:turbulence-rate</name>
|
||||||
|
<enable>
|
||||||
|
<condition>
|
||||||
|
<property>/environment/config/enabled</property>
|
||||||
|
</condition>
|
||||||
|
</enable>
|
||||||
|
<input>/environment/config/interpolated/turbulence/rate-hz</input>
|
||||||
|
<output>/environment/turbulence/rate-hz</output>
|
||||||
|
<type>exponential</type>
|
||||||
|
<filter-time>1</filter-time>
|
||||||
|
</filter>
|
||||||
|
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
|
|
|
@ -578,6 +578,12 @@
|
||||||
<label>Dewpt (C)</label>
|
<label>Dewpt (C)</label>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
|
<text>
|
||||||
|
<row>0</row>
|
||||||
|
<col>6</col>
|
||||||
|
<label>Turbulence</label>
|
||||||
|
</text>
|
||||||
|
|
||||||
<input>
|
<input>
|
||||||
<name>aloft-4-elevation-ft</name>
|
<name>aloft-4-elevation-ft</name>
|
||||||
<row>1</row>
|
<row>1</row>
|
||||||
|
@ -686,6 +692,33 @@
|
||||||
</binding>
|
</binding>
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
|
<combo>
|
||||||
|
<name>aloft-4-turbulence</name>
|
||||||
|
<row>1</row>
|
||||||
|
<col>6</col>
|
||||||
|
<pref-width>90</pref-width>
|
||||||
|
<live>true</live>
|
||||||
|
<property>/environment/config/aloft/entry[4]/turbulence-name</property>
|
||||||
|
<value>none</value>
|
||||||
|
<value>light</value>
|
||||||
|
<value>moderate</value>
|
||||||
|
<value>severe</value>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>aloft-4-turbulence</object-name>
|
||||||
|
</binding>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>controller.setTurbulence("aloft",4);</script>
|
||||||
|
</binding>
|
||||||
|
<!--enable>
|
||||||
|
<equals>
|
||||||
|
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</equals>
|
||||||
|
</enable-->
|
||||||
|
</combo>
|
||||||
|
|
||||||
<input>
|
<input>
|
||||||
<name>aloft-3-elevation-ft</name>
|
<name>aloft-3-elevation-ft</name>
|
||||||
<row>2</row>
|
<row>2</row>
|
||||||
|
@ -794,6 +827,33 @@
|
||||||
</binding>
|
</binding>
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
|
<combo>
|
||||||
|
<name>aloft-3-turbulence</name>
|
||||||
|
<row>2</row>
|
||||||
|
<col>6</col>
|
||||||
|
<pref-width>90</pref-width>
|
||||||
|
<live>true</live>
|
||||||
|
<property>/environment/config/aloft/entry[3]/turbulence-name</property>
|
||||||
|
<value>none</value>
|
||||||
|
<value>light</value>
|
||||||
|
<value>moderate</value>
|
||||||
|
<value>severe</value>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>aloft-3-turbulence</object-name>
|
||||||
|
</binding>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>controller.setTurbulence("aloft",3);</script>
|
||||||
|
</binding>
|
||||||
|
<!--enable>
|
||||||
|
<equals>
|
||||||
|
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</equals>
|
||||||
|
</enable-->
|
||||||
|
</combo>
|
||||||
|
|
||||||
<input>
|
<input>
|
||||||
<name>aloft-2-elevation-ft</name>
|
<name>aloft-2-elevation-ft</name>
|
||||||
<row>3</row>
|
<row>3</row>
|
||||||
|
@ -902,6 +962,34 @@
|
||||||
</binding>
|
</binding>
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
|
<combo>
|
||||||
|
<name>aloft-2-turbulence</name>
|
||||||
|
<row>3</row>
|
||||||
|
<col>6</col>
|
||||||
|
<pref-width>90</pref-width>
|
||||||
|
<live>true</live>
|
||||||
|
<property>/environment/config/aloft/entry[2]/turbulence-name</property>
|
||||||
|
<value>none</value>
|
||||||
|
<value>light</value>
|
||||||
|
<value>moderate</value>
|
||||||
|
<value>severe</value>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>aloft-2-turbulence</object-name>
|
||||||
|
</binding>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>controller.setTurbulence("aloft",2);</script>
|
||||||
|
</binding>
|
||||||
|
<!--enable>
|
||||||
|
<equals>
|
||||||
|
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</equals>
|
||||||
|
</enable-->
|
||||||
|
</combo>
|
||||||
|
|
||||||
|
|
||||||
<input>
|
<input>
|
||||||
<name>aloft-1-elevation-ft</name>
|
<name>aloft-1-elevation-ft</name>
|
||||||
<row>4</row>
|
<row>4</row>
|
||||||
|
@ -1010,6 +1098,33 @@
|
||||||
</binding>
|
</binding>
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
|
<combo>
|
||||||
|
<name>aloft-1-turbulence</name>
|
||||||
|
<row>4</row>
|
||||||
|
<col>6</col>
|
||||||
|
<pref-width>90</pref-width>
|
||||||
|
<live>true</live>
|
||||||
|
<property>/environment/config/aloft/entry[1]/turbulence-name</property>
|
||||||
|
<value>none</value>
|
||||||
|
<value>light</value>
|
||||||
|
<value>moderate</value>
|
||||||
|
<value>severe</value>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>aloft-1-turbulence</object-name>
|
||||||
|
</binding>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>controller.setTurbulence("aloft",1);</script>
|
||||||
|
</binding>
|
||||||
|
<!--enable>
|
||||||
|
<equals>
|
||||||
|
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</equals>
|
||||||
|
</enable-->
|
||||||
|
</combo>
|
||||||
|
|
||||||
<input>
|
<input>
|
||||||
<name>aloft-0-elevation-ft</name>
|
<name>aloft-0-elevation-ft</name>
|
||||||
<row>5</row>
|
<row>5</row>
|
||||||
|
@ -1123,6 +1238,34 @@
|
||||||
<object-name>aloft-0-dewpoint-degc</object-name>
|
<object-name>aloft-0-dewpoint-degc</object-name>
|
||||||
</binding>
|
</binding>
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
|
<combo>
|
||||||
|
<name>aloft-0-turbulence</name>
|
||||||
|
<row>5</row>
|
||||||
|
<col>6</col>
|
||||||
|
<pref-width>90</pref-width>
|
||||||
|
<live>true</live>
|
||||||
|
<property>/environment/config/aloft/entry[0]/turbulence-name</property>
|
||||||
|
<value>none</value>
|
||||||
|
<value>light</value>
|
||||||
|
<value>moderate</value>
|
||||||
|
<value>severe</value>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>aloft-0-turbulence</object-name>
|
||||||
|
</binding>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>controller.setTurbulence("aloft",0);</script>
|
||||||
|
</binding>
|
||||||
|
<!--enable>
|
||||||
|
<equals>
|
||||||
|
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</equals>
|
||||||
|
</enable-->
|
||||||
|
</combo>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
<empty>
|
<empty>
|
||||||
<stretch>true</stretch>
|
<stretch>true</stretch>
|
||||||
|
@ -1316,6 +1459,33 @@
|
||||||
</binding>
|
</binding>
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
|
<combo>
|
||||||
|
<name>boundary-1-turbulence</name>
|
||||||
|
<row>1</row>
|
||||||
|
<col>6</col>
|
||||||
|
<pref-width>90</pref-width>
|
||||||
|
<live>true</live>
|
||||||
|
<property>/environment/config/boundary/entry[1]/turbulence-name</property>
|
||||||
|
<value>none</value>
|
||||||
|
<value>light</value>
|
||||||
|
<value>moderate</value>
|
||||||
|
<value>severe</value>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>boundary-1-turbulence</object-name>
|
||||||
|
</binding>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>controller.setTurbulence("boundary",1);</script>
|
||||||
|
</binding>
|
||||||
|
<!--enable>
|
||||||
|
<equals>
|
||||||
|
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</equals>
|
||||||
|
</enable-->
|
||||||
|
</combo>
|
||||||
|
|
||||||
<input>
|
<input>
|
||||||
<name>boundary-0-elevation-ft</name>
|
<name>boundary-0-elevation-ft</name>
|
||||||
<row>2</row>
|
<row>2</row>
|
||||||
|
@ -1429,6 +1599,34 @@
|
||||||
<object-name>boundary-0-dewpoint-degc</object-name>
|
<object-name>boundary-0-dewpoint-degc</object-name>
|
||||||
</binding>
|
</binding>
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
|
<combo>
|
||||||
|
<name>boundary-0-turbulence</name>
|
||||||
|
<row>2</row>
|
||||||
|
<col>6</col>
|
||||||
|
<pref-width>90</pref-width>
|
||||||
|
<live>true</live>
|
||||||
|
<property>/environment/config/boundary/entry[0]/turbulence-name</property>
|
||||||
|
<value>none</value>
|
||||||
|
<value>light</value>
|
||||||
|
<value>moderate</value>
|
||||||
|
<value>severe</value>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>boundary-0-turbulence</object-name>
|
||||||
|
</binding>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>controller.setTurbulence("boundary",0);</script>
|
||||||
|
</binding>
|
||||||
|
<!--enable>
|
||||||
|
<equals>
|
||||||
|
<property>/sim/gui/dialogs/weather-scenario/state</property>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</equals>
|
||||||
|
</enable-->
|
||||||
|
</combo>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
<empty>
|
<empty>
|
||||||
<stretch>true</stretch>
|
<stretch>true</stretch>
|
||||||
|
@ -1593,6 +1791,12 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
open : func {
|
open : func {
|
||||||
|
for( var i = 0; i < 5; i+=1 )
|
||||||
|
me.initTurbulence("aloft", i );
|
||||||
|
|
||||||
|
for( var i = 0; i < 2; i+=1 )
|
||||||
|
me.initTurbulence("boundary", i );
|
||||||
|
|
||||||
#initialize the METAR source selection
|
#initialize the METAR source selection
|
||||||
if( getprop( "environment/params/metar-updates-environment" ) == 0 ) {
|
if( getprop( "environment/params/metar-updates-environment" ) == 0 ) {
|
||||||
setprop( me.base ~ "/source-selection", "Disabled" );
|
setprop( me.base ~ "/source-selection", "Disabled" );
|
||||||
|
@ -1713,6 +1917,26 @@
|
||||||
gui.dialog_update( "weather", "metar" );
|
gui.dialog_update( "weather", "metar" );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setTurbulence : func( where, idx ) {
|
||||||
|
var propPath = "/environment/config/" ~ where ~ "/entry[" ~ idx ~ "]/";
|
||||||
|
setprop( propPath ~ "turbulence/magnitude-norm",
|
||||||
|
me.turbulenceNames[getprop(propPath ~ "turbulence-name")]/(size(me.turbulenceNames)-1) );
|
||||||
|
},
|
||||||
|
|
||||||
|
initTurbulence : func( where, idx ) {
|
||||||
|
var propPath = "/environment/config/" ~ where ~ "/entry[" ~ idx ~ "]/";
|
||||||
|
var turb = getprop( propPath ~ "turbulence/magnitude-norm" ) * (size(me.turbulenceNames)-1);
|
||||||
|
turb = int(int(10*turb+5)/10); # round to nearest integer
|
||||||
|
foreach( var t; keys(me.turbulenceNames) ) {
|
||||||
|
if( me.turbulenceNames[t] == turb ) {
|
||||||
|
setprop( propPath ~ "turbulence-name", t );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
turbulenceNames : { "none" : 0, "light" : 1, "moderate" : 2, "severe" : 3 },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var controller = GlobalWeatherDialogController.new( cmdarg() );
|
var controller = GlobalWeatherDialogController.new( cmdarg() );
|
||||||
|
|
Loading…
Add table
Reference in a new issue