1
0
Fork 0

Merge branch 'master' of D:\Git_New\fgdata

This commit is contained in:
Vivian Meazza 2012-08-10 09:15:15 +01:00
commit ec1175807e
17 changed files with 467 additions and 353 deletions

View file

@ -91,7 +91,7 @@
<terrain_alt><use>/environment/mean-terrain-elevation-m</use></terrain_alt>
<overcast><use>/rendering/scene/overcast</use></overcast>
<eye_alt><use>/sim/rendering/eye-altitude-m</use></eye_alt>
<mysnow_level><use>/environment/mysnow-level-m</use></mysnow_level>
<snow_level><use>/environment/snow-level-m</use></snow_level>
<dust_cover_factor><use>/environment/surface/dust-cover-factor</use></dust_cover_factor>
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
<fogstructure><use>/environment/fog-structure</use></fogstructure>

View file

@ -66,7 +66,7 @@
<terrain_alt><use>/environment/mean-terrain-elevation-m</use></terrain_alt>
<overcast><use>/rendering/scene/overcast</use></overcast>
<eye_alt><use>/sim/rendering/eye-altitude-m</use></eye_alt>
<mysnow_level><use>/environment/mysnow-level-m</use></mysnow_level>
<snow_level><use>/environment/snow-level-m</use></snow_level>
<dust_cover_factor><use>/environment/surface/dust-cover-factor</use></dust_cover_factor>
<wetness><use>/environment/surface/wetness</use></wetness>
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
@ -252,9 +252,9 @@
<value><use>eye_alt</use></value>
</uniform>
<uniform>
<name>mysnowlevel</name>
<name>snowlevel</name>
<type>float</type>
<value><use>mysnow_level</use></value>
<value><use>snow_level</use></value>
</uniform>
<uniform>
<name>dust_cover_factor</name>

View file

@ -27,7 +27,7 @@
<terrain_alt><use>/environment/mean-terrain-elevation-m</use></terrain_alt>
<overcast><use>/rendering/scene/overcast</use></overcast>
<eye_alt><use>/sim/rendering/eye-altitude-m</use></eye_alt>
<mysnow_level><use>/environment/mysnow-level-m</use></mysnow_level>
<snow_level><use>/environment/snow-level-m</use></snow_level>
<dust_cover_factor><use>/environment/surface/dust-cover-factor</use></dust_cover_factor>
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
<fogstructure><use>/environment/fog-structure</use></fogstructure>

View file

@ -303,9 +303,9 @@
<value><use>eye_alt</use></value>
</uniform>
<uniform>
<name>mysnowlevel</name>
<name>snowlevel</name>
<type>float</type>
<value><use>mysnow_level</use></value>
<value><use>snow_level</use></value>
</uniform>
<uniform>
<name>dust_cover_factor</name>
@ -500,9 +500,9 @@
<value><use>eye_alt</use></value>
</uniform>
<uniform>
<name>mysnowlevel</name>
<name>snowlevel</name>
<type>float</type>
<value><use>mysnow_level</use></value>
<value><use>snow_level</use></value>
</uniform>
<uniform>
<name>dust_cover_factor</name>

View file

@ -23,18 +23,27 @@
Fetch live weather data for your nearest airport from noaa.gov. You need a working internet connection.
All the controls in this dialog are computed automatically, once a valid METAR is received.
</description>
<tile>live</tile>
<local-weather>
<tile-type>live</tile-type>
<tile-management>METAR</tile-management>
</local-weather>
</scenario>
<scenario>
<name type="string">Manual input</name>
<description type="string">Enter your favorite METAR weather in the textbox above. A valid METAR syntax is required.</description>
<tile>manual</tile>
<local-weather>
<tile-type>manual</tile-type>
<tile-management>METAR</tile-management>
</local-weather>
</scenario>
<scenario>
<name type="string">Fair weather</name>
<metar type="string">XXXX 012345Z 15003KT 12SM SCT041 FEW200 20/08 Q1015 NOSIG</metar>
<description type="string">A lovely day for trip to your favorite 100$ hamburger airfield</description>
<tile>High-pressure-core</tile>
<local-weather>
<tile-type>High-pressure-core</tile-type>
<tile-management>realistic-weather</tile-management>
</local-weather>
</scenario>
<scenario>
<name type="string">Thunderstorm</name>
@ -44,7 +53,10 @@
Be prepared for reduction of visibility in showers and strong gusts
near thunderstorms
</description>
<tile>Thunderstorms</tile>
<local-weather>
<tile-type>Thunderstorms</tile-type>
<tile-management>realistic-weather</tile-management>
</local-weather>
</scenario>
<scenario>
<name type="string">Stormy Monday</name>
@ -285,6 +297,7 @@
<metar-max-age-min type="long">240</metar-max-age-min>
<metar-updates-environment type="bool">true</metar-updates-environment>
<metar-updates-winds-aloft type="bool">true</metar-updates-winds-aloft>
<metar-updates-snow-level type="bool" userarchive="y">true</metar-updates-snow-level>
<control-fdm-atmosphere type="bool">true</control-fdm-atmosphere>
<contrail-altitude type="double">30000</contrail-altitude>
<!-- definitions for the metar generated fog/mist/haze layer -->
@ -344,7 +357,6 @@
<ground-haze-thickness-m type="double" userarchive="n">2000.0</ground-haze-thickness-m>
<terminator-relative-position-m type="double" userarchive="n">1000000.0</terminator-relative-position-m>
<mean-terrain-elevation-m type="double" userarchive="n">0.0</mean-terrain-elevation-m>
<mysnow-level-m type="double" userarchive="y">3200.0</mysnow-level-m>
<fog-structure type="double" userarchive="y">0.0</fog-structure>
<!-- definitions for the environment at surface interface -->
<surface>

View file

@ -415,6 +415,12 @@
<name>MetarController:snow-level</name>
<type>gain</type>
<gain>1.0</gain>
<enable>
<condition>
<property>/environment/params/metar-updates-snow-level</property>
<property>/environment/params/metar-updates-environment</property>
</condition>
</enable>
<input>
<condition>
<property>/environment/metar/valid</property>

View file

@ -711,14 +711,41 @@ var Image = {
var m = {
parents: [Image, Element.new(parent, "image", id, arg)]
};
m.color = _createColorNodes(m._node, "color");
m.sourceRect = m._node.getNode("source", 1);
m.color_fill = _createColorNodes(m._node, "color-fill");
return m;
},
# Set image file to be used
#
# @param file Path to file or canvas (Use canvas://... for canvas, eg.
# canvas://by-index/texture[0])
setFile: func(file)
{
me.set("file", file);
me.set("file", file);
},
# Set rectangular region of source image to be used
#
# @param left Rectangle minimum x coordinate
# @param top Rectangle minimum y coordinate
# @param right Rectangle maximum x coordinate
# @param bottom Rectangle maximum y coordinate
# @param normalized Whether to use normalized ([0,1]) or image
# ([0, image_width]/[0, image_height]) coordinates
setSourceRect: func(left, top, right, bottom, normalized = 1)
{
me._node.getNode("source", 1).setValues({
left: left,
top: top,
right: right,
bottom: bottom,
normalized: normalized
});
return me;
},
# Set size of image element
setSize: func(width, height)
{
me._node.setValues({size: [width, height]});
return me;
}
};
@ -764,7 +791,12 @@ var Canvas = {
# Set the background color
#
# @param color Vector of 3 or 4 values in [0, 1]
setColorBackground: func { _setColorNodes(me.color, arg); return me; }
setColorBackground: func { _setColorNodes(me.color, arg); return me; },
# Get path of canvas to be used eg. in Image::setFile
getPath: func()
{
return "canvas://by-index/texture[" ~ me._node.getIndex() ~ "]";
}
};
# Create a new canvas. Pass parameters as hash, eg:
@ -779,11 +811,7 @@ var new = func(vals)
{
var m = { parents: [Canvas] };
m.texture = _createNodeWithIndex
(
props.globals.getNode("canvas", 1),
"texture"
);
m.texture = _createNodeWithIndex(Canvas.property_root, "texture");
m.color = _createColorNodes(m.texture, "color-background");
m.texture.setValues(vals);
@ -802,11 +830,7 @@ var get = func(name)
node_canvas = name;
else if( typeof(name) == 'scalar' )
{
var canvas_root = props.globals.getNode("canvas");
if( canvas_root == nil )
return nil;
foreach(var c; canvas_root.getChildren("texture"))
foreach(var c; Canvas.property_root.getChildren("texture"))
{
if( c.getValue("name") == name )
node_canvas = c;
@ -847,4 +871,7 @@ else
{button: {legend: "Ok", binding: {command: "dialog-close"}}}
);
}
} })();
}
Canvas.property_root = props.globals.getNode("canvas/by-index", 1);
})();

View file

@ -28,7 +28,7 @@ uniform float terrain_alt;
uniform float hazeLayerAltitude;
uniform float overcast;
uniform float eye_alt;
uniform float mysnowlevel;
uniform float snowlevel;
uniform float dust_cover_factor;
uniform float wetness;
uniform float fogstructure;
@ -262,7 +262,7 @@ void main()
// mix snow
snow_alpha = smoothstep(0.75, 0.85, abs(steepness));
texel = mix(texel, snow_texel, smoothstep(mysnowlevel, mysnowlevel+200.0, snow_alpha * (relPos.z + eye_alt)+ (noise_2000m + 0.1 * noise_10m -0.55) *400.0));
texel = mix(texel, snow_texel, smoothstep(snowlevel, snowlevel+200.0, snow_alpha * (relPos.z + eye_alt)+ (noise_2000m + 0.1 * noise_10m -0.55) *400.0));
}

View file

@ -43,7 +43,7 @@ uniform float terrain_alt;
uniform float hazeLayerAltitude;
uniform float overcast;
uniform float eye_alt;
uniform float mysnowlevel;
uniform float snowlevel;
uniform float dust_cover_factor;
uniform float wetness;
uniform float fogstructure;

View file

@ -43,6 +43,7 @@
<!-- Environment menu -->
<environment>Environment</environment>
<global-weather>Weather</global-weather>
<environment-settings>Environment Settings</environment-settings>
<time-settings>Time Settings</time-settings>
<wildfire-settings>Wildfire Settings</wildfire-settings>
<terrasync>Scenery Download</terrasync>

View file

@ -0,0 +1,259 @@
<?xml version="1.0"?>
<PropertyList>
<name>environment-settings</name>
<modal>false</modal>
<resizable>false</resizable>
<layout>vbox</layout>
<default-padding>3</default-padding>
<!-- Title bar with close button -->
<group>
<layout>hbox</layout>
<default-padding>1</default-padding>
<empty>
<stretch>true</stretch>
</empty>
<text>
<label>Environmental Settings</label>
</text>
<empty>
<stretch>true</stretch>
</empty>
<button>
<legend/>
<key>Esc</key>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>table</layout>
<text>
<row>0</row>
<col>0</col>
<label>Ground textures:</label>
<halign>right</halign>
</text>
<combo>
<row>0</row>
<col>1</col>
<name>season</name>
<halign>left</halign>
<live>true</live>
<property>/sim/startup/season</property>
<value>summer</value>
<value>winter</value>
<binding>
<command>dialog-apply</command>
<object-name>season</object-name>
</binding>
</combo>
<button>
<row>0</row>
<col>2</col>
<legend>Reload Scenery</legend>
<binding>
<command>reinit</command>
<subsystem>tile-manager</subsystem>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>table</layout>
<text>
<row>0</row>
<col>0</col>
<colspan>4</colspan>
<halign>left</halign>
<label>Ground conditions (requires shaders effects)</label>
</text>
<checkbox>
<row>1</row>
<col>0</col>
<colspan>4</colspan>
<halign>left</halign>
<label>Set snow level from METAR</label>
<name>metar-snow</name>
<property>/environment/params/metar-updates-snow-level</property>
<binding>
<command>dialog-apply</command>
<object-name>metar-snow</object-name>
</binding>
</checkbox>
<text>
<label>Snow line</label>
<halign>left</halign>
<row>2</row>
<col>0</col>
</text>
<text>
<label>-425m</label>
<halign>right</halign>
<row>2</row>
<col>1</col>
</text>
<slider>
<name>snow-level</name>
<row>2</row>
<col>2</col>
<min>-425.0</min>
<max>7500.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>
<label>7500m</label>
<halign>left</halign>
<row>2</row>
<col>3</col>
</text>
<text>
<row>2</row>
<col>4</col>
<label>12345678</label>
<format>%.fm</format>
<live>true</live>
<property>/environment/snow-level-m</property>
</text>
<text>
<label>Dust cover</label>
<halign>left</halign>
<row>3</row>
<col>0</col>
</text>
<text>
<label>none</label>
<halign>right</halign>
<row>3</row>
<col>1</col>
</text>
<slider>
<name>dust-level</name>
<row>3</row>
<col>2</col>
<min>0.0</min>
<max>0.7</max>
<live>true</live>
<property>/environment/surface/dust-cover-factor</property>
<binding>
<command>dialog-apply</command>
<object-name>dust-level</object-name>
</binding>
</slider>
<text>
<label>dusty</label>
<halign>left</halign>
<row>3</row>
<col>3</col>
</text>
<text>
<label>Wetness</label>
<halign>left</halign>
<row>4</row>
<col>0</col>
</text>
<text>
<label>dry</label>
<halign>right</halign>
<row>4</row>
<col>1</col>
</text>
<slider>
<name>wetness</name>
<row>4</row>
<col>2</col>
<min>0.0</min>
<max>0.7</max>
<live>true</live>
<property>/environment/surface/wetness</property>
<binding>
<command>dialog-apply</command>
<object-name>wetness</object-name>
</binding>
</slider>
<text>
<label>wet</label>
<halign>left</halign>
<row>4</row>
<col>3</col>
</text>
</group>
<hrule/>
<group>
<empty>
<stretch>true</stretch>
</empty>
<layout>hbox</layout>
<button>
<legend>OK</legend>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
<button>
<legend>Apply</legend>
<binding>
<command>dialog-apply</command>
</binding>
</button>
<button>
<legend>Close</legend>
<default>true</default>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
<empty>
<stretch>true</stretch>
</empty>
</group>
</PropertyList>

View file

@ -1,189 +0,0 @@
<?xml version="1.0"?>
<PropertyList>
<name>local_weather_environment</name>
<width>400</width>
<height>210</height>
<modal>false</modal>
<text>
<x>5</x>
<y>180</y>
<label>Environment parameters (only used by detailed shaders)</label>
</text>
<text>
<x>5</x>
<y>150</y>
<label>Snow line:</label>
</text>
<text>
<x>120</x>
<y>150</y>
<label>0 m </label>
</text>
<slider>
<x>190</x>
<y>150</y>
<width>90</width>
<height>20</height>
<min>0.0</min>
<max>7500.0</max>
<property>/environment/mysnow-level-m</property>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<text>
<x>290</x>
<y>150</y>
<label>7500 m</label>
</text>
<text>
<x>340</x>
<y>150</y>
<label>12345678</label>
<format>%.fm</format>
<live>true</live>
<property>/environment/mysnow-level-m</property>
</text>
<text>
<x>5</x>
<y>120</y>
<label>Terrain dust cover:</label>
</text>
<text>
<x>120</x>
<y>120</y>
<label>none </label>
</text>
<slider>
<x>190</x>
<y>120</y>
<width>90</width>
<height>20</height>
<min>0.0</min>
<max>0.7</max>
<property>/environment/surface/dust-cover-factor</property>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<text>
<x>290</x>
<y>120</y>
<label>dusty</label>
</text>
<text>
<x>5</x>
<y>90</y>
<label>Fog properties:</label>
</text>
<text>
<x>120</x>
<y>90</y>
<label>smooth </label>
</text>
<slider>
<x>190</x>
<y>90</y>
<width>90</width>
<height>20</height>
<min>0.0</min>
<max>12.0</max>
<property>/environment/fog-structure</property>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<text>
<x>290</x>
<y>90</y>
<label>structured</label>
</text>
<text>
<x>5</x>
<y>60</y>
<label>Terrain wetness:</label>
</text>
<text>
<x>120</x>
<y>60</y>
<label>dry </label>
</text>
<slider>
<x>190</x>
<y>60</y>
<width>90</width>
<height>20</height>
<min>0.0</min>
<max>0.7</max>
<property>/environment/surface/wetness</property>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<text>
<x>290</x>
<y>60</y>
<label>wet</label>
</text>
<group>
<x>10</x>
<y>10</y>
<button>
<x>0</x>
<y>0</y>
<legend>OK</legend>
<!--<default>true</default>-->
<equal>true</equal>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
<button>
<x>265</x>
<y>0</y>
<legend>Cancel</legend>
<equal>true</equal>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
</PropertyList>

View file

@ -430,19 +430,51 @@
<row>3</row>
<col>0</col>
<halign>right</halign>
<label>Max. visibility</label>
<label>Fog properties</label>
</text>
<text>
<row>3</row>
<col>1</col>
<halign>right</halign>
<label>20 km</label>
<label>smooth</label>
</text>
<slider>
<row>3</row>
<col>2</col>
<min>0.0</min>
<max>12.0</max>
<property>/environment/fog-structure</property>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<text>
<row>3</row>
<col>3</col>
<halign>left</halign>
<label>structured</label>
</text>
<text>
<row>4</row>
<col>0</col>
<halign>right</halign>
<label>Max. visibility</label>
</text>
<text>
<row>4</row>
<col>1</col>
<halign>right</halign>
<label>20 km</label>
</text>
<slider>
<row>4</row>
<col>2</col>
<min>9.90348</min>
<max>12.429216196</max>
<property>/local-weather/config/aux-max-vis-range-m</property>
@ -452,14 +484,14 @@
</slider>
<text>
<row>3</row>
<row>4</row>
<col>3</col>
<halign>left</halign>
<label>250 km</label>
</text>
<text>
<row>3</row>
<row>4</row>
<col>4</col>
<halign>left</halign>
<label>12345678</label>
@ -579,17 +611,6 @@
</binding>
</button>
<button>
<legend>Advanced...</legend>
<binding>
<command>dialog-show</command>
<dialog-name>local_weather_environment</dialog-name>
</binding>
<binding>
<command>dialog-apply</command>
</binding>
</button>
<empty>
<stretch>true</stretch>
</empty>

View file

@ -207,31 +207,8 @@
<group>
<layout>table</layout>
<text>
<row>0</row>
<col>0</col>
<colspan>2</colspan>
<label>Season (ground textures): </label>
<halign>right</halign>
</text>
<combo>
<row>0</row>
<col>2</col>
<colspan>2</colspan>
<name>season</name>
<halign>left</halign>
<live>true</live>
<property>/sim/startup/season</property>
<value>summer</value>
<value>winter</value>
<binding>
<command>dialog-apply</command>
<object-name>season</object-name>
</binding>
</combo>
<checkbox>
<row>1</row>
<row>0</row>
<col>0</col>
<halign>left</halign>
<label>Animated jetways</label>
@ -244,7 +221,7 @@
</checkbox>
<checkbox>
<row>2</row>
<row>1</row>
<col>0</col>
<halign>left</halign>
<label>Random buildings</label>
@ -255,9 +232,21 @@
<object-name>random-buildings</object-name>
</binding>
</checkbox>
<text>
<row>1</row>
<col>1</col>
<colspan>3</colspan>
<color>
<red>1.0</red>
<green>0.6</green>
<blue>0.6</blue>
</color>
<label>Warning: Requires lots of memory</label>
</text>
<checkbox>
<row>3</row>
<row>2</row>
<col>0</col>
<halign>left</halign>
<label>Random objects</label>
@ -270,7 +259,7 @@
</checkbox>
<checkbox>
<row>4</row>
<row>3</row>
<col>0</col>
<halign>left</halign>
<label>Random vegetation</label>
@ -282,7 +271,7 @@
</binding>
</checkbox>
<text>
<row>4</row>
<row>3</row>
<col>1</col>
<label>density</label>
<enable>
@ -290,7 +279,7 @@
</enable>
</text>
<slider>
<row>4</row>
<row>3</row>
<col>2</col>
<name>vegetation-density</name>
<min>0</min>
@ -303,7 +292,7 @@
</binding>
</slider>
<text>
<row>4</row>
<row>3</row>
<col>3</col>
<label>12345678</label>
<format>%.1f</format>

View file

@ -372,67 +372,6 @@
</binding>
</input>
<text>
<label>Snow line</label>
<row>2</row>
<col>0</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>
</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>

View file

@ -38,9 +38,10 @@
var scenarioName = getprop( me.base ~ "/source-selection");
if (getprop( me.base ~ "/mode/manual-weather")) {
# In manual weather mode we have to diable live weather
# In manual weather mode we have to disable live weather
# fetch so the weather can be changed by the user in the
# weather configuration dialog.
setprop( "/environment/params/metar-updates-environment", 0 );
setprop( "/environment/realwx/enabled", 0 );
setprop( "/environment/config/enabled", 0 );
@ -77,13 +78,14 @@
} else {
# preset configured scenario
var wsn = props.globals.getNode( "/environment/weather-scenarios" );
var current = getprop("/environment/weather-scenario", "");
var found = 0;
if( wsn != nil ) {
var scenarios = wsn.getChildren("scenario");
forindex (var i; scenarios ) {
var metarN = scenarios[i].getNode("metar");
metarN == nil and continue;
if( metarN.getValue() == getprop("/environment/metar/data","") ) {
if( scenarios[i].getNode("name").getValue() == current ) {
setprop( me.base ~ "/source-selection", scenarios[i].getNode("name").getValue() );
found = 1;
break;
@ -122,7 +124,6 @@
apply : func {
var scenarioName = getprop( me.base ~ "/source-selection");
var metar = getprop( "environment/metar/data" );
var tile = getprop( me.base ~ "/tile");
var global_weather_enabled = getprop( me.base ~ "/mode/global-weather");
var local_weather_enabled = getprop( me.base ~ "/mode/local-weather");
var manual_weather_enabled = getprop( me.base ~ "/mode/manual-weather");
@ -131,7 +132,7 @@
if (manual_weather_enabled == 1) {
setprop( "/environment/params/metar-updates-environment", 0 );
setprop( "/environment/realwx/enabled", 0 );
setprop( "/environment/config/enabled", 0 );
setprop( "/environment/config/enabled", 1 );
metar = "";
} else if( scenarioName == "Live data" ) {
setprop( "/environment/params/metar-updates-environment", 1 );
@ -149,6 +150,8 @@
metar = getprop( me.base ~ "/metar-string" );
}
setprop("/environment/weather-scenario", scenarioName);
if( metar != nil ) {
setprop( "environment/metar/data", normalize_string(metar) );
}
@ -161,20 +164,6 @@
# If Local Weather is enabled, re-initialize with updated
# initial tile and tile selection.
setprop("/nasal/local_weather/enabled", "true");
setprop("/local-weather/tmp/tile-type", tile);
if ((scenarioName == "Live data" ) or
(scenarioName == "Manual input") ) {
# If using Live data, or a manually entered METAR string, the
# only sensible tile selection mode is "METAR"
setprop("/local-weather/tmp/tile-management", "METAR");
} else if (tile != "") {
# Use Realistic Weather for defined tiles
setprop("/local-weather/tmp/tile-management", "realistic weather");
} else {
# Otherwise repeat the tile
setprop("/local-weather/tmp/tile-management", "repeat-tile");
}
# Re-initialize local weather.
local_weather.set_tile();
@ -194,14 +183,15 @@
},
scenarioListener : func( n ) {
description = "";
metar = "nil";
tile = "";
var description = "";
var metar = "nil";
var local_weather_props = nil;
var scenario = me.findScenarioByName( n.getValue() );
if( scenario != nil ) {
description = normalize_string(scenario.getNode("description", 1 ).getValue());
metar = normalize_string(scenario.getNode("metar", 1 ).getValue());
tile = normalize_string(scenario.getNode("tile", 1 ).getValue());
local_weather_props = scenario.getNode("local-weather");
}
if (n.getValue() == "Live data") {
@ -212,12 +202,63 @@
if (n.getValue() == "Manual input") {
# Special case - retain current values
var metar = getprop( me.base ~ "/metar-string" );
}
}
setprop(me.base ~ "/description", description );
setprop(me.base ~ "/metar-string", metar );
setprop(me.base ~ "/tile", tile);
# Set the wind from the METAR string.
var result = [];
var msplit = split(" ", string.uc(metar));
foreach (var word; msplit) {
if ((size(word) > 6) and string.match(word, "*[0-9][0-9]KT")) {
# We've got the wind definition word. Now to split it up.
# Format is nnnmmKT or nnnmmGppKT
# Direction is easy - the first 3 characters.
var dir = chr(word[0]) ~ chr(word[1]) ~ chr(word[2]);
if (dir == "VRB") {
setprop("/local-weather/tmp/tile-orientation-deg", 360.0 * rand());
setprop("/local-weather/tmp/gust-angular-variation-deg", 180.0);
setprop("/local-weather/tmp/gust-frequency-hz", 0.001);
} else {
setprop("/local-weather/tmp/tile-orientation-deg", dir);
setprop("/local-weather/tmp/gust-angular-variation-deg", 0.0);
setprop("/local-weather/tmp/gust-frequency-hz", 0.0);
}
# Next two are the base wind
var spd = chr(word[3]) ~ chr(word[4]);
setprop("/local-weather/tmp/windspeed-kt", spd);
var gst = 0;
if ((size(word) > 7) and (chr(word[5]) == 'G')) {
# Gusty case
gst = chr(word[6]) ~ chr(word[7]);
}
if ((gst > spd) and (spd > 0)) {
setprop("/local-weather/tmp/gust-relative-strength", (gst - spd) / spd);
setprop("/local-weather/tmp/gust-frequency-hz", 0.7);
} else {
setprop("/local-weather/tmp/gust-relative-strength", 0.0);
}
}
}
if (local_weather_props != nil) {
# The local weather properties need to be set now, so they can
# be configured by the user if they select Advanced Settings
props.copy(local_weather_props, props.globals.getNode("/local-weather/tmp", 1));
} else {
# If no local weather properties have been set, we'll read from the scenario
# METAR
setprop("/local-weather/tmp/tile-type", "manual");
setprop("/local-weather/tmp/tile-management", "METAR");
}
me.refresh();
},

View file

@ -281,6 +281,14 @@
</binding>
</item>
<item>
<name>environment-settings</name>
<binding>
<command>dialog-show</command>
<dialog-name>environment-settings</dialog-name>
</binding>
</item>
<item>
<name>time-settings</name>
<binding>