refactor(street-level): remove the remaining duplicated code and fakes

A duplicate scan of every module the PR adds (repeated 4-line blocks,
normalised) after gekh's dedup round left these:

- glyphs.js: the cone, ring and position glyphs share cachedGlyph(), wedge(),
  ring() and dot(). Checked with a recording canvas: all 20 draw calls keep
  the same path and fill/stroke state, so the glyphs are pixel-identical.
- panelPositionControls.js: one placeAt() for the three places that pin a
  panel's top-left corner as a fixed window.
- tiles.js: one warn() for the three background-failure logs.
- Tests: src/testSupport/streetLevelFakes.mjs holds the provider snapshot
  (uiState + presentation tests), the stand-in provider (core + controls
  tests) and one real-ray pinhole camera (view + coverage tests, which had
  each written their own). The coverage line-of-sight test still fails when
  refresh() stops passing its focus.
- qa-street-level.mjs: one waitForCoverage() for the five copies of the
  "on, drawn, settled, not key-gated" wait.

No behaviour change: unit 5862 pass, fixture gate 16/16, panel gate 5/5.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Said TurkseverandClaude Opus 5.5 committed 2026-10-06 14:27:58 +01:00
1 parent d70f468781
commit c2f1b54d00
12 files changed
+281 -345

No files matched your search

@@ -3,6 +3,7 @@ import test from 'node:test';
import * as Cesium from 'cesium';
import { SWAP_MAX_WAIT_MS, createCoverage } from './coverage.js';
import { encodeCoverageTile } from './coverageFixture.mjs';
import { rayCamera } from '../../../../testSupport/streetLevelFakes.mjs';
import {
COLORS,
COVERAGE_MAX_SEQUENCES,
@@ -641,46 +642,19 @@ test('the draped lines go after the wait even if the cast lines never get ready'
coverage.clear();
});
/**
* A camera `height` m above WGS84 looking along `heading` with `pitch` (deg),
* a 60°×40° view on a 100×100 canvas, whose screen rays really meet the
* ellipsoid they are given (as Cesium's `pickEllipsoid` does).
*/
/** A camera over a 100×100 canvas with a 60°×40° view (see rayCamera). */
function tiltedCamera({ lon, lat, height, heading, pitch }) {
const position = Cesium.Cartesian3.fromDegrees(lon, lat, height);
const frameAt = Cesium.Transforms.eastNorthUpToFixedFrame(position);
function ray(point) {
const h = (heading + (point.x / 100 - 0.5) * 60) * RAD;
const p = (pitch + (0.5 - point.y / 100) * 40) * RAD;
const local = new Cesium.Cartesian3(
Math.sin(h) * Math.cos(p),
Math.cos(h) * Math.cos(p),
Math.sin(p),
);
const direction = Cesium.Matrix4.multiplyByPointAsVector(
frameAt,
local,
new Cesium.Cartesian3(),
);
return new Cesium.Ray(
position,
Cesium.Cartesian3.normalize(direction, direction),
);
}
return {
positionWC: position,
positionCartographic: {
longitude: lon * RAD,
latitude: lat * RAD,
height,
},
pickEllipsoid(point, ellipsoid) {
const r = ray(point);
const hit = Cesium.IntersectionTests.rayEllipsoid(r, ellipsoid);
return hit ? Cesium.Ray.getPoint(r, hit.start) : undefined;
},
computeViewRectangle: () => undefined,
};
return rayCamera({
lon,
lat,
altitude: height,
heading,
pitch,
width: 100,
height: 100,
fovX: 60,
fovY: 40,
});
}
/**