Talk:FlightGear missions and adventures

From FlightGear wiki
Jump to navigation Jump to search

MapStructure layer for tutorial targets (05/2014)

Tutorials#Targets

# See: http://wiki.flightgear.org/MapStructure
# Class things:
var name = 'TUTORIAL_TGT';
var parents = [SymbolLayer.Controller];
var __self__ = caller(0)[0];
SymbolLayer.Controller.add(name, __self__);
SymbolLayer.add(name, {
	parents: [MultiSymbolLayer],
	type: name, # Symbol type
	df_controller: __self__, # controller to use by default -- this one
        df_style:{},
});
var new = func(layer) {
	var m = {
		parents: [__self__],
		layer: layer,
		map: layer.map,
		listeners: [],
query_type:'"tutorial targets"',
	};
# TODO: for non-navaid/FGPositioned layers this needs to be customized to compare objects on the layer
# layer.searcher._equals = func(a,b) 0;

	return m;
}; # ctor
var del = func() {
	foreach (var l; me.listeners)
		removelistener(l);
}; # del
var searchCmd = func {
	printlog(_MP_dbg_lvl, "Running query:", me.query_type);
	var range = me.map.controller.query_range();
	if (range == nil) return;
	return tutorial.get_targets(range);
};