Cesium lines: segments on every mode and style, draped patterns, inertial depth-fail

Segment colours and shows were drawn on draped solid lines only. Any other
segmented line (3D, geodesic or draped; glow, dash, arrow, flow, pattern or
an outlined solid) now draws a primitive a segment, each with its style's
material in the segment's colour under a pick id that reads as the line's,
recoloured and shown in place; an arrow's head is on its last segment, and
a revealed line shows each segment by its share of the length. Draped
pieces swap in with the set's other ground primitives. Pattern lines drape
on a ground polyline of their own, and an inertial line with a depth-fail
style is a primitive turned with the sky each frame. The new conformance
check draw.lines.segmentStyles picks shown and hidden segments of five
mode and style pairs before and after an in-place change; Cesium runs it.
This commit is contained in:
Sameh Khamis committed 2026-11-11 16:13:56 -08:00
1 parent c7bb08bfb4
commit 19055b2b8b
5 files changed
+444 -52

No files matched your search

+67
View File
@@ -2353,6 +2353,73 @@ export function portChecks() {
lines.dispose();
},
),
check(
'draw.lines.segmentStyles',
'every line mode and style takes segment colours and shows: a hidden segment is not picked, a shown one picks as its line',
async (h, r) => {
await overAustin(h, r, 3000);
const lines = r.draw.lines({ id: 'conf:segment-styles' });
const kinds = [
['3d', { kind: 'glow', color: '#ffffff', power: 0.3 }],
['geodesic', { kind: 'dash', color: '#ffffff', length: 16 }],
['draped', { kind: 'arrow', color: '#ffffff' }],
['3d', { kind: 'pattern', image: PIXEL_PNG, repeat: 4 }],
[
'draped',
{
kind: 'solid',
color: '#ffffff',
outline: { color: '#000000', widthPx: 4 },
},
],
];
// Off the canvas's centre row: the Cesium port does not pick draped
// lines at its exact centre.
const lat = (k) =>
AUSTIN.lat + 0.0008 + (k - (kinds.length - 1) / 2) * 0.0015;
const at = (k, dLon) =>
h.toEcef({
lon: AUSTIN.lon + dLon,
lat: lat(k),
height: kinds[k][0] === 'draped' ? 0 : 20,
});
const ends = [-0.006, -0.002, 0.002, 0.006];
const line = (k, shows) => ({
id: `l${k}`,
positions: ends.map((d) => at(k, d)),
widthPx: 12,
mode: kinds[k][0],
style: kinds[k][1],
segmentColors: ['#ff0000', '#00ff00', '#0000ff'],
segmentShow: shows,
});
lines.set(kinds.map((_, k) => line(k, [true, false, true])));
await settled(r);
await drawn(h, r);
const pickAt = (k, dLon) => {
const s = r.query.project(at(k, dLon));
ok(s, `line ${k} projects`);
return r.query
.drillPick(s.x, s.y)
.filter((hit) => hit.set === 'conf:segment-styles')
.map((hit) => hit.id);
};
kinds.forEach(([mode, style], k) => {
const what = `${mode} ${style.kind}`;
deepEqual(pickAt(k, -0.004), [`l${k}`], `${what}: shown segment`);
deepEqual(pickAt(k, 0), [], `${what}: hidden segment`);
});
lines.upsert(kinds.map((_, k) => line(k, [false, true, true])));
equal(lines.size(), kinds.length, 'changed in place, not added');
await drawn(h, r);
kinds.forEach(([mode, style], k) => {
const what = `${mode} ${style.kind}`;
deepEqual(pickAt(k, -0.004), [], `${what}: now hidden`);
deepEqual(pickAt(k, 0), [`l${k}`], `${what}: now shown`);
});
lines.dispose();
},
),
check(
'draw.points.update',
'an upserted point is drawn where it now is once drawn again, and shows only within its display range',