mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Draw FIRMS fire glows through the draw port and take the FIRMS renderer off the Cesium list
The fire glows are one draw-port icon set with horizon cull, drawn on the renderer's moving-icon path with a hold motion, as the layer's own icon primitive drew them. Only glows that are new or changed are written, after the set accepts them; fires a refresh drops are removed. Clicks read the renderer's hit and match the layer's own set id. The sprite order registers the set by its id.
This commit is contained in:
1 parent
3fa1ad0283
commit
b2502d6f37
11 files changed
+275
-118
No files matched your search
@@ -17,6 +17,7 @@ import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { fakeInput } from '../input/testDoubles.mjs';
|
||||
import { bindFakeCesiumScene } from '../testSupport/fakeCesiumScene.mjs';
|
||||
import { fakeDrawPort } from '../testSupport/fakeDrawPort.mjs';
|
||||
|
||||
const LAYER_SOURCE = readLayerSource(
|
||||
path.join(path.dirname(fileURLToPath(import.meta.url)), 'firmsHeatmap.js'),
|
||||
@@ -37,6 +38,9 @@ function makeFire(overrides = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
/** A pick of the layer's glow `id`, as the renderer reports one of its icons. */
|
||||
const glowPick = (id) => ({ glow: id });
|
||||
|
||||
/**
|
||||
* Stand the layer up far enough to drive one click. `cardHit` is what the
|
||||
* overlay host reports under the click position — the real host only publishes
|
||||
@@ -73,16 +77,30 @@ function harness({
|
||||
},
|
||||
});
|
||||
|
||||
const draw = fakeDrawPort();
|
||||
// A glow pick names the layer's own icon set, as the renderer's pick does.
|
||||
const pick = () =>
|
||||
picked?.glow
|
||||
? {
|
||||
primitive: {},
|
||||
id: {
|
||||
set: [...draw.sets.values()].find(
|
||||
(record) => record.kind === 'icons' && !record.disposed,
|
||||
)?.spec.id,
|
||||
id: picked.glow,
|
||||
},
|
||||
}
|
||||
: picked;
|
||||
const viewer = {
|
||||
scene: {
|
||||
pick: () => picked,
|
||||
pick,
|
||||
canvas: { clientWidth: 1280, clientHeight: 800 },
|
||||
camera: cameraPosition ? { positionWC: cameraPosition } : undefined,
|
||||
globe: { ellipsoid: Cesium.Ellipsoid.WGS84 },
|
||||
},
|
||||
dataSources: { add() {}, remove() {} },
|
||||
};
|
||||
bindFakeCesiumScene(viewer);
|
||||
bindFakeCesiumScene(viewer, { draw });
|
||||
const input = fakeInput(viewer);
|
||||
// The LOD rebuild (and with it the context-registration sweep) is inert
|
||||
// without a data source, so tests that drive a real refresh need one.
|
||||
@@ -205,7 +223,7 @@ test('far-side detections cannot consume the bounded ambient-card cohort', () =>
|
||||
|
||||
test('clicking a fire sprite selects it and requests the camera transfer', () => {
|
||||
const fire = makeFire();
|
||||
const h = harness({ fires: [fire], picked: { id: 'firms-7' } });
|
||||
const h = harness({ fires: [fire], picked: glowPick('firms-7') });
|
||||
try {
|
||||
h.click();
|
||||
assert.equal(h.requests.length, 1);
|
||||
@@ -217,6 +235,19 @@ test('clicking a fire sprite selects it and requests the camera transfer', () =>
|
||||
}
|
||||
});
|
||||
|
||||
test('an item named like a fire in another draw set is not a fire', () => {
|
||||
const h = harness({
|
||||
fires: [makeFire()],
|
||||
picked: { primitive: {}, id: { set: 'other-layer:1:icons', id: 'firms-7' } },
|
||||
});
|
||||
try {
|
||||
h.click();
|
||||
assert.equal(h.requests.length, 0);
|
||||
} finally {
|
||||
h.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test('clicking a fire CARD behaves exactly like clicking its sprite', () => {
|
||||
const fire = makeFire();
|
||||
// The click lands on the card, but the scene pick returns the 3D-Tiles
|
||||
@@ -239,7 +270,7 @@ test('clicking a fire CARD behaves exactly like clicking its sprite', () => {
|
||||
// The voice model reads these labels as data (track_entity, get_entity_context,
|
||||
// pointer_context); the voice card translates them where it shows them.
|
||||
test('fire labels stay English data in a translated interface', () => {
|
||||
const h = harness({ fires: [makeFire()], picked: { id: 'firms-7' } });
|
||||
const h = harness({ fires: [makeFire()], picked: glowPick('firms-7') });
|
||||
try {
|
||||
setLocale('ru');
|
||||
h.click();
|
||||
|
||||
Reference in new issue
Block a user