1
0
Fork 0
fgdata/Nasal/canvas/map/airports.model
Gijs de Rooy a9576e8c8d Canvas Navigational Display:
- get rid of global variables and use instance variables
- identified all important drawing routines and move them into *.draw files
- changed to dynamic loading of *.draw *.model and *.layer files
- implemented poor-man's controller hash to move use-case specific conditionals out of the draw files, and back into the instantiation, i.e. Gijs' EFIS class
- started identifying stuff that is not specific to drawing, but to what is to be drawn, i.e. Model stuff - such as positioned queries, moved those out into *.model files
- some more work on supporting more than a single ND MFD instance per aircraft
- renamed a handful of SVG identifiers to avoid naming conflicts and to simplify usage of SVG IDs as member fields
- moved all of the setlistener setup out of the fdm-initialized stub right into the ctor of the Efis class (actually that's controller stuff...)
- initial MapStructure framework
- aircraft-agnostic NavDisplay class
- preparations for deprecating map.nas
- additions to canvas.map
- preparations for making NDStyles configurable via XML
2013-12-01 13:36:23 +01:00

26 lines
1,000 B
Text

var AirportModel = {};
AirportModel.new = func make(AirportModel, LayerModel);
# FIXME: Just testing for now: This really shouldn't be part of the core LayerModel, needs to go to "AirportModel" instead
# FIXME: This will get called ONCE for EACH layer that uses the AirportModel, so VERY inefficient ATM! => should be shared among layers
AirportModel.init = func {
me._view.reset();
var id = getprop(me._input_property); # HACK: this needs to be handled via the controller - introduce "input_property"
#print("ID is:", id);
(id == "") and return;
var apt=airportinfo(id); # FIXME: replace with controller call to update the model
foreach(var a; [ apt ]) #FIXME: move to separate method: "populate"
# print("storing:", a.id) and
me.push(a);
#print("Work items in Model:", me.hasData() );
#print("Model updated!!");
# set RefPos and hdg to apt !!
me._map.setRefPos(apt.lat, apt.lon);
#TODO: Notify view on update - use proper NOTIFICATIONS (INIT; UPDATE etc)
me.notifyView();
}