20,741
edits
m (→Example: Tutorial Layer (TUT: http://forum.flightgear.org/viewtopic.php?f=71&t=27591#p259306) |
|||
Line 1,211: | Line 1,211: | ||
{{MapStructure lcontroller|layername=TUT}} | {{MapStructure lcontroller|layername=TUT}} | ||
Now, here's some code to actually test the new layer (contributed by ludomotico [http://forum.flightgear.org/viewtopic.php?f=71&t=27591#p259306]): | |||
<syntaxhighlight lang="nasal"> | |||
var temp = {}; | |||
temp.dlg = canvas.Window.new([600,400],"dialog"); | |||
temp.canvas = temp.dlg.createCanvas().setColorBackground(1,1,1,0.5); | |||
temp.root = temp.canvas.createGroup(); | |||
var TestMap = temp.root.createChild("map"); | |||
TestMap.setController("Aircraft position"); | |||
TestMap.setRange(25); | |||
TestMap.setTranslation( | |||
temp.canvas.get("view[0]")/2, | |||
temp.canvas.get("view[1]")/2 | |||
); | |||
var r = func(name,vis=1,zindex=nil) return caller(0)[0]; | |||
foreach(var type; [r('TUT'),r('APT'), r('APS') ] ) | |||
TestMap.addLayer(factory: canvas.SymbolLayer, type_arg: type.name, visible: type.vis, priority: type.zindex,); | |||
</syntaxhighlight> | |||
== Diagnostics == | == Diagnostics == |