refactor(maps): use the globe engine

MapSourceController (and MapStackController) take the page's globe
engine: a globe stack becomes engine.maps.setBaseImagery with the
controller's ready provider and credit, then setPhotorealTiles(null),
then setTerrain with the cached terrain; a 3D stack becomes
setPhotorealTiles with its tileset and credit; owned tilesets are
released through maps.releasePhotorealTiles before disposal. The
controller keeps its provider/terrain/tileset caches, construction and
tile-failure fallbacks, switch generations and error watch. The scene
builds its map stack controller with its engine; without an engine the
controller applies sources to the viewer as before. The photoreal-to-
globe sequence (imagery, credit, globe, tileset) is tested end to end on
the Cesium engine.
This commit is contained in:
German Khokhlov committed 2026-10-15 18:40:19 +04:00
1 parent 83c13f330d
commit 3e3aa0bd9f
4 files changed
+258 -7

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { MapStackController } from './mapStackController.js';
import { createFakeEngine } from './globe/testing/fakeEngine.js';
test('the map stack controller applies its stacks through a given globe engine', async () => {
const engine = createFakeEngine();
const tileset = { show: true };
const controller = new MapStackController(null, {
engine,
googleTileset: tileset,
});
await controller.setStack('photoreal');
assert.equal(
engine.fake.callsOf('maps.setPhotorealTiles')[0].args[0].tileset,
tileset,
);
await controller.setStack('osm');
const [imagery] = engine.fake.callsOf('maps.setBaseImagery')[0].args;
assert.equal(imagery.descriptor.id, 'osm');
assert.ok(imagery.provider, 'a ready provider the controller built');
assert.equal(engine.fake.callsOf('maps.setPhotorealTiles')[1].args[0], null);
controller.destroy();
});