Template:MapStructure lcontroller

From FlightGear wiki
Jump to navigation Jump to search
# See: http://wiki.flightgear.org/MapStructure
# Class things:
var name = 'DEMO';
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:'dme',
	};
# 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 positioned.findWithinRange(range, me.query_type);
}; # searchCmd