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 = 'FIX';
|
|
|
|
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 = {
|
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-01-10 03:04:36 +00:00
|
|
|
var element_type = "group"; # we want a group, becomes "me.element"
|
|
|
|
|
2014-04-29 02:26:32 +00:00
|
|
|
##
|
|
|
|
# used during initialization to populate the symbol cache with a FIX symbol
|
|
|
|
#
|
2014-05-25 18:11:13 +00:00
|
|
|
var drawFIX = func(group) {
|
|
|
|
group.createChild("path")
|
2014-01-10 03:04:36 +00:00
|
|
|
.moveTo(-15,15)
|
|
|
|
.lineTo(0,-15)
|
|
|
|
.lineTo(15,15)
|
|
|
|
.close()
|
2014-05-25 18:11:13 +00:00
|
|
|
.setStrokeLineWidth(line_width)
|
2014-07-08 10:28:26 +00:00
|
|
|
.setColor(color);
|
2014-04-29 02:26:32 +00:00
|
|
|
}
|
2015-05-30 18:20:59 +00:00
|
|
|
var _name = name;
|
2014-04-29 02:26:32 +00:00
|
|
|
|
2014-05-25 18:11:13 +00:00
|
|
|
var init = func {
|
|
|
|
# initialize the cached fix symbol
|
2015-05-30 18:20:59 +00:00
|
|
|
var draw_fn = me.getOption('draw_function');
|
|
|
|
if(typeof(draw_fn) != 'func')
|
|
|
|
draw_fn = drawFIX;
|
|
|
|
|
|
|
|
var cache = StyleableCacheable.new(
|
|
|
|
name:_name,
|
|
|
|
draw_func: draw_fn,
|
|
|
|
cache: SymbolCache32x32,
|
|
|
|
draw_mode: SymbolCache.DRAW_CENTERED,
|
|
|
|
relevant_keys: ["line_width", "color"],
|
|
|
|
);
|
2014-05-25 18:11:13 +00:00
|
|
|
cache.render(me.element, me.style).setScale(me.style.scale_factor);
|
2014-04-29 02:26:32 +00:00
|
|
|
|
2017-10-02 19:22:06 +00:00
|
|
|
var txt_offset = me.getStyle('text_offset', [3, 0]);
|
2015-05-30 18:20:59 +00:00
|
|
|
var txt_color = me.getStyle('text_color', [0,0.6,0.85]);
|
2014-05-25 18:11:13 +00:00
|
|
|
# non-cached stuff:
|
2015-05-30 18:20:59 +00:00
|
|
|
if (me.style.show_labels){
|
|
|
|
me.text_fix = me.newText(me.model.id).
|
|
|
|
setScale(me.style.scale_factor).
|
|
|
|
setTranslation(txt_offset).
|
|
|
|
setColor(txt_color);
|
|
|
|
}
|
2014-04-29 02:26:32 +00:00
|
|
|
}
|
2015-05-30 18:20:59 +00:00
|
|
|
var draw = func {me.callback('draw');};
|