This repository has been archived on 2021-09-26. You can view files and clone it, but cannot push or open issues or pull requests.
IDG-A32X/Models/Instruments/ND/canvas/map/ALT-profile.symbol
2017-06-18 20:14:41 -04:00

51 lines
1.3 KiB
Text

# 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();
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")
.setStrokeLineWidth(5)
.moveTo(-radius, 0)
.arcLargeCW(radius, radius, 0, 2 * radius, 0)
.arcLargeCW(radius, radius, 0, -2 * radius, 0)
.setColor(0.195,0.96,0.097);
me.element.createChild("text")
.setDrawMode( canvas.Text.TEXT )
.setText(disptext)
.setFont("LiberationFonts/LiberationSans-Regular.ttf")
.setFontSize(28)
.setTranslation(25,35)
.setColor(0.195,0.96,0.097);
}
me.callback('init_after');
}
var draw = func{
me.callback('draw');
}