2014-04-29 02:26:32 +00:00
|
|
|
# See: http://wiki.flightgear.org/MapStructure
|
2014-01-10 03:04:36 +00:00
|
|
|
# Class things:
|
|
|
|
var name = 'WPT';
|
|
|
|
var parents = [DotSym];
|
|
|
|
var __self__ = caller(0)[0];
|
|
|
|
DotSym.makeinstance( name, __self__ );
|
|
|
|
|
2014-05-25 18:11:13 +00:00
|
|
|
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],
|
|
|
|
};
|
|
|
|
|
2014-01-10 03:04:36 +00:00
|
|
|
var element_type = "group"; # we want a group, becomes "me.element"
|
2014-05-25 18:11:13 +00:00
|
|
|
var active = nil;
|
2014-01-10 03:04:36 +00:00
|
|
|
|
2014-05-25 18:11:13 +00:00
|
|
|
var init = func {
|
|
|
|
me.path = me.element.createChild("path")
|
|
|
|
.setStrokeLineWidth(me.style.line_width)
|
2014-01-10 03:04:36 +00:00
|
|
|
.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)
|
2014-05-25 18:11:13 +00:00
|
|
|
.close()
|
|
|
|
.setScale(me.style.scale_factor);
|
2014-01-10 03:04:36 +00:00
|
|
|
|
2014-05-25 18:11:13 +00:00
|
|
|
me.newText(me.model.name, me.style.font_color).setTranslation(25,35)
|
|
|
|
.setScale(me.style.scale_factor);
|
|
|
|
|
|
|
|
me.draw();
|
|
|
|
};
|
|
|
|
var draw = func {
|
2014-06-07 02:12:39 +00:00
|
|
|
var active = (getprop(me.options.current_wp_node) == me.model.idx);
|
2014-05-25 18:11:13 +00:00
|
|
|
if (active != me.active) {
|
|
|
|
me.path.setColor(
|
|
|
|
active ?
|
|
|
|
me.style.active_color :
|
|
|
|
me.style.inactive_color
|
|
|
|
);
|
|
|
|
me.active = active;
|
|
|
|
}
|
2014-01-10 03:04:36 +00:00
|
|
|
};
|
|
|
|
|