Debian Codegraph @

Nasal/canvas/map/airports.model

raw
1 # WARNING: *.model files will be deprecated, see: http://wiki.flightgear.org/MapStructure
2 var AirportModel = {};
3 AirportModel.new = func make(AirportModel, LayerModel);
4
5 # FIXME: Just testing for now: This really shouldn't be part of the core LayerModel, needs to go to "AirportModel" instead
6 # FIXME: This will get called ONCE for EACH layer that uses the AirportModel, so VERY inefficient ATM! => should be shared among layers
7
8 AirportModel.init = func {
9 me._view.reset();
10 var id = getprop(me._input_property); # HACK: this needs to be handled via the controller - introduce "input_property"
11 #print("ID is:", id);
12 (id == "") and return;
13 var apt=airportinfo(id); # FIXME: replace with controller call to update the model
14
15 foreach(var a; [ apt ]) #FIXME: move to separate method: "populate"
16 # print("storing:", a.id) and
17 me.push(a);
18 #print("Work items in Model:", me.hasData() );
19 #print("Model updated!!");
20
21 # set RefPos and hdg to apt !!
22 me._map.setRefPos(apt.lat, apt.lon);
23
24 #TODO: Notify view on update - use proper NOTIFICATIONS (INIT; UPDATE etc)
25 me.notifyView();
26 }
27