Show mode A/C data in aircraft table
This commit is contained in:
parent
15c66a379a
commit
5b4ad4d8d9
|
@ -8,6 +8,7 @@ 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 PlanesModeAc = {};
|
||||||
var PlanesOrdered = [];
|
var PlanesOrdered = [];
|
||||||
var PlaneFilter = {};
|
var PlaneFilter = {};
|
||||||
var SelectedPlane = null;
|
var SelectedPlane = null;
|
||||||
|
@ -65,13 +66,16 @@ function processReceiverUpdate(data) {
|
||||||
for (var j=0; j < acs.length; j++) {
|
for (var j=0; j < acs.length; j++) {
|
||||||
var ac = acs[j];
|
var ac = acs[j];
|
||||||
var hex = ac.hex;
|
var hex = ac.hex;
|
||||||
|
var squawk = ac.squawk;
|
||||||
var plane = null;
|
var plane = null;
|
||||||
|
|
||||||
// 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 (Planes[hex]) {
|
if (hex !== "000000" && Planes[hex]) {
|
||||||
plane = Planes[hex];
|
plane = Planes[hex];
|
||||||
|
} else if (hex === "000000" && PlanesModeAc[squawk]) {
|
||||||
|
plane = PlanesModeAc[squawk];
|
||||||
} else {
|
} else {
|
||||||
plane = new PlaneObject(hex);
|
plane = new PlaneObject(hex);
|
||||||
plane.filter = PlaneFilter;
|
plane.filter = PlaneFilter;
|
||||||
|
@ -93,30 +97,34 @@ function processReceiverUpdate(data) {
|
||||||
$('img', plane.tr.cells[1]).css('display', 'none');
|
$('img', plane.tr.cells[1]).css('display', 'none');
|
||||||
}
|
}
|
||||||
|
|
||||||
plane.tr.addEventListener('click', function(h, evt) {
|
if (hex !== "000000") {
|
||||||
if (evt.srcElement instanceof HTMLAnchorElement) {
|
plane.tr.addEventListener('click', function(h, evt) {
|
||||||
evt.stopPropagation();
|
if (evt.srcElement instanceof HTMLAnchorElement) {
|
||||||
return;
|
evt.stopPropagation();
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$("#map_container").is(":visible")) {
|
if (!$("#map_container").is(":visible")) {
|
||||||
showMap();
|
showMap();
|
||||||
}
|
}
|
||||||
selectPlaneByHex(h, false);
|
selectPlaneByHex(h, false);
|
||||||
adjustSelectedInfoBlockPosition();
|
adjustSelectedInfoBlockPosition();
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
}.bind(undefined, hex));
|
}.bind(undefined, hex));
|
||||||
|
|
||||||
plane.tr.addEventListener('dblclick', function(h, evt) {
|
plane.tr.addEventListener('dblclick', function(h, evt) {
|
||||||
if (!$("#map_container").is(":visible")) {
|
if (!$("#map_container").is(":visible")) {
|
||||||
showMap();
|
showMap();
|
||||||
}
|
}
|
||||||
selectPlaneByHex(h, true);
|
selectPlaneByHex(h, true);
|
||||||
adjustSelectedInfoBlockPosition();
|
adjustSelectedInfoBlockPosition();
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
}.bind(undefined, hex));
|
}.bind(undefined, hex));
|
||||||
|
|
||||||
Planes[hex] = plane;
|
Planes[hex] = plane;
|
||||||
|
} else {
|
||||||
|
PlanesModeAc[squawk] = plane;
|
||||||
|
}
|
||||||
PlanesOrdered.push(plane);
|
PlanesOrdered.push(plane);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,23 +667,25 @@ function createSiteCircleFeatures() {
|
||||||
function reaper() {
|
function reaper() {
|
||||||
//console.log("Reaping started..");
|
//console.log("Reaping started..");
|
||||||
|
|
||||||
// Look for planes where we have seen no messages for >300 seconds
|
// Look for planes where we have seen no messages for >300 seconds
|
||||||
var newPlanes = [];
|
var newPlanes = [];
|
||||||
for (var i = 0; i < PlanesOrdered.length; ++i) {
|
for (var i = 0; i < PlanesOrdered.length; ++i) {
|
||||||
var plane = PlanesOrdered[i];
|
var plane = PlanesOrdered[i];
|
||||||
if (plane.seen > 300) {
|
if (plane.seen > 300) {
|
||||||
// Reap it.
|
// Reap it.
|
||||||
//console.log("Reaping " + plane.icao);
|
|
||||||
//console.log("parent " + plane.tr.parentNode);
|
|
||||||
plane.tr.parentNode.removeChild(plane.tr);
|
plane.tr.parentNode.removeChild(plane.tr);
|
||||||
plane.tr = null;
|
plane.tr = null;
|
||||||
delete Planes[plane.icao];
|
if (plane.icao === "000000") {
|
||||||
|
delete PlanesModeAc[plane.squawk];
|
||||||
|
} else {
|
||||||
|
delete Planes[plane.icao];
|
||||||
|
}
|
||||||
plane.destroy();
|
plane.destroy();
|
||||||
} else {
|
} else {
|
||||||
// Keep it.
|
// Keep it.
|
||||||
newPlanes.push(plane);
|
newPlanes.push(plane);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PlanesOrdered = newPlanes;
|
PlanesOrdered = newPlanes;
|
||||||
refreshTableInfo();
|
refreshTableInfo();
|
||||||
|
@ -1336,7 +1346,7 @@ function getFlightAwareIdentLink(ident, linkText) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFlightAwareModeSLink(code, linkText) {
|
function getFlightAwareModeSLink(code, linkText) {
|
||||||
if (code !== null && code.length > 0 && code[0] !== '~') {
|
if (code !== null && code.length > 0 && code[0] !== '~' && code !== "000000") {
|
||||||
if (!linkText) {
|
if (!linkText) {
|
||||||
linkText = "FlightAware: " + code.toUpperCase();
|
linkText = "FlightAware: " + code.toUpperCase();
|
||||||
}
|
}
|
||||||
|
@ -1355,7 +1365,7 @@ function getFlightAwarePhotoLink(registration) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAirframesModeSLink(code) {
|
function getAirframesModeSLink(code) {
|
||||||
if (code !== null && code.length > 0 && code[0] !== '~') {
|
if (code !== null && code.length > 0 && code[0] !== '~' && code !== "000000") {
|
||||||
return "<a href=\"http://www.airframes.org/\" onclick=\"$('#airframes_post_icao').attr('value','" + code + "'); document.getElementById('horrible_hack').submit.call(document.getElementById('airframes_post')); return false;\">Airframes.org: " + code.toUpperCase() + "</a>";
|
return "<a href=\"http://www.airframes.org/\" onclick=\"$('#airframes_post_icao').attr('value','" + code + "'); document.getElementById('horrible_hack').submit.call(document.getElementById('airframes_post')); return false;\">Airframes.org: " + code.toUpperCase() + "</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue