Draw imported files through the draw port, off Cesium

Import no longer loads KML, KMZ, GeoJSON and GPX through Cesium's data
source loaders. geoImportFeatures.js reads the sanitized file into plain
pins, lines, walls, polygons and ground overlays with the looks those
loaders gave them: icon, scale, colour, heading and hot spot, the shared
and inline style precedence, line and polygon colours and widths,
extruded and clamped geometry, rotated boxes and quads, and GeoJSON's
48 px pins, draped lines along rhumb lines and quarter-opacity fills.
geoImportPins.js draws them in three draw sets per file, places ground
pins through the height service (0 on the bare ellipsoid, whose coarse
tiles sag below it; the mesh nearby on photoreal maps), follows a
double-clicked pin, frames Fly-to, and shows, hides and removes them.

The Cesium adapter now draws two members the contract already had: an
icon's pixel offset and the wall shape. Image fills draw in the
translucent pass, so an overlay's own alpha blends as it did.

The Cesium allow-list is now empty; the ratchet test checks that its
scan still sees each way of reaching Cesium. The QA scripts read what a
file drew through the import's drawn(id), and the large-file check
compares it with Cesium's own reading of the same KML. A file the
renderer refuses to draw is refused by itself, without stopping its
batch. Two translations no longer used are dropped.
This commit is contained in:
Sameh Khamis committed 2026-11-09 15:50:53 -08:00
1 parent c073064507
commit 6c1f91014c
33 files changed
+2608 -1177

No files matched your search

+54
View File
@@ -3356,6 +3356,59 @@ test('a draped line shown after it is ready keeps that show through the swap', (
set.dispose();
}));
test('an icon stands off its position by its pixel offset, and back when it has none', () => {
const { scene, draw } = drawOver();
const set = draw.icons({ id: 'offset-pins' });
const icon = (pixelOffset) => ({
id: 'a',
pos: { lon: 0, lat: 0 },
image: 'pin.png',
size: [8, 8],
...(pixelOffset ? { pixelOffset } : {}),
});
set.set([icon({ x: 3, y: -4 })]);
const pin = () => scene.added[0].get(0);
assert.deepEqual([pin().pixelOffset.x, pin().pixelOffset.y], [3, -4]);
set.upsert([icon({ x: 0, y: 6 })]);
assert.deepEqual([pin().pixelOffset.x, pin().pixelOffset.y], [0, 6]);
set.upsert([icon()]);
assert.deepEqual([pin().pixelOffset.x, pin().pixelOffset.y], [0, 0]);
set.dispose();
});
test('a wall stands up from the ellipsoid to its positions, with or without a fill', () => {
const { scene, draw } = drawOver();
const set = draw.shapes({ id: 'walls' });
const wall = (id, fill) => ({
id,
geometry: {
kind: 'wall',
positions: [
{ lon: 0, lat: 0, height: 100 },
{ lon: 0.01, lat: 0, height: 150 },
],
},
fill,
outline: [1, 1, 0, 1],
});
set.set([wall('filled', [0, 0, 1, 0.5]), wall('outline', null)]);
const geometries = [];
const walk = (primitive) => {
if (!primitive) return;
if (primitive instanceof Cesium.PrimitiveCollection)
for (let i = 0; i < primitive.length; i++) walk(primitive.get(i));
for (const instance of [primitive.geometryInstances ?? []].flat())
geometries.push([instance.id?.id, instance.geometry.constructor.name]);
};
scene.added.forEach(walk);
assert.deepEqual(geometries.sort(), [
['filled', 'WallGeometry'],
['filled', 'WallOutlineGeometry'],
['outline', 'WallOutlineGeometry'],
]);
set.dispose();
});
test('icons blend as their set says', () => {
const { scene, draw } = drawOver();
const set = draw.icons({ id: 'pins', blend: 'translucent' });
@@ -4229,6 +4282,7 @@ test('an unclamped shape filled with an image draws a textured primitive and fre
assert.ok(appearance instanceof Cesium.MaterialAppearance);
assert.equal(appearance.material.type, 'Image');
assert.equal(appearance.material.uniforms.image, 'picture.png');
assert.equal(appearance.isTranslucent(), true, 'its own alpha blends');
assert.deepEqual(
appearance.material.uniforms.repeat,
new Cesium.Cartesian2(2, 3),