Skip to content

Commit 8180186

Browse files
committed
Prediction link and planned icon
Added link to prediction popup. Also added a temp icon for 'planned' recoveries
1 parent ba0174a commit 8180186

File tree

2 files changed

+101
-1
lines changed

2 files changed

+101
-1
lines changed

js/sondehub.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4765,6 +4765,13 @@ function updateRecoveryMarker(recovery) {
47654765
_recovery_icon = host_url + markers_url + "payload-not-recovered.png";
47664766
}
47674767

4768+
// Override icon if 'is planned' field exists and is true
4769+
if(recovery.hasOwnProperty('planned')){
4770+
if(recovery.planned == true){
4771+
_recovery_icon = host_url + markers_url + "payload-recovery-planned.png";
4772+
}
4773+
}
4774+
47684775
recoveryIcon = new L.icon({
47694776
iconUrl: _recovery_icon,
47704777
iconSize: [17, 19],

js/station.js

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ function launchSitePredictions(times, station, properties, marker, id) {
705705
}
706706
}
707707

708+
//VK6DI Changes
708709
function plotPrediction (data, dates, marker, properties) {
709710
if (!launchPredictions.hasOwnProperty(marker)) {
710711
launchPredictions[marker] = {};
@@ -768,17 +769,109 @@ function plotPrediction (data, dates, marker, properties) {
768769
icon: new L.NumberedDivIcon({number: dates.indexOf(data.request.launch_datetime)+1})
769770
}).addTo(map);
770771

772+
var coords_text = format_coordinates(landingPoint.latitude, landingLongitude, "Prediction");
773+
771774
var landingTime = new Date(landingPoint.datetime);
772775
if (properties[3] != "" && properties[4] != "") {
773776
var landingTooltip = "<b>Time:</b> " + landingTime.toLocaleString() + "<br><b>Model Dataset:</b> " + data.request.dataset +
777+
"<br><b>Prediction:</b> " + coords_text +
774778
"<br><b>Model Assumptions:</b><br>- " + data.request.ascent_rate + "m/s ascent<br>- " + data.request.burst_altitude + "m burst altitude (" + properties[3] + " samples)<br>- " + data.request.descent_rate + "m/s descent (" + properties[4] + " samples)";
775779
} else {
776780
var landingTooltip = "<b>Time:</b> " + landingTime.toLocaleString() + "<br><b>Model Dataset:</b> " + data.request.dataset +
781+
"<br><b>Prediction:</b>" + coords_text +
777782
"<br><b>Model Assumptions:</b><br>- " + data.request.ascent_rate + "m/s ascent<br>- " + data.request.burst_altitude + "m burst altitude<br>- " + data.request.descent_rate + "m/s descent";
778783
}
779-
plot.landingMarker.bindTooltip(landingTooltip, {offset: [13,-28]});
784+
785+
plot.landingMarker.bindPopup(landingTooltip, { autoClose: false, closeOnClick: false })
786+
.on('click', function (e) {
787+
this.openPopup();
788+
});
789+
780790
}
781791

792+
////Existing function
793+
// function plotPrediction (data, dates, marker, properties) {
794+
// if (!launchPredictions.hasOwnProperty(marker)) {
795+
// launchPredictions[marker] = {};
796+
// }
797+
// launchPredictions[marker][dates.indexOf(data.request.launch_datetime)+1] = {};
798+
// plot = launchPredictions[marker][dates.indexOf(data.request.launch_datetime)+1];
799+
800+
// ascent = data.prediction[0].trajectory;
801+
// descent = data.prediction[1].trajectory;
802+
// var predictionPath = [];
803+
// for (var i = 0; i < ascent.length; i++) {
804+
// if (ascent[i].longitude > 180.0) {
805+
// var longitude = ascent[i].longitude - 360.0;
806+
// } else {
807+
// var longitude = ascent[i].longitude;
808+
// }
809+
// predictionPath.push([ascent[i].latitude, longitude]);
810+
// };
811+
// for (var x = 0; x < descent.length; x++) {
812+
// if (descent[x].longitude > 180.0) {
813+
// var longitude = descent[x].longitude - 360.0;
814+
// } else {
815+
// var longitude = descent[x].longitude;
816+
// }
817+
// predictionPath.push([descent[x].latitude, longitude]);
818+
// };
819+
// var burstPoint = ascent[ascent.length-1];
820+
// var landingPoint = descent[descent.length-1];
821+
822+
// plot.predictionPath = new L.polyline(predictionPath, {color: 'red'}).addTo(map);
823+
824+
// burstIconImage = host_url + markers_url + "balloon-pop.png";
825+
826+
// burstIcon = new L.icon({
827+
// iconUrl: burstIconImage,
828+
// iconSize: [20,20],
829+
// iconAnchor: [10, 10],
830+
// });
831+
832+
// if (burstPoint.longitude > 180.0) {
833+
// var burstLongitude = burstPoint.longitude - 360.0;
834+
// } else {
835+
// var burstLongitude = burstPoint.longitude;
836+
// }
837+
838+
// plot.burstMarker = new L.marker([burstPoint.latitude, burstLongitude], {
839+
// icon: burstIcon
840+
// }).addTo(map);
841+
842+
// var burstTime = new Date(burstPoint.datetime);
843+
// var burstTooltip = "<b>Time: </b>" + burstTime.toLocaleString() + "<br><b>Altitude: </b>" + Math.round(burstPoint.altitude) + "m";
844+
// plot.burstMarker.bindTooltip(burstTooltip, {offset: [5,0]});
845+
846+
847+
848+
849+
// if (landingPoint.longitude > 180.0) {
850+
// var landingLongitude = landingPoint.longitude - 360.0;
851+
// } else {
852+
// var landingLongitude = landingPoint.longitude;
853+
// }
854+
855+
// plot.landingMarker = new L.marker([landingPoint.latitude, landingLongitude], {
856+
// icon: new L.NumberedDivIcon({number: dates.indexOf(data.request.launch_datetime)+1})
857+
// }).addTo(map);
858+
859+
// var coords_text = format_coordinates(landingPoint.latitude, landingLongitude, "Prediction");
860+
861+
// var landingTime = new Date(landingPoint.datetime);
862+
// if (properties[3] != "" && properties[4] != "") {
863+
// var landingTooltip = "<b>Time:</b> " + landingTime.toLocaleString() + "<br><b>Model Dataset:</b> " + data.request.dataset +
864+
// "<br><b>Prediction:</b>" + coords_text +
865+
// "<br><b>Model Assumptions:</b><br>- " + data.request.ascent_rate + "m/s ascent<br>- " + data.request.burst_altitude + "m burst altitude (" + properties[3] + " samples)<br>- " + data.request.descent_rate + "m/s descent (" + properties[4] + " samples)";
866+
// } else {
867+
// var landingTooltip = "<b>Time:</b> " + landingTime.toLocaleString() + "<br><b>Model Dataset:</b> " + data.request.dataset +
868+
// "<br><b>Prediction:</b>" + coords_text +
869+
// "<br><b>Model Assumptions:</b><br>- " + data.request.ascent_rate + "m/s ascent<br>- " + data.request.burst_altitude + "m burst altitude<br>- " + data.request.descent_rate + "m/s descent";
870+
// }
871+
// plot.landingMarker.bindTooltip(landingTooltip, {offset: [13,-28]});
872+
// //var popup = new L.popup({ autoClose: false, closeOnClick: false }).setContent(serial);
873+
// }
874+
782875
function showPrediction(url) {
783876
var ajaxReq = $.ajax({
784877
type: "GET",

0 commit comments

Comments
 (0)