spatial-monorepo / core/src / rehydrateImdfLayers
Function: rehydrateImdfLayers()
rehydrateImdfLayers(
map,levels,roomType?,wallFill?,beforeId?):void
Defined in: packages/core/src/layers/rehydrate.ts:39
Re-registers all IMDF sources and layers that were lost during a style swap.
Parameters
map
Map$1
The MapLibre map instance.
levels
Map`<string, IMDFData>`
Map of levelId → IMDFData that should be present on the map.
roomType?
ThemeRoomType
Issue #447 — the active theme's roomType palette to build the unit fill-color expression from. Defaults to addIMDFLayers's own default (the light palette) when omitted, so a style swap doesn't silently revert a dark-themed app's fills to light.
wallFill?
string
Issue #474 — the active theme's wall fill colour for the imdf-walls-<levelId> layer. Same default-to-light contract as roomType when omitted.
beforeId?
string
Issue #810 — id of the style layer every rehydrated level's layers should be inserted directly beneath. Forwarded to addIMDFLayers so a style-swap rehydration reinserts IMDF layers back under route/RTLS/data layers instead of always re-appending them at the top of the style.
For each entry:
- Skips re-adding if the source already exists (double-fire guard).
- Calls addIMDFLayers with the stored data to recreate sources + layers.
Returns
void
