Skip to content

Commit 08a38e1

Browse files
Mark JessopMark Jessop
authored andcommitted
Clean up burst icons for float predictions, show prediction type in burst and target popups.
1 parent cca2577 commit 08a38e1

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

js/tracker.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,6 +1460,7 @@ function updateVehicleInfo(vcallsign, newPosition) {
14601460
timeChosen = timeSent;
14611461
}
14621462

1463+
14631464
//desktop
14641465
var a = '<div class="header">' +
14651466
'<span>' + sonde_type + vcallsign + ' <i class="icon-target"></i></span>' +
@@ -1816,7 +1817,7 @@ function redrawPrediction(vcallsign) {
18161817
vehicle.prediction_polyline.path_length = path_length;
18171818

18181819
var image_src;
1819-
if(vcallsign != "wb8elk2") { // WhiteStar
1820+
if(vcallsign != "wb8elk2") { // WhiteStar - Not sure the reasons behind a check for this? Seems odd. May be from when WB8ELK was first doing floater flights?
18201821
var html = "";
18211822
if(vehicle.prediction_target) {
18221823
vehicle.prediction_target.setLatLng(latlng);
@@ -1836,7 +1837,13 @@ function redrawPrediction(vcallsign) {
18361837
});
18371838
}
18381839
vehicle.prediction_target.pdata = data[data.length-1];
1840+
if(vehicle.prediction.descent_rate == null){
1841+
vehicle.prediction_target.pred_type = "Float Prediction";
1842+
} else {
1843+
vehicle.prediction_target.pred_type = "Standard, " + vehicle.prediction.descent_rate.toFixed(1) + " m/s descent rate.";
1844+
}
18391845
} else {
1846+
// Suspect this will never be called?
18401847
if(vehicle.prediction_target) vehicle.prediction_target = null;
18411848
}
18421849

@@ -1859,8 +1866,17 @@ function redrawPrediction(vcallsign) {
18591866
});
18601867
}
18611868
vehicle.prediction_burst.pdata = data[burst_index];
1869+
if(vehicle.prediction.descent_rate == null){
1870+
vehicle.prediction_burst.pred_type = "Float Prediction";
1871+
} else {
1872+
vehicle.prediction_burst.pred_type = "Standard, " + vehicle.prediction.descent_rate.toFixed(1) + " m/s descent rate.";
1873+
}
18621874
} else {
1863-
if(vehicle.prediction_burst) vehicle.prediction_burst = null;
1875+
if(vehicle.prediction_burst){
1876+
// Remove burst icon from the map if no burst data in prediction.
1877+
map.removeLayer(vehicle.prediction_burst);
1878+
vehicle.prediction_burst = null;
1879+
}
18641880
}
18651881
}
18661882

@@ -2160,11 +2176,14 @@ function mapInfoBox_handle_prediction(event) {
21602176
altitude = Math.round(data.alt) + " m";
21612177
}
21622178

2179+
console.log(event);
2180+
21632181
mapInfoBox.setContent("<pre>" +
21642182
formatDate(new Date(parseInt(data.time) * 1000), true) + "\n\n" +
21652183
"<b>Altitude:</b> " + altitude + "\n" +
21662184
"<b>Latitude:</b> " + data.lat + "\n" +
21672185
"<b>Longitude:</b> " + data.lon + "\n" +
2186+
"<b>Prediction Type:</b> " + event.target.pred_type + "\n" +
21682187
"</pre>"
21692188
);
21702189
mapInfoBox.setLatLng(event.latlng);

0 commit comments

Comments
 (0)