mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 03:32:19 +00:00
Base map through the globe port
Cesium switches the map stacks through its globe port, as any renderer does, rather than through a map engine of its own. Every route keeps its behaviour: - Google 3D turned off is kept hidden, and shown again without loading it anew; the key route's tiles take clamped marks, as the token routes' do. - Esri goes to its deepest level (23); its "Map data not yet available" picture is a missing tile, so the parent's imagery stays. - Cesium ion's world imagery is Bing over HTTPS on any page, with ion's credits; a token ion refuses refuses the switch, as before. - Keyless terrain that does not answer is the flat ellipsoid, tried again behind it; world terrain asks ion first, as before. - window.__godsEyeView.tileset is the Cesium photoreal tileset.
This commit is contained in:
1 parent
65480f2604
commit
8ff9a1fa29
12 files changed
+496
-81
No files matched your search
@@ -1,7 +1,11 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import * as Cesium from 'cesium';
|
||||
import { createCesiumGlobe, markBaseTileset } from './globe.js';
|
||||
import {
|
||||
cesiumPhotorealOf,
|
||||
createCesiumGlobe,
|
||||
markBaseTileset,
|
||||
} from './globe.js';
|
||||
import { hookProvider, TILE_RETRY_DELAY_MS, xyzTileUrl } from './imagery.js';
|
||||
|
||||
const ALL = new Set([
|
||||
@@ -805,3 +809,43 @@ test('hillshade shading owns a free globe material, follows the terrain, gives i
|
||||
assert.equal(scene.globe.material, theirs);
|
||||
dispose();
|
||||
});
|
||||
|
||||
test('photoreal turned off is kept hidden, and the same spec shows it without loading it again', async () => {
|
||||
const scene = fakeScene();
|
||||
const loads = [];
|
||||
const { port } = createCesiumGlobe(
|
||||
{ scene },
|
||||
{
|
||||
capabilities: new Set(['photoreal']),
|
||||
requestRender: () => {},
|
||||
credentials: { worldDataToken: 'ion' },
|
||||
loadPhotoreal: async (_sdk, credentials) => {
|
||||
loads.push(credentials);
|
||||
return { tileset: fakeTileset(), route: 'direct', errors: [] };
|
||||
},
|
||||
},
|
||||
);
|
||||
const spec = { provider: 'google', key: 'key', fallback: true };
|
||||
assert.deepEqual(await port.setPhotoreal(spec), { route: 'google' });
|
||||
assert.equal(loads.length, 1);
|
||||
assert.equal(loads[0].googleApiKey, 'key');
|
||||
assert.equal(loads[0].cesiumToken, 'ion');
|
||||
const first = cesiumPhotorealOf(scene);
|
||||
assert.equal(first.show, true);
|
||||
|
||||
assert.deepEqual(await port.setPhotoreal(null), { route: 'none' });
|
||||
assert.equal(first.isDestroyed(), false, 'kept');
|
||||
assert.equal(first.show, false, 'hidden');
|
||||
assert.equal(cesiumPhotorealOf(scene), first, 'QA scripts still read it');
|
||||
|
||||
assert.deepEqual(await port.setPhotoreal(spec), { route: 'google' });
|
||||
assert.equal(loads.length, 1, 'not loaded again');
|
||||
assert.equal(cesiumPhotorealOf(scene), first);
|
||||
assert.equal(first.show, true);
|
||||
|
||||
await port.setPhotoreal(null);
|
||||
await port.setPhotoreal({ provider: 'google', key: 'other' });
|
||||
assert.equal(loads.length, 2, 'another spec loads its own');
|
||||
assert.equal(first.isDestroyed(), true, 'the kept one goes');
|
||||
assert.notEqual(cesiumPhotorealOf(scene), first);
|
||||
});
|
||||
Reference in new issue
Block a user