mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Add and remove points in place, set only what changed, and recolour material lines in place in the Cesium draw port
A set of unclamped points drawn by one point collection now takes new points and removals where it is, instead of building the collection anew; its pick ids and horizon cull follow, and the draw port's version changes only when pick ids do. A point moved or restyled in place sets only the members of its look whose values changed, and writes its position without allocating, so a set moved every frame makes nothing new. A draped line drawn by a material of its own takes a colour-only change on its material, and unmoved lines sent again compare their positions without flattening them. The shared conformance suite checks points joining and leaving a set one by one.
This commit is contained in:
1 parent
6286bcfb07
commit
d9db5199ed
4 files changed
+456
-44
No files matched your search
@@ -1735,6 +1735,47 @@ export function portChecks() {
|
||||
set.dispose();
|
||||
},
|
||||
),
|
||||
check(
|
||||
'draw.points.population',
|
||||
'points added and removed one by one draw and pick on their own, the others staying where they are',
|
||||
async (h, r) => {
|
||||
await overAustin(h, r);
|
||||
const set = r.draw.points({
|
||||
id: 'conf:points-population',
|
||||
blend: 'translucent',
|
||||
});
|
||||
const at = (k) =>
|
||||
h.toEcef({ lon: AUSTIN.lon + 0.003 * k, lat: AUSTIN.lat });
|
||||
const point = (k) => ({
|
||||
id: `p${k}`,
|
||||
pos: at(k),
|
||||
pixelSize: 16,
|
||||
color: [1, 0, 0, 0.9],
|
||||
meta: { k },
|
||||
});
|
||||
const picked = (k) => {
|
||||
const s = r.query.project(at(k));
|
||||
const hit = s && r.query.pick(s.x, s.y);
|
||||
return hit?.set === 'conf:points-population' ? hit.meta?.k : null;
|
||||
};
|
||||
set.upsert([point(0)]);
|
||||
set.upsert([point(1), point(-1)]);
|
||||
await drawn(h, r);
|
||||
deepEqual([picked(-1), picked(0), picked(1)], [-1, 0, 1], 'all drawn');
|
||||
set.remove(['p0']);
|
||||
await drawn(h, r);
|
||||
deepEqual(
|
||||
[picked(-1), picked(0), picked(1)],
|
||||
[-1, null, 1],
|
||||
'removed: only that one is gone',
|
||||
);
|
||||
equal(set.size(), 2, 'two left');
|
||||
set.upsert([point(0)]);
|
||||
await drawn(h, r);
|
||||
equal(picked(0), 0, 'added again: drawn again');
|
||||
set.dispose();
|
||||
},
|
||||
),
|
||||
check(
|
||||
'draw.columns',
|
||||
'column updates are rows: sized, picked, removed',
|
||||
|
||||
Reference in new issue
Block a user