Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Template:MapStructure lcontroller

From FlightGear wiki
Jump to: navigation, 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