mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Draw the air quality stations through the renderer's draw port
The station discs are now one draw set of ground-clamped filled ellipses per layer, with the same band colours, alpha and radius, and their readings as item meta; they had no visible outline before either (Cesium turns outlines off on clamped entity ellipses). The readout's in-view list reads the view rectangle through the camera port. The layer no longer imports Cesium and leaves the allow-list; a caller handing it a Cesium viewer of their own, with no renderer bound, loads the ./render/cesium/unbound export once first. Double-clicking a station no longer starts the viewer's entity follow, since draw items are not entities.
This commit is contained in:
1 parent
03ff8f291f
commit
2061f5647c
9 files changed
+186
-82
No files matched your search
@@ -431,6 +431,49 @@ test('the earthquakes layer draws its discs as ground fills on a viewer of its o
|
||||
assert.equal(scene.added.length, 0);
|
||||
});
|
||||
|
||||
test('the air quality layer draws its stations as ground fills on a viewer of its own', async () => {
|
||||
const { createAirQualityLayer } =
|
||||
await import('../../layers/airQuality/index.js');
|
||||
const scene = fakeScene();
|
||||
const viewer = { scene };
|
||||
const reading = (id, lon) => ({
|
||||
id,
|
||||
provider: 'eccc',
|
||||
scale: 'AQHI',
|
||||
value: 3,
|
||||
band: 'low',
|
||||
name: id,
|
||||
lat: 45,
|
||||
lon,
|
||||
observedMs: 0,
|
||||
color: '#4cc9f0',
|
||||
label: '3',
|
||||
risk: 'Low health risk',
|
||||
note: null,
|
||||
});
|
||||
const layer = createAirQualityLayer({
|
||||
source: { getSnapshot: async () => [reading('a', -75), reading('b', -60)] },
|
||||
overlayHost: { setEntries() {}, setVisible() {}, clearSource() {} },
|
||||
});
|
||||
layer.init(viewer);
|
||||
layer.enable(viewer);
|
||||
assert.equal(await layer.update(viewer), true);
|
||||
const host = scene.added[0];
|
||||
const grounds = [];
|
||||
for (let i = 0; i < host.length; i++)
|
||||
if (host.get(i) instanceof Cesium.GroundPrimitive)
|
||||
grounds.push(host.get(i));
|
||||
const instances = grounds.flatMap((ground) => ground.geometryInstances);
|
||||
assert.deepEqual(instances.map((instance) => instance.id.id).sort(), [
|
||||
'air-quality:a',
|
||||
'air-quality:b',
|
||||
]);
|
||||
assert.ok(instances[0].geometry instanceof Cesium.EllipseGeometry);
|
||||
assert.equal(grounds[0].classificationType, Cesium.ClassificationType.BOTH);
|
||||
layer.destroy();
|
||||
assert.equal(scene.added.length, 0);
|
||||
});
|
||||
|
||||
test('the cyclones layer draws clamped dots, draped tracks and holed cones on a viewer of its own', async () => {
|
||||
const { createCycloneRendering } =
|
||||
await import('../../layers/cyclones/rendering.js');
|
||||
|
||||
Reference in new issue
Block a user