7ca8482b07
In time for 3.0. The API is still not fully complete, and not fully cleaned up, but this is good enough for this release cycle (and it should offer benefit longer term, if not now -- hopefully performance as well). Many thanks to Hooray as well, who has helped prepare things while I could not, and often suggested ideas.
24 lines
969 B
Text
24 lines
969 B
Text
|
|
var RouteModel = {route_monitor:nil};
|
|
RouteModel.new = func make(LayerModel, RouteModel);
|
|
|
|
RouteModel.init = func {
|
|
me._view.reset();
|
|
if (!getprop("/autopilot/route-manager/active"))
|
|
return;
|
|
|
|
## TODO: all the model stuff is still inside the draw file for now, this just ensures that it will be called once
|
|
foreach(var t; [nil] )
|
|
me.push(t);
|
|
|
|
me.notifyView();
|
|
|
|
#FIXME: segfault of the day: use this layer once without a route, and then with a route - and BOOM, need to investigate.
|
|
|
|
# TODO: should register a route manager listener here to update itself whenever the route/active WPT changes!
|
|
# also, if the layer is used in a dialog, the listener should be removed when the dialog is closed
|
|
if (me.route_monitor == nil) # FIXME: remove this listener durint reinit
|
|
me.route_monitor=setlistener("/autopilot/route-manager/active", func me.init() ); # this can probably be shared (singleton), because all canvases will be displaying same route ???
|
|
}
|
|
|
|
|