mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Give a viewer of its own a query port, as it has draw and camera ports
The Cesium query port moves out of createCesiumPorts into its own module, unchanged, so it can also be built over a caller's viewer with no renderer bound. findQuery and queryOf find the bound renderer's query port or, for such a viewer, one the Cesium adapter's factory builds, as findDraw and findCamera do. It picks the sets drawn through findDraw on that viewer and its height samples see through them, so a layer can exclude its own sets; it projects, casts rays and picks the ellipsoid as the renderer's does. A renderer bound later answers new callers. The camera factory and the caller's unbound export load it, and the factory walk checks that every public entry reaching a findQuery or queryOf caller loads it, or is a Cesium-free entry whose caller does.
This commit is contained in:
1 parent
ee6b9e49aa
commit
784561a6ae
10 files changed
+654
-308
No files matched your search
@@ -12,7 +12,9 @@
|
||||
* `render/cesium/draw.js` the same way (the camera factory loads it),
|
||||
* unless it is Cesium-free: then it is listed in `DRAW_FROM_CALLER`, and
|
||||
* a caller handing it a viewer with no renderer bound loads the package's
|
||||
* `./render/cesium/unbound` export once.
|
||||
* `./render/cesium/unbound` export once. An entry that reaches a caller of
|
||||
* `findQuery` or `queryOf` loads `render/cesium/query.js` (the camera
|
||||
* factory loads it too), or is such a Cesium-free entry.
|
||||
*
|
||||
* The graph is every static import, re-export and literal dynamic import of
|
||||
* the entry's module and those it reaches, read by the parsers the Cesium
|
||||
@@ -35,6 +37,7 @@ const FACTORY = 'src/render/cesium/camera.js';
|
||||
const EFFECTS_FACTORY = 'src/render/cesium/effects.js';
|
||||
const GLOBE_FACTORY = 'src/render/cesium/globe.js';
|
||||
const DRAW_FACTORY = 'src/render/cesium/draw.js';
|
||||
const QUERY_FACTORY = 'src/render/cesium/query.js';
|
||||
const UNBOUND = 'src/render/cesium/unbound.js';
|
||||
|
||||
/**
|
||||
@@ -196,8 +199,14 @@ test('every public entry that reaches the renderer bridge loads the unbound came
|
||||
/**
|
||||
* Every public entry reaching a caller of `lookup` loads `factory`. With
|
||||
* `reached`, at least one entry must reach one, or the walk is broken.
|
||||
* With `fromCaller`, the Cesium-free entries listed in
|
||||
* `DRAW_FROM_CALLER` may leave the factory to their caller.
|
||||
*/
|
||||
function checkLookupFactory(lookup, factory, { reached = true } = {}) {
|
||||
function checkLookupFactory(
|
||||
lookup,
|
||||
factory,
|
||||
{ reached = true, fromCaller = false } = {},
|
||||
) {
|
||||
const missing = [];
|
||||
let reaching = 0;
|
||||
const calls = (file) =>
|
||||
@@ -212,6 +221,7 @@ function checkLookupFactory(lookup, factory, { reached = true } = {}) {
|
||||
const entry = path.normalize(target.slice(2));
|
||||
if (![...reachable(entry)].some(calls)) continue;
|
||||
reaching += 1;
|
||||
if (fromCaller && DRAW_FROM_CALLER.has(key)) continue;
|
||||
const carrier = INJECTED[key];
|
||||
const loads = (file) => reachable(file, { eager: true }).has(factory);
|
||||
if (!loads(entry) && !(carrier && loads(carrier))) missing.push(key);
|
||||
@@ -235,12 +245,25 @@ test('every public entry that reaches a findGlobe caller loads the unbound globe
|
||||
checkLookupFactory('findGlobe', GLOBE_FACTORY);
|
||||
});
|
||||
|
||||
test('every public entry that reaches a findQuery or queryOf caller loads the unbound query factory, or its caller can', () => {
|
||||
for (const lookup of ['findQuery', 'queryOf'])
|
||||
checkLookupFactory(lookup, QUERY_FACTORY, {
|
||||
reached: false,
|
||||
fromCaller: true,
|
||||
});
|
||||
});
|
||||
|
||||
test('the unbound camera factory loads the unbound query factory', () => {
|
||||
assert.ok(reachable(FACTORY, { eager: true }).has(QUERY_FACTORY));
|
||||
});
|
||||
|
||||
test('the unbound export brings every unbound factory', () => {
|
||||
const loaded = reachable(UNBOUND, { eager: true });
|
||||
for (const factory of [
|
||||
FACTORY,
|
||||
EFFECTS_FACTORY,
|
||||
DRAW_FACTORY,
|
||||
QUERY_FACTORY,
|
||||
'src/render/cesium/credits.js',
|
||||
])
|
||||
assert.ok(loaded.has(factory), factory);
|
||||
|
||||
Reference in new issue
Block a user