diff --git a/js/tracker.js b/js/tracker.js index 705cfa4..88cc1ba 100644 --- a/js/tracker.js +++ b/js/tracker.js @@ -832,6 +832,8 @@ function drawHistorical (data, station) { var time = landing.datetime; if (!historicalPlots[station].sondes.hasOwnProperty(serial)) { + // Using age to detmine colour + /* const date = new Date(time); var minTime = historicalPlots[station].data.minTime; var actualTime = date.getTime(); @@ -841,9 +843,23 @@ function drawHistorical (data, station) { historicalPlots[station].sondes[serial].time = actualTime - // Calculate normalised time between 0 and 1 var normalisedTime = ((actualTime-minTime)/(maxTime-minTime)); var iconColour = ConvertRGBtoHex(evaluate_cmap(normalisedTime, 'turbo')); + */ + + // Using last known alt to detmine colour + var minAlt = 0; + var actualAlt = landing.alt; + var maxAlt = 10000; + + if (actualAlt > maxAlt) { + actualAlt = maxAlt; + } else if (actualAlt < minAlt) { + actualAlt = minAlt; + } + + var normalisedAlt = ((actualAlt-minAlt)/(maxAlt-minAlt)); + var iconColour = ConvertRGBtoHex(evaluate_cmap(normalisedAlt, 'turbo')); // Check if we have recovery data for it var recovered = false; @@ -875,23 +891,22 @@ function drawHistorical (data, station) { html += "
"; if (recovered) { - html += "
Recovered: "+recovery_info.recovered+"
"; - html += "
Recovered by: "+recovery_info.recovered_by+"
"; - html += "
Recovery time: "+recovery_info.datetime+"
"; - html += "
Recovery location: "+recovery_info.position[1]+","+recovery_info.position[0] + "
"; + html += "
"+(recovery_info.recovered ? "Recovered by " : "Not Recovered by ")+recovery_info.recovered_by+"
"; + html += "
Recovery time: "+formatDate(stringToDateUTC(recovery_info.datetime))+"
"; + html += "
Recovery location: "+recovery_info.position[1]+", "+recovery_info.position[0] + "
"; html += "
Recovery notes: "+recovery_info.description+"
"; html += "
"; } - html += "
Flight Path: " + serial + "
"; - html += "
Card: " + serial + "
"; + html += "
Show Full Flight Path: " + serial + "
"; + html += "
Flight SkewT Plot: " + serial + "
"; html += "
"; html += "
" if (landing.hasOwnProperty("uploader_callsign")) { - html += "
" + landing.uploader_callsign + "
"; + html += "
Last received by: " + landing.uploader_callsign.toLowerCase() + "
"; }; popup.setContent(html); @@ -1053,6 +1068,15 @@ function historicalLaunchViewer(station, marker) { return; } + // Find latest year + var latestYear = "0"; + var latestYears = Object.keys(data); + for (var i=0; i < latestYears.length; i++) { + if (parseInt(latestYears[i]) > parseInt(latestYear)) { + latestYear = latestYears[i]; + } + } + // Generate year drop down var yearList = document.createElement("select"); yearList.name = "year" @@ -1066,10 +1090,43 @@ function historicalLaunchViewer(station, marker) { var option = document.createElement("option"); option.value = year; option.text = year; + if (year == latestYear) { + option.setAttribute("selected", "selected"); + } yearList.appendChild(option); } } + // Find latest month + var latestMonth = "0"; + var latestMonths = Object.keys(data[latestYear]); + for (var i=0; i < latestMonths.length; i++) { + if (parseInt(latestMonths[i]) > parseInt(latestMonth)) { + latestMonth = latestMonths[i]; + } + } + + // Generate month drop down + var monthList = document.createElement("select"); + monthList.name = "month" + monthList.id = "monthList"; + var option = document.createElement("option"); + option.value = "all"; + option.text = "All"; + monthList.appendChild(option); + var months = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; + var monthsText = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; + for (var i=0; i < months.length; i++) { + var option = document.createElement("option"); + option.value = months[i]; + option.text = monthsText[i]; + if (months[i] == latestMonth) { + option.setAttribute("selected", "selected"); + } + monthList.appendChild(option); + } + + // Calculate total launches var totalLaunches = 0; for (let year in data) { @@ -1085,7 +1142,7 @@ function historicalLaunchViewer(station, marker) { // Generate HTML var popupContent = "


Launches Selected: " + totalLaunches + "
"; popupContent += "
" + yearList.outerHTML; - popupContent += "
"; + popupContent += "" + monthList.outerHTML + ""; popupContent += "
"; historical.html(popupContent); historical.show(); @@ -1095,6 +1152,7 @@ function historicalLaunchViewer(station, marker) { if (!realpopup.isOpen()) { realpopup.setContent("
" + popup.html() + "
"); } + getSelectedNumber(station); } if (historical.is(":visible")) { // Don't regenerate if already in memory @@ -2976,9 +3034,14 @@ function addPosition(position) { iconAnchor: [23,90], }); + var tempTitle = vcallsign; + if (typeof position.type !== 'undefined') { + var tempTitle = position.type + ' ' + vcallsign; + } + marker = new L.Marker(point, { icon: balloonIcon, - title: position.type + ' ' + vcallsign, + title: tempTitle, zIndexOffset: Z_PAYLOAD, }).addTo(map).on('click', onClick); @@ -3149,7 +3212,7 @@ function addPosition(position) { if (vehicle_type == "car") { title = marker.bindTooltip(vcallsign, {direction: 'center', permanent: 'true', className: 'serialtooltip'}); } else { - title = marker.bindTooltip((position.type + ' ' + vcallsign), {direction: 'center', permanent: 'true', className: 'serialtooltip'}); + title = marker.bindTooltip((tempTitle), {direction: 'center', permanent: 'true', className: 'serialtooltip'}); } } else { title = null;