Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G


Jump to: navigation, search

Canvas ND Framework

441 bytes removed, 14:48, 22 December 2015
Some little updates/edits
{{infobox subsystem
|description = [[Canvas]]/[[Nasal]] driven NDs
|status = Under active development as of 12/2013
|maintainers = Gijs (B747), Hyde(B777), Soitanen(B737NG), (Hooray, Philosopher & D-LEON via [[MapStructure]])
|developers = [[User:Gijs]] (since 11/2013)
Extending the framework should normally require very little in terms of coding - typically, people can simply take an existing feature/symbol, copy & paste the code section and customize it according to their needs (e.g. different SVG element id, different animations, different properties) - symbols can be easily changed by providing a separate SVG file, or by creating a new one via Inkscape.
It can be found on [[Git]] in fgdata/master (2.99). The main source is located in <tt>at {{Git link|gitorious|fg/fgdata|masterfile|Nasal/canvas/map/navdisplay.mfd|pre=$FG_ROOT/}}</tt> aircraft. Aircraft-specifics can be found in {{Git link|gitorious|fg/fgdata|masterfile|Nasal/canvas/map/navdisplay.styles|pre=$FG_ROOT/}}. 
[[File:777-200-ND-Controls.png|thumb|Screen shot showing the control panel of the 777-200ER for controlling the Canvas-based [[NavDisplay]]]]
== Adding the navigation display to your aircraft ==
Note that the latest ND code is currently only available in Git and not in the latest stable release.
# Add a surface object to your 3D model and apply a place holder texture to it. You can refer to the 747-400 and 777 for examples.
# Copy the ND.nas file of the Boeing 777 into your own aircraft directory (<tt>[{{Git linkfgaddon url|gitorious777|fgModels/Instruments/ND/ND.nas}} $FG_ROOT/fgdata|master|Aircraft/777/Models/Instruments/ND/ND.nas|pre=[[$FG_ROOT]]/}}</tt>).
# Add the file to the <nasal> block in your aircraft's [[Aircraft-set.xml|-set.xml]] file.
# In order to customize the ND for your specific aircraft, change a few options in your ND.nas file:
## the node behind <code>addPlacement</code> is the name of the object in your 3D model. For multiple independent NDs, each ND should have its own object (and thus placement node). The 777 for example has a "ndScreenL" and a "ndScreenR".
## Rename the properties in the "myCockpit_switches" hash at the top of the ND.nas file to match your own properties (range selector, mode selector etc.), see [{{Git linkfgaddon url|gitorious747-400|fgModels/Cockpit/Instruments/ND/ND.nas}} $FG_ROOT/fgdata|master|Aircraft/747-400/Models/Cockpit/Instruments/ND/ND.nas|3|22|pre=[[$FG_ROOT]]/}} . You're advised to use the defaults (and change other systems of your aircraft accordingly). For an overview of switches, see [[#Cockpit switches]].# Add knobs/buttons to the 3D model of your cockpit to control the various options of the ND. See <tt>[{{Git linkfgaddon url|gitorious777|fgModels/Instruments/EFIS/efis-ctl1.xml}} $FG_ROOT/fgdata|master|Aircraft/777/Models/Instruments/EFIS/efis-ctl1.xml|pre=[[$FG_ROOT]]/}}</tt> for an example.# Add a binding to your screen(s) to open the ND in a popup dialog. See <tt>[{{Git linkfgaddon url|gitorious777|fgModels/Instruments/ND/ND_L.xml}} $FG_ROOT/fgdata|master|Aircraft/777/Models/Instruments/ND/ND_L.xml|pre=[[$FG_ROOT]]/}}</tt> for an example.
That's the only thing you need to do right now. future changes will be in navdisplay.mfd and will be automatically available to you once they're committed/merged, no changes needed in your ND.nas at all, except for additional switches/buttons that may be created, and which would obviously need to be mapped to your cockpit hot spots.
== Gallery ==
<gallery mode="packed " widths="230px " heights="230px">
Navigation display MAP mode.png|MAP mode
Navigation display centered MAP mode.png|Centered MAP mode
<syntaxhighlight lang="xml">
<!--######################## Airports ############################--> <animation> <type>pick</type> <object-name>bt-h1</object-name> <visible>true</visible> <action> <button>0</button> <binding> <command>property-toggle</command> <property>/instrumentation/efis/inputs/arpt</property> </binding> </action> </animation>
Or here again for the range selection:
<syntaxhighlight lang="xml">
<animation> <type>pick</type> <object-name>trim1</object-name> <action> <button>4</button> <!-- scroll up --> <repeatable>false</repeatable> <binding> <command>property-cycle</command> <property>/instrumentation/efis/inputs/range-nm</property> <value>10</value> <value>20</value> <value>40</value> <value>80</value> <value>160</value> <value>320</value> </binding> </action> </animation>
<animation> <type>pick</type> <object-name>trim1</object-name> <action> <button>3</button> <!-- scroll up --> <repeatable>false</repeatable> <binding> <command>property-cycle</command> <property>/instrumentation/efis/inputs/range-nm</property> <value>320</value> <value>160</value> <value>80</value> <value>40</value> <value>20</value> <value>10</value> </binding> </action> </animation>
<syntaxhighlight lang="xml">
<animation> <type>pick</type> <object-name>blackbkd</object-name> <action> <button>0</button> <repeatable>false</repeatable> <binding> <command>nasal</command> <script>mirage2000.showNd();</script> </binding> </action> </animation>
* $FG_ROOT/Nasal/canvas/map/ND/nd.airbus-3_4
* $FG_ROOT/Nasal/canvas/map/ND/nd.airbus-4_0
=== Getting rid of Aircraft Dependencies ===
* the constructor/newMFD() methods still contain a few hard-coded assumptions due to the origins of the code, but those can be also moved into some kind of construct() field in the hash, or you can simply use the method I suggested, i.e. hiding unneeded symbols. But you're right, that the most proper solution would be identifying non-generic code that contains hard-coded assumptions and moving that into some kind of construct() field that is simply invoked by the new/newMFD() methods. Doing that would not be difficult, it would be just copy & paste - i.e. copy from the navdisplay.mfd file into the style file, by adding a corresponding hash field entry there - and calling it instead. Takes under 3 minutes[http://forum.flightgear.org/viewtopic.php?f=71&t=21509&p=214897#p214835]
=== Encapsulating Properties ===
=== Post 3.2 ===
Gijs has already begun to clean up the update() method, and navdisplay.mfd is now back down to under 800 lines of code. Hooray will need to revisit adding support for '''switches''' (i.e. a helper class) and corresponding display modes.

Navigation menu