Draw GNSS integrity cells through the renderer's draw port

Cells are clamped rectangle fills in one draw set per layer
(gnss-integrity:N), made with pickable: false so they never hide what is
under them from clicks, as before. The view anchor comes from the camera
port: where the line of sight meets the ellipsoid, else the middle of the
view rectangle, else the point under the eye. Re-anchoring follows the
camera port's moveEnd and changed events. The ray-ellipsoid intersection
moves from the stub renderer into geo/ellipsoid.js for both to use, and
geo/rectangle.js adds the antimeridian-aware width, height and centre of
a radian rectangle. The layer leaves the allow-list; the QA script finds
the cells among the scene's unpickable ground primitives.
This commit is contained in:
Sameh Khamis committed 2026-11-06 20:30:33 -08:00
1 parent 3f9089eccb
commit 6f82f9cc9c
10 files changed
+418 -232

No files matched your search

+51
View File
@@ -800,3 +800,54 @@ test('the fire perimeters layer draws holed ground fills and draped fire lines o
layer.destroy();
assert.equal(scene.added.length, 0);
});
test('the GNSS layer draws its cells as ground fills that stay out of the pick pass', async (t) => {
const { createGnssIntegrityLayer } =
await import('../../layers/gnss/index.js');
const scene = fakeScene();
const viewer = { scene };
const row = (hex, lat, degraded) => ({
hex,
lat,
lon: 30.2,
nic: degraded ? 0 : 8,
nacp: degraded ? 0 : 10,
gpsLost: false,
degraded,
});
const layer = createGnssIntegrityLayer({
source: {
getSnapshot: async () => ({
ageMs: 0,
rows: [row('a1', 50.1, true), row('a2', 50.1, true), row('a3', 50.2)],
}),
},
viewAnchor: () => ({ latitude: 50, longitude: 30 }),
});
layer.init(viewer);
layer.enable();
assert.equal(await layer.update(), 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));
assert.equal(grounds.length, 1);
const [fill] = grounds;
assert.equal(fill.allowPicking, false);
assert.equal(fill.classificationType, Cesium.ClassificationType.BOTH);
const [instance] = fill.geometryInstances;
assert.ok(instance.geometry instanceof Cesium.RectangleGeometry);
assert.equal(instance.id.id, 'gnss-integrity:280:420');
// A ground primitive draws its stencil in the pick pass even unpickable,
// erasing picks of ground geometry under it; these skip that pass.
let updates = 0;
t.mock.method(Cesium.GroundPrimitive.prototype, 'update', () => updates++);
fill.update({ passes: { pick: true } });
assert.equal(updates, 0);
fill.update({ passes: { render: true, pick: false } });
assert.equal(updates, 1);
t.mock.restoreAll();
layer.destroy();
assert.equal(scene.added.length, 0);
});