1
0
Fork 0

Merge branch 'master' of gitorious.org:fg/fgdata

This commit is contained in:
Curtis L. Olson 2011-01-19 10:27:22 -06:00
commit fa26992660
14 changed files with 5339 additions and 24 deletions

View file

@ -150,12 +150,12 @@ var cdu = func{
line1l = sprintf("%3.1f", (getprop("/yasim/gross-weight-lbs")/1000));
line2l = sprintf("%3.1f", (getprop("/consumables/fuel/total-fuel-lbs")/1000));
yasim_emptyweight = line1l;
yasim_emptyweight = getprop("/yasim/gross-weight-lbs");
yasim_emptyweight -= getprop("/consumables/fuel/total-fuel-lbs");
yasim_weights = props.globals.getNode("/sim").getChildren("weight");
for (i = 0; i < size(yasim_weights); i += 1) {
yasim_emptyweight -= yasim_weights[i].getValue();
yasim_emptyweight -= yasim_weights[i].getChild("weight-lb").getValue();
}
yasim_emptyweight -= line2l;
line3l = sprintf("%3.1f", yasim_emptyweight/1000);
}

2717
HLA/AviationSimNet-v3.1.xml Normal file

File diff suppressed because it is too large Load diff

63
HLA/av-aircraft.xml Normal file
View file

@ -0,0 +1,63 @@
<?xml version="1.0"?>
<hlaConfiguration version="1">
<!-- This is the top level HLA configuration file for use with the
multiplayer federation. This serves now as first demo how to configure
flightgears hla implementation.
This toplevel file consists of startup parameters for the rti,
the federate object model to use on create and a way to map the hla
attribute values to a semantic meaning or flightgear properties.
-->
<rti version="RTI13">
<!-- is ignored for RTI13 anyway, so the example here ... -->
<argument>rtiarg0</argument>
<argument>rtiarg1</argument>
</rti>
<!-- Contains the data layout and the object classes -->
<federateObjectModel name="AviationSimNet-v3.1.xml"/>
<!-- ??? more a AIModel Tag??? Or a generic one and decide which type should be time exact???? -->
<objects>
<objectClass type="Multiplayer" name="aircraft">
<model type="map">
<dataElement type="external" name="aircraftType"/>
<key external="A320" modelPath="Aircraft/A320/Models/a320-fb.xml"/>
<key external="B733" modelPath="Aircraft/737-300/Models/737-300.xml"/>
<key external="B742" modelPath="Aircraft/747-200/Models/boeing747-200.xml"/>
<key external="C172" modelPath="Aircraft/c172p/Models/c172p.xml"/>
<key external="C310" modelPath="Aircraft/c310/Models/c310-dpm.xml"/>
<key external="F18" modelPath="Aircraft/f18/Models/f18.xml"/>
<key external="PC7" modelPath="Aircraft/pc7/Models/pc7.xml"/>
<key external="DH8C" modelPath="Aircraft/dhc8/Models/dhc8-300Q.xml"/>
<key external="UFO" modelPath="Aircraft/ufo/Models/ufo.xml"/>
<key external="C172"/>
</model>
<!-- This is an example for the variant that would make the AviationSimNet guys visible in flightgear. -->
<!-- It does not know any rotational velocities, but the linear velocity is present. -->
<position type="geodetic">
<dataElement type="latitude-deg" name="latitude"/>
<dataElement type="longitude-deg" name="longitude"/>
<dataElement type="elevation-m" name="altitudeMSL"/>
<dataElement type="heading-deg" name="trueHeading"/>
<dataElement type="pitch-deg" name="pitch"/>
<dataElement type="roll-deg" name="roll"/>
<dataElement type="ground-track-deg" name="groundTrack"/>
<dataElement type="ground-speed-kt" name="groundSpeed"/>
<dataElement type="vertical-speed-ft-per-min" name="verticalSpeed"/>
</position>
<simTime type="attribute-sec-msec">
<dataElement type="local-simtime-sec" name="timestampSeconds"/>
<dataElement type="local-simtime-msec" name="timestampMilliseconds"/>
</simTime>
<dataElement type="property" name="tailNum" in="sim/user/callsign" out="sim/user/callsign"/>
</objectClass>
</objects>
</hlaConfiguration>

324
HLA/hla.dtd Normal file
View file

@ -0,0 +1,324 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- HLA.dtd This is version 1.0 of a DTD file to fully define the OMT in XML terms -->
<!ELEMENT objectModel (
objects?,
interactions?,
dimensions?,
time?,
tags?,
synchronizations?,
transportations?,
switches?,
dataTypes?,
notes?)>
<!ATTLIST objectModel
DTDversion CDATA #FIXED "1516.2"
name CDATA #REQUIRED
nameNotes NMTOKENS #IMPLIED
type (FOM|SOM) #REQUIRED
typeNotes NMTOKENS #IMPLIED
version CDATA #IMPLIED
versionNotes NMTOKENS #IMPLIED
date CDATA #IMPLIED
dateNotes NMTOKENS #IMPLIED
purpose CDATA #IMPLIED
purposeNotes NMTOKENS #IMPLIED
appDomain CDATA #IMPLIED
appDomainNotes NMTOKENS #IMPLIED
sponsor CDATA #IMPLIED
sponsorNotes NMTOKENS #IMPLIED
pocName CDATA #IMPLIED
pocNameNotes NMTOKENS #IMPLIED
pocOrg CDATA #IMPLIED
pocOrgNotes NMTOKENS #IMPLIED
pocPhone CDATA #IMPLIED
pocPhoneNotes NMTOKENS #IMPLIED
pocEmail CDATA #IMPLIED
pocEmailNotes NMTOKENS #IMPLIED
references CDATA #IMPLIED
referencesNotes NMTOKENS #IMPLIED
other CDATA #IMPLIED
otherNotes NMTOKENS #IMPLIED>
<!ELEMENT objects (objectClass+)>
<!ELEMENT objectClass (attribute*, objectClass*)>
<!ATTLIST objectClass
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
sharing (Publish|Subscribe|PublishSubscribe|Neither) #IMPLIED
sharingNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT attribute EMPTY>
<!ATTLIST attribute
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
dataType NMTOKEN #IMPLIED
dataTypeNotes NMTOKENS #IMPLIED
updateType (Static|Periodic|Conditional|NA) #IMPLIED
updateTypeNotes NMTOKENS #IMPLIED
updateCondition CDATA #IMPLIED
updateConditionNotes NMTOKENS #IMPLIED
ownership (Divest|Acquire|DivestAcquire|NoTransfer)
#IMPLIED
ownershipNotes NMTOKENS #IMPLIED
sharing (Publish|Subscribe|PublishSubscribe|Neither)
#IMPLIED
sharingNotes NMTOKENS #IMPLIED
dimensions NMTOKENS #IMPLIED
dimensionsNotes NMTOKENS #IMPLIED
transportation NMTOKEN #IMPLIED
transportationNotes NMTOKENS #IMPLIED
order (Receive|TimeStamp) #IMPLIED
orderNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED>
<!ELEMENT interactions (interactionClass+)>
<!ELEMENT interactionClass (parameter*, interactionClass*)>
<!ATTLIST interactionClass
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
sharing (Publish|Subscribe|PublishSubscribe|Neither) #IMPLIED
sharingNotes NMTOKENS #IMPLIED
dimensions NMTOKENS #IMPLIED
dimensionsNotes NMTOKENS #IMPLIED
transportation NMTOKEN #IMPLIED
transportationNotes NMTOKENS #IMPLIED
order (Receive|TimeStamp) #IMPLIED
orderNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT parameter EMPTY>
<!ATTLIST parameter
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
dataType NMTOKEN #IMPLIED
dataTypeNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT dimensions (dimension*)>
<!ELEMENT dimension EMPTY>
<!ATTLIST dimension
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
dataType NMTOKEN #IMPLIED
dataTypeNotes NMTOKENS #IMPLIED
upperBound CDATA #IMPLIED
upperBoundNotes NMTOKENS #IMPLIED
normalization CDATA #IMPLIED
normalizationNotes NMTOKENS #IMPLIED
value CDATA #IMPLIED
valueNotes NMTOKENS #IMPLIED>
<!ELEMENT time (timeStamp?, lookahead?)>
<!ELEMENT timeStamp EMPTY>
<!ATTLIST timeStamp
dataType NMTOKEN #IMPLIED
dataTypeNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT lookahead EMPTY>
<!ATTLIST lookahead
dataType NMTOKEN #IMPLIED
dataTypeNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT tags (updateReflectTag?,
sendReceiveTag?,
deleteRemoveTag?,
divestitureRequestTag?,
divestitureCompletionTag?,
acquisitionRequestTag?,
requestUpdateTag?)>
<!ELEMENT updateReflectTag EMPTY>
<!ATTLIST updateReflectTag
dataType NMTOKEN #REQUIRED
dataTypeNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT sendReceiveTag EMPTY>
<!ATTLIST sendReceiveTag
dataType NMTOKEN #REQUIRED
dataTypeNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT deleteRemoveTag EMPTY>
<!ATTLIST deleteRemoveTag
dataType NMTOKEN #REQUIRED
dataTypeNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT divestitureRequestTag EMPTY>
<!ATTLIST divestitureRequestTag
dataType NMTOKEN #REQUIRED
dataTypeNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT divestitureCompletionTag EMPTY>
<!ATTLIST divestitureCompletionTag
dataType NMTOKEN #REQUIRED
dataTypeNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT acquisitionRequestTag EMPTY>
<!ATTLIST acquisitionRequestTag
dataType NMTOKEN #REQUIRED
dataTypeNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT requestUpdateTag EMPTY>
<!ATTLIST requestUpdateTag
dataType NMTOKEN #REQUIRED
dataTypeNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT synchronizations (synchronization+)>
<!ELEMENT synchronization EMPTY>
<!ATTLIST synchronization
label NMTOKEN #REQUIRED
labelNotes NMTOKENS #IMPLIED
dataType NMTOKEN #IMPLIED
dataTypeNotes NMTOKENS #IMPLIED
capability (Register|Achieve|RegisterAchieve|NoSynch) #IMPLIED
capabilityNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT transportations (transportation+)>
<!ELEMENT transportation EMPTY>
<!ATTLIST transportation
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
description CDATA #IMPLIED
descriptionNotes NMTOKENS #IMPLIED>
<!ELEMENT switches EMPTY>
<!ATTLIST switches
autoProvide (Enabled|Disabled) #IMPLIED
autoProvideNotes NMTOKENS #IMPLIED
conveyRegionDesignatorSets (Enabled|Disabled) #IMPLIED
conveyRegionDesignatorSetsNotes NMTOKENS #IMPLIED
attributeScopeAdvisory (Enabled|Disabled) #IMPLIED
attributeScopeAdvisoryNotes NMTOKENS #IMPLIED
attributeRelevanceAdvisory (Enabled|Disabled) #IMPLIED
attributeRelevanceAdvisoryNotes NMTOKENS #IMPLIED
objectClassRelevanceAdvisory (Enabled|Disabled) #IMPLIED
objectClassRelevanceAdvisoryNotes NMTOKENS #IMPLIED
interactionRelevanceAdvisory (Enabled|Disabled) #IMPLIED
interactionRelevanceAdvisoryNotes NMTOKENS #IMPLIED
serviceReporting (Enabled|Disabled) #IMPLIED
serviceReportingNotes NMTOKENS #IMPLIED>
<!ELEMENT dataTypes (basicDataRepresentations,
simpleDataTypes?,
enumeratedDataTypes?,
arrayDataTypes?,
fixedRecordDataTypes?,
variantRecordDataTypes?)>
<!ELEMENT basicDataRepresentations (basicData+)>
<!ELEMENT basicData EMPTY>
<!ATTLIST basicData
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
size CDATA #IMPLIED
sizeNotes NMTOKENS #IMPLIED
interpretation CDATA #IMPLIED
interpretationNotes NMTOKENS #IMPLIED
endian (Big|Little) #IMPLIED
endianNotes NMTOKENS #IMPLIED
encoding CDATA #IMPLIED
encodingNotes NMTOKENS #IMPLIED>
<!ELEMENT simpleDataTypes (simpleData+)>
<!ELEMENT simpleData EMPTY>
<!ATTLIST simpleData
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
representation NMTOKEN #IMPLIED
representationNotes NMTOKENS #IMPLIED
units CDATA #IMPLIED
unitsNotes NMTOKENS #IMPLIED
resolution CDATA #IMPLIED
resolutionNotes NMTOKENS #IMPLIED
accuracy CDATA #IMPLIED
accuracyNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED>
<!ELEMENT enumeratedDataTypes (enumeratedData+)>
<!ELEMENT enumeratedData (enumerator+)>
<!ATTLIST enumeratedData
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
representation NMTOKEN #IMPLIED
representationNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT enumerator EMPTY>
<!ATTLIST enumerator
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
values NMTOKENS #IMPLIED
valuesNotes NMTOKENS #IMPLIED>
<!ELEMENT arrayDataTypes (arrayData+)>
<!ELEMENT arrayData EMPTY>
<!ATTLIST arrayData
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
dataType NMTOKEN #IMPLIED
dataTypeNotes NMTOKENS #IMPLIED
cardinality CDATA #IMPLIED
cardinalityNotes NMTOKENS #IMPLIED
encoding CDATA #IMPLIED
encodingNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED>
<!ELEMENT fixedRecordDataTypes (fixedRecordData+)>
<!ELEMENT fixedRecordData (field+)>
<!ATTLIST fixedRecordData
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
encoding CDATA #IMPLIED
encodingNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >
<!ELEMENT field EMPTY>
<!ATTLIST field
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
dataType NMTOKEN #IMPLIED
dataTypeNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED>
<!ELEMENT variantRecordDataTypes (variantRecordData+)>
<!ELEMENT variantRecordData (alternative+)>
<!ATTLIST variantRecordData
name NMTOKEN #REQUIRED
nameNotes NMTOKENS #IMPLIED
discriminant CDATA #IMPLIED
discriminantNotes NMTOKENS #IMPLIED
dataType NMTOKEN #IMPLIED
dataTypeNotes NMTOKENS #IMPLIED
encoding CDATA #IMPLIED
encodingNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED>
<!ELEMENT alternative EMPTY>
<!ATTLIST alternative
enumerator CDATA #REQUIRED
enumeratorNotes NMTOKENS #IMPLIED
name NMTOKEN #IMPLIED
nameNotes NMTOKENS #IMPLIED
dataType NMTOKEN #IMPLIED
dataTypeNotes NMTOKENS #IMPLIED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED>
<!ELEMENT notes (note+)>
<!ELEMENT note EMPTY>
<!ATTLIST note
name NMTOKEN #REQUIRED
semantics CDATA #IMPLIED
semanticsNotes NMTOKENS #IMPLIED >

1710
HLA/mp-aircraft-fom.xml Normal file

File diff suppressed because it is too large Load diff

64
HLA/mp-aircraft.xml Normal file
View file

@ -0,0 +1,64 @@
<?xml version="1.0"?>
<hlaConfiguration version="1">
<!-- This is the top level HLA configuration file for use with the
multiplayer federation. This serves now as first demo how to configure
flightgears hla implementation.
This toplevel file consists of startup parameters for the rti,
the federate object model to use on create and a way to map the hla
attribute values to a semantic meaning or flightgear properties.
-->
<rti version="RTI13">
<!-- is ignored for RTI13 anyway, so the example here ... -->
<argument>rtiarg0</argument>
<argument>rtiarg1</argument>
</rti>
<!-- Contains the data layout and the object classes -->
<federateObjectModel name="mp-aircraft-fom.xml"/>
<objects>
<objectClass type="Multiplayer" name="MPAircraft">
<model type="native">
<dataElement type="model-path" name="model.path"/>
</model>
<!-- Should contain all those attributes that form the position and orientation of the aircraft in total -->
<position type="cartesian">
<!-- These are the positions in the earth centered coordinate system. -->
<dataElement type="position-x" name="location.position[0]"/>
<dataElement type="position-y" name="location.position[1]"/>
<dataElement type="position-z" name="location.position[2]"/>
<!-- A very compact and lossless representation of a quaternion wrt the earth centered coordinate system. -->
<dataElement type="orientation-sin-angle-axis-x" name="location.orientation[0]"/>
<dataElement type="orientation-sin-angle-axis-y" name="location.orientation[1]"/>
<dataElement type="orientation-sin-angle-axis-z" name="location.orientation[2]"/>
<!-- The body velocities in the usual x-fwd, z-down, righthandside body coordinate system. -->
<dataElement type="linear-velocity-x" name="velocity.linear[0]"/>
<dataElement type="linear-velocity-y" name="velocity.linear[1]"/>
<dataElement type="linear-velocity-z" name="velocity.linear[2]"/>
<dataElement type="angular-velocity-x" name="velocity.angular[0]"/>
<dataElement type="angular-velocity-y" name="velocity.angular[1]"/>
<dataElement type="angular-velocity-z" name="velocity.angular[2]"/>
</position>
<simTime type="attribute">
<dataElement type="local-simtime" name="simTime"/>
</simTime>
<!-- the attribute that carries the big blob of multiplayer attributes.
This datatype is tightly coupled with the implementation for now.
It is done in this way to provide the same feature set for the
multiplayer object like the existing multiplayer protocol.
In the long term, think more about the content of this blob and
sensibly distribute that across different datatypes and attributes.
-->
<mpProperties name="mpProperties"/>
<dataElement type="property" name="model.livery" in="sim/model/livery/file" out="sim/model/livery/file"/>
</objectClass>
</objects>
</hlaConfiguration>

View file

@ -2,7 +2,6 @@
<PropertyList>
<name>Default Aircraft Hud</name>
<enable3d>true</enable3d>
<import>
<path>Huds/Instruments/turn-bank-indicator.xml</path>

View file

@ -532,6 +532,54 @@ var FileSelector = {
},
};
##
# ScreenshotSelector class (derived from Dialog class).
#
# SYNOPSIS: DirectorySelector.new(<callback>, <title>, <button> [, <pattern> [, <dir>]])
#
# callback ... callback function that gets return value as first argument
# title ... dialog title
# button ... button text (should say "Save", "Load", etc. and not just "OK")
# pattern ... array with shell pattern or nil (which is equivalent to "*")
# dir ... starting dir ($FG_ROOT if unset)
var ScreenshotSelector = {
new: func(callback, title, button, pattern = nil, dir = "") {
var name = "screenshot";
## var data = props.globals.getNode("/sim/gui/dialogs/", 1);
# for (var i = 1; 1; i += 1)
# if (data.getNode(name ~ i, 0) == nil)
# break;
data = props.globals.getNode("sim/gui/dialogs/screenshot", 1);
var m = Dialog.new(data.getNode("dialog", 1), "gui/dialogs/screenshot.xml", name);
m.parents = [ScreenshotSelector, Dialog];
m.data = data;
m.set_title(title);
m.set_button(button);
m.set_directory(dir);
m.set_pattern(pattern);
m.cblistener = setlistener(data.getNode("path", 1), callback);
return m;
},
# setters only take effect after the next call to open()
set_title: func(title) { me.data.getNode("title", 1).setValue(title) },
set_button: func(button) { me.data.getNode("button", 1).setValue(button) },
set_directory: func(dir) { me.data.getNode("directory", 1).setValue(dir) },
set_pattern: func(pattern) {
me.data.removeChildren("pattern");
if (pattern != nil)
forindex (var i; pattern)
me.data.getChild("pattern", i, 1).setValue(pattern[i]);
},
del: func {
me.close();
delete(me.instance, me.name);
removelistener(me.cblistener);
me.data.remove();
},
};
##
# Save/load flight menu functions.
@ -561,6 +609,32 @@ var load_flight = func {
}
##
# Save screenshot menu function.
#
var save_screenshot_sel = nil;
var save_screenshot = func {
foreach (var n; props.globals.getNode("/sim/presets").getChildren())
n.setAttribute("archive", 1);
var save = func(n) {
save_screenshot_sel.close();
setprop("/sim/paths/screenshot-dir", n.getValue());
var hide_menubar = getprop("sim/gui/dialogs/screenshot/hide-menubar");
if (hide_menubar == 1){
menu_visibility = getprop("/sim/menubar/visibility");
setprop("/sim/menubar/visibility",0);
}
settimer(func { fgcommand("screen-capture") },0);
if (hide_menubar == 1){
settimer(func { setprop("/sim/menubar/visibility",menu_visibility) },0);
}
}
if (save_screenshot_sel == nil)
save_screenshot_sel = ScreenshotSelector.new(save, "Save Screenshot", "Take screenshot",
, getprop("/sim/paths/screenshot-dir"),);
save_screenshot_sel.open();
}
##
# Open property browser with given target path.

View file

@ -0,0 +1,27 @@
# Set the global weather according to the defined
# scenario in /environment/weather-scenario
#
var initialize_weather_scenario = func {
getprop( "/environment/params/metar-updates-environment", 0 ) == 0 and return;
getprop( "/environment/realwx/enabled", 0 ) and return;
getprop( "/environment/metar/data", "" ) != "" and return;
# preset configured scenario
var scn = getprop("/environment/weather-scenario", "");
var wsn = props.globals.getNode( "/environment/weather-scenarios" );
if( wsn != nil ) {
var scenarios = wsn.getChildren("scenario");
forindex (var i; scenarios ) {
if( scenarios[i].getNode("name").getValue() == scn ) {
setprop("/environment/metar/data", scenarios[i].getNode("metar").getValue() );
break;
}
}
}
};
_setlistener("/sim/signals/nasal-dir-initialized", func {
initialize_weather_scenario();
delete(globals, "weather_scenario");
});

View file

@ -27,16 +27,20 @@
<layout>hbox</layout>
<default-padding>1</default-padding>
<empty><stretch>true</stretch></empty>
<empty>
<stretch>true</stretch>
</empty>
<text>
<label>About FlightGear</label>
</text>
<empty><stretch>true</stretch></empty>
<empty>
<stretch>true</stretch>
</empty>
<button>
<legend></legend>
<legend/>
<key>Esc</key>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
@ -48,51 +52,101 @@
</group>
<hrule/>
<group>
<layout>vbox</layout>
<halign>left</halign>
<text>
<label>FlightGear Flight Simulator</label>
</text>
<text>
<label>MMMMMMMMMMMMM</label>
<format>Version: %s</format>
<halign>left</halign>
<label>MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM</label>
<format>This is FlightGear Flight Simulator V%s</format>
<property>/sim/version/flightgear</property>
</text>
<text>
<label>(c) 1996-2011, the FlightGear contributors</label>
</text>
<text>
<label>http://www.flightgear.org/</label>
</text>
<text>
<label>License: GNU General Public License Version 2</label>
</text>
<text>
<halign>left</halign>
<label>FlightGear is free and open source software, licensed</label>
</text>
<text>
<halign>left</halign>
<label>under the GNU General Public License Version 2.</label>
</text>
<text>
<halign>left</halign>
<label>Get new versions, add-ons, forum, wiki and more</label>
</text>
<text>
<halign>left</halign>
<label>from the web-site at http://www.flightgear.org/ for free.</label>
</text>
<text>
<halign>left</halign>
<label>Have a nice flight!</label>
</text>
<empty>
<stretch>true</stretch>
</empty>
<text>
<halign>left</halign>
<label>Version information</label>
</text>
<text>
<halign>left</halign>
<label>MMMMMMMMMM</label>
<format>SimGear Version: %s</format>
<property>/sim/version/flightgear</property>
</text>
<text>
<halign>left</halign>
<label>MMMMMMMMMM</label>
<format>SimGear Version: %s</format>
<property>/sim/version/simgear</property>
</text>
<text>
<halign>left</halign>
<label>MMMMMMMMMMMMMMMMMM</label>
<format>OpenSceneGraph Version: %s</format>
<property>/sim/version/openscenegraph</property>
</text>
<text>
<halign>left</halign>
<label>MMMMMMMMMMMMMMMMMM</label>
<format>Build Id: %s</format>
<property>/sim/version/build-id</property>
</text>
<text>
<halign>left</halign>
<label>MMMMMM</label>
<format>Build Number: %d</format>
<property>/sim/version/build-number</property>
</text>
<text>
<halign>left</halign>
<label>MMMMMM</label>
<format>Revision: %s</format>
<property>/sim/version/revision</property>
</text>
<hrule/>
<text>
<label>(c) 1996-2011, the FlightGear contributors</label>
</text>
</group>
<nasal>
<open><![CDATA[
]]></open>
@ -102,4 +156,3 @@
</nasal>
</PropertyList>

261
gui/dialogs/screenshot.xml Normal file
View file

@ -0,0 +1,261 @@
<?xml version="1.0"?>
<!--
Ctrl-click on "." toggles display of hidden Unix filex (dotfiles)
Ctrl-click on ".." enters $FG_ROOT
Shift-click on ".." enters $FG_HOME
Alt-click on ".." enters current working directory
-->
<PropertyList>
<name>screenshot</name>
<dialog-name>screenshot</dialog-name>
<layout>vbox</layout>
<resizable>true</resizable>
<pref-width>450</pref-width>
<group>
<layout>hbox</layout>
<empty><stretch>1</stretch></empty>
<text>
<label>Select directory</label>
</text>
<empty><stretch>1</stretch></empty>
<button>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<legend></legend>
<default>1</default>
<keynum>27</keynum>
<border>2</border>
<binding>
<command>nasal</command>
<script>close()</script>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<input>
<name>dir-input</name>
<pref-width>442</pref-width>
<halign>fill</halign>
<property>/sim/gui/dialogs/screenshot/directory</property>
<live>1</live>
<binding>
<command>dialog-apply</command>
<object-name>dir-input</object-name>
</binding>
<binding>
<command>nasal</command>
<script>dir_input()</script>
</binding>
</input>
<list>
<name>list</name>
<halign>fill</halign>
<valign>fill</valign>
<stretch>true</stretch>
<pref-height>300</pref-height>
<property>/sim/gui/dialogs/screenshot/selection</property>
<binding>
<command>dialog-apply</command>
<object-name>list</object-name>
</binding>
<binding>
<command>nasal</command>
<script>select()</script>
</binding>
</list>
<group>
<layout>hbox</layout>
<checkbox>
<halign>left</halign>
<label>Hide menubar from screenshot</label>
<name>hide-menubar</name>
<property>/sim/gui/dialogs/screenshot/hide-menubar</property>
<binding>
<command>dialog-apply</command>
<object-name>hide-menubar</object-name>
</binding>
</checkbox>
<button>
<legend>OK</legend>
<live>1</live>
<pref-width>200</pref-width>
<default>true</default>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>nasal</command>
<script>ok()</script>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<nasal>
<open>
var self = cmdarg();
var list = self.getNode("list");
# cloning
var dlgname = self.getNode("name").getValue();
self.getNode("input/property").setValue("/sim/gui/dialogs/" ~ dlgname ~ "/directory");
self.getNode("list/property").setValue("/sim/gui/dialogs/" ~ dlgname ~ "/selection");
# self.getNode("group[1]/input/property").setValue("/sim/gui/dialogs/" ~ dlgname ~ "/selection");
var dlg = props.globals.getNode("/sim/gui/dialogs/" ~ dlgname, 1);
var selection = dlg.getNode("selection", 1);
var title = dlg.getNode("title", 1);
var button = dlg.getNode("button", 1);
var dir = dlg.getNode("directory", 1);
var file = dlg.getNode("file", 1);
var path = dlg.getNode("path", 1);
var dotfiles = dlg.getNode("dotfiles", 1);
dotfiles.setBoolValue(dotfiles.getValue());
var kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl", 1);
var kbdshift = props.globals.getNode("/devices/status/keyboard/shift", 1);
var kbdalt = props.globals.getNode("/devices/status/keyboard/alt", 1);
var current = { dir : "", file : "" };
var pattern = [];
foreach (var p; dlg.getChildren("pattern"))
append(pattern, p.getValue());
var matches = func(s) {
foreach (var p; pattern)
if (string.match(s, p))
return 1;
return 0;
}
var update = func(d) {
var entries = directory(d);
if (entries == nil) # dir doesn't exist or no permissions
return 0;
var files = [];
var dirs = [];
var hide = !dotfiles.getValue();
foreach (var e; entries) {
if (e == ".") {
append(dirs, e);
continue;
}
if (e == "..") {
if (d != "/")
append(dirs, e);
continue;
}
if (hide and e[0] == `.`)
continue;
var stat = io.stat(d ~ "/" ~ e);
if (stat == nil) # dead link
continue;
if (stat[11] == "dir")
append(dirs, e ~ "/");
elsif (!size(pattern) or matches(e))
append(files, e);
}
list.removeChildren("value");
var entries = sort(dirs, cmp) ~ sort(files, cmp);
forindex (var i; entries)
list.getChild("value", i, 1).setValue(entries[i]);
dir.setValue(d);
gui.dialog_update(dlgname, "dir-input", "list");
return 1;
}
var select = func {
var e = selection.getValue();
current.file = "";
var new = nil;
if (e == ".") {
new = current.dir;
if (kbdctrl.getValue())
dotfiles.setBoolValue(!dotfiles.getValue());
} elsif (e == "..") {
if (kbdctrl.getValue())
new = getprop("/sim/fg-root");
elsif (kbdshift.getValue())
new = getprop("/sim/fg-home");
elsif (kbdalt.getValue())
new = getprop("/sim/fg-current");
else
new = current.dir ~ "/..";
} elsif (e[size(e) - 1] == `/`) {
new = current.dir ~ "/" ~ e;
} else {
current.file = e;
gui.dialog_update(dlgname, "screenshot");
}
if (new != nil) {
var p = string.normpath(new);
if (update(p))
current.dir = p;
selection.setValue("");
}
}
var file_input = func {
current.file = selection.getValue();
}
var dir_input = func {
var p = string.normpath(dir.getValue());
if (update(p))
current.dir = p;
gui.dialog_update(dlgname, "list");
}
var close = func {
call(func { gui.Dialog.instance[dlgname].close() }, nil, var err = []);
}
var ok = func {
dir_input();
file_input();
var p = string.normpath(current.dir ~ "/" ~ current.file);
var stat = io.stat(p);
path.setValue(stat != nil and stat[11] == "dir" ? p ~ "/" : p);
file.setValue(current.file);
close();
}
var op = button.getValue();
if (op == nil or op == "")
op = "OK";
self.getNode("group[1]/button/legend").setValue(op);
var t = title.getValue();
if (t == nil or t == "")
t = "Select File";
self.getNode("group[0]/text/label").setValue(t);
current.dir = (var d = dir.getValue()) != nil and d != "" ? d : getprop("/sim/fg-current");
current.file = (var d = file.getValue()) != nil and d != "" ? d : "";
gui.dialog_update(dlgname, "screenshot"); ## dir-input ?
update(string.normpath(current.dir));
dir.setValue(current.dir);
</open>
</nasal>
</PropertyList>

View file

@ -1599,6 +1599,22 @@
} else if( getprop( "environment/realwx/enabled" ) ) {
setprop( me.base ~ "/source-selection", "Live data" );
} else {
# preset configured scenario
var wsn = props.globals.getNode( "/environment/weather-scenarios" );
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","") ) {
setprop( me.base ~ "/source-selection", scenarios[i].getNode("name").getValue() );
found = 1;
break;
}
}
}
if( found == 0 )
setprop( me.base ~ "/source-selection", "Manual input" );
}
setprop( me.base ~ "/metar", normalize_string(getprop("environment/metar/data")) );

View file

@ -67,6 +67,13 @@
</script>
</binding>
</item>
<item>
<label>Screesnhot (set directory)</label>
<binding>
<command>nasal</command>
<script>gui.save_screenshot()</script>
</binding>
</item>
<!--
<item>
<label>Last snapshot</label>

View file

@ -246,7 +246,7 @@ Started September 2000 by David Megginson, david@megginson.com
</current-view>
<panel>
<path>Aircraft/Generic/Panels/generic-vfr-panel.xml</path>
<visibility type="bool">false</visibility>
<visibility type="bool" userarchive="y">false</visibility>
<jitter type="bool">false</jitter>
</panel>
<panel_2>
@ -574,8 +574,8 @@ Started September 2000 by David Megginson, david@megginson.com
</gui>
<mouse>
<hide-cursor>true</hide-cursor>
<cursor-timeout-sec>10.0</cursor-timeout-sec>
<hide-cursor type="bool" userarchive="y">true</hide-cursor>
<cursor-timeout-sec type="int" userarchive="y">10.0</cursor-timeout-sec>
</mouse>
<replay>