@@ -714,15 +714,17 @@ function throttle_events(event) {
714714
715715function sub_to_nearby_sondes ( ) {
716716 let bounds = map . getBounds ( ) . pad ( 1 ) ; // expand by one viewport
717- let zoomed_out = map . getZoom ( ) <= 7 ;
717+ let zoomed_out = map . getZoom ( ) <= 6 ;
718718 if ( zoomed_out ) {
719719 // If we are fairly zooomed out - only give the slow feed
720720 for ( let i = 1 ; i < clientTopic . length ; i ++ ) { // skip first slow topic
721721 console . log ( "zoomed fully out. unsubbing from " + clientTopic [ i ] )
722722 client . unsubscribe ( clientTopic [ i ] ) ;
723723 }
724724 clientTopic = [ clientTopic [ 0 ] ]
725+ document . getElementById ( "zoom_warning" ) . style . display = "block"
725726 } else {
727+ document . getElementById ( "zoom_warning" ) . style . display = "none"
726728 // If zoomed in then we sub to specific sondes
727729 for ( let vehicle in vehicles ) {
728730 let topic = "sondes/" + vehicle ;
@@ -822,6 +824,7 @@ function clean_refresh(text, force, history_step) {
822824 refreshNewReceivers ( true ) ;
823825 }
824826
827+ sub_to_nearby_sondes ( ) ;
825828 return true ;
826829}
827830
@@ -1633,7 +1636,7 @@ function updateVehicleInfo(vcallsign, newPosition) {
16331636 zIndexOffset : Z_CAR ,
16341637 icon : landing_icon ,
16351638 title : vcallsign + " Onboard Landing Prediction" ,
1636- } ) . addTo ( map ) ;
1639+ } ) // .addTo(map);
16371640
16381641 // Add the marker to the vehicle object.
16391642 vehicle . landing_marker = landing_marker ;
@@ -1826,9 +1829,9 @@ function updateVehicleInfo(vcallsign, newPosition) {
18261829 '<i class="arrow"></i></div>' +
18271830 '<div class="data">' +
18281831 '<img class="' + ( ( vehicle . vehicle_type == "car" ) ?'car' :'' ) + '" src="' + image + '" />' +
1829- ( ( vehicle . vehicle_type != "car" ) ? '<span class="sbutton" onclick="shareVehicle(\'' + vcallsign + '\')" style="top:' + ( vehicle . image_src_size [ 1 ] + 85 ) + 'px">Share</span>' : '' ) +
1830- ( ( vehicle . vehicle_type != "car" ) ? '<span class="sbutton" onclick="skewTdraw(\'' + vcallsign + '\')" style="top:' + ( vehicle . image_src_size [ 1 ] + 115 ) + 'px">SkewT</span>' : '' ) +
1831- ( ( vehicle . vehicle_type != "car" ) ? '<span class="sbutton" onclick="openURL(\'' + grafana_dashboard_url + '\')" style="top:' + ( vehicle . image_src_size [ 1 ] + 145 ) + 'px">Plots</span>' : '' ) +
1832+ ( ( vehicle . vehicle_type != "car" ) ? '<span class="sbutton" onclick="shareVehicle(\'' + vcallsign + '\')" style="top:' + ( vehicle . image_src_size [ 1 ] + 55 ) + 'px">Share</span>' : '' ) +
1833+ ( ( vehicle . vehicle_type != "car" ) ? '<span class="sbutton" onclick="skewTdraw(\'' + vcallsign + '\')" style="top:' + ( vehicle . image_src_size [ 1 ] + 85 ) + 'px">SkewT</span>' : '' ) +
1834+ ( ( vehicle . vehicle_type != "car" ) ? '<span class="sbutton" onclick="openURL(\'' + grafana_dashboard_url + '\')" style="top:' + ( vehicle . image_src_size [ 1 ] + 115 ) + 'px">Plots</span>' : '' ) +
18321835 '<div class="left">' +
18331836 '<dl>' ;
18341837 //mobile
@@ -1838,9 +1841,9 @@ function updateVehicleInfo(vcallsign, newPosition) {
18381841 '<i class="arrow"></i></div>' +
18391842 '<div class="data">' +
18401843 '<img class="' + ( ( vehicle . vehicle_type == "car" ) ?'car' :'' ) + '" src="' + image + '" />' +
1841- ( ( vehicle . vehicle_type != "car" ) ? '<span class="sbutton" onclick="shareVehicle(\'' + vcallsign + '\')" style="top:85px ">Share</span>' : '' ) +
1842- ( ( vehicle . vehicle_type != "car" ) ? '<span class="sbutton" onclick="skewTdraw(\'' + vcallsign + '\')" style="top:115px ">SkewT</span>' : '' ) +
1843- ( ( vehicle . vehicle_type != "car" ) ? '<span class="sbutton" onclick="openURL(\'' + grafana_dashboard_url + '\')" style="top:145px ">Plots</span>' : '' ) +
1844+ ( ( vehicle . vehicle_type != "car" ) ? '<span class="sbutton" onclick="shareVehicle(\'' + vcallsign + '\')" style="top:55px ">Share</span>' : '' ) +
1845+ ( ( vehicle . vehicle_type != "car" ) ? '<span class="sbutton" onclick="skewTdraw(\'' + vcallsign + '\')" style="top:85px ">SkewT</span>' : '' ) +
1846+ ( ( vehicle . vehicle_type != "car" ) ? '<span class="sbutton" onclick="openURL(\'' + grafana_dashboard_url + '\')" style="top:115px ">Plots</span>' : '' ) +
18441847 '<div class="left">' +
18451848 '<dl>' ;
18461849 var b = '</dl>' +
@@ -2194,7 +2197,7 @@ function drawLaunchPrediction(vcallsign) {
21942197 color : balloon_colors [ vehicle . color_index ] ,
21952198 opacity : 0.4 ,
21962199 weight : 3 ,
2197- } ) . addTo ( map ) ;
2200+ } ) // .addTo(map);
21982201
21992202 vehicle . prediction_launch_polyline . on ( 'click' , function ( e ) {
22002203 mapInfoBox_handle_prediction_path ( e ) ;
@@ -2257,45 +2260,43 @@ function redrawPrediction(vcallsign) {
22572260 vehicle . prediction_polyline . path_length = path_length ;
22582261
22592262 var image_src ;
2260- if ( vcallsign != "wb8elk2" ) { // WhiteStar
2261- var html = "" ;
2262- if ( vehicle . prediction_target ) {
2263- vehicle . prediction_target . setLatLng ( latlng ) ;
2264- } else {
2265- image_src = host_url + markers_url + "target-" + balloon_colors_name [ vehicle . color_index ] + ".png" ;
2266- predictionIcon = new L . icon ( {
2267- iconUrl : image_src ,
2268- iconSize : [ 20 , 20 ] ,
2269- iconAnchor : [ 10 , 10 ] ,
2270- } ) ;
2271- vehicle . prediction_target = new L . Marker ( latlng , {
2272- zIndexOffset : Z_SHADOW ,
2273- icon : predictionIcon ,
2274- } ) . addTo ( map ) ;
2275- vehicle . prediction_target . on ( 'click' , function ( e ) {
2276- mapInfoBox_handle_prediction ( e ) ;
2277- } ) ;
2278- }
2279- vehicle . prediction_target . pdata = data [ data . length - 1 ] ;
22802263
2281- if ( vehicle . prediction . descent_rate == null ) {
2282- vehicle . prediction_target . pred_type = "<b>Prediction Type:</b> Float\n" ;
2264+ var html = "" ;
2265+ if ( vehicle . prediction_target ) {
2266+ vehicle . prediction_target . setLatLng ( latlng ) ;
2267+ } else {
2268+ image_src = host_url + markers_url + "target-" + balloon_colors_name [ vehicle . color_index ] + ".png" ;
2269+ predictionIcon = new L . icon ( {
2270+ iconUrl : image_src ,
2271+ iconSize : [ 20 , 20 ] ,
2272+ iconAnchor : [ 10 , 10 ] ,
2273+ } ) ;
2274+ vehicle . prediction_target = new L . Marker ( latlng , {
2275+ zIndexOffset : Z_SHADOW ,
2276+ icon : predictionIcon ,
2277+ } ) //addTo(map);
2278+ // vehicle.prediction_target.on('click', function (e) {
2279+ // mapInfoBox_handle_prediction(e);
2280+ // });
2281+ }
2282+ vehicle . prediction_target . pdata = data [ data . length - 1 ] ;
2283+
2284+ if ( vehicle . prediction . descent_rate == null ) {
2285+ vehicle . prediction_target . pred_type = "<b>Prediction Type:</b> Float\n" ;
2286+ } else {
2287+ if ( vehicle . prediction . descending == 1 ) {
2288+ vehicle . prediction_target . pred_type = "<b>Prediction Type:</b> Standard \n" +
2289+ "<b>Descent Rate:</b> " + vehicle . prediction . descent_rate . toFixed ( 1 ) + " m/s \n" ;
22832290 } else {
2284- if ( vehicle . prediction . descending == 1 ) {
2285- vehicle . prediction_target . pred_type = "<b>Prediction Type:</b> Standard \n" +
2286- "<b>Descent Rate:</b> " + vehicle . prediction . descent_rate . toFixed ( 1 ) + " m/s \n" ;
2287- } else {
2288- vehicle . prediction_target . pred_type = "<b>Prediction Type:</b> Standard \n" +
2289- "<b>Ascent Rate:</b> " + vehicle . prediction . ascent_rate . toFixed ( 1 ) + " m/s \n" +
2290- "<b>Burst Altitude:</b> " + vehicle . prediction . burst_altitude . toFixed ( 0 ) + " m\n" +
2291- "<b>Descent Rate:</b> " + vehicle . prediction . descent_rate . toFixed ( 1 ) + " m/s \n" ;
2292- }
2291+ vehicle . prediction_target . pred_type = "<b>Prediction Type:</b> Standard \n" +
2292+ "<b>Ascent Rate:</b> " + vehicle . prediction . ascent_rate . toFixed ( 1 ) + " m/s \n" +
2293+ "<b>Burst Altitude:</b> " + vehicle . prediction . burst_altitude . toFixed ( 0 ) + " m\n" +
2294+ "<b>Descent Rate:</b> " + vehicle . prediction . descent_rate . toFixed ( 1 ) + " m/s \n" ;
22932295 }
2294- } else {
2295- if ( vehicle . prediction_target ) vehicle . prediction_target = null ;
22962296 }
2297+
22972298
2298- if ( burst_index !== 0 && vcallsign != "wb8elk2" ) {
2299+ if ( burst_index !== 0 ) {
22992300 if ( vehicle . prediction_burst ) {
23002301 vehicle . prediction_burst . setLatLng ( latlng_burst ) ;
23012302 } else {
@@ -3825,7 +3826,14 @@ function liveData() {
38253826 if ( document . getElementById ( "stTimer" ) . classList . contains ( 'friendly-dtime' ) ) {
38263827 document . getElementById ( "stTimer" ) . classList . remove ( 'friendly-dtime' ) ;
38273828 }
3828- $ ( "#stTimer" ) . text ( Math . round ( messageRate / 10 ) + " msg/s" ) ;
3829+ var tracking_sondes = clientTopic . length ;
3830+ if ( clientTopic [ 0 ] = "sondes-new/#" ) { // need to subtract one if we are subbed to the slow feed
3831+ tracking_sondes = tracking_sondes - 1 ;
3832+ }
3833+
3834+
3835+
3836+ $ ( "#stTimer" ) . text ( Math . round ( messageRate / 10 ) + " msg/s " + tracking_sondes + " sondes" ) ;
38293837 $ ( "#updatedText" ) . text ( " " ) ;
38303838 var dateNow = new Date ( ) . getTime ( ) ;
38313839 try {
@@ -4791,6 +4799,7 @@ function update(response, none) {
47914799 } ;
47924800
47934801 ctx_init . run ( ctx_init ) ;
4802+ sub_to_nearby_sondes ( ) ;
47944803}
47954804
47964805function zoom_on_payload ( ) {
0 commit comments