f0d44ae8fe
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.)
53 lines
1.2 KiB
Text
53 lines
1.2 KiB
Text
# See: http://wiki.flightgear.org/MapStructure
|
|
# Class things:
|
|
var name = 'WPT';
|
|
var parents = [DotSym];
|
|
var __self__ = caller(0)[0];
|
|
DotSym.makeinstance( name, __self__ );
|
|
|
|
SymbolLayer.get(name).df_style = { # style to use by default
|
|
line_width: 3,
|
|
scale_factor: 1,
|
|
font: "LiberationFonts/LiberationSans-Regular.ttf",
|
|
font_size: 28,
|
|
font_color: [1,0,1],
|
|
active_color: [1,0,1],
|
|
inactive_color: [1,1,1],
|
|
};
|
|
|
|
var element_type = "group"; # we want a group, becomes "me.element"
|
|
var active = nil;
|
|
|
|
var init = func {
|
|
# TODO: active vs inactive?
|
|
me.path = me.element.createChild("path")
|
|
.setStrokeLineWidth(me.style.line_width)
|
|
.moveTo(0,-25)
|
|
.lineTo(-5,-5)
|
|
.lineTo(-25,0)
|
|
.lineTo(-5,5)
|
|
.lineTo(0,25)
|
|
.lineTo(5,5)
|
|
.lineTo(25,0)
|
|
.lineTo(5,-5)
|
|
.setColor(1,1,1)
|
|
.close()
|
|
.setScale(me.style.scale_factor);
|
|
|
|
me.newText(me.model.name, me.style.font_color).setTranslation(25,35)
|
|
.setScale(me.style.scale_factor);
|
|
|
|
me.draw();
|
|
};
|
|
var draw = func {
|
|
var active = (getprop(me.layer.options.current_wp_node) == me.model.idx);
|
|
if (active != me.active) {
|
|
me.path.setColor(
|
|
active ?
|
|
me.style.active_color :
|
|
me.style.inactive_color
|
|
);
|
|
me.active = active;
|
|
}
|
|
};
|
|
|