| 1 |
# See: http://wiki.flightgear.org/MapStructure |
| 2 |
# Class things: |
| 3 |
var name = 'ALT-profile'; |
| 4 |
var parents = [DotSym]; |
| 5 |
var __self__ = caller(0)[0]; |
| 6 |
DotSym.makeinstance( name, __self__ ); |
| 7 |
|
| 8 |
SymbolLayer.get(name).df_style = { |
| 9 |
radius: 13, |
| 10 |
}; |
| 11 |
|
| 12 |
var element_type = "group"; |
| 13 |
|
| 14 |
var init = func { |
| 15 |
var name = me.model.getName(); |
| 16 |
var svg_path = me.getOption('svg_path'); |
| 17 |
if (svg_path != nil) { |
| 18 |
var grp = me.element.createChild("group", name); |
| 19 |
if(typeof(svg_path) == 'scalar'){ |
| 20 |
canvas.parsesvg(me.element, svg_path); |
| 21 |
} |
| 22 |
else{ #need hash |
| 23 |
if(!contains(svg_path, name)) |
| 24 |
die('ALT-Profile: no SVG Path for '~ name); |
| 25 |
var path = svg_path[name]; |
| 26 |
canvas.parsesvg(me.element, path); |
| 27 |
} |
| 28 |
} else { |
| 29 |
var disptext = chr(string.toupper(name[0]))~"/"~chr(string.toupper(name[1])); |
| 30 |
var radius = me.style.radius; |
| 31 |
me.element.createChild("path") |
| 32 |
.setStrokeLineWidth(5) |
| 33 |
.moveTo(-radius, 0) |
| 34 |
.arcLargeCW(radius, radius, 0, 2 * radius, 0) |
| 35 |
.arcLargeCW(radius, radius, 0, -2 * radius, 0) |
| 36 |
.setColor(0.195,0.96,0.097); |
| 37 |
me.element.createChild("text") |
| 38 |
.setDrawMode( canvas.Text.TEXT ) |
| 39 |
.setText(disptext) |
| 40 |
.setFont("LiberationFonts/LiberationSans-Regular.ttf") |
| 41 |
.setFontSize(28) |
| 42 |
.setTranslation(25,35) |
| 43 |
.setColor(0.195,0.96,0.097); |
| 44 |
} |
| 45 |
me.callback('init_after'); |
| 46 |
} |
| 47 |
|
| 48 |
var draw = func{ |
| 49 |
me.callback('draw'); |
| 50 |
} |
| 51 |
|