mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
refactor: own application request operations and surface caches
This commit is contained in:
1 parent
310809e8f1
commit
ac977bd8bc
53 files changed
+4388
-3317
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { createTerrainHeights } from '../services/terrainHeights.js';
|
||||
import { createGroundFloor } from '../services/groundFloor.js';
|
||||
import { createMeshFloorSampler } from '../services/meshFloorSampler.js';
|
||||
import { createGroundSnap } from '../services/groundSnap.js';
|
||||
import { createFireAnchors } from '../layers/firms/anchors.js';
|
||||
|
||||
/** Own the DEM, coarse floors and mesh samples used by one application. */
|
||||
export function createSurfaceServices({
|
||||
terrainSource,
|
||||
signal,
|
||||
eventTarget = globalThis.window,
|
||||
}) {
|
||||
const terrain = createTerrainHeights({ source: terrainSource, signal });
|
||||
const groundFloor = createGroundFloor({ terrain, signal });
|
||||
const meshFloor = createMeshFloorSampler({
|
||||
groundFloor,
|
||||
signal,
|
||||
eventTarget,
|
||||
});
|
||||
return Object.freeze({
|
||||
terrain,
|
||||
groundFloor,
|
||||
meshFloor,
|
||||
groundSnap: Object.freeze({
|
||||
createGroundSnap: () => createGroundSnap({ groundFloor }),
|
||||
}),
|
||||
anchors: createFireAnchors(groundFloor),
|
||||
controlServices: Object.freeze({
|
||||
cachedGroundFloor: groundFloor.cachedGroundFloor,
|
||||
cachedMeshFloor: groundFloor.cachedMeshFloor,
|
||||
GROUND_FLOOR_LIFT_M: groundFloor.GROUND_FLOOR_LIFT_M,
|
||||
meshFloorPreferred: groundFloor.meshFloorPreferred,
|
||||
warmGroundFloor: groundFloor.warmGroundFloor,
|
||||
sampleMeshFloorCells: meshFloor.sampleMeshFloorCells,
|
||||
}),
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user