From 4989111f6782d3ba2701fe8f02e08e64beaa2495 Mon Sep 17 00:00:00 2001 From: Carlos Salaverria Date: Wed, 14 Sep 2016 13:10:20 -0500 Subject: [PATCH] Fix incorrect flagging of 000000 ICAO codes as mode A/C --- public_html/planeObject.js | 10 +++------- public_html/script.js | 10 +++++----- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/public_html/planeObject.js b/public_html/planeObject.js index 1671139..70110ec 100644 --- a/public_html/planeObject.js +++ b/public_html/planeObject.js @@ -214,14 +214,10 @@ PlaneObject.prototype.getDataSource = function() { return 'adsb'; } - var emptyHexRegex = /^0*$/; - // No position and no ICAO hex code - Mode A/C - if (emptyHexRegex.test(this.icao)) { - return 'mode_ac'; - } - - // No position and ICAO hex code present - Mode S + // Otherwise Mode S return 'mode_s'; + + // TODO: add support for Mode A/C }; PlaneObject.prototype.getMarkerColor = function() { diff --git a/public_html/script.js b/public_html/script.js index f6d5db0..7685818 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -8,7 +8,7 @@ var SiteCircleFeatures = new ol.Collection(); var PlaneIconFeatures = new ol.Collection(); var PlaneTrailFeatures = new ol.Collection(); var Planes = {}; -var PlanesModeAc = {}; +var PlanesNoHex = {}; var PlanesOrdered = []; var PlaneFilter = {}; var SelectedPlane = null; @@ -74,8 +74,8 @@ function processReceiverUpdate(data) { if (hex !== "000000" && Planes[hex]) { plane = Planes[hex]; - } else if (hex === "000000" && PlanesModeAc[squawk]) { - plane = PlanesModeAc[squawk]; + } else if (hex === "000000" && PlanesNoHex[squawk]) { + plane = PlanesNoHex[squawk]; } else { plane = new PlaneObject(hex); plane.filter = PlaneFilter; @@ -123,7 +123,7 @@ function processReceiverUpdate(data) { Planes[hex] = plane; } else { - PlanesModeAc[squawk] = plane; + PlanesNoHex[squawk] = plane; } PlanesOrdered.push(plane); } @@ -676,7 +676,7 @@ function reaper() { plane.tr.parentNode.removeChild(plane.tr); plane.tr = null; if (plane.icao === "000000") { - delete PlanesModeAc[plane.squawk]; + delete PlanesNoHex[plane.squawk]; } else { delete Planes[plane.icao]; }