1
0
Fork 0
fgdata/Nasal/canvas/map/FIX.symbol
Philosopher f0d44ae8fe Lots lots more MapStructure changes
Fix the main bugs, add features and convert most of the layers.
Move/refactor some things as well. Add a canvas map dialog next to the
built-in one -- it's not 100% functional but it's quite close actually.

As before, the excitement has been taking place at our team clone.
https://gitorious.org/fg/canvas-hackers-fgdata/commits/0b4cc84
(topics/canvas-map-dialog branch this time, current HEAD in above URL.)
2014-05-25 14:27:11 -05:00

49 lines
1.1 KiB
Text

# See: http://wiki.flightgear.org/MapStructure
# Class things:
var name = 'FIX';
var parents = [DotSym];
var __self__ = caller(0)[0];
DotSym.makeinstance( name, __self__ );
SymbolLayer.get(name).df_style = {
line_width: 3,
scale_factor: 1,
font: "LiberationFonts/LiberationSans-Regular.ttf",
font_color: [0,0,0],
font_size: 28,
color: [0, 0.6, 0.85],
show_labels: 1,
};
var element_type = "group"; # we want a group, becomes "me.element"
##
# used during initialization to populate the symbol cache with a FIX symbol
#
var drawFIX = func(group) {
group.createChild("path")
.moveTo(-15,15)
.lineTo(0,-15)
.lineTo(15,15)
.close()
.setStrokeLineWidth(line_width)
.setColor(color);
}
var cache = StyleableCacheable.new(
name:name, draw_func: drawFIX,
cache: SymbolCache32x32,
draw_mode: SymbolCache.DRAW_CENTERED,
relevant_keys: ["line_width", "color"],
);
var init = func {
# initialize the cached fix symbol
cache.render(me.element, me.style).setScale(me.style.scale_factor);
# non-cached stuff:
if (me.style.show_labels)
me.text_fix = me.newText(me.model.id).setScale(me.style.scale_factor);
}
var draw = func;