Prune the special handling for 000000 which is not needed.

This commit is contained in:
Oliver Jowett 2016-10-25 21:09:27 +01:00
parent 14748b1e8f
commit 8f1663cb98

View file

@ -8,7 +8,6 @@ var SiteCircleFeatures = new ol.Collection();
var PlaneIconFeatures = new ol.Collection(); var PlaneIconFeatures = new ol.Collection();
var PlaneTrailFeatures = new ol.Collection(); var PlaneTrailFeatures = new ol.Collection();
var Planes = {}; var Planes = {};
var PlanesNoHex = {};
var PlanesOrdered = []; var PlanesOrdered = [];
var PlaneFilter = {}; var PlaneFilter = {};
var SelectedPlane = null; var SelectedPlane = null;
@ -72,10 +71,8 @@ function processReceiverUpdate(data) {
// Do we already have this plane object in Planes? // Do we already have this plane object in Planes?
// If not make it. // If not make it.
if (hex !== "000000" && Planes[hex]) { if (Planes[hex]) {
plane = Planes[hex]; plane = Planes[hex];
} else if (hex === "000000" && PlanesNoHex[squawk]) {
plane = PlanesNoHex[squawk];
} else { } else {
plane = new PlaneObject(hex); plane = new PlaneObject(hex);
plane.filter = PlaneFilter; plane.filter = PlaneFilter;
@ -97,7 +94,6 @@ function processReceiverUpdate(data) {
$('img', plane.tr.cells[1]).css('display', 'none'); $('img', plane.tr.cells[1]).css('display', 'none');
} }
if (hex !== "000000") {
plane.tr.addEventListener('click', function(h, evt) { plane.tr.addEventListener('click', function(h, evt) {
if (evt.srcElement instanceof HTMLAnchorElement) { if (evt.srcElement instanceof HTMLAnchorElement) {
evt.stopPropagation(); evt.stopPropagation();
@ -122,9 +118,6 @@ function processReceiverUpdate(data) {
}.bind(undefined, hex)); }.bind(undefined, hex));
Planes[hex] = plane; Planes[hex] = plane;
} else {
PlanesNoHex[squawk] = plane;
}
PlanesOrdered.push(plane); PlanesOrdered.push(plane);
} }
@ -697,11 +690,7 @@ function reaper() {
// Reap it. // Reap it.
plane.tr.parentNode.removeChild(plane.tr); plane.tr.parentNode.removeChild(plane.tr);
plane.tr = null; plane.tr = null;
if (plane.icao === "000000") {
delete PlanesNoHex[plane.squawk];
} else {
delete Planes[plane.icao]; delete Planes[plane.icao];
}
plane.destroy(); plane.destroy();
} else { } else {
// Keep it. // Keep it.