1
0
Fork 0
A320-family/Models/Instruments/ND/canvas/map/TERRAIN.lcontroller

59 lines
1.4 KiB
Text
Raw Normal View History

2021-02-11 22:46:04 +00:00
# See: http://wiki.flightgear.org/MapStructure
# Class things:
var name = 'TERRAIN';
var parents = [canvas.SymbolLayer.Controller];
var __self__ = caller(0)[0];
canvas.SymbolLayer.Controller.add(name, __self__);
canvas.SymbolLayer.add(name, {
parents: [MultiSymbolLayer],
type: name, # Symbol type
df_controller: __self__, # controller to use by default -- this one
df_options: { # default configuration options
viewport_radius: 670
}
});
var terrain_tree = "/instrumentation/efis[0]/nd/terrain-on-nd";
var new = func(layer) {
var m = {
parents: [__self__],
layer: layer,
map: layer.map,
2021-02-13 16:06:04 +00:00
startpos: layer.map.getPosCoord(),
2021-02-11 22:46:04 +00:00
listeners: [],
};
layer.searcher._equals = func(l,r) l.equals(r);
m.addVisibilityListener();
return m;
};
var del = func() {
#print(name~".lcontroller.del()");
foreach (var l; me.listeners)
removelistener(l);
};
var searchCmd = func {
if(me.map.getRange() == nil) return [];
#var lat = getprop(terrain_tree~"/center/latitude-deg");
#var lon = getprop(terrain_tree~"/center/longitude-deg");
#if(lat == nil or lon == nil) {
var pos = geo.aircraft_position();
var lat = pos.lat();
var lon = pos.lon();
2021-02-11 22:46:04 +00:00
#}
var result = geo.Coord.new();
result.set_latlon(lat, lon);
result.rangeNm = me.map.getRange();
result.fetchRad = 184; # is this number accurate?
result.equals = func(r){
me.fetchRad == r.fetchRad and me.lat == r.lat and me.lon == r.lon
};
return [result];
};