Cut duplicated and dead code across the engines, the layers and the QA scripts

- src/geo drops the ported debug argument checks and the tests that
  bitExact already covers; package boundaries accept a directory entry,
  so src/geo/ is listed once per group.
- Cesium no longer carries movers and lines nobody draws with: they are
  optional engine capabilities. The fake engine and the Cesium camera use
  the shared cameraMath; unused contract tables, clock.ticked, the
  'finest' surface detail and Navara click statistics are gone.
- ALPR keeps one overlay core and one presentation model for both
  engines, bikeshare one station bookkeeping, the Navara ground effects
  one definition helper; image atlases, view centres, mover banks and
  colours are shared.
- The legacy switch route, the clock offset and rate controls and other
  unused exports are removed.
- The acceptance runs the Navara draw, geo import and scope checks;
  scenarios use the harness switch and page helpers; the main chunk
  check keeps the size budget only and runs once in CI.
This commit is contained in:
German Khokhlov committed 2026-11-05 13:32:39 +04:00
1 parent c502404e1d
commit 7abf74518f
272 files changed
+4828 -10213

No files matched your search

-165
View File
@@ -1,165 +0,0 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import * as Cesium from 'cesium';
import { createCesiumLines, dashPattern } from './lines.js';
import { createFakeViewer } from './testing/fakeViewer.mjs';
function fakePrimitives() {
const made = [];
return {
made,
factories: {
primitive: (options) => {
const primitive = {
...options,
isDestroyed: () => false,
destroy() {
primitive.destroyed = true;
},
};
made.push(primitive);
return primitive;
},
appearance: (spec) => ({
material: { type: spec.type, uniforms: { ...spec.uniforms } },
}),
},
};
}
const points = [
{ x: 6_378_137, y: 0, z: 0 },
{ x: 6_378_137, y: 1000, z: 0 },
{ x: 6_378_137, y: 2000, z: 1000 },
];
test('a dash in pixels becomes PolylineDash with a 16-bit pattern', () => {
assert.equal(dashPattern(16, 16), 0xff00);
assert.equal(dashPattern(12, 4), 0xfff0);
assert.equal(dashPattern(1, 0), 0xffff);
});
test('positions build one polyline primitive; a change rebuilds it', () => {
const viewer = createFakeViewer();
const { factories, made } = fakePrimitives();
const renders = [];
const { lines, destroy } = createCesiumLines(viewer, {
factories,
requestRender: (reason) => renders.push(reason),
});
assert.equal(viewer.scene.primitives.length, 0, 'nothing at creation');
const line = lines.createLine({
id: 'trail',
widthPx: 3,
color: [1, 0, 0, 1],
depthFailAlpha: 0.4,
arc: 'geodesic',
pickId: 'trail-1',
});
assert.equal(viewer.scene.primitives.length, 1);
assert.equal(made.length, 0, 'no primitive without positions');
line.setPositions(points);
assert.equal(made.length, 1);
const [first] = made;
const geometry = first.geometryInstances.geometry;
assert.equal(geometry._width, 3);
assert.equal(geometry._arcType, Cesium.ArcType.GEODESIC);
assert.equal(geometry._positions.length, 3);
assert.equal(first.geometryInstances.id, 'trail-1');
assert.equal(first.asynchronous, false);
assert.ok(first.depthFailAppearance, 'the dimmer copy behind the scene');
assert.ok(
Cesium.Color.equals(
first.depthFailAppearance.material.uniforms.color,
new Cesium.Color(1, 0, 0, 0.4),
),
);
line.setPositions(points.slice(0, 2));
assert.equal(made.length, 2);
assert.equal(first.destroyed, true, 'the old primitive goes');
line.setColor([0, 1, 0, 1]);
assert.ok(
Cesium.Color.equals(
made[1].appearance.material.uniforms.color,
new Cesium.Color(0, 1, 0, 1),
),
);
const turn = Cesium.Matrix4.fromRotation(Cesium.Matrix3.fromRotationZ(0.5));
line.setModelMatrix(Cesium.Matrix4.toArray(turn));
assert.ok(Cesium.Matrix4.equals(made[1].modelMatrix, turn));
line.show(false);
assert.equal(made[1].show, false);
line.setPositions(points);
assert.equal(made[2].show, false, 'a rebuild keeps show and matrix');
assert.ok(Cesium.Matrix4.equals(made[2].modelMatrix, turn));
assert.ok(renders.length >= 4);
line.destroy();
assert.equal(made[2].destroyed, true);
destroy();
assert.equal(viewer.scene.primitives.length, 0);
});
test('dash kinds pick their materials', () => {
const viewer = createFakeViewer();
const { factories, made } = fakePrimitives();
const { lines } = createCesiumLines(viewer, { factories });
lines
.createLine({
id: 'd',
widthPx: 2,
color: [1, 1, 1, 1],
dash: { lengthPx: 12, gapPx: 4 },
})
.setPositions(points);
lines
.createLine({ id: 't', widthPx: 3, color: [0, 1, 1, 1], dash: 'tactical' })
.setPositions(points);
lines
.createLine({ id: 's', widthPx: 1, color: [1, 1, 1, 1] })
.setPositions(points);
assert.equal(made[0].appearance.material.type, 'PolylineDash');
assert.equal(made[0].appearance.material.uniforms.dashLength, 16);
assert.equal(made[0].appearance.material.uniforms.dashPattern, 0xfff0);
assert.equal(made[1].appearance.material.type, 'GevLineTactical');
assert.equal(made[1].appearance.material.uniforms.groupCount, 4);
assert.equal(made[2].appearance.material.type, 'Color');
assert.equal(made[2].depthFailAppearance, undefined);
});
test('a pick of a line primitive names the line', () => {
const viewer = createFakeViewer();
const { factories, made } = fakePrimitives();
const { lines, identify } = createCesiumLines(viewer, { factories });
lines
.createLine({
id: 'orbit-25544',
widthPx: 2,
color: [1, 1, 1, 1],
pickId: 'o',
})
.setPositions(points);
assert.deepEqual(identify({ primitive: made[0], id: 'o' }), {
owner: 'orbit-25544',
});
assert.equal(identify({ primitive: {}, id: 'o' }), null);
});
test('arrow lines retain the native arrow material in both depth passes', () => {
const { factories, made } = fakePrimitives();
const { lines, destroy } = createCesiumLines(createFakeViewer(), {
factories,
});
lines
.createLine({
id: 'arrow',
widthPx: 8,
color: [1, 0, 0, 1],
arrow: true,
depthFailAlpha: 0.45,
})
.setPositions(points);
assert.equal(made[0].appearance.material.type, 'PolylineArrow');
assert.equal(made[0].depthFailAppearance.material.type, 'PolylineArrow');
assert.equal(made[0].depthFailAppearance.material.uniforms.color.alpha, 0.45);
destroy();
});