mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Draw Street Level's coverage lines through the renderer's draw port
The coverage lines are draped line sets on the draw port now, not ground polyline primitives of the layer's own. A tile draws in sets of 120 line parts, as its primitives were batched; each part is an item of its own (its id made unique in the tile) that picks its sequence (`meta.pick`). A filter change redraws the sets in place, so the old lines show until the new ones are ready. The selected sequence is one set over the coverage, redrawn in place as tiles land; the tiles hide their own lines of it, a show change made in place, so it shows whichever set is drawn over which. The wait for the terrain-height table goes: the renderer builds draped lines when it is ready. A colour the layer cannot read is handed to the renderer as given. Clicks no longer read the renderer's pick. The click dispatcher's event gains `windowHit(width, height)`, the wider pick read as the canonical id, the draw-set hit and whether it is the map itself. Street Level routes its own sets' hits by their pick, anything else (a provider's own drawing) by its id, as before; the ground under a click comes from the event, and the ground click is told whether the map was hit. The screen centre is aimed through the query port, a pick that fails counting as a miss. Street Level no longer reads the scenePick service. The Cesium draw port no longer lets a show queued while a draped line built override one applied once it was ready, before the swap: the highlight hand-over now depends on that. lineCoverage leaves the Cesium allow-list; with it every Street Level file named in this work is off the list. Differences the contract does not let us avoid: - The lines draw among the scene's primitives, not its ground primitives: they now draw over other layers' clamped entities and ground primitives, and win picks against them. - The highlight builds asynchronously: a newly selected line is not drawn for the frames that takes. - Lines of other sequences in tiles that land after the highlight was first drawn cross over it.
This commit is contained in:
1 parent
40ad27fb95
commit
7e07927660
19 files changed
+680
-285
No files matched your search
@@ -16,6 +16,8 @@ const viewerWith = (viewer) =>
|
||||
/**
|
||||
* A layer state with providers `{id, on, groundClick, configured, available}`;
|
||||
* `picked` is where the depth buffer lands, `ellipsoid` the fallback hit.
|
||||
* `click(pick)` clicks as the click dispatcher reports it: whether `pick`
|
||||
* is the map itself, and the ground under the click.
|
||||
*/
|
||||
function harness({
|
||||
providers = [
|
||||
@@ -30,7 +32,7 @@ function harness({
|
||||
const opened = [];
|
||||
const state = {
|
||||
enabled,
|
||||
services: { scenePick },
|
||||
services: {},
|
||||
providers: new Map(
|
||||
providers.map(
|
||||
({
|
||||
@@ -65,7 +67,12 @@ function harness({
|
||||
},
|
||||
isAvailable: (entry) => entry.available,
|
||||
});
|
||||
return { opened, openAtGround };
|
||||
const click = (pick) =>
|
||||
openAtGround({
|
||||
surface: scenePick.isSurfacePick(pick),
|
||||
ground: () => scenePick.pickGroundPosition(state.viewer, { x: 1, y: 1 }),
|
||||
});
|
||||
return { opened, click };
|
||||
}
|
||||
|
||||
const near = (point) =>
|
||||
@@ -74,8 +81,8 @@ const near = (point) =>
|
||||
|
||||
test('a click on the map opens the click-to-open providers there, without moving the camera', () => {
|
||||
for (const picked of [undefined, { primitive: TILESET }, { content: {} }]) {
|
||||
const { opened, openAtGround } = harness();
|
||||
openAtGround({ x: 10, y: 20 }, picked);
|
||||
const { opened, click } = harness();
|
||||
click(picked);
|
||||
assert.equal(opened.length, 1, JSON.stringify(picked));
|
||||
assert.ok(near(opened[0].point));
|
||||
assert.deepEqual(opened[0].options, {
|
||||
@@ -86,11 +93,11 @@ test('a click on the map opens the click-to-open providers there, without moving
|
||||
});
|
||||
|
||||
test('where the depth buffer names no place, the ellipsoid answers', () => {
|
||||
const { opened, openAtGround } = harness({
|
||||
const { opened, click } = harness({
|
||||
picked: new Cesium.Cartesian3(500, 0, 0),
|
||||
ellipsoid: GROUND,
|
||||
});
|
||||
openAtGround({ x: 1, y: 1 });
|
||||
click(undefined);
|
||||
assert.ok(near(opened[0].point));
|
||||
});
|
||||
|
||||
@@ -119,8 +126,8 @@ test('nothing opens over another layer’s object, the sky, from high up, off it
|
||||
{ options: { enabled: false }, label: 'layer off' },
|
||||
];
|
||||
for (const { picked, options = {}, label } of cases) {
|
||||
const { opened, openAtGround } = harness(options);
|
||||
assert.equal(openAtGround({ x: 1, y: 1 }, picked), false, label);
|
||||
const { opened, click } = harness(options);
|
||||
assert.equal(click(picked), false, label);
|
||||
assert.equal(opened.length, 0, label);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user