diff --git a/html/index.html b/html/index.html index dd0ec5a..d2b383d 100644 --- a/html/index.html +++ b/html/index.html @@ -601,6 +601,10 @@
M
+
P
+
I
+
+
R
F
diff --git a/html/planeObject.js b/html/planeObject.js index 4b4bec7..72e0f0e 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -958,7 +958,15 @@ PlaneObject.prototype.updateData = function(now, last, data, init) { }; -PlaneObject.prototype.updateTick = function(now, last, init) { +PlaneObject.prototype.updateTick = function(redraw) { + if (this.dataSource == "uat") + this.updateFeatures(uat_now, uat_last, redraw); + else + this.updateFeatures(now, last, redraw); +} + +PlaneObject.prototype.updateFeatures = function(now, last, redraw) { + // recompute seen and seen_pos this.seen = now - this.last_message_time; this.seen_pos = now - this.position_time; @@ -984,7 +992,13 @@ PlaneObject.prototype.updateTick = function(now, last, init) { || (noVanish && this.position != null) ) { this.visible = true; - if (init || this.updateTrack(now, last)) { + if (SelectedAllPlanes && !this.isFiltered()) + this.selected = true; + + if (redraw) { + this.updateLines(); + this.updateMarker(false); // didn't move + } else if (this.updateTrack(now, last)) { this.updateLines(); this.updateMarker(true); } else { @@ -996,6 +1010,7 @@ PlaneObject.prototype.updateTick = function(now, last, init) { this.clearMarker(); this.clearLines(); this.visible = false; + this.selected = false; if (SelectedPlane == this.icao) selectPlaneByHex(null,false); } @@ -1076,12 +1091,15 @@ PlaneObject.prototype.altitudeLines = function(altitude) { // Update our planes tail line, PlaneObject.prototype.updateLines = function() { - if (!this.selected) - return; + if (!this.visible || (!this.selected && !SelectedAllPlanes) || this.isFiltered()) + return this.clearLines(); if (this.track_linesegs.length == 0) return; + if (!this.layer.getVisible()) + this.layer.setVisible(true); + // create the new elastic band feature var lastseg = this.track_linesegs[this.track_linesegs.length - 1]; var lastfixed = lastseg.fixed.getCoordinateAt(1.0); @@ -1142,9 +1160,6 @@ PlaneObject.prototype.updateLines = function() { } - // after making sure everything is drawn, also show the layer - if (!this.layer.getVisible()) - this.layer.setVisible(true); }; PlaneObject.prototype.remakeTrail = function() { @@ -1156,6 +1171,7 @@ PlaneObject.prototype.remakeTrail = function() { } this.elastic_feature = null; + /* trailGroup.remove(this.layer); this.trail_features = new ol.Collection(); @@ -1170,8 +1186,9 @@ PlaneObject.prototype.remakeTrail = function() { }); trailGroup.push(this.layer); + */ - this.updateLines(); + this.updateTick(true); } PlaneObject.prototype.destroy = function() { diff --git a/html/script.js b/html/script.js index addb681..bb8b5b4 100644 --- a/html/script.js +++ b/html/script.js @@ -96,8 +96,6 @@ var isFlightFeeder = false; function processReceiverUpdate(data, init) { - - // update now and last var uat = false; if (data.uat_978 == "true") { @@ -328,13 +326,8 @@ function fetchData() { // update timestamps, visibility, history track for all planes - not only those updated for (var i = 0; i < PlanesOrdered.length; ++i) { - var plane = PlanesOrdered[i]; - if (plane.receiver == "uat" && uat_now) - plane.updateTick(uat_now, uat_last); - else - plane.updateTick(now, last); + PlanesOrdered[i].updateTick(); } - selectNewPlanes(); refreshSelected(); @@ -729,10 +722,7 @@ function parse_history() { plane.last_message_time -= 999; } - if (plane.dataSource == "uat") - plane.updateTick(uat_now, uat_last, true); - else - plane.updateTick(now, last, true); + plane.updateTick(true); } @@ -750,7 +740,7 @@ function parse_history() { refreshHighlighted(); // Setup our timer to poll from the server. - window.setInterval(fetchData, RefreshInterval); + window.setInterval(fetchData, 5000); window.setInterval(reaper, 60000); if (enable_pf_data) { window.setInterval(fetchPfData, RefreshInterval*10.314); @@ -1055,90 +1045,7 @@ function initialize_map() { case "Escape": deselectAllPlanes(); break; - case "?": - if (!SelectedPlane) { - console.log("No plane selected"); - break; - } - console.log(SelectedPlane.icao + ": " + SelectedPlane.baseMarkerKey + " " + SelectedPlane.shape); - console.log(SelectedPlane); - break; - case "m": - toggleMultiSelect(); - break; - case "v": - toggleTableInView(); - break; - case "r": - followRandomPlane(); - break; - case "t": - selectAllPlanes(); - break; - case "h": - resetMap(); - break; - case "f": - toggleFollowSelected(); - break; - case "F": - onlySelected = !onlySelected; - break; - case "l": - toggleLabels(); - break; - case "o": - toggleExtendedLabels(); - break; - case "M": - onlyMLAT = !onlyMLAT; - break; - case "T": - filterTISB = !filterTISB; - break; - case "A": - onlyADSB = !onlyADSB; - break; - case "P": - debugPosFilter = !debugPosFilter; - localStorage['debugPosFilter'] = debugPosFilter; - console.log('debugPosFilter = ' + debugPosFilter); - break; - case "V": - noVanish = !noVanish; - filterTracks = noVanish; - localStorage['noVanish'] = noVanish; - console.log('noVanish = ' + noVanish); - for (var i in PlanesOrdered) { - PlanesOrdered[i].remakeTrail(); - } - if (!noVanish) - reaper(); - break; - case "D": - debug = !debug; - localStorage['debug'] = debug; - console.log('debug = ' + debug); - break; - case "j": - selectPlaneByHex(jumpTo, true); - break; - case "J": - debugJump = !debugJump; - localStorage['debugJump'] = debugJump; - console.log('debugJump = ' + debugJump); - break; - case "N": - noMLAT = !noMLAT; - localStorage['noMLAT'] = noMLAT; - console.log('noMLAT = ' + noMLAT); - break; - case "k": - toggleTrackLabels(); - break; - case "b": - toggleMapDim(); - break; + // zoom and movement case "q": zoomOut(); break; @@ -1173,6 +1080,87 @@ function initialize_map() { OLMap.getView().setCenter(newCenter); FollowSelected = false; break; + // misc + case "b": + toggleMapDim(); + break; + case "m": + toggleMultiSelect(); + break; + case "v": + toggleTableInView(); + break; + case "r": + followRandomPlane(); + break; + case "t": + selectAllPlanes(); + break; + case "h": + resetMap(); + break; + case "f": + toggleFollowSelected(); + break; + // filters + case "M": + onlyMLAT = !onlyMLAT; + break; + case "T": + filterTISB = !filterTISB; + break; + case "A": + onlyADSB = !onlyADSB; + break; + // persistance mode + case "i": + toggleIsolation(); + break; + case "p": + togglePersistence(); + break; + // Labels + case "l": + toggleLabels(); + break; + case "o": + toggleExtendedLabels(); + break; + case "k": + toggleTrackLabels(); + break; + // debug stuff + case "D": + debug = !debug; + localStorage['debug'] = debug; + console.log('debug = ' + debug); + break; + case "P": + debugPosFilter = !debugPosFilter; + localStorage['debugPosFilter'] = debugPosFilter; + console.log('debugPosFilter = ' + debugPosFilter); + break; + case "?": + if (!SelectedPlane) { + console.log("No plane selected"); + break; + } + console.log(SelectedPlane.icao + ": " + SelectedPlane.baseMarkerKey + " " + SelectedPlane.shape); + console.log(SelectedPlane); + break; + case "j": + selectPlaneByHex(jumpTo, true); + break; + case "J": + debugJump = !debugJump; + localStorage['debugJump'] = debugJump; + console.log('debugJump = ' + debugJump); + break; + case "N": + noMLAT = !noMLAT; + localStorage['noMLAT'] = noMLAT; + console.log('noMLAT = ' + noMLAT); + break; } }, true); @@ -2037,22 +2025,6 @@ function selectAllPlanes() { setSelectedInfoBlockVisibility(); } -// on refreshes, try to find new planes and mark them as selected -function selectNewPlanes() { - if (SelectedAllPlanes) { - for (var key in PlanesOrdered) { - if (!PlanesOrdered[key].visible || PlanesOrdered[key].isFiltered()) { - if (PlanesOrdered[key].selected) { - PlanesOrdered[key].selected = false; - PlanesOrdered[key].clearLines(); - } - } else if (PlanesOrdered[key].selected !== true) { - PlanesOrdered[key].selected = true; - PlanesOrdered[key].updateLines(); - } - } - } -} // deselect all the planes function deselectAllPlanes() { @@ -2340,6 +2312,24 @@ function filterBlockedMLAT(switchFilter) { PlaneFilter.blockedMLAT = blockedMLATFilter; } + +function toggleIsolation() { + onlySelected = !onlySelected; + for (var i in PlanesOrdered) { + PlanesOrdered[i].updateTick(); + } +} +function togglePersistence() { + noVanish = !noVanish; + filterTracks = noVanish; + for (var i in PlanesOrdered) { + PlanesOrdered[i].remakeTrail(); + } + if (!noVanish) + reaper(); + localStorage['noVanish'] = noVanish; + console.log('noVanish = ' + noVanish); +} function toggleDebugAll() { if (localStorage['debugAll'] === "true") { debugAll = false; @@ -2538,11 +2528,7 @@ function updatePlaneFilter() { } for (var i in PlanesOrdered) { - var plane = PlanesOrdered[i]; - if (plane.dataSource == "uat") - plane.updateTick(uat_now, uat_last); - else - plane.updateTick(now, last); + PlanesOrdered[i].updateTick(); } } diff --git a/web.sh b/web.sh deleted file mode 100755 index 7b3785f..0000000 --- a/web.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# file for local testing of changes to the webinterface - -ipath=/usr/local/share/tar1090 - -if [ -z $1 ]; then - htmlpath="$ipath/html" -else - htmlpath="$ipath/$1-html" -fi -echo $htmlpath -mkdir -p $htmlpath - -mv $htmlpath/config.js /tmp/ - -cp -r -T html $htmlpath - -mv /tmp/config.js $htmlpath - -# bust cache for all css and js files -sed -i -e "s/__cache_version__/$(date +%s)/g" $htmlpath/index.html -