mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-24 04:02:19 +00:00
feat(perimeters): colour fire perimeters by age
The Fire Perimeters layer now draws a snapshot of fires and the pieces of
their burned area, each piece coloured by its age at the snapshot's moment
(under 6 h, 6-24 h, 1-3 days, older or unknown). Containment stays on the
card; the legend counts fires by last growth and shows the source's note.
- One source method, getSnapshot, returning {at, fetchedAt, stale,
revision, note, fires, pieces}; getSnapshotDetail is removed.
- WFIGS: one piece per polygon, born at poly_PolygonDateTime, else
poly_DateCurrent; a time more than 10 minutes ahead is unknown.
- Outlines are drawn apart from fills, so cut pieces have no line along
the cut; redraws happen only on a new revision or a change of age band.
- The card ages from `at` and adds "last growth ... ago"; with a past
`at` it links only to an InciWeb incident that began by then.
- perimeterOptions: { inciweb: false } creates no InciWeb sources.
- get_fire_perimeters filters by pieces, places fires at their anchor and
returns last_growth; analyst items carry lastGrowthTime; spot
conditions use the anchor.
This commit is contained in:
1 parent
e51853de3d
commit
d303d48693
48 files changed
+2127
-734
No files matched your search
@@ -7,6 +7,8 @@ import { catalogControlServices } from './catalog.js';
|
||||
import { LayerLifecycle } from '../data/lifecycle.js';
|
||||
import { fakeStreetLevelProvider } from '../testSupport/streetLevelFakes.mjs';
|
||||
import { worldClock } from '../time/worldClock.js';
|
||||
import { bindFakeDraw } from '../testSupport/fakeDrawPort.mjs';
|
||||
import { fakeInput } from '../input/testDoubles.mjs';
|
||||
|
||||
const flush = async () => {
|
||||
for (let i = 0; i < 20; i++) await Promise.resolve();
|
||||
@@ -254,3 +256,48 @@ test('a GNSS integrity source can set the layer evidence window', (t) => {
|
||||
`${String(windowMs)} falls back to the default`,
|
||||
);
|
||||
});
|
||||
|
||||
test('perimeterOptions reach Fire Perimeters: inciweb false never asks InciWeb', async (t) => {
|
||||
const lifetime = new AbortController();
|
||||
const { signal } = lifetime;
|
||||
const sources = fixtureSources([], []);
|
||||
sources['fire-perimeters'] = {
|
||||
getSnapshot: async () => ({
|
||||
at: null,
|
||||
fetchedAt: null,
|
||||
stale: false,
|
||||
revision: 'r',
|
||||
note: null,
|
||||
fires: [],
|
||||
pieces: [],
|
||||
}),
|
||||
};
|
||||
const requested = [];
|
||||
t.mock.method(globalThis, 'fetch', async (url) => {
|
||||
requested.push(String(url));
|
||||
return Response.json([]);
|
||||
});
|
||||
const viewer = { scene: { pick: () => null } };
|
||||
bindFakeDraw(viewer);
|
||||
const input = fakeInput(viewer);
|
||||
const layer = createApplicationCatalog({
|
||||
sources,
|
||||
signal,
|
||||
surface: fixtureSurface(signal),
|
||||
perimeterOptions: { inciweb: false, inputFor: () => input.input },
|
||||
}).get('fire-perimeters');
|
||||
t.after(() => {
|
||||
layer.destroy();
|
||||
input.destroy();
|
||||
lifetime.abort();
|
||||
worldClock.goLive();
|
||||
});
|
||||
layer.init(viewer);
|
||||
layer.enable(viewer);
|
||||
assert.equal(await layer.update(viewer), true);
|
||||
await new Promise(setImmediate);
|
||||
assert.deepEqual(
|
||||
requested.filter((url) => url.includes('inciweb')),
|
||||
[],
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user