20,741
edits
mNo edit summary |
|||
Line 265: | Line 265: | ||
NavDisplay-GUIFrontend.png|NavDisplay/MapStructure testbed | NavDisplay-GUIFrontend.png|NavDisplay/MapStructure testbed | ||
</gallery> | </gallery> | ||
== Adding new MapStructure Layers == | |||
To add a new mapping layer to display custom symbols (radar, scenery objects etc), you only need to open $FG_ROOT/Nasal/canvas/map/navdisplay.styles, navigate to the vector named '''layers''' and add your new layer there, e.g. named "AA": | |||
<syntaxhighlight lang="nasal"> | |||
{ name:'AA', isMapStructure:1, update_on:['toggle_range','toggle_display_mode'], | |||
predicate: func(nd, layer) { | |||
# toggle visibility here | |||
var visible=nd.in_mode('toggle_display_mode', ['MAP']); | |||
layer.group.setVisible( visible ); | |||
if (visible) { | |||
#print("Updating MapStructure ND layer: AA"); | |||
layer.update(); | |||
} | |||
}, # end of layer update predicate | |||
'z-index': 1, | |||
}, # end of AA layer | |||
</syntaxhighlight> | |||
You may want to add new switches to directly toggle the layer on/off | |||
== Adding new features == | == Adding new features == | ||
Line 299: | Line 318: | ||
To get started, just copy the whole 747-400 section in NDStyles and rename it to match your needs. Once that is working (getting a 747-400 ND via the 777-200 identifier), you can simply replace the SVG file name and add your own update handlers to incrementally come up with your own ND. | To get started, just copy the whole 747-400 section in NDStyles and rename it to match your needs. Once that is working (getting a 747-400 ND via the 777-200 identifier), you can simply replace the SVG file name and add your own update handlers to incrementally come up with your own ND. | ||
== Development == | == Development == |