# See: http://wiki.flightgear.org/MapStructure # TODO: this layer doesn't make sense to support for AI/MP traffic, because we don't currently have access to flightplan/routing info # that also applies to other layers like WPT or even navaid layers that handle station tuning based on local radio settings # # Class things: var name = 'RTE'; 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_options: { # default configuration options active_node: "/autopilot/route-manager/active", current_wp_node: "/autopilot/route-manager/current-wp", wp_num: "/autopilot/route-manager/route/num", } }); var new = func(layer) { var m = { parents: [__self__], layer: layer, map: layer.map, listeners: [], }; layer.searcher._equals = func(l,r) 0; # TODO: create model objects instead? append(m.listeners, setlistener(layer.options.active_node, func m.layer.update() ), setlistener(layer.options.wp_num, func m.layer.update() )); m.addVisibilityListener(); return m; }; var del = func() { foreach (var l; me.listeners) removelistener(l); }; var searchCmd = func { # FIXME: do we return the current route even if it isn't active? printlog(_MP_dbg_lvl, "Running query: ", name); var plans = []; # TODO: multiple flightplans? # http://wiki.flightgear.org/Nasal_Flightplan var fp = flightplan(); var fpSize = fp.getPlanSize(); if (!getprop(me.layer.options.active_node)) fpSize = 0; var coords = []; for (var i=0; i