20,741
edits
m (http://wiki.flightgear.org/Canvas_MapStructure#The_SymbolCache) |
|||
Line 232: | Line 232: | ||
| {{Caution|This is currently untested code}} | | {{Caution|This is currently untested code}} | ||
<syntaxhighlight lang="nasal" enclose="div"> | <syntaxhighlight lang="nasal" enclose="div"> | ||
# ... | var drawVOR = func(group) { | ||
return group.createChild("path") | |||
.moveTo(-15,0) | |||
.lineTo(-7.5,12.5) | |||
.lineTo(7.5,12.5) | |||
.lineTo(15,0) | |||
.lineTo(7.5,-12.5) | |||
.lineTo(-7.5,-12.5) | |||
.close() | |||
.setStrokeLineWidth(line_width) | |||
.setColor(color); | |||
}; | |||
style = { # style to use by default | |||
line_width: 3, | |||
range_line_width: 3, | |||
radial_line_width: 3, | |||
range_dash_array: [5, 15, 5, 15, 5], | |||
radial_dash_array: [15, 5, 15, 5, 15], | |||
scale_factor: 1, | |||
active_color: [0, 1, 0], | |||
inactive_color: [0, 0.6, 0.85], | |||
}; | |||
var myCache = StyleableCacheable.new( | |||
name:'VOR', draw_func: drawVOR, | |||
cache: canvas.SymbolCache32x32, | |||
draw_mode: SymbolCache.DRAW_CENTERED, | |||
relevant_keys: ["line_width", "color"], | |||
); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
|} | |} | ||
== Adding Text Elements == | == Adding Text Elements == |