diff --git a/README-query.md b/README-query.md index 1f00165..91590fc 100644 --- a/README-query.md +++ b/README-query.md @@ -83,6 +83,7 @@ See the main readme for more examples on how to use the filters - heatAlpha - 0.1 to 1.0 - how transparent the dots will be - heatRadius - dot size for heatmap - heatManualRedraw - only redraw dots when pressing r +- heatFilters - significant slowdown / experimental: enable filtering by type code / type description / hex / DB flags / military / registration / country of registration / data source - realHeat - real heatmap instead of dots - heatBlur - parameter for realHeat diff --git a/html/early.js b/html/early.js index 8e8107c..f0cf693 100644 --- a/html/early.js +++ b/html/early.js @@ -267,6 +267,8 @@ if (usp.has('heatmap') || usp.has('realHeat')) { heatmap.end -= tmp * 3600 * 1000; if (usp.has('heatLines')) heatmap.lines = true; + if (usp.has('heatfilters')) + heatmap.filters = true; tmp = parseFloat(usp.get('heatAlpha')); if (!isNaN(tmp)) { heatmap.alpha = tmp; diff --git a/html/planeObject.js b/html/planeObject.js index ee5e9dc..02236ff 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -2796,7 +2796,7 @@ PlaneObject.prototype.checkForDB = function(data) { this.dbinfoLoaded = true; } } - if (!this.dbinfoLoaded && (!dbServer || replay || pTracks)) { + if (!this.dbinfoLoaded && (!dbServer || replay || pTracks || heatmap)) { this.getAircraftData(); return; } diff --git a/html/script.js b/html/script.js index b098d8a..f8b702b 100644 --- a/html/script.js +++ b/html/script.js @@ -7014,6 +7014,7 @@ function drawHeatmap() { } let points = myPoints[k]; + let pointsU = new Uint32Array(points.buffer); let i = 4 * indexes[k][offsets[k]]; @@ -7055,6 +7056,33 @@ function drawHeatmap() { if (PlaneFilter.enabled && altFiltered(alt)) continue; + if (heatmap.filters) { + let type = (pointsU[i] >> 27) & 0x1F; + let dataSource; + switch (type) { + case 0: dataSource = 'adsb'; break; + case 1: dataSource = 'modeS'; break; + case 2: dataSource = 'adsr'; break; + case 3: dataSource = 'tisb'; break; + case 4: dataSource = 'adsc'; break; + case 5: dataSource = 'mlat'; break; + case 6: dataSource = 'other'; break; + case 7: dataSource = 'modeS'; break; + case 8: dataSource = 'adsb'; break; + case 9: dataSource = 'adsr'; break; + case 10: dataSource = 'tisb'; break; + case 11: dataSource = 'tisb'; break; + default: dataSource = 'unknown'; + } + let hex = (pointsU[i] & 0xFFFFFF).toString(16).padStart(6, '0'); + hex = (pointsU[i] & 0x1000000) ? ('~' + hex) : hex; + let plane = g.planes[hex] || new PlaneObject(hex); + plane.dataSource = dataSource; + if (plane.isFiltered()) { + continue; + } + } + pointCount++; //console.log(pos);