Skip to content

Commit

Permalink
heatmap: query option heatFilters
Browse files Browse the repository at this point in the history
new heatmap query option:
significant slowdown / experimental
enable filtering by type code / type description / hex / DB flags /
military / registration / country of registration / data source
  • Loading branch information
wiedehopf committed Apr 3, 2024
1 parent 8a6bde9 commit c0f9522
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions README-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions html/early.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion html/planeObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
28 changes: 28 additions & 0 deletions html/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -7014,6 +7014,7 @@ function drawHeatmap() {
}

let points = myPoints[k];
let pointsU = new Uint32Array(points.buffer);

let i = 4 * indexes[k][offsets[k]];

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit c0f9522

Please sign in to comment.