2014-04-29 02:26:32 +00:00
|
|
|
# WARNING: *.model files will be deprecated, see: http://wiki.flightgear.org/MapStructure
|
2013-12-04 22:19:22 +00:00
|
|
|
var StormModel = {};
|
|
|
|
StormModel.new = func make( LayerModel, StormModel );
|
|
|
|
|
|
|
|
StormModel.init = func {
|
|
|
|
me._view.reset(); # wraps removeAllChildren() ATM
|
|
|
|
|
|
|
|
foreach (var n; props.globals.getNode("/instrumentation/wxradar",1).getChildren("storm")) {
|
|
|
|
# Model 3 degree radar beam
|
|
|
|
var stormLat = n.getNode("latitude-deg").getValue();
|
|
|
|
stormLon = n.getNode("longitude-deg").getValue();
|
|
|
|
acLat = getprop("/position/latitude-deg");
|
|
|
|
acLon = getprop("/position/longitude-deg");
|
|
|
|
stormGeo = geo.Coord.new();
|
|
|
|
acGeo = geo.Coord.new();
|
|
|
|
|
|
|
|
stormGeo.set_latlon(stormLat, stormLon);
|
|
|
|
acGeo.set_latlon(acLat, acLon);
|
|
|
|
|
|
|
|
var directDistance = acGeo.direct_distance_to(stormGeo);
|
|
|
|
beamH = 0.1719 * directDistance; # M2FT * tan(3deg)
|
|
|
|
beamBase = getprop("position/altitude-ft") - beamH;
|
|
|
|
|
|
|
|
if (n.getNode("top-altitude-ft").getValue() > beamBase) {
|
|
|
|
me.push( { lat: stormLat, lon : stormLon, radiusNm : n.getNode("radius-nm").getValue() } );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
me.notifyView();
|
|
|
|
}
|
|
|
|
|
|
|
|
|