2014-05-25 18:11:13 +00:00
|
|
|
# See: http://wiki.flightgear.org/MapStructure
|
|
|
|
# Class things:
|
|
|
|
var name = 'ALT-profile';
|
|
|
|
var parents = [DotSym];
|
|
|
|
var __self__ = caller(0)[0];
|
|
|
|
DotSym.makeinstance( name, __self__ );
|
|
|
|
|
|
|
|
SymbolLayer.get(name).df_style = {
|
|
|
|
radius: 13,
|
|
|
|
};
|
|
|
|
|
|
|
|
var element_type = "group";
|
|
|
|
|
|
|
|
var init = func {
|
|
|
|
var name = me.model.getName();
|
2015-05-30 18:20:59 +00:00
|
|
|
var svg_path = me.getOption('svg_path');
|
|
|
|
if (svg_path != nil) {
|
|
|
|
var grp = me.element.createChild("group", name);
|
|
|
|
if(typeof(svg_path) == 'scalar'){
|
|
|
|
canvas.parsesvg(me.element, svg_path);
|
|
|
|
}
|
|
|
|
else{ #need hash
|
|
|
|
if(!contains(svg_path, name))
|
|
|
|
die('ALT-Profile: no SVG Path for '~ name);
|
|
|
|
var path = svg_path[name];
|
|
|
|
canvas.parsesvg(me.element, path);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
var disptext = chr(string.toupper(name[0]))~"/"~chr(string.toupper(name[1]));
|
|
|
|
var radius = me.style.radius;
|
|
|
|
me.element.createChild("path")
|
2014-05-25 18:11:13 +00:00
|
|
|
.setStrokeLineWidth(5)
|
|
|
|
.moveTo(-radius, 0)
|
2015-05-30 18:20:59 +00:00
|
|
|
.arcLargeCW(radius, radius, 0, 2 * radius, 0)
|
|
|
|
.arcLargeCW(radius, radius, 0, -2 * radius, 0)
|
2014-05-25 18:11:13 +00:00
|
|
|
.setColor(0.195,0.96,0.097);
|
2015-05-30 18:20:59 +00:00
|
|
|
me.element.createChild("text")
|
2014-05-25 18:11:13 +00:00
|
|
|
.setDrawMode( canvas.Text.TEXT )
|
|
|
|
.setText(disptext)
|
|
|
|
.setFont("LiberationFonts/LiberationSans-Regular.ttf")
|
|
|
|
.setFontSize(28)
|
|
|
|
.setTranslation(25,35)
|
|
|
|
.setColor(0.195,0.96,0.097);
|
2015-05-30 18:20:59 +00:00
|
|
|
}
|
|
|
|
me.callback('init_after');
|
|
|
|
}
|
|
|
|
|
|
|
|
var draw = func{
|
|
|
|
me.callback('draw');
|
2014-05-25 18:11:13 +00:00
|
|
|
}
|
|
|
|
|