f0d44ae8fe
Fix the main bugs, add features and convert most of the layers. Move/refactor some things as well. Add a canvas map dialog next to the built-in one -- it's not 100% functional but it's quite close actually. As before, the excitement has been taking place at our team clone. https://gitorious.org/fg/canvas-hackers-fgdata/commits/0b4cc84 (topics/canvas-map-dialog branch this time, current HEAD in above URL.)
55 lines
1.6 KiB
Text
55 lines
1.6 KiB
Text
# 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",
|
|
}
|
|
});
|
|
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() ));
|
|
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();
|
|
var coords = [];
|
|
for (var i=0; i<fpSize; i += 1) {
|
|
var leg = fp.getWP(i);
|
|
foreach (var c; leg.path()) {
|
|
append(coords, c);
|
|
}
|
|
}
|
|
append(plans, coords);
|
|
return plans;
|
|
};
|
|
|