Debian Codegraph @

Nasal/canvas/map/route.model

raw
1 # WARNING: *.model files will be deprecated, see: http://wiki.flightgear.org/MapStructure
2
3 var RouteModel = {route_monitor:nil};
4 RouteModel.new = func make(LayerModel, RouteModel);
5
6 RouteModel.init = func {
7 me._view.reset();
8 if (!getprop("/autopilot/route-manager/active"))
9 return;
10
11 ## TODO: all the model stuff is still inside the draw file for now, this just ensures that it will be called once
12 foreach(var t; [nil] )
13 me.push(t);
14
15 me.notifyView();
16
17 #FIXME: segfault of the day: use this layer once without a route, and then with a route - and BOOM, need to investigate.
18
19 # TODO: should register a route manager listener here to update itself whenever the route/active WPT changes!
20 # also, if the layer is used in a dialog, the listener should be removed when the dialog is closed
21 if (me.route_monitor == nil) # FIXME: remove this listener durint reinit
22 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 ???
23 }
24
25