@@ -832,6 +832,8 @@ function drawHistorical (data, station) {
832832 var time = landing . datetime ;
833833
834834 if ( ! historicalPlots [ station ] . sondes . hasOwnProperty ( serial ) ) {
835+ // Using age to detmine colour
836+ /*
835837 const date = new Date(time);
836838 var minTime = historicalPlots[station].data.minTime;
837839 var actualTime = date.getTime();
@@ -841,9 +843,23 @@ function drawHistorical (data, station) {
841843
842844 historicalPlots[station].sondes[serial].time = actualTime
843845
844- // Calculate normalised time between 0 and 1
845846 var normalisedTime = ((actualTime-minTime)/(maxTime-minTime));
846847 var iconColour = ConvertRGBtoHex(evaluate_cmap(normalisedTime, 'turbo'));
848+ */
849+
850+ // Using last known alt to detmine colour
851+ var minAlt = 0 ;
852+ var actualAlt = landing . alt ;
853+ var maxAlt = 10000 ;
854+
855+ if ( actualAlt > maxAlt ) {
856+ actualAlt = maxAlt ;
857+ } else if ( actualAlt < minAlt ) {
858+ actualAlt = minAlt ;
859+ }
860+
861+ var normalisedAlt = ( ( actualAlt - minAlt ) / ( maxAlt - minAlt ) ) ;
862+ var iconColour = ConvertRGBtoHex ( evaluate_cmap ( normalisedAlt , 'turbo' ) ) ;
847863
848864 // Check if we have recovery data for it
849865 var recovered = false ;
@@ -875,23 +891,22 @@ function drawHistorical (data, station) {
875891 html += "<hr style='margin:0px;margin-top:5px'>" ;
876892
877893 if ( recovered ) {
878- html += "<div><b>Recovered: </b>" + recovery_info . recovered + "</div>" ;
879- html += "<div><b>Recovered by: </b>" + recovery_info . recovered_by + "</div>" ;
880- html += "<div><b>Recovery time: </b>" + recovery_info . datetime + "</div>" ;
881- html += "<div><b>Recovery location: </b>" + recovery_info . position [ 1 ] + "," + recovery_info . position [ 0 ] + "</div>" ;
894+ html += "<div><b>" + ( recovery_info . recovered ? "Recovered by " : "Not Recovered by " ) + recovery_info . recovered_by + "</u></b></div>" ;
895+ html += "<div><b>Recovery time: </b>" + formatDate ( stringToDateUTC ( recovery_info . datetime ) ) + "</div>" ;
896+ html += "<div><b>Recovery location: </b>" + recovery_info . position [ 1 ] + ", " + recovery_info . position [ 0 ] + "</div>" ;
882897 html += "<div><b>Recovery notes: </b>" + recovery_info . description + "</div>" ;
883898
884899 html += "<hr style='margin:0px;margin-top:5px'>" ;
885900 }
886901
887- html += "<div><b>Flight Path: <b><a href=\"javascript:showRecoveredMap('" + serial + "')\">" + serial + "</a></div>" ;
888- html += "<div><b>Card : <b><a href='https://www.sondehub.org/card/" + serial + "' target='_blank'>" + serial + "</a></div>" ;
902+ html += "<div><b>Show Full Flight Path: <b><a href=\"javascript:showRecoveredMap('" + serial + "')\">" + serial + "</a></div>" ;
903+ html += "<div><b>Flight SkewT Plot : <b><a href='https://www.sondehub.org/card/" + serial + "' target='_blank'>" + serial + "</a></div>" ;
889904
890905 html += "<hr style='margin:0px;margin-top:5px'>" ;
891906 html += "<div style='font-size:11px;'>"
892907
893908 if ( landing . hasOwnProperty ( "uploader_callsign" ) ) {
894- html += "<div>" + landing . uploader_callsign + "</div>" ;
909+ html += "<div>Last received by: " + landing . uploader_callsign . toLowerCase ( ) + "</div>" ;
895910 } ;
896911
897912 popup . setContent ( html ) ;
@@ -1053,6 +1068,15 @@ function historicalLaunchViewer(station, marker) {
10531068 return ;
10541069 }
10551070
1071+ // Find latest year
1072+ var latestYear = "0" ;
1073+ var latestYears = Object . keys ( data ) ;
1074+ for ( var i = 0 ; i < latestYears . length ; i ++ ) {
1075+ if ( parseInt ( latestYears [ i ] ) > parseInt ( latestYear ) ) {
1076+ latestYear = latestYears [ i ] ;
1077+ }
1078+ }
1079+
10561080 // Generate year drop down
10571081 var yearList = document . createElement ( "select" ) ;
10581082 yearList . name = "year"
@@ -1066,10 +1090,43 @@ function historicalLaunchViewer(station, marker) {
10661090 var option = document . createElement ( "option" ) ;
10671091 option . value = year ;
10681092 option . text = year ;
1093+ if ( year == latestYear ) {
1094+ option . setAttribute ( "selected" , "selected" ) ;
1095+ }
10691096 yearList . appendChild ( option ) ;
10701097 }
10711098 }
10721099
1100+ // Find latest month
1101+ var latestMonth = "0" ;
1102+ var latestMonths = Object . keys ( data [ latestYear ] ) ;
1103+ for ( var i = 0 ; i < latestMonths . length ; i ++ ) {
1104+ if ( parseInt ( latestMonths [ i ] ) > parseInt ( latestMonth ) ) {
1105+ latestMonth = latestMonths [ i ] ;
1106+ }
1107+ }
1108+
1109+ // Generate month drop down
1110+ var monthList = document . createElement ( "select" ) ;
1111+ monthList . name = "month"
1112+ monthList . id = "monthList" ;
1113+ var option = document . createElement ( "option" ) ;
1114+ option . value = "all" ;
1115+ option . text = "All" ;
1116+ monthList . appendChild ( option ) ;
1117+ var months = [ "01" , "02" , "03" , "04" , "05" , "06" , "07" , "08" , "09" , "10" , "11" , "12" ] ;
1118+ var monthsText = [ "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" , "10" , "11" , "12" ] ;
1119+ for ( var i = 0 ; i < months . length ; i ++ ) {
1120+ var option = document . createElement ( "option" ) ;
1121+ option . value = months [ i ] ;
1122+ option . text = monthsText [ i ] ;
1123+ if ( months [ i ] == latestMonth ) {
1124+ option . setAttribute ( "selected" , "selected" ) ;
1125+ }
1126+ monthList . appendChild ( option ) ;
1127+ }
1128+
1129+
10731130 // Calculate total launches
10741131 var totalLaunches = 0 ;
10751132 for ( let year in data ) {
@@ -1085,7 +1142,7 @@ function historicalLaunchViewer(station, marker) {
10851142 // Generate HTML
10861143 var popupContent = "<br><hr style='margin-bottom:0;'><br>Launches Selected: <span id='launchCount'>" + totalLaunches + "</span><br>" ;
10871144 popupContent += "<form onchange='getSelectedNumber(\"" + station + "\")'><label for='year'>Year:</label>" + yearList . outerHTML ;
1088- popupContent += "<label for='month'>Month:</label><select name='month' id=' monthList'><option value='all'>All</option><option value='01'>1</option><option value='02'>2</option><option value='03'>3</option><option value='04'>4</option><option value='05'>5</option><option value='06'>6</option><option value='07'>7</option><option value='08'>8</option><option value='09'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option></select> </form>" ;
1145+ popupContent += "<label for='month'>Month:</label>" + monthList . outerHTML + " </form>";
10891146 popupContent += "<br><button id='submit' onclick='return showHistorical(\"" + station + "\", \"" + marker + "\")'>Fetch</button><img id='submitLoading' style='width:60px;height:20px;display:none;' src='img/hab-spinner.gif' /><button id='deleteHistorical' style='display:none;' onclick='return deleteHistorical(\"" + station + "\")'>Delete</button>" ;
10901147 historical . html ( popupContent ) ;
10911148 historical . show ( ) ;
@@ -1095,6 +1152,7 @@ function historicalLaunchViewer(station, marker) {
10951152 if ( ! realpopup . isOpen ( ) ) {
10961153 realpopup . setContent ( "<div id='popup" + station + "'>" + popup . html ( ) + "</div>" ) ;
10971154 }
1155+ getSelectedNumber ( station ) ;
10981156 }
10991157 if ( historical . is ( ":visible" ) ) {
11001158 // Don't regenerate if already in memory
@@ -2976,9 +3034,14 @@ function addPosition(position) {
29763034 iconAnchor : [ 23 , 90 ] ,
29773035 } ) ;
29783036
3037+ var tempTitle = vcallsign ;
3038+ if ( typeof position . type !== 'undefined' ) {
3039+ var tempTitle = position . type + ' ' + vcallsign ;
3040+ }
3041+
29793042 marker = new L . Marker ( point , {
29803043 icon : balloonIcon ,
2981- title : position . type + ' ' + vcallsign ,
3044+ title : tempTitle ,
29823045 zIndexOffset : Z_PAYLOAD ,
29833046 } ) . addTo ( map ) . on ( 'click' , onClick ) ;
29843047
@@ -3149,7 +3212,7 @@ function addPosition(position) {
31493212 if ( vehicle_type == "car" ) {
31503213 title = marker . bindTooltip ( vcallsign , { direction : 'center' , permanent : 'true' , className : 'serialtooltip' } ) ;
31513214 } else {
3152- title = marker . bindTooltip ( ( position . type + ' ' + vcallsign ) , { direction : 'center' , permanent : 'true' , className : 'serialtooltip' } ) ;
3215+ title = marker . bindTooltip ( ( tempTitle ) , { direction : 'center' , permanent : 'true' , className : 'serialtooltip' } ) ;
31533216 }
31543217 } else {
31553218 title = null ;
0 commit comments