1
0
Fork 0
fgdata/Nasal/canvas/map/GPS.symbol

44 lines
1.1 KiB
Text
Raw Permalink Normal View History

# See: http://wiki.flightgear.org/MapStructure
#
# GPS line. Displays GPS leg information
# Class things:
var name = 'GPS';
var parents = [LineSymbol];
var __self__ = caller(0)[0];
LineSymbol.makeinstance( name, __self__ );
SymbolLayer.get(name).df_style = { # style to use by default
line_width: 5,
color: [1,0,1],
line_dash: []
};
var getLineStyle = func(property, df_val){
var type = nil;
if(typeof(me.model) == 'hash'){
type = me.model.type;
}
if(type != nil and type != 'current'){
var base_prop = property;
property = property~'_'~type;
me.getStyle(property, me.getStyle(base_prop, df_val));
} else {
me.getStyle(property, df_val);
}
};
var setRouteStyle = func{
var df_style = SymbolLayer.get(name).df_style;
var dash = me.getLineStyle('line_dash', []);
var color = me.getLineStyle('color', df_style.color);
var line_width = me.getLineStyle('line_width', df_style.line_width);
me.element.setColor(color).setStrokeLineWidth(line_width);
if(typeof(dash) == 'vector')
me.element.setStrokeDashArray(dash);
};
var init = func {
me.setRouteStyle();
};