Draw the traffic dots through the draw port and read the road surface through renderer ports

The traffic layer's vehicle dots are now a points set on the draw port,
moved, added to and taken from in place each frame, instead of a Cesium
point collection. Road surface heights and readiness read the query,
camera, frame and globe ports and the heights service instead of the
scene; the surface identity and "any tileset drawn" checks, which the
contract cannot answer, move to rendering.js with the heat lines.

animation.js, style.js and surface.js leave the Cesium allow-list.

The Cesium draw port compares a moved point's look without allocating:
colours by index, and a frozen colour or curve of plain data by identity,
so a thousand dots moved every frame cost about what direct writes did.
The traffic QA scripts read the dots' draw items.
This commit is contained in:
Sameh Khamis committed 2026-11-07 23:16:11 -08:00
1 parent d9db5199ed
commit bbd6049e21
24 files changed
+872 -467

No files matched your search

+4
View File
@@ -2342,6 +2342,10 @@
"src/layers/traffic/ingestion.js",
"src/sources/requestDeadline.js",
"src/layers/traffic/lifecycle.js",
"src/render/cesium/globe.js",
"src/maps/google3d.js",
"src/render/cesium/imagery.js",
"src/render/cesium/tileRequests.js",
"src/layers/traffic/model.js",
"src/geo/ellipsoid.js",
"src/geo/vector.js",
+8 -4
View File
@@ -158,9 +158,13 @@ try {
(window.__motion.holdStart === null
? ''
: ` | camera stopped +${((now - window.__motion.holdStart) / 1000).toFixed(1)}s`);
// A layer dot is its draw item (`pos`, hidden only when `show` is
// false); a collection's point is Cesium's.
const visit = (id, roadId, point) => {
if (!point.show) return;
const s = scene.cartesianToCanvasCoordinates(point.position);
if (point.show === false) return;
const s = scene.cartesianToCanvasCoordinates(
point.pos ?? point.position,
);
if (s && s.x >= 0 && s.y >= 0 && s.x <= 1280 && s.y <= 800)
points.set(id, { x: s.x, y: s.y, roadId });
};
@@ -168,7 +172,7 @@ try {
offRoad = 0;
if (!baseline && layer.visitMotionDots) {
layer.visitMotionDots((id, roadId, point, road) => {
if (point.show) {
if (point.show !== false) {
const p = road?.roadProperties;
const allowed = road?.directFlow
? [
@@ -195,7 +199,7 @@ try {
p?.brunnel !== 'tunnel';
if (!allowed) offRoad++;
}
if (point.show) n++;
if (point.show !== false) n++;
visit(id, roadId, point);
});
} else {
+8 -5
View File
@@ -83,9 +83,10 @@ try {
lower = 0;
dataManager.layers
.get('traffic')
.module.visitMotionDots((id, key, p) => {
if (!p.show) return;
const s = viewer.scene.cartesianToCanvasCoordinates(p.position);
.module.visitMotionDots((id, key, dot) => {
// A dot is its draw item: `pos`, hidden only when `show` is false.
if (dot.show === false) return;
const s = viewer.scene.cartesianToCanvasCoordinates(dot.pos);
if (s && s.x >= 240 && s.x <= 1040 && s.y >= 0 && s.y <= 800) {
if (s.y < 400) upper++;
else lower++;
@@ -197,8 +198,10 @@ try {
const camera = viewer.camera.positionWC;
dataManager.layers
.get('traffic')
.module.visitMotionDots((id, key, p) => {
if (!p.show) return;
.module.visitMotionDots((id, key, dot) => {
// A dot is its draw item: `pos`, hidden only when `show` is false.
if (dot.show === false) return;
const p = { position: dot.pos };
const q = viewer.scene.cartesianToCanvasCoordinates(p.position);
if (q && q.x >= 240 && q.x <= 1040 && q.y >= 0 && q.y <= 800) {
if (q.y < 400) upper++;