isard 2.4.1 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,21 @@ versions [Semantic Versioning](https://semver.org) (before 1.0.0, a minor versio
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.4.2] - 2026-11-02
9
+
10
+ With `isard-react-native` and `isard-map` (Python) 2.4.2.
11
+
12
+ ### Added
13
+
14
+ - `map.renderer` (`'webgpu'` or `'webgl2'`) and the `'gpulost'` event: `{ reason, message, losses, recovery }`; in
15
+ `isard-react-native`, the view's `onError` hears it, and the examples' app too.
16
+
17
+ ### Fixed
18
+
19
+ - A map whose WebGPU device is lost (an iPhone taking its memory back: Paris by night went black and stayed so) is made
20
+ again lighter so as not to lose it again: the low quality and half the GPU memory budget at the first loss, the WebGL2
21
+ fallback at the next one, or when WebGPU gives no new device.
22
+
8
23
  ## [2.4.1] - 2026-11-02
9
24
 
10
25
  With `isard-react-native` and `isard-map` (Python) 2.4.1.
package/README.md CHANGED
@@ -187,10 +187,14 @@ More in [Develop and release](https://ideal-adventure-zqn6y6p.pages.github.io/gu
187
187
  By priority:
188
188
 
189
189
  - **P1**, next: the memory budget measured on a phone (a phone closes a page past about a gigabyte).
190
- - **P2**, then: rasters draped within an area; a clipping volume; a performance report.
191
- - **P3**, later: objects moving along paths; video in the scene.
192
- - **P4**, when time allows: the whole MapLibre style drawn as vectors, a 3D vector map to walk through, Panoramax's
193
- street-level photos, fluids on the globe, several projections on the globe, smaller items.
190
+ - **P2**, then: a feature found by its attributes and framed (#176); OGC API - Features and Tiles (#177); virtual
191
+ point clouds (#183); Cloud-Optimized GeoTIFF (#184); measured against iTowns on 3D data (#178); rasters draped
192
+ within an area; a performance report.
193
+ - **P3**, later: several elevation sources (#179); a time for layers (#180); objects moving along paths (#181); photos
194
+ projected onto the meshes (#187) and video in the scene; composable effects over the frame (#182).
195
+ - **P4**, when time allows: Gaussian splats (#186), WebXR (#185), the whole MapLibre style drawn as vectors, a 3D
196
+ vector map to walk through, Panoramax's street-level photos, fluids on the globe, several projections on the globe,
197
+ smaller items.
194
198
 
195
199
  See [Roadmap](https://ideal-adventure-zqn6y6p.pages.github.io/guide/roadmap).
196
200
 
Binary file
Binary file
Binary file
@@ -2,19 +2,23 @@
2
2
  * The engine a map runs, made asynchronously (its device asked for), and the workers decoding its 3D Tiles, started
3
3
  * with the first one.
4
4
  */
5
- import { type EngineClass } from '../engine-loader.ts';
5
+ import { type EngineClass, type EngineKind } from '../engine-loader.ts';
6
6
  import type { Settings } from '../settings.ts';
7
7
  import type { GeoMapOptions } from '../types.ts';
8
8
  import type { Engine } from '../wasm/isard_webgpu.js';
9
9
  /** What making the engine and its workers needs */
10
- export type Tiles3dEngineOptions = Pick<GeoMapOptions, 'workers' | 'workerUrl' | 'decoders' | 'pointsWasmUrl' | 'tiles3dWasmUrl' | 'assetsUrl' | 'quality' | 'antialias'>;
10
+ export type Tiles3dEngineOptions = Pick<GeoMapOptions, 'workers' | 'workerUrl' | 'decoders' | 'pointsWasmUrl' | 'tiles3dWasmUrl' | 'webgl2WasmUrl' | 'assetsUrl' | 'quality' | 'antialias'>;
11
11
  /** The engine class of a map (the engine on wgpu, through WebGPU or its WebGL2 fallback: one module, 3D Tiles
12
12
  * included) and the workers decoding its 3D Tiles, started with the first engine */
13
13
  export declare class MapEngines {
14
- private readonly engineClass;
14
+ #private;
15
+ private engineClass;
15
16
  private loader;
16
17
  private readonly options;
17
- constructor(engineClass: EngineClass, options: Tiles3dEngineOptions);
18
+ constructor(engineClass: EngineClass, renderer: EngineKind, options: Tiles3dEngineOptions);
19
+ get renderer(): EngineKind;
20
+ /** The next engines through WebGL2 (a device WebGPU keeps losing or no longer gives): its module loaded */
21
+ fallBack(): Promise<void>;
18
22
  /** A new engine drawing on `canvas` (its device asked for), with the settings and the decoding workers */
19
23
  create(canvas: HTMLCanvasElement, redraw: () => void, settings: Settings): Promise<Engine>;
20
24
  /** Height of the geoid above the ellipsoid at a position, in metres */
@@ -2,18 +2,32 @@
2
2
  * The engine a map runs, made asynchronously (its device asked for), and the workers decoding its 3D Tiles, started
3
3
  * with the first one.
4
4
  */
5
- import { startTileLoader } from "../engine-loader.js";
5
+ import { engineUrl, loadEngine, startTileLoader } from "../engine-loader.js";
6
6
  import { applySettings } from "./engine-settings.js";
7
7
  /** The engine class of a map (the engine on wgpu, through WebGPU or its WebGL2 fallback: one module, 3D Tiles
8
8
  * included) and the workers decoding its 3D Tiles, started with the first engine */
9
9
  export class MapEngines {
10
10
  engineClass;
11
+ /** What the engine draws through: WebGPU, or its WebGL2 fallback (`fallBack`) */
12
+ #renderer;
11
13
  loader;
12
14
  options;
13
- constructor(engineClass, options) {
15
+ constructor(engineClass, renderer, options) {
14
16
  this.engineClass = engineClass;
17
+ this.#renderer = renderer;
15
18
  this.options = { ...options };
16
19
  }
20
+ get renderer() {
21
+ return this.#renderer;
22
+ }
23
+ /** The next engines through WebGL2 (a device WebGPU keeps losing or no longer gives): its module loaded */
24
+ async fallBack() {
25
+ if (this.#renderer === 'webgl2')
26
+ return;
27
+ const bindings = await loadEngine('webgl2', engineUrl('webgl2', this.options));
28
+ this.engineClass = bindings.Engine;
29
+ this.#renderer = 'webgl2';
30
+ }
17
31
  /** A new engine drawing on `canvas` (its device asked for), with the settings and the decoding workers */
18
32
  async create(canvas, redraw, settings) {
19
33
  const engine = await this.engineClass.create(canvas, redraw, this.options.antialias);
@@ -1 +1 @@
1
- {"version":3,"file":"engines.js","sourceRoot":"","sources":["../../src/map/engines.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAoB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAIxE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAQrD;oFACoF;AACpF,MAAM,OAAO,UAAU;IACJ,WAAW,CAAc;IAClC,MAAM,CAAyB;IACtB,OAAO,CAAuB;IAE/C,YAAY,WAAwB,EAAE,OAA6B;QACjE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;IAChC,CAAC;IAED,0GAA0G;IAC1G,KAAK,CAAC,MAAM,CAAC,MAAyB,EAAE,MAAkB,EAAE,QAAkB;QAC5E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAErF,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,KAAK,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACtD,IAAI,IAAI,CAAC,MAAM;YAAE,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEnD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,uEAAuE;IACvE,WAAW,CAAC,GAAW,EAAE,GAAW;QAClC,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;IAED,yDAAyD;IACzD,YAAY,CAAC,GAAW,EAAE,GAAW,EAAE,QAAgB;QACrD,OAAO,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAED,iCAAiC;IACjC,OAAO;QACL,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/**\n * The engine a map runs, made asynchronously (its device asked for), and the workers decoding its 3D Tiles, started\n * with the first one.\n */\n\nimport type { TileLoader } from '../decoding/loader.ts';\nimport { type EngineClass, startTileLoader } from '../engine-loader.ts';\nimport type { Settings } from '../settings.ts';\nimport type { GeoMapOptions } from '../types.ts';\nimport type { Engine } from '../wasm/isard_webgpu.js';\nimport { applySettings } from './engine-settings.ts';\n\n/** What making the engine and its workers needs */\nexport type Tiles3dEngineOptions = Pick<\n GeoMapOptions,\n 'workers' | 'workerUrl' | 'decoders' | 'pointsWasmUrl' | 'tiles3dWasmUrl' | 'assetsUrl' | 'quality' | 'antialias'\n>;\n\n/** The engine class of a map (the engine on wgpu, through WebGPU or its WebGL2 fallback: one module, 3D Tiles\n * included) and the workers decoding its 3D Tiles, started with the first engine */\nexport class MapEngines {\n private readonly engineClass: EngineClass;\n private loader: TileLoader | undefined;\n private readonly options: Tiles3dEngineOptions;\n\n constructor(engineClass: EngineClass, options: Tiles3dEngineOptions) {\n this.engineClass = engineClass;\n this.options = { ...options };\n }\n\n /** A new engine drawing on `canvas` (its device asked for), with the settings and the decoding workers */\n async create(canvas: HTMLCanvasElement, redraw: () => void, settings: Settings): Promise<Engine> {\n const engine = await this.engineClass.create(canvas, redraw, this.options.antialias);\n\n applySettings(engine, settings);\n this.loader ??= startTileLoader(this.options, engine);\n if (this.loader) engine.setTileLoader(this.loader);\n\n return engine;\n }\n\n /** Height of the geoid above the ellipsoid at a position, in metres */\n geoidHeight(lon: number, lat: number): number {\n return this.engineClass.geoidHeight(lon, lat);\n }\n\n /** The matrix of a custom layer's model at a position */\n customMatrix(lon: number, lat: number, altitude: number): Float32Array | undefined {\n return this.engineClass.customMatrix(lon, lat, altitude);\n }\n\n /** Stops the decoding workers */\n destroy(): void {\n this.loader?.destroy();\n }\n}\n"]}
1
+ {"version":3,"file":"engines.js","sourceRoot":"","sources":["../../src/map/engines.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAqC,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAIhH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAgBrD;oFACoF;AACpF,MAAM,OAAO,UAAU;IACb,WAAW,CAAc;IACjC,iFAAiF;IACjF,SAAS,CAAa;IACd,MAAM,CAAyB;IACtB,OAAO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IACzD,YAAY,CAAC,GAAW,EAAE,GAAW,EAAE,QAAgB;QACrD,OAAO,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAED,iCAAiC;IACjC,OAAO;QACL,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/**\n * The engine a map runs, made asynchronously (its device asked for), and the workers decoding its 3D Tiles, started\n * with the first one.\n */\n\nimport type { TileLoader } from '../decoding/loader.ts';\nimport { type EngineClass, type EngineKind, engineUrl, loadEngine, startTileLoader } from '../engine-loader.ts';\nimport type { Settings } from '../settings.ts';\nimport type { GeoMapOptions } from '../types.ts';\nimport type { Engine } from '../wasm/isard_webgpu.js';\nimport { applySettings } from './engine-settings.ts';\n\n/** What making the engine and its workers needs */\nexport type Tiles3dEngineOptions = Pick<\n GeoMapOptions,\n | 'workers'\n | 'workerUrl'\n | 'decoders'\n | 'pointsWasmUrl'\n | 'tiles3dWasmUrl'\n | 'webgl2WasmUrl'\n | 'assetsUrl'\n | 'quality'\n | 'antialias'\n>;\n\n/** The engine class of a map (the engine on wgpu, through WebGPU or its WebGL2 fallback: one module, 3D Tiles\n * included) and the workers decoding its 3D Tiles, started with the first engine */\nexport class MapEngines {\n private engineClass: EngineClass;\n /** What the engine draws through: WebGPU, or its WebGL2 fallback (`fallBack`) */\n #renderer: EngineKind;\n private loader: TileLoader | undefined;\n private readonly options: Tiles3dEngineOptions;\n\n constructor(engineClass: EngineClass, renderer: EngineKind, options: Tiles3dEngineOptions) {\n this.engineClass = engineClass;\n this.#renderer = renderer;\n this.options = { ...options };\n }\n\n get renderer(): EngineKind {\n return this.#renderer;\n }\n\n /** The next engines through WebGL2 (a device WebGPU keeps losing or no longer gives): its module loaded */\n async fallBack(): Promise<void> {\n if (this.#renderer === 'webgl2') return;\n\n const bindings = await loadEngine('webgl2', engineUrl('webgl2', this.options));\n\n this.engineClass = bindings.Engine;\n this.#renderer = 'webgl2';\n }\n\n /** A new engine drawing on `canvas` (its device asked for), with the settings and the decoding workers */\n async create(canvas: HTMLCanvasElement, redraw: () => void, settings: Settings): Promise<Engine> {\n const engine = await this.engineClass.create(canvas, redraw, this.options.antialias);\n\n applySettings(engine, settings);\n this.loader ??= startTileLoader(this.options, engine);\n if (this.loader) engine.setTileLoader(this.loader);\n\n return engine;\n }\n\n /** Height of the geoid above the ellipsoid at a position, in metres */\n geoidHeight(lon: number, lat: number): number {\n return this.engineClass.geoidHeight(lon, lat);\n }\n\n /** The matrix of a custom layer's model at a position */\n customMatrix(lon: number, lat: number, altitude: number): Float32Array | undefined {\n return this.engineClass.customMatrix(lon, lat, altitude);\n }\n\n /** Stops the decoding workers */\n destroy(): void {\n this.loader?.destroy();\n }\n}\n"]}
@@ -12,6 +12,7 @@ export class MapListeners {
12
12
  click: new Set(),
13
13
  render: new Set(),
14
14
  quality: new Set(),
15
+ gpulost: new Set(),
15
16
  idle: new Set(),
16
17
  leave: new Set(),
17
18
  clipvolume: new Set(),
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/map/events.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAG9E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,iDAAiD;AACjD,MAAM,OAAO,YAAY;IACN,SAAS,GAAc;QACtC,SAAS,EAAE,IAAI,GAAG,EAAE;QACpB,IAAI,EAAE,IAAI,GAAG,EAAE;QACf,OAAO,EAAE,IAAI,GAAG,EAAE;QAClB,MAAM,EAAE,IAAI,GAAG,EAAE;QACjB,KAAK,EAAE,IAAI,GAAG,EAAE;QAChB,YAAY,EAAE,IAAI,GAAG,EAAE;QACvB,KAAK,EAAE,IAAI,GAAG,EAAE;QAChB,MAAM,EAAE,IAAI,GAAG,EAAE;QACjB,OAAO,EAAE,IAAI,GAAG,EAAE;QAClB,IAAI,EAAE,IAAI,GAAG,EAAE;QACf,KAAK,EAAE,IAAI,GAAG,EAAE;QAChB,UAAU,EAAE,IAAI,GAAG,EAAE;KACtB,CAAC;IAEF,qEAAqE;IACrE,EAAE,CAA4B,IAAO,EAAE,QAAuC;QAC5E,MAAM,SAAS,GAAuC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAE3E,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAExB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,kGAAkG;IAClG,IAAI,CAA4B,IAAO,EAAE,KAAmB;QAC1D,MAAM,SAAS,GAAuC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAE3E,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC7B,IAAI,CAAC;gBACH,QAAQ,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kCAAkC;IAClC,GAAG,CAAC,IAAqB;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;IACvC,CAAC;IAED,6BAA6B;IAC7B,KAAK;QACH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAClD,SAAS,CAAC,KAAK,EAAE,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["/** The listeners of the map's events: added, called, cleared with the map. */\n\nimport type { MapEvents } from '../types.ts';\nimport { report } from './checks.ts';\n\ntype Listeners = { [K in keyof MapEvents]: Set<(event: MapEvents[K]) => void> };\n\n/** The listeners of the map's events, by type */\nexport class MapListeners {\n private readonly listeners: Listeners = {\n movestart: new Set(),\n move: new Set(),\n moveend: new Set(),\n resize: new Set(),\n hover: new Set(),\n hoverfeature: new Set(),\n click: new Set(),\n render: new Set(),\n quality: new Set(),\n idle: new Set(),\n leave: new Set(),\n clipvolume: new Set(),\n };\n\n /** Listens to an event; returns the function that stops listening */\n on<K extends keyof MapEvents>(type: K, listener: (event: MapEvents[K]) => void): () => void {\n const listeners: Set<(event: MapEvents[K]) => void> = this.listeners[type];\n\n listeners.add(listener);\n\n return () => listeners.delete(listener);\n }\n\n /** Calls the listeners; one that throws is reported and does not stop the others nor the frame */\n emit<K extends keyof MapEvents>(type: K, event: MapEvents[K]): void {\n const listeners: Set<(event: MapEvents[K]) => void> = this.listeners[type];\n\n listeners.forEach((listener) => {\n try {\n listener(event);\n } catch (error) {\n report(error);\n }\n });\n }\n\n /** Something listens to `type` */\n has(type: keyof MapEvents): boolean {\n return this.listeners[type].size > 0;\n }\n\n /** Forgets every listener */\n clear(): void {\n Object.values(this.listeners).forEach((listeners) => {\n listeners.clear();\n });\n }\n}\n"]}
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/map/events.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAG9E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,iDAAiD;AACjD,MAAM,OAAO,YAAY;IACN,SAAS,GAAc;QACtC,SAAS,EAAE,IAAI,GAAG,EAAE;QACpB,IAAI,EAAE,IAAI,GAAG,EAAE;QACf,OAAO,EAAE,IAAI,GAAG,EAAE;QAClB,MAAM,EAAE,IAAI,GAAG,EAAE;QACjB,KAAK,EAAE,IAAI,GAAG,EAAE;QAChB,YAAY,EAAE,IAAI,GAAG,EAAE;QACvB,KAAK,EAAE,IAAI,GAAG,EAAE;QAChB,MAAM,EAAE,IAAI,GAAG,EAAE;QACjB,OAAO,EAAE,IAAI,GAAG,EAAE;QAClB,OAAO,EAAE,IAAI,GAAG,EAAE;QAClB,IAAI,EAAE,IAAI,GAAG,EAAE;QACf,KAAK,EAAE,IAAI,GAAG,EAAE;QAChB,UAAU,EAAE,IAAI,GAAG,EAAE;KACtB,CAAC;IAEF,qEAAqE;IACrE,EAAE,CAA4B,IAAO,EAAE,QAAuC;QAC5E,MAAM,SAAS,GAAuC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAE3E,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAExB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,kGAAkG;IAClG,IAAI,CAA4B,IAAO,EAAE,KAAmB;QAC1D,MAAM,SAAS,GAAuC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAE3E,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC7B,IAAI,CAAC;gBACH,QAAQ,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kCAAkC;IAClC,GAAG,CAAC,IAAqB;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;IACvC,CAAC;IAED,6BAA6B;IAC7B,KAAK;QACH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAClD,SAAS,CAAC,KAAK,EAAE,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["/** The listeners of the map's events: added, called, cleared with the map. */\n\nimport type { MapEvents } from '../types.ts';\nimport { report } from './checks.ts';\n\ntype Listeners = { [K in keyof MapEvents]: Set<(event: MapEvents[K]) => void> };\n\n/** The listeners of the map's events, by type */\nexport class MapListeners {\n private readonly listeners: Listeners = {\n movestart: new Set(),\n move: new Set(),\n moveend: new Set(),\n resize: new Set(),\n hover: new Set(),\n hoverfeature: new Set(),\n click: new Set(),\n render: new Set(),\n quality: new Set(),\n gpulost: new Set(),\n idle: new Set(),\n leave: new Set(),\n clipvolume: new Set(),\n };\n\n /** Listens to an event; returns the function that stops listening */\n on<K extends keyof MapEvents>(type: K, listener: (event: MapEvents[K]) => void): () => void {\n const listeners: Set<(event: MapEvents[K]) => void> = this.listeners[type];\n\n listeners.add(listener);\n\n return () => listeners.delete(listener);\n }\n\n /** Calls the listeners; one that throws is reported and does not stop the others nor the frame */\n emit<K extends keyof MapEvents>(type: K, event: MapEvents[K]): void {\n const listeners: Set<(event: MapEvents[K]) => void> = this.listeners[type];\n\n listeners.forEach((listener) => {\n try {\n listener(event);\n } catch (error) {\n report(error);\n }\n });\n }\n\n /** Something listens to `type` */\n has(type: keyof MapEvents): boolean {\n return this.listeners[type].size > 0;\n }\n\n /** Forgets every listener */\n clear(): void {\n Object.values(this.listeners).forEach((listeners) => {\n listeners.clear();\n });\n }\n}\n"]}
package/dist/map.d.ts CHANGED
@@ -85,15 +85,25 @@ export declare class GeoMap {
85
85
  private get layers();
86
86
  /** Layers new layers go under */
87
87
  private get onTop();
88
+ /** What the map draws through: `'webgpu'`, or `'webgl2'` (the fallback of a browser without WebGPU, or of a device
89
+ * WebGPU kept losing) */
90
+ get renderer(): 'webgpu' | 'webgl2';
88
91
  /** The GPU is lost: nothing drawn, the engine dropped (`dropLostEngine`) */
89
92
  private gpuLost;
90
93
  /**
91
94
  * Follows the loss of `engine`'s WebGPU device (a phone taking its memory back, a driver reset, the GPU process
92
95
  * gone): while it is the map's, the map drops it and makes a new one at once, WebGPU having no event for the GPU
93
- * given back. The device of an engine the map freed itself (replaced, the map destroyed) is lost too: not the map's
94
- * any more, left be
96
+ * given back, lighter so as not to lose it again (`lighten`). The device of an engine the map freed itself
97
+ * (replaced, the map destroyed) is lost too: not the map's any more, left be
95
98
  */
96
99
  private watchDevice;
100
+ /**
101
+ * After a device lost, the next engine lighter, the same scene then holding less: at the first loss the low quality
102
+ * (one pixel a CSS pixel, no sun's shadows, one worker, fewer tiles far away) and half the GPU memory budget; at the
103
+ * next one, the WebGL2 fallback (a phone whose WebGPU keeps losing its device: Safari's GPU process taking its
104
+ * memory back) and half the budget again. What it did: `'lighter'` or `'webgl2'`
105
+ */
106
+ private lighten;
97
107
  /**
98
108
  * The context is lost: its engine freed at once, the map's calls going to one that does nothing until `restore`
99
109
  * builds the next. The old engine's GPU objects went with the context: deleted now, it is silent (on the context
package/dist/map.js CHANGED
@@ -61,6 +61,8 @@ const BODY_START = { center: [0, 0], zoom: 2, pitch: 0, bearing: 0 };
61
61
  const FIRST_PERSON_PITCH = [1, 179];
62
62
  /** The eye's field of view at street level (degrees): from a telephoto to a wide angle, the projection still sane */
63
63
  const FIRST_PERSON_FOV = [10, 140];
64
+ /** The least GPU memory budget a lost device leaves the map (bytes, `lighten`) */
65
+ const MIN_MEMORY = 64 * 2 ** 20;
64
66
  /** A network's defaults: the values past which it is unreached (half an hour of travel, in seconds), its halo's
65
67
  * opacity at the middle of a line (a glow, not a second line) */
66
68
  const NETWORK_MAX = 1800;
@@ -141,7 +143,7 @@ export class GeoMap {
141
143
  // The engine on wgpu (#146): WebGPU, else wgpu's WebGL2 fallback
142
144
  const kind = await rendererKind(options.renderer);
143
145
  const bindings = await loadEngine(kind, engineUrl(kind, options));
144
- const map = new GeoMap(container, options, bindings.Engine);
146
+ const map = new GeoMap(container, options, bindings.Engine, kind);
145
147
  // Its device asked for: the map started on a placeholder meanwhile, its layers created on the engine once it is
146
148
  // there (as after a context loss)
147
149
  map.adopt(await map.engines.create(map.canvas, () => map.requestRender(), map.settings));
@@ -152,8 +154,8 @@ export class GeoMap {
152
154
  }
153
155
  return map;
154
156
  }
155
- constructor(container, options, engineClass) {
156
- this.engines = new MapEngines(engineClass, options);
157
+ constructor(container, options, engineClass, renderer) {
158
+ this.engines = new MapEngines(engineClass, renderer, options);
157
159
  const workerUrl = options.basemapWorkerUrl ?? defaultWorkerUrl(options.assetsUrl);
158
160
  this.tessUrl = tessUrl(options);
159
161
  this.gridUrl = gridUrl(options);
@@ -238,6 +240,13 @@ export class GeoMap {
238
240
  get onTop() {
239
241
  return this.stack.onTop;
240
242
  }
243
+ /** WebGPU devices lost so far: each one makes the next engine lighter (`lighten`) */
244
+ #losses = 0;
245
+ /** What the map draws through: `'webgpu'`, or `'webgl2'` (the fallback of a browser without WebGPU, or of a device
246
+ * WebGPU kept losing) */
247
+ get renderer() {
248
+ return this.engines.renderer;
249
+ }
241
250
  /** The GPU is lost: nothing drawn, the engine dropped (`dropLostEngine`) */
242
251
  gpuLost() {
243
252
  this.lost = true;
@@ -247,17 +256,40 @@ export class GeoMap {
247
256
  /**
248
257
  * Follows the loss of `engine`'s WebGPU device (a phone taking its memory back, a driver reset, the GPU process
249
258
  * gone): while it is the map's, the map drops it and makes a new one at once, WebGPU having no event for the GPU
250
- * given back. The device of an engine the map freed itself (replaced, the map destroyed) is lost too: not the map's
251
- * any more, left be
259
+ * given back, lighter so as not to lose it again (`lighten`). The device of an engine the map freed itself
260
+ * (replaced, the map destroyed) is lost too: not the map's any more, left be
252
261
  */
253
262
  watchDevice(engine) {
254
- void engine.gpuDevice()?.lost.then((info) => {
263
+ void engine
264
+ .gpuDevice()
265
+ ?.lost.then(async (info) => {
255
266
  if (this.gone || this.#engine !== engine)
256
267
  return;
257
- console.warn(`isard: the GPU device was lost (${info.reason}: ${info.message}), the map made again`);
258
268
  this.gpuLost();
269
+ const recovery = await this.lighten();
270
+ console.warn(`isard: the GPU device was lost (${info.reason}: ${info.message}), the map made again (${recovery})`);
271
+ this.emit('gpulost', { reason: info.reason, message: info.message, losses: this.#losses, recovery });
259
272
  this.restore();
260
- });
273
+ })
274
+ // The fallback's module not loaded: told, as a failed restore is
275
+ .catch(report);
276
+ }
277
+ /**
278
+ * After a device lost, the next engine lighter, the same scene then holding less: at the first loss the low quality
279
+ * (one pixel a CSS pixel, no sun's shadows, one worker, fewer tiles far away) and half the GPU memory budget; at the
280
+ * next one, the WebGL2 fallback (a phone whose WebGPU keeps losing its device: Safari's GPU process taking its
281
+ * memory back) and half the budget again. What it did: `'lighter'` or `'webgl2'`
282
+ */
283
+ async lighten() {
284
+ this.#losses += 1;
285
+ this.settings.memory = Math.max(MIN_MEMORY, this.settings.memory / 2);
286
+ if (this.#losses === 1 || this.engines.renderer === 'webgl2') {
287
+ this.qualityWatch = undefined;
288
+ this.applyQuality('low');
289
+ return 'lighter';
290
+ }
291
+ await this.engines.fallBack();
292
+ return 'webgl2';
261
293
  }
262
294
  /**
263
295
  * The context is lost: its engine freed at once, the map's calls going to one that does nothing until `restore`
@@ -278,8 +310,17 @@ export class GeoMap {
278
310
  restore() {
279
311
  if (this.gone)
280
312
  return;
281
- this.engines
282
- .create(this.canvas, () => this.requestRender(), this.settings)
313
+ const make = () => this.engines.create(this.canvas, () => this.requestRender(), this.settings);
314
+ make()
315
+ .catch(async (error) => {
316
+ // WebGPU giving no new device after a loss (an adapter refused): the WebGL2 fallback
317
+ if (this.engines.renderer === 'webgl2')
318
+ throw error;
319
+ console.warn(`isard: no new WebGPU device (${String(error)}), the map made again through WebGL2`);
320
+ await this.engines.fallBack();
321
+ this.emit('gpulost', { reason: 'unknown', message: String(error), losses: this.#losses, recovery: 'webgl2' });
322
+ return make();
323
+ })
283
324
  .then((engine) => this.adopt(engine))
284
325
  .catch(report);
285
326
  }
package/dist/map.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"map.js","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAuB,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAA2B,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAuB,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EACL,eAAe,EAEf,SAAS,EACT,OAAO,EACP,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AAC,MAAM,EAAE,CAAC;QACxB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACxB,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACrC,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACzB,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;QACjC,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACvB,qFAAqF;QACrF,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACnB,kHAAkH;QAClH,gDAAgD;QAChD,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACvC,oEAAoE;QACpE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/**\n * The map: canvas, camera, layers, events, overlays, credits and the frame loop. Frames are drawn on demand only: an\n * idle map costs nothing. Hover events are coalesced to one per frame, so the values computed for a mouse position are\n * drawn in the same frame. The engine's loading is in engine-loader.ts, its settings from the options in settings.ts,\n * the camera animations in animation.ts; the parts of the map with a state of their own (the drawing order of the\n * layers, the overlays and controls, the frame loop, the hover picking, the workers…) in map/.\n */\n\nimport { SEA } from './basemap/basemaps.ts';\nimport { type PmtilesOptions, pmtilesLayer } from './basemap/pmtileslayer.ts';\nimport { VectorTiles, type VectorTilesOptions } from './basemap/vectortiles.ts';\nimport { type BasemapWorkers, defaultWorkerUrl } from './basemap/workerpool.ts';\nimport {\n destroyedEngine,\n type EngineClass,\n engineUrl,\n gridUrl,\n loadEngine,\n rendererKind,\n tessUrl,\n} from './engine-loader.ts';\nimport { IGN_PRESETS } from './geoplateforme.ts';\nimport type { Grid } from './grids.ts';\nimport { CustomLayer, type CustomLayerInterface } from './layers/custom.ts';\nimport { ExtrusionLayer, type ExtrusionOptions, extrusionStyle } from './layers/extrusions.ts';\nimport {\n CircleLayer,\n type CircleOptions,\n circleStyle,\n type Feature,\n FillLayer,\n type FillOptions,\n fillStyle,\n LineLayer,\n type LineOptions,\n lineStyle,\n} from './layers/features.ts';\nimport { FlowLayer, type FlowOptions } from './layers/flow.ts';\nimport type { Glyphs } from './layers/glyphs.ts';\nimport { GroundLayer, type GroundOptions } from './layers/ground.ts';\nimport type { Icons, ImageOptions, Pixels } from './layers/icons.ts';\nimport type { Layer } from './layers/layers.ts';\nimport { ModelLayer, type ModelOptions } from './layers/models.ts';\nimport { NetworkLayer } from './layers/network.ts';\nimport { loadPanoramas, type PanoramaOptions, type Panoramas } from './layers/panoramas.ts';\nimport { addPhoto, type PhotoOptions } from './layers/photos.ts';\nimport { PointCloudLayer, type PointCloudOptions } from './layers/pointclouds.ts';\nimport { RasterLayer } from './layers/raster.ts';\nimport { SymbolLayer, type SymbolOptions, symbolStyle } from './layers/symbols.ts';\nimport { Tiles3dLayer } from './layers/tiles3d.ts';\nimport { addTrees, type TreeOptions } from './layers/trees.ts';\nimport { VectorLayer } from './layers/vectors.ts';\nimport { BasemapLayers } from './map/basemap-layers.ts';\nimport { createCanvas, labelCanvas, watchContext, watchPixelRatio } from './map/canvas.ts';\nimport { checkBasemap, report, validateNetwork } from './map/checks.ts';\nimport { applyClipVolume, ClipVolumeHandles } from './map/clip-volume.ts';\nimport { Credits } from './map/credits.ts';\nimport { mapSettings, sendHeaders } from './map/engine-settings.ts';\nimport { MapEngines } from './map/engines.ts';\nimport { MapListeners } from './map/events.ts';\nimport { FrameLoop } from './map/frame-loop.ts';\nimport { HoverPick, type HoverPicking, pickOnce } from './map/hover-pick.ts';\nimport { addSpec, type LayerSpec } from './map/layer-spec.ts';\nimport { LayerStack } from './map/layer-stack.ts';\nimport { OverlayHost } from './map/overlay-host.ts';\nimport { panoramaHost } from './map/panorama-host.ts';\nimport { QUALITY, type QualitySettings, QualityWatch, startLevel } from './map/quality.ts';\nimport { rasterSource } from './map/raster-source.ts';\nimport { SymbolAtlases } from './map/symbol-atlases.ts';\nimport { applyViewshed } from './map/viewshed.ts';\nimport { MapWorkers } from './map/workers.ts';\nimport { atmosphereSettings, rgb, type Settings, terrainSettings } from './settings.ts';\nimport type {\n AnimationOptions,\n AtmosphereOptions,\n Basemap,\n CelestialBody,\n ClipVolume,\n FeatureHit,\n FirstPersonView,\n FlyToOptions,\n GeoMapOptions,\n LoadingMode,\n LonLat,\n MapEvents,\n MapGpuTimings,\n MapMemory,\n NetworkOptions,\n PickOptions,\n Point,\n Projection,\n Quality,\n RasterOptions,\n SunOptions,\n SwipeOptions,\n TerrainModel,\n TerrainOptions,\n Tiles3dOptions,\n ViewshedOptions,\n} from './types.ts';\nimport { AttributionControl, type Control, type ControlPosition } from './ui/controls.ts';\nimport { Interaction } from './ui/interaction.ts';\nimport type { Positioned } from './ui/overlay.ts';\nimport { easeTo, flyTo, type Step } from './util/animation.ts';\nimport { RAD } from './util/geo.ts';\nimport { clamp } from './util/math.ts';\nimport { onHeaderRules } from './util/requests.ts';\nimport { sunPosition } from './util/sun.ts';\nimport type { Camera, Engine, PickHit, RasterLayerStats } from './wasm/isard_webgpu.js';\n\nexport type { LayerSpec } from './map/layer-spec.ts';\n\n/** Where a map of the Earth opens without a camera given: Saint-Mandé, the IGN's home, its streets in view; of another\n * body, all of it */\nconst EARTH_START: Camera = { center: [2.4246, 48.8457], zoom: 13, pitch: 0, bearing: 0 };\nconst BODY_START: Camera = { center: [0, 0], zoom: 2, pitch: 0, bearing: 0 };\n\n/** The eye's pitch at street level (degrees from straight down): off the vertical, where its heading means nothing */\nconst FIRST_PERSON_PITCH: [min: number, max: number] = [1, 179];\n\n/** The eye's field of view at street level (degrees): from a telephoto to a wide angle, the projection still sane */\nconst FIRST_PERSON_FOV: [min: number, max: number] = [10, 140];\n\n/** A network's defaults: the values past which it is unreached (half an hour of travel, in seconds), its halo's\n * opacity at the middle of a line (a glow, not a second line) */\nconst NETWORK_MAX = 1800;\nconst NETWORK_HALO_OPACITY = 0.11;\n\n/** A layer whose picked features come back with their properties (lines, circles, fills, extrusions, 3D Tiles…) */\nconst hasFeatures = (layer: Layer): layer is Layer & { featureAt(index: number): Feature | undefined } =>\n 'featureAt' in layer && typeof layer.featureAt === 'function';\n\n/** A map (see `GeoMap.create`); layers take it as their host */\n/** The parts of a frame by their code in the engine's GPU timings (`Engine.gpuTimings`) */\nconst GPU_PARTS = ['backdrop', 'ground', 'layer', 'shadows', 'panorama', 'viewshed'] as const;\n\n/** Turns the GPU timing of an engine on or off: whether it times, false for an engine built without it (only a build to\n * profile has `setGpuTiming`) */\nconst engineGpuTiming = (engine: Engine, on: boolean): boolean => {\n const set: unknown = Reflect.get(engine, 'setGpuTiming');\n\n return typeof set === 'function' && Reflect.apply(set, engine, [on]) === true;\n};\n\nexport class GeoMap {\n readonly canvas: HTMLCanvasElement;\n #engine: Engine;\n /** The frames' parts timed on the GPU (`setGpuTiming`), again on a new engine */\n private gpuTiming = false;\n /** The work the map waits on before it is idle (`track`) */\n #working = 0;\n /** The engine, made asynchronously, and the workers decoding its 3D Tiles */\n private readonly engines: MapEngines;\n /** The layers in drawing order and those kept on top */\n private readonly stack = new LayerStack(() => this.#engine);\n /** The basemap and the hillshade */\n private readonly basemaps: BasemapLayers;\n /** The glyphs and icons of the symbol layers */\n private readonly atlases: SymbolAtlases;\n /** The workers of the vector tiles, the relief and the reprojected rasters */\n private readonly workers: MapWorkers;\n private readonly container: HTMLElement;\n /** The canvas in the container, the markers and popups over it, the controls in its corners */\n private readonly overlays: OverlayHost;\n private readonly settings: Settings;\n /** @internal Where the basemap workers load the tessellation module from (`isard_tess_bg.wasm`) */\n readonly tessUrl: string;\n /** @internal Where the workers load the grid module from (`isard_grid_bg.wasm`) */\n readonly gridUrl: string;\n /** The GPU is lost (the WebGL context, the WebGPU device): nothing is drawn until a new engine is there */\n private lost = false;\n private gone = false;\n private readonly listeners = new MapListeners();\n /** Frames drawn on demand, with their events */\n private readonly frames: FrameLoop;\n private readonly resizeObserver: ResizeObserver;\n private readonly interaction: Interaction | undefined;\n /** The map is of the Earth: a basemap by default */\n private readonly earth: boolean;\n /** The body, as the option named it */\n private readonly body: CelestialBody | undefined;\n /** Credits of the raster layers that have some, and the attribution controls told when they change */\n private readonly credits = new Credits();\n /** The picking for 'hoverfeature', its answer emitted on a later frame */\n private readonly hoverPick = new HoverPick(\n () => this.engine,\n () => this.lost,\n (result) =>\n this.emit('hoverfeature', {\n point: [result.x, result.y],\n lonLat: result.lonLat,\n hit: result.hit && this.featureHit(result.hit),\n }),\n );\n /** What 'hoverfeature' looks for: within `radius` CSS pixels, in `layers` only if given */\n hoverPicking: HoverPicking = {};\n /** Vector tiles made by `vectorTiles()`, destroyed with the map */\n private readonly vectorSets = new Set<VectorTiles>();\n /** Stops watching the device pixel ratio */\n private readonly unwatchRatio: () => void;\n /** Stops following the page's request headers (`setRequestHeaders`) */\n private unwatchHeaders: () => void = () => undefined;\n /** Stops listening to the canvas's context loss and restoration */\n private readonly unwatchContext: () => void;\n\n /** Loads the engine (once per page) and creates a map filling `container` */\n static async create(container: HTMLElement, given: GeoMapOptions = {}): Promise<GeoMap> {\n // A preset under the options given\n const options: GeoMapOptions = given.preset ? { ...IGN_PRESETS[given.preset], ...given } : given;\n // Before anything is created\n if (options.basemap !== undefined) checkBasemap(options.basemap);\n\n // The engine on wgpu (#146): WebGPU, else wgpu's WebGL2 fallback\n const kind = await rendererKind(options.renderer);\n const bindings = await loadEngine(kind, engineUrl(kind, options));\n const map = new GeoMap(container, options, bindings.Engine);\n\n // Its device asked for: the map started on a placeholder meanwhile, its layers created on the engine once it is\n // there (as after a context loss)\n map.adopt(await map.engines.create(map.canvas, () => map.requestRender(), map.settings));\n\n // A profiling script's page (`window.__isardProfile` set before isard loads): its maps, to time\n if (Reflect.get(globalThis, '__isardProfile')) {\n const maps: unknown = Reflect.get(globalThis, '__isardMaps');\n\n Reflect.set(globalThis, '__isardMaps', [...(Array.isArray(maps) ? maps : []), map]);\n }\n\n return map;\n }\n\n private constructor(container: HTMLElement, options: GeoMapOptions, engineClass: EngineClass) {\n this.engines = new MapEngines(engineClass, options);\n\n const workerUrl = options.basemapWorkerUrl ?? defaultWorkerUrl(options.assetsUrl);\n\n this.tessUrl = tessUrl(options);\n this.gridUrl = gridUrl(options);\n\n this.workers = new MapWorkers(\n workerUrl,\n options.workers,\n () => this.gone,\n this,\n () => this.quality.workers,\n );\n this.basemaps = new BasemapLayers(this, this.stack, workerUrl, options.basemapTileSize);\n this.container = container;\n this.canvas = createCanvas();\n // The engine takes the canvas for itself: it says how large a texture its device takes\n this.atlases = new SymbolAtlases(\n () => this.#engine.maxTextureSize(),\n options.glyphs,\n () => this.#engine,\n );\n this.overlays = new OverlayHost(container, this.canvas, this);\n this.earth = (options.body ?? 'earth') === 'earth';\n this.body = options.body;\n this.settings = mapSettings(options, this.earth, this.workers.terrainLoader);\n this.frames = new FrameLoop(\n {\n engine: () => this.engine,\n camera: () => this.getCamera(),\n lost: () => this.lost,\n interacting: () => this.interaction?.active === true,\n customLayers: () => this.layers.some((layer) => layer instanceof CustomLayer),\n working: () => this.#working > 0,\n drawn: (hovered) => {\n this.qualityWatch?.frame(performance.now(), this.movingNow);\n // The picking pass sees the frame just drawn; its answer comes on a later frame\n if (hovered && this.listeners.has('hoverfeature')) this.hoverPick.request(hovered, this.hoverPicking);\n // Overlays follow the frame just drawn\n this.overlays.positionAll();\n },\n },\n this.listeners,\n );\n // The engine is made asynchronously (`GeoMap.create` adopts it): a placeholder meanwhile\n this.#engine = destroyedEngine(EARTH_START);\n // Once it has an engine: a map whose creation failed before is not left following them\n this.unwatchHeaders = onHeaderRules((rules) => sendHeaders(this.#engine, rules));\n // The browser may take the GPU away (driver reset, background tab on mobile): the map waits, then rebuilds. A\n // WebGPU device lost is watched with each engine (`adopt`)\n this.unwatchContext = watchContext(\n this.canvas,\n () => this.gpuLost(),\n () => this.restore(),\n );\n\n const start = this.earth ? EARTH_START : BODY_START;\n\n this.setCamera({ ...start, ...options });\n this.setBasemap(options.basemap ?? (this.earth ? 'osm-positron' : 'none'), options.hillshade ?? 0);\n if (options.sun) this.setSun(options.sun);\n this.resizeObserver = new ResizeObserver(() => this.resize());\n this.resizeObserver.observe(container);\n this.#quality = startLevel(options.quality);\n if (options.quality === 'auto') {\n this.qualityWatch = new QualityWatch('high', (level) => this.applyQuality(level));\n // The frames measured are those of a move\n this.on('movestart', () => {\n this.movingNow = true;\n });\n this.on('moveend', () => {\n this.movingNow = false;\n });\n }\n this.unwatchRatio = watchPixelRatio(() => this.resize());\n this.resize();\n\n const interactive = options.interactive ?? true;\n const keyboard = interactive && (options.keyboard ?? true);\n\n this.interaction = interactive ? new Interaction(this, { keyboard }) : undefined;\n labelCanvas(this.canvas, keyboard, options.ariaLabel ?? 'Map');\n\n const attribution = options.attributionControl ?? true;\n\n if (attribution !== false) {\n this.addControl(new AttributionControl(attribution === true ? {} : attribution), 'bottom-right');\n }\n }\n\n /** The element the map was created in */\n getContainer(): HTMLElement {\n return this.container;\n }\n\n getCanvas(): HTMLCanvasElement {\n return this.canvas;\n }\n\n /** @internal The engine (replaced after a context loss) */\n get engine(): Engine {\n return this.#engine;\n }\n\n /** Layers in drawing order (bottom first) */\n private get layers(): readonly Layer[] {\n return this.stack.layers;\n }\n\n /** Layers new layers go under */\n private get onTop(): Set<Layer> {\n return this.stack.onTop;\n }\n\n /** The GPU is lost: nothing drawn, the engine dropped (`dropLostEngine`) */\n private gpuLost(): void {\n this.lost = true;\n this.frames.cancel();\n this.dropLostEngine();\n }\n\n /**\n * Follows the loss of `engine`'s WebGPU device (a phone taking its memory back, a driver reset, the GPU process\n * gone): while it is the map's, the map drops it and makes a new one at once, WebGPU having no event for the GPU\n * given back. The device of an engine the map freed itself (replaced, the map destroyed) is lost too: not the map's\n * any more, left be\n */\n private watchDevice(engine: Engine): void {\n void engine.gpuDevice()?.lost.then((info) => {\n if (this.gone || this.#engine !== engine) return;\n console.warn(`isard: the GPU device was lost (${info.reason}: ${info.message}), the map made again`);\n this.gpuLost();\n this.restore();\n });\n }\n\n /**\n * The context is lost: its engine freed at once, the map's calls going to one that does nothing until `restore`\n * builds the next. The old engine's GPU objects went with the context: deleted now, it is silent (on the context\n * restored, each one warns); its 3D Tiles downloads stop. Its layers' updates meanwhile (a tile uploaded, labels)\n * would fail on the lost context, whose limits read 0\n */\n private dropLostEngine(): void {\n this.hoverPick.cancel();\n\n const camera = this.getCamera();\n\n this.#engine.free();\n this.#engine = destroyedEngine(camera);\n // Glyph ranges and icons arriving meanwhile upload to it, not to the freed engine\n this.atlases.attach(this.#engine);\n }\n\n /** After the GPU lost: a new engine with the same camera, settings and layers (same handles, same order); the engine\n * made asynchronously, adopted once there */\n private restore(): void {\n if (this.gone) return;\n this.engines\n .create(this.canvas, () => this.requestRender(), this.settings)\n .then((engine) => this.adopt(engine))\n .catch(report);\n }\n\n /** A new engine in place of the map's (a placeholder, or a lost one): the same camera, settings and layers (same\n * handles, same order) */\n private adopt(engine: Engine): void {\n if (this.gone) {\n engine.free();\n\n return;\n }\n this.hoverPick.cancel();\n\n const camera = this.getCamera();\n\n this.#engine.free();\n this.#engine = engine;\n this.lost = false;\n this.watchDevice(engine);\n // Still timed (profiling)\n if (this.gpuTiming) engineGpuTiming(engine, true);\n this.setCamera(camera);\n this.atlases.attach(this.#engine);\n this.stack.reattach(this.#engine);\n this.applySwipe();\n // A street-level eye stays one in the new engine\n if (this.#firstPerson) this.setFirstPerson(this.#firstPerson);\n // What the old engine drew over the scene: the viewshed, the sun's shadows, the panoramas shown\n if (this.viewshed) this.setViewshed(this.viewshed);\n applyClipVolume(this.engine, this.clipVolume, this.settings.body.radius);\n if (this.sun) this.setSun(this.sun);\n this.panoramaSets.forEach((set) => {\n if (set.current) void set.show(set.current.index).catch(report);\n });\n this.resize();\n this.requestRender();\n }\n\n /** The street-level eye, while there is one (`setFirstPerson`) */\n #firstPerson: Required<FirstPersonView> | undefined;\n\n /** The street-level eye, if the camera is one */\n get firstPerson(): Readonly<Required<FirstPersonView>> | undefined {\n return this.#firstPerson;\n }\n\n /**\n * Puts the camera at street level: an eye `height` metres above the ground, looking `bearing` and `pitch`, the\n * drag turning it around (the wheel narrows or widens its field of view); undefined gives back the camera turning\n * around a point, above where the eye stood, facing the same way\n */\n setFirstPerson(view: FirstPersonView | undefined): void {\n if (!view) {\n const was = this.#firstPerson;\n\n this.#firstPerson = undefined;\n if (was) this.setCamera({ center: was.lonLat, zoom: 18, pitch: 60, bearing: was.bearing });\n\n return;\n }\n\n const lonLat: LonLat = [view.lonLat[0], view.lonLat[1]];\n const eye = { height: 1.7, pitch: 90, fov: 75, ...view, lonLat };\n\n eye.pitch = clamp(eye.pitch, ...FIRST_PERSON_PITCH);\n eye.fov = clamp(eye.fov, ...FIRST_PERSON_FOV);\n eye.bearing = ((eye.bearing % 360) + 360) % 360;\n this.#firstPerson = eye;\n this.engine.setFirstPerson(eye.lonLat[0], eye.lonLat[1], eye.height, eye.bearing, eye.pitch, eye.fov);\n this.requestRender();\n }\n\n /** The swipe set (`setSwipe`), applied again with the layers' ids of a new engine */\n private swipe: SwipeOptions | undefined;\n\n /**\n * Compares two states of a place: `layers` shown on one side of a vertical line only, at `position` CSS pixels\n * from the left of the map (left of it by default, `side: 'right'` for the other), the layers beneath them on the\n * other side; `other`: layers shown on the other side only (two meshes of a place, each on its side). Set again as\n * the line moves (a slider, a drag); undefined stops\n */\n setSwipe(options: SwipeOptions | undefined): void {\n const used = options && (options.layers.length > 0 || (options.other?.length ?? 0) > 0);\n\n this.swipe = used ? { ...options, layers: [...options.layers], other: [...(options.other ?? [])] } : undefined;\n this.applySwipe();\n this.requestRender();\n }\n\n private applySwipe(): void {\n const s = this.swipe;\n const idsOf = (layers: readonly Layer[] | undefined) =>\n Uint32Array.from(\n (layers ?? []).filter((l) => l.id >= 0),\n (l) => l.id,\n );\n const ids = idsOf(s?.layers);\n const others = idsOf(s?.other);\n const shown = ids.length > 0 || others.length > 0;\n\n this.engine.setSwipe(s && shown ? s.position : Number.NaN, s?.side === 'right', ids, others);\n }\n\n /** @internal Forgets a removed layer */\n detach(layer: Layer): void {\n this.stack.forget(layer);\n this.credits.forget(layer);\n }\n\n /** @internal The layer is on the map */\n hasLayer(layer: Layer): boolean {\n return !this.gone && this.stack.has(layer);\n }\n\n private addLayer<L extends Layer>(layer: L): L {\n try {\n layer.attach(this.engine);\n } catch (error) {\n // A context lost before the browser says so (its event comes later): nothing could be made on it, the layer is\n // made with the others on the next engine (`restore`). Any other failure is the caller's\n if (!this.contextLost()) throw error;\n }\n // Under the layers kept on top (the basemap's labels)\n this.stack.add(layer);\n this.requestRender();\n\n return layer;\n }\n\n /** Whether the canvas's WebGL context is lost, its event come or not */\n private contextLost(): boolean {\n // On a WebGPU canvas, no WebGL context: null, nothing taken\n return this.lost || this.canvas.getContext('webgl2')?.isContextLost() === true;\n }\n\n /** @internal Keeps a layer above the layers added after it (they go under it), as the labels of a basemap */\n keepOnTop(layer: Layer): void {\n this.onTop.add(layer);\n }\n\n /** @internal Moves a layer under `before`, or on top of all */\n moveLayer(layer: Layer, before: Layer | undefined): void {\n this.stack.move(layer, before);\n this.requestRender();\n }\n\n /** @internal See `LayerHost.replaceLayer` */\n replaceLayer(layer: Layer, old: number): void {\n this.stack.replace(layer, old);\n }\n\n // ── Events ──\n\n /** Listens to an event; returns the function that stops listening */\n on<K extends keyof MapEvents>(type: K, listener: (event: MapEvents[K]) => void): () => void {\n return this.listeners.on(type, listener);\n }\n\n /** @internal Calls the listeners; one that throws is reported and does not stop the others nor the frame */\n emit<K extends keyof MapEvents>(type: K, event: MapEvents[K]): void {\n this.listeners.emit(type, event);\n }\n\n // ── Camera ──\n\n #quality: Quality = 'high';\n /** 'auto': the frames watched, the map stepped down while they stay slow */\n private qualityWatch: QualityWatch | undefined;\n private movingNow = false;\n\n /** The map's quality: `'high'`, `'medium'` or `'low'` (as `GeoMapOptions.quality` says; `'auto'` the level it\n * stepped down to) */\n getQuality(): Quality {\n return this.#quality;\n }\n\n /** @internal What its quality draws */\n get quality(): QualitySettings {\n return QUALITY[this.#quality];\n }\n\n /** Sets the map's quality (`GeoMapOptions.quality`); `'auto'` starts again from `'high'` */\n setQuality(quality: Quality | 'auto'): void {\n this.qualityWatch = quality === 'auto' ? new QualityWatch('high', (level) => this.applyQuality(level)) : undefined;\n this.applyQuality(quality === 'auto' ? 'high' : quality);\n }\n\n private applyQuality(quality: Quality): void {\n if (quality === this.#quality) return;\n this.#quality = quality;\n // The canvas at its pixel ratio, the sun's shadows, the layers' detail\n this.resize();\n if (this.sun) this.setSun(this.sun);\n this.layers.forEach((layer) => {\n layer.qualityChanged();\n });\n this.emit('quality', { quality });\n this.requestRender();\n }\n\n getCamera(): Camera {\n return this.frames.camera ?? this.engine.camera();\n }\n\n setCamera(camera: Partial<Camera>): void {\n const c = { ...this.getCamera(), ...camera };\n\n this.engine.setCamera(c.center[0], c.center[1], c.zoom, c.pitch, c.bearing);\n this.requestRender();\n }\n\n /** Animated move to a camera: over `duration` milliseconds (or the options), ease-out by default */\n easeTo(camera: Partial<Camera>, options: number | AnimationOptions = 600): void {\n const from = this.getCamera();\n const to = { ...from, ...camera };\n\n this.animate(easeTo(() => this.engine, from, to, options));\n // The destination's tiles load during the flight (as Cesium does)\n this.engine.preload(to.center[0], to.center[1], to.zoom, to.pitch, to.bearing);\n }\n\n /**\n * Flight to a camera that zooms out on its way and back in (van Wijk and Nuij's optimal path, as MapLibre's\n * `flyTo`): long moves stay readable. Pitch and bearing follow the progress.\n */\n flyTo(camera: Partial<Camera>, options: FlyToOptions = {}): void {\n const from = this.getCamera();\n const to = { ...from, ...camera };\n const viewport = Math.max(this.canvas.clientWidth, this.canvas.clientHeight);\n\n this.animate(flyTo(() => this.engine, from, to, viewport, options));\n this.engine.preload(to.center[0], to.center[1], to.zoom, to.pitch, to.bearing);\n }\n\n /** Longitudes and latitudes the view covers on the ground: `[west, south, east, north]` */\n getBounds(): [west: number, south: number, east: number, north: number] {\n const [west = -180, south = -85, east = 180, north = 85] = this.engine.bounds();\n\n return [west, south, east, north];\n }\n\n /** Lowest zoom the camera accepts (the widest view) */\n setMinZoom(zoom: number): void {\n this.settings.zoomRange[0] = zoom;\n this.engine.setZoomRange(...this.settings.zoomRange);\n this.requestRender();\n }\n\n setMaxZoom(zoom: number): void {\n this.settings.zoomRange[1] = zoom;\n this.engine.setZoomRange(...this.settings.zoomRange);\n this.requestRender();\n }\n\n /** Highest pitch, degrees, up to 85 */\n setMaxPitch(pitch: number): void {\n this.settings.maxPitch = pitch;\n this.engine.setMaxPitch(pitch);\n this.requestRender();\n }\n\n /** Sky over the plane and the fog of the ground (see `GeoMapOptions.atmosphere`); undefined to remove them */\n setAtmosphere(options: AtmosphereOptions | undefined): void {\n this.settings.atmosphere = atmosphereSettings(options);\n this.engine.setAtmosphere(this.settings.atmosphere);\n this.requestRender();\n }\n\n setProjection(projection: Projection): void {\n this.settings.globe = projection === 'globe';\n this.engine.setGlobe(this.settings.globe);\n this.requestRender();\n }\n\n /** How tiles load and show (see `LoadingMode`) */\n setLoading(mode: LoadingMode): void {\n this.settings.loading = mode;\n this.engine.setImmediateLoading(mode === 'immediate');\n this.requestRender();\n }\n\n /** Space behind the globe (stars, atmosphere halo) */\n setSky(enabled: boolean): void {\n this.settings.sky = enabled;\n this.engine.setSky(enabled);\n this.requestRender();\n }\n\n /** The viewshed set, set again in a new engine */\n private viewshed: ViewshedOptions | readonly ViewshedOptions[] | undefined;\n\n /** The sun set, set again in a new engine */\n private sun: SunOptions | undefined;\n\n /**\n * The sun casting shadows: the buildings, trees, models, 3D Tiles and the relief shade the ground and one another,\n * the walls turned away from it are in their own shade; the labels stay over them. The sun stands where it is at\n * `date` over the map's center (now by default), or at `azimuth` and `altitude`. As it sets the night falls (`night`\n * to set it by hand): the scene tinted in its blue, the windows of the buildings and the streets of `vectors()` lit,\n * the labels light on dark.\n * The shadows cover the ground around the view's center, fading out away from it, and cost two more depth passes\n * of the solid scene each frame. Undefined removes them\n */\n setSun(options: SunOptions | undefined): void {\n this.sun = options;\n if (!options) {\n this.engine.setSun(Number.NaN, Number.NaN, 0, 0);\n this.requestRender();\n\n return;\n }\n\n const { azimuth, altitude } =\n options.azimuth !== undefined && options.altitude !== undefined\n ? { azimuth: options.azimuth, altitude: options.altitude }\n : sunPosition(options.date ?? new Date(), this.getCamera().center);\n // The twilight: from 6° above the horizon to 6° under it, smoothly\n const dusk = Math.min(1, Math.max(0, (6 - altitude) / 12));\n const night = Math.min(1, Math.max(0, options.night ?? dusk * dusk * (3 - 2 * dusk)));\n // The shadows fade with the sun's light; none at a low quality (its light and the night stay)\n const opacity = this.quality.shadows ? Math.min(1, Math.max(0, options.opacity ?? 0.35)) * (1 - night) : 0;\n\n this.engine.setSun(azimuth, altitude, opacity, night);\n this.requestRender();\n }\n\n /** Tints what can be seen from a point and what is hidden from it, within a range, all around or within a cone\n * (`direction`): the relief, extrusions, 3D Tiles and models hide what lies behind them (only what the map has\n * loaded for its view). Several observers (16 at most): what any of them sees is seen, what is hidden from all those\n * that reach it is hidden, in the colors and opacity of the first. Undefined or none removes it */\n setViewshed(options: ViewshedOptions | readonly ViewshedOptions[] | undefined): void {\n this.viewshed = options;\n if (applyViewshed(this.engine, options)) this.requestRender();\n }\n\n private clipVolume: ClipVolume | undefined;\n /** The clipping volume's handles over the map, while it has them */\n private clipHandles: ClipVolumeHandles | undefined;\n\n /** Cuts the 3D layers (models, 3D Tiles, extrusions, point clouds) by a volume, a box, a cylinder or a prism on a\n * polygon: what lies inside it, or outside it (`cut`), the faces the cut opens filled; with `handles`, sized and\n * moved with the pointer (`'clipvolume'` tells each change). Undefined removes it */\n setClipVolume(volume: ClipVolume | undefined): void {\n this.clipVolume = volume;\n applyClipVolume(this.engine, volume, this.settings.body.radius);\n if (volume?.handles) {\n this.clipHandles ??= this.addClipHandles(volume);\n this.clipHandles.set(volume);\n this.overlays.position(this.clipHandles);\n } else if (this.clipHandles) {\n this.overlays.detach(this.clipHandles, this.clipHandles.element);\n this.clipHandles = undefined;\n }\n this.requestRender();\n }\n\n /** The clipping volume set (`setClipVolume`), as its handles left it */\n getClipVolume(): ClipVolume | undefined {\n return this.clipVolume;\n }\n\n private addClipHandles(volume: ClipVolume): ClipVolumeHandles {\n const handles = new ClipVolumeHandles(\n {\n project: (lonLat, height) => this.project(lonLat, height),\n unproject: (point) => this.unproject(point),\n elevationAt: (lonLat) => this.elevationAt(lonLat),\n getCanvas: () => this.canvas,\n moved: (moved) => {\n this.setClipVolume(moved);\n this.emit('clipvolume', moved);\n },\n },\n volume,\n this.settings.body.radius,\n );\n\n this.overlays.attach(handles, handles.element);\n\n return handles;\n }\n\n /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles, NASA's\n * on the Moon and Mars), one of the Earth's models by name (`'ign'`), its options, or false; on another body, its\n * options with a `url` */\n setTerrain(terrain: boolean | TerrainModel | TerrainOptions): void {\n this.settings.terrain = terrainSettings(terrain, this.body, this.settings.body.radius, this.workers.terrainLoader);\n\n const t = this.settings.terrain;\n\n this.engine.setTerrain(t?.url, t?.exaggeration ?? 1, t?.maxZoom, t?.geoid, t?.loader);\n this.credits.changed();\n this.requestRender();\n }\n\n /** @internal Whether a relief is under the basemap: the fills of vector tiles drawn as geometry need their prisms */\n get hasRelief(): boolean {\n return this.settings.terrain !== undefined;\n }\n\n /** @internal The credits of the raster layers (the basemap first) and of the relief in use, each once */\n attributions(): string[] {\n return this.credits.of(this.layers, this.settings.terrain?.attribution);\n }\n\n /** @internal Calls `listener` when the credits change; returns what stops it */\n onAttributionChange(listener: () => void): () => void {\n return this.credits.onChange(listener);\n }\n\n /** Color behind the map, a CSS color (its alpha ignored) */\n setBackground(color: string): void {\n this.settings.background = rgb(color);\n this.engine.setBackground(...this.settings.background);\n this.requestRender();\n }\n\n /** The GPU memory its layers hold (bytes): the tiles of the 3D Tiles and point clouds, kept within the budget\n * (`GeoMapOptions.memory`), the rasters' pools */\n memory(): MapMemory {\n // Two numbers a layer, its id and its bytes, the relief's (id 0) last\n const pairs = this.engine.memory();\n const byId = new Map(Array.from({ length: pairs.length / 2 }, (_, i) => [pairs[2 * i], pairs[2 * i + 1] ?? 0]));\n const layers = this.layers.flatMap((layer) => {\n const bytes = layer.id >= 0 ? byId.get(layer.id) : undefined;\n\n return bytes === undefined ? [] : [{ layer, bytes }];\n });\n\n return {\n budget: this.settings.memory,\n held: [...byId.values()].reduce((sum, bytes) => sum + bytes, 0),\n layers,\n };\n }\n\n /** Tile counters of the raster layers, for diagnostics */\n stats(): RasterLayerStats[] {\n return this.engine.stats();\n }\n\n /** Times the parts of each frame on the GPU, for profiling (`gpuTimings`): timer queries, read a few frames later.\n * An engine built to profile only (`PROFILE=1 bun run build`); false without one, or if the browser cannot\n * (`EXT_disjoint_timer_query_webgl2`) */\n setGpuTiming(on: boolean): boolean {\n this.gpuTiming = engineGpuTiming(this.engine, on);\n\n return this.gpuTiming;\n }\n\n /** The GPU time of the last frame measured (`setGpuTiming`), in all and by part: the backdrop, the ground (the raster\n * layers over the relief), each layer, the shadows, the panorama, the viewshed (ms) */\n gpuTimings(): MapGpuTimings | undefined {\n // The frame's number, then each part's code, layer id (-1 for none) and milliseconds\n const read: unknown = Reflect.get(this.engine, 'gpuTimings');\n const flat: unknown = typeof read === 'function' ? Reflect.apply(read, this.engine, []) : undefined;\n\n if (!(flat instanceof Float64Array) || flat.length === 0) return undefined;\n\n const parts = Array.from({ length: (flat.length - 1) / 3 }, (_, k) => {\n const [code = 0, id = -1, ms = 0] = flat.subarray(1 + k * 3, 4 + k * 3);\n const layer = id >= 0 ? this.layers.find((l) => l.id === id) : undefined;\n\n return { part: GPU_PARTS[code] ?? 'layer', ms, ...(layer && { layer }) };\n });\n\n return { frame: flat[0] ?? 0, ms: parts.reduce((sum, p) => sum + p.ms, 0), parts };\n }\n\n /**\n * The feature under a screen point (CSS pixels), undefined if none: its layer id and index. Reads the pixels around\n * the point of an offscreen picking pass, whatever the number of features, once the GPU is done (a frame or two\n * later: the GPU is not waited for). On hover, listen to 'hoverfeature' instead.\n */\n async pick(point: Point, { radius = 0, layers }: PickOptions = {}): Promise<PickHit | undefined> {\n const only = layers && Uint32Array.from(layers.map((l) => l.id));\n\n return (await pickOnce(() => this.engine, point, radius, only))?.hit;\n }\n\n /**\n * The feature under a screen point (CSS pixels), or the nearest one within `radius` pixels: its layer handle, its\n * index there and, for line, circle and fill layers, the feature itself; undefined if none. `layers` restricts the\n * search to some layers (the others hide nothing).\n */\n async pickFeature(point: Point, options: PickOptions = {}): Promise<FeatureHit | undefined> {\n const hit = await this.pick(point, options);\n\n return hit && this.featureHit(hit);\n }\n\n /** A hit with its layer handle and feature; undefined if the layer is gone */\n private featureHit(hit: PickHit): FeatureHit | undefined {\n const layer = this.layers.find((l) => l.id === hit.layer);\n\n if (!layer) return undefined;\n\n const feature = hasFeatures(layer) ? layer.featureAt(hit.index) : undefined;\n\n return { layer, index: hit.index, feature };\n }\n\n /** Screen point (CSS pixels) of a position on the ground (the relief), or `height` metres above it, undefined\n * behind the camera */\n project(lonLat: LonLat, height = 0): Point | undefined {\n return this.engine.project(lonLat[0], lonLat[1], height);\n }\n\n /** Position under a screen point (CSS pixels), undefined above the horizon */\n unproject(point: Point): LonLat | undefined {\n return this.engine.ground(point[0], point[1]);\n }\n\n /**\n * Street-level panoramas (oriented images of a vehicle's cameras, the iTowns immersive format): their positions\n * and calibrations loaded, none shown until `show`, which projects one onto the scene around it\n */\n async addPanoramas(options: PanoramaOptions): Promise<Panoramas> {\n const host = panoramaHost(this, (lon, lat) => this.engines.geoidHeight(lon, lat));\n const panoramas = await loadPanoramas(host, options);\n\n this.panoramaSets.add(panoramas);\n panoramas.whenRemoved.push(() => {\n this.panoramaSets.delete(panoramas);\n });\n\n return panoramas;\n }\n\n /** The panorama sets, their panorama shown again in a new engine */\n private readonly panoramaSets = new Set<Panoramas>();\n\n /** Altitude of the relief at a position, in metres (exaggeration included): from the copy of its tiles the map\n * keeps, as fine as the tiles loaded there; undefined without relief or where none is loaded yet */\n elevationAt(lonLat: LonLat): number | undefined {\n return this.engine.elevationAt(lonLat[0], lonLat[1]);\n }\n\n /** Metres on the ground per CSS pixel at a screen point (default the center of the map), across the screen: for a\n * scale bar; undefined above the horizon */\n metersPerPixel(point?: Point): number | undefined {\n const [x, y] = point ?? [this.canvas.clientWidth / 2, this.canvas.clientHeight / 2];\n const a = this.unproject([x - 0.5, y]);\n const b = this.unproject([x + 0.5, y]);\n\n if (!a || !b) return undefined;\n\n // Haversine, on the mean radius of the body\n const [dLat, dLon] = [(b[1] - a[1]) * RAD, (b[0] - a[0]) * RAD];\n const h = Math.sin(dLat / 2) ** 2 + Math.cos(a[1] * RAD) * Math.cos(b[1] * RAD) * Math.sin(dLon / 2) ** 2;\n\n return 2 * this.settings.body.radius * Math.asin(Math.min(1, Math.sqrt(h)));\n }\n\n /** Whether a double click zooms in (Shift: out), on by default: off while a drawing takes double clicks */\n setDoubleClickZoom(enabled: boolean): void {\n if (this.interaction) this.interaction.doubleClickZoom = enabled;\n }\n\n /** Whether a drag that turns and tilts the map (right button, Ctrl or Shift) goes around what is under the pointer\n * where it starts, a roof or a mesh as the relief (on by default), or around the screen center */\n setRotateAroundPointer(enabled: boolean): void {\n if (this.interaction) this.interaction.rotateAroundPointer = enabled;\n }\n\n /** What is drawn under a screen point (CSS pixels), on the relief or standing on it (a roof, a wall, a mesh): its\n * position and its height above the relief, in metres; undefined where nothing was drawn. Read from the last copy of\n * the scene's depth (a frame or two old, a pixel every 4 CSS pixels): at once, without waiting for the GPU */\n pickSurface(point: Point): { lonLat: LonLat; height: number } | undefined {\n const hit = this.engine.surface(point[0], point[1]);\n\n return hit && { lonLat: [hit[0], hit[1]], height: hit[2] };\n }\n\n /** The height above the relief, in metres, of the top of what stands at a position: a roof, a mesh, 0 on the bare\n * ground; undefined where nothing of the last frame is there, or until measured: the scene is drawn looking down at\n * it after a frame and read back a frame or two later, the answer kept and measured again every 250 ms at most (ask\n * again on the next `render` event) */\n surfaceAt(lonLat: LonLat): number | undefined {\n return this.engine.surfaceAt(lonLat[0], lonLat[1]);\n }\n\n // ── Overlays and controls ──\n\n /** Adds a control in a corner of the map; controls stack from the corner inward */\n addControl(control: Control, position: ControlPosition = 'top-right'): this {\n this.overlays.addControl(control, position);\n\n return this;\n }\n\n removeControl(control: Control): this {\n this.overlays.removeControl(control);\n\n return this;\n }\n\n /** @internal Shows a marker or popup, placed after every frame from now on */\n attachOverlay(item: Positioned, element: HTMLElement): void {\n this.overlays.attach(item, element);\n }\n\n /** @internal */\n detachOverlay(item: Positioned, element: HTMLElement): void {\n this.overlays.detach(item, element);\n }\n\n /** @internal Places one overlay now (it moved), without drawing a frame */\n positionOverlay(item: Positioned): void {\n this.overlays.position(item);\n }\n\n // ── Layers ──\n\n /** Replaces the basemap and the IGN hillshade, under the other layers (hillshade by default: 0, none). The former\n * names of the Géoplateforme basemaps throw, naming the new ones */\n setBasemap(basemap: Basemap, hillshade = 0): void {\n const name = checkBasemap(basemap);\n\n this.basemaps.replace(name);\n // Off the Earth, the body's own color\n if (this.earth) this.settings.globeColor = SEA[name];\n this.engine.setGlobeColor(...this.settings.globeColor);\n this.basemaps.addHillshade(hillshade);\n this.credits.changed();\n }\n\n /** Raster tiles ({z}, {x}, {y} URL; Web Mercator, or reprojected from another `grid`: longitudes and latitudes,\n * Lambert-93, UTM…), over the layers already added */\n addRaster(options: RasterOptions): RasterLayer {\n const { url, opacity = 1, saturation = 1, size, before, ground = true } = options;\n const { loader, minZoom, maxZoom } = rasterSource(options, this.workers.remoteReprojection);\n const layer = new RasterLayer(this, { url, minZoom, maxZoom, opacity, saturation, size, loader, ground });\n\n this.place(layer, before);\n if (options.attribution) this.credits.set(layer, options.attribution);\n\n return layer;\n }\n\n /**\n * A PMTiles archive (v3) read by range requests: a raster layer of its images, or vector tiles drawn with `style` (by\n * default a plain style of the archive's layers) with their labels. Its header decides which unless `kind` says;\n * `url` with or without `pmtiles://`, relative to the page, or a `blob:` URL. `addRaster({ url: 'pmtiles://…' })` and\n * a style source `pmtiles://…` in `vectorTiles` read archives too\n */\n addPmtiles(options: PmtilesOptions): Promise<RasterLayer | VectorTiles> {\n return pmtilesLayer(this, options);\n }\n\n /** Line network colored by a value per node; `layer.setValues` recolors it in one texture upload */\n addNetwork(options: NetworkOptions): NetworkLayer {\n const { nodes, edges, lines, costs, edgeWidths, width = 2, max = NETWORK_MAX, contour = 0, opacity = 1 } = options;\n const {\n halo = 0,\n haloOpacity = NETWORK_HALO_OPACITY,\n ramp,\n unreachedColor = 'rgba(140, 140, 140, 0.25)',\n fade = 0,\n } = options;\n const style = { width, max, contour, opacity, halo, haloOpacity, ramp, unreachedColor, fade };\n\n validateNetwork(nodes, edges);\n\n return this.place(new NetworkLayer(this, { nodes, edges, lines }, costs, style, edgeWidths), options.before);\n }\n\n /**\n * A layer from its description, as an application's configuration gives it: `{ type, ...options }`, the options of\n * the `add…` method of that type (`'lines'` for `addLines`, `'tiles3d'` for `addTiles3d`…); `before` to go under\n * another layer. The layer's `ready` resolves once the map has drawn it\n */\n add<P = Record<string, unknown>>(spec: LayerSpec<P>): Layer {\n return addSpec<P>(this, spec);\n }\n\n /** @internal A layer made anew from its description, in the place of `old` in the drawing order (old removed) */\n rebuildLayer<P = Record<string, unknown>>(old: Layer, spec: LayerSpec<P>): Layer {\n const index = this.layers.indexOf(old);\n // The first layer above that goes not with it: its companions are removed with it\n const above = index >= 0 ? this.layers.slice(index + 1).find((l) => !old.companions.includes(l)) : undefined;\n const layer = this.add(spec);\n\n if (!('before' in spec && spec.before) && index >= 0) layer.moveBefore(above);\n old.remove();\n\n return layer;\n }\n\n /**\n * @internal Work the map waits on before it is idle (the vector tiles cut in the workers, uploaded over frames): the\n * engine knows only the tiles it holds, not those coming (an engine made anew holds none until the workers cut them\n * again from their cache, no request on the network meanwhile); a frame once it is done, to tell\n */\n track<T>(work: Promise<T>): Promise<T> {\n this.#working += 1;\n\n const done = () => {\n this.#working -= 1;\n this.requestRender();\n };\n\n work.then(done, done);\n\n return work;\n }\n\n /** @internal Resolves once the map is idle (everything in view loaded and drawn) */\n whenIdle(): Promise<void> {\n if (this.gone) return Promise.resolve();\n\n return new Promise((resolve) => {\n const off = this.on('idle', () => {\n off();\n resolve();\n });\n\n this.frames.requestIdle();\n });\n }\n\n /** Lines from GeoJSON (line strings, and polygon outlines), styled per feature */\n addLines<P = Record<string, unknown>>(options: LineOptions<P>): LineLayer<P> {\n return this.place(\n new LineLayer<P>(this, options.data, lineStyle(options), options.altitudeReference),\n options.before,\n );\n }\n\n /** Discs from GeoJSON points, styled per feature */\n addCircles<P = Record<string, unknown>>(options: CircleOptions<P>): CircleLayer<P> {\n return this.place(new CircleLayer<P>(this, options.data, circleStyle(options)), options.before);\n }\n\n /** Filled polygons from GeoJSON (holes included), styled per feature; over the relief they lie on the ground */\n addFills<P = Record<string, unknown>>(options: FillOptions<P>): FillLayer<P> {\n return this.place(new FillLayer<P>(this, options.data, fillStyle(options)), options.before);\n }\n\n /** The application's fragment shader over the ground (see `GroundOptions`); under `before` if given */\n addGround(options: GroundOptions): GroundLayer {\n return this.place(new GroundLayer(this, options), options.before);\n }\n\n /** Polygons raised into blocks with depth (buildings), styled per feature; tiles of them come with `setTile` */\n addExtrusions<P = Record<string, unknown>>(options: ExtrusionOptions<P> = {}): ExtrusionLayer<P> {\n return this.place(\n new ExtrusionLayer<P>(this, options.data, extrusionStyle(options), options.drape),\n options.before,\n );\n }\n\n /** Text labels from GeoJSON (points, the middle of lines, the center of polygons), placed without overlaps */\n addSymbols<P = Record<string, unknown>>(options: SymbolOptions<P>): SymbolLayer<P> {\n return this.place(new SymbolLayer<P>(this, options.data, symbolStyle(options)), options.before);\n }\n\n /** @internal The glyphs of the symbol layers, loaded on first use */\n get glyphs(): Glyphs {\n return this.atlases.glyphs;\n }\n\n /** @internal The icons of the symbol layers: the application's images and the vector basemaps' sprites */\n get icons(): Icons {\n return this.atlases.icons;\n }\n\n /**\n * An image for the symbol layers' icons (`icon: name`), as MapLibre's `addImage`: its pixels (an image, a canvas,\n * `ImageData`, or RGBA bytes with their size), `pixelRatio` 2 for an image drawn at twice its CSS size; `sdf` for a\n * signed distance field drawn in the `iconColor`; `stretchX`, `stretchY` and `content` for an icon stretched around its\n * text. An image of the same name is replaced\n */\n addImage(\n name: string,\n image: Pixels | (CanvasImageSource & { width: number; height: number }),\n options: ImageOptions = {},\n ): void {\n this.atlases.addImage(name, image, options);\n }\n\n hasImage(name: string): boolean {\n return this.atlases.hasImage(name);\n }\n\n removeImage(name: string): void {\n this.atlases.removeImage(name);\n }\n\n /**\n * Vector tiles with a MapLibre style (OpenFreeMap's Positron by default): `tiles.raster(…)` draws its fills and lines\n * (or a subset) as a raster layer, `tiles.vectors(…)` as geometry, `tiles.labels(…)` its labels.\n * `setBasemap('osm-positron')` draws the basemap with a raster layer and the labels.\n */\n vectorTiles(options: VectorTilesOptions = {}): VectorTiles {\n const tiles = new VectorTiles(this, {\n ...(this.workers.url ? { workerUrl: this.workers.url } : {}),\n ...options,\n });\n\n // Its workers stop with the map\n this.vectorSets.add(tiles);\n\n return tiles;\n }\n\n /** @internal The geometry of a `VectorTiles` (`vectors`), under `before` if given */\n addVectorLayer(before?: Layer): VectorLayer {\n return this.place(new VectorLayer(this), before);\n }\n\n /** @internal Forgets a destroyed `VectorTiles` */\n dropVectorTiles(tiles: VectorTiles): void {\n this.vectorSets.delete(tiles);\n }\n\n /**\n * @internal The workers for a `VectorTiles`: the map's shared pool, or a pool of its own (`own`, to stop with it)\n * when it asks for another count or URL\n */\n basemapWorkers(count?: number, url?: string | URL): { pool: BasemapWorkers; own: boolean } {\n return this.workers.pool(count, url);\n }\n\n /** Adds a layer, under `before` if given */\n private place<L extends Layer>(layer: L, before: Layer | undefined): L {\n this.addLayer(layer);\n if (before) this.moveLayer(layer, before);\n\n return layer;\n }\n\n /** Textured meshes in 3D Tiles (photogrammetry, buildings), drawn with depth over the basemap */\n addTiles3d(options: Tiles3dOptions): Tiles3dLayer {\n const {\n url,\n maxScreenSpaceError = 16,\n opacity = 1,\n pointSize,\n color,\n geoid = false,\n facades = false,\n drape,\n } = options;\n\n return this.place(\n new Tiles3dLayer(\n this,\n url,\n geoid,\n {\n maxScreenSpaceError,\n opacity,\n ...(pointSize !== undefined ? { pointSize } : {}),\n ...(color !== undefined ? { color } : {}),\n },\n facades,\n drape,\n ),\n options.before,\n );\n }\n\n /**\n * A point cloud (see `PointCloudOptions`): a COPC file read by range requests (IGN's LiDAR HD…), or 3D Tiles\n * points; with depth; under `before` if given\n */\n addPointCloud(options: PointCloudOptions): PointCloudLayer {\n return this.place(new PointCloudLayer(this, options), options.before);\n }\n\n /**\n * The grids of a GRIB2 or classic NetCDF file (its URL, or its bytes): a weather or ocean model's fields on grids of\n * longitudes and latitudes, read in a worker by the grid module (loaded with the first file). GRIB2 on a regular\n * latitude/longitude grid, packed simply, in groups or in groups of spatial differences (NOAA's GFS); NetCDF-3 with\n * the CF conventions. `windFields` pairs a wind's components into the fields of `addFlow`\n */\n readGrids(source: string | URL | ArrayBuffer | Uint8Array, options: { signal?: AbortSignal } = {}): Promise<Grid[]> {\n return this.workers.readGrids(source, this.gridUrl, options.signal);\n }\n\n /** Particles carried by a field of velocities (a wind, a current), their trails animated and colored by speed on\n * the globe and the relief (see `FlowOptions`) */\n addFlow(options: FlowOptions): FlowLayer {\n return this.place(new FlowLayer(this, options), options.before);\n }\n\n /** A glTF model drawn at positions (see `ModelOptions`), with depth */\n addModels(options: ModelOptions): ModelLayer {\n return this.place(new ModelLayer(this, options), options.before);\n }\n\n /** Trees at the points of a source that has them (a city's street trees), broadleaved or conifers by their data,\n * scaled to their height (see `TreeOptions`); the conifers on a layer that goes with the one returned */\n addTrees<P = Record<string, unknown>>(options: TreeOptions<P>): ModelLayer {\n return addTrees((o) => this.addModels(o), options);\n }\n\n /** A photo standing where it was taken, facing its way (see `PhotoOptions`): flat on a frame across its field of\n * view, a 360° one on a band round its camera; resolves once its image is read */\n addPhoto(options: PhotoOptions): Promise<ModelLayer> {\n return addPhoto((o) => this.addModels(o), options);\n }\n\n /**\n * The page's own WebGPU drawing at its place among the layers, in every frame (see `CustomLayerInterface`): raw\n * WebGPU, three.js's WebGPU renderer… with the map's device and the matrices of the frame (`frame.matrixAt`); under\n * `before` if given. Not drawn on the WebGL2 fallback\n */\n addCustomLayer(layer: CustomLayerInterface, options: { before?: Layer } = {}): CustomLayer {\n const custom = new CustomLayer(\n this,\n layer,\n this,\n (lon, lat, altitude) => this.engines.customMatrix(lon, lat, altitude),\n () => this.getCamera(),\n );\n\n return this.place(custom, options.before);\n }\n\n // ── Frames ──\n\n /** Asks for a frame; several calls before the next frame draw it once */\n requestRender(): void {\n this.frames.request();\n }\n\n /** @internal Runs `step` every frame until it returns false; replaces the running animation */\n animate(step: Step | undefined): void {\n this.frames.animate(step);\n }\n\n /** @internal The pointer moved over the map (undefined: it left). Without 'hover' and 'hoverfeature' listeners,\n * nothing is drawn: a still map stays idle under a moving mouse */\n hover(point: Point | undefined): void {\n if (!point) {\n this.frames.hover(undefined);\n this.hoverPick.cancel();\n\n return;\n }\n if (!this.listeners.has('hover') && !this.listeners.has('hoverfeature')) return;\n this.frames.hover(point);\n this.requestRender();\n }\n\n private resize(): void {\n if (this.lost) return;\n\n const { clientWidth: width, clientHeight: height } = this.canvas;\n const ratio = Math.min(window.devicePixelRatio || 1, this.quality.pixelRatio);\n\n this.canvas.width = Math.round(width * ratio);\n this.canvas.height = Math.round(height * ratio);\n this.engine.resize(width, height, ratio);\n this.overlays.size = [width, height];\n this.emit('resize', { width, height });\n // Draw at once: a resized canvas is cleared, waiting one frame would flash\n this.frames.drawNow();\n }\n\n destroy(): void {\n if (this.gone) return;\n this.gone = true;\n // A context restored later rebuilds nothing\n this.unwatchContext();\n\n const camera = this.getCamera();\n\n this.frames.stop();\n this.hoverPick.cancel();\n this.basemaps.destroy();\n [...this.vectorSets].forEach((tiles) => {\n tiles.remove();\n });\n this.vectorSets.clear();\n this.workers.terminate();\n this.unwatchRatio();\n this.unwatchHeaders();\n this.resizeObserver.disconnect();\n this.interaction?.destroy();\n this.engines.destroy();\n // Custom layers free their GPU objects, models their data, while the device is there\n this.stack.dispose();\n this.engine.free();\n // Work still under way (labels being shaped, tiles arriving, timers) may call the engine after this: it finds one\n // that does nothing, and nothing is drawn again\n this.#engine = destroyedEngine(camera);\n // Glyph ranges still arriving upload to it, not to the freed engine\n this.atlases.attach(this.#engine);\n this.lost = true;\n this.overlays.destroy();\n this.listeners.clear();\n }\n}\n"]}
1
+ {"version":3,"file":"map.js","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAuB,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAA2B,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAuB,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EACL,eAAe,EAGf,SAAS,EACT,OAAO,EACP,UAAU,EACV,YAAY,EACZ,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAA6B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAyB,cAAc,EAAE,MAAM,wBAAwB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as, camera, layers, events, overlays, credits and the frame loop. Frames are drawn on demand only: an\n * idle map costs nothing. Hover events are coalesced to one per frame, so the values computed for a mouse position are\n * drawn in the same frame. The engine's loading is in engine-loader.ts, its settings from the options in settings.ts,\n * the camera animations in animation.ts; the parts of the map with a state of their own (the drawing order of the\n * layers, the overlays and controls, the frame loop, the hover picking, the workers…) in map/.\n */\n\nimport { SEA } from './basemap/basemaps.ts';\nimport { type PmtilesOptions, pmtilesLayer } from './basemap/pmtileslayer.ts';\nimport { VectorTiles, type VectorTilesOptions } from './basemap/vectortiles.ts';\nimport { type BasemapWorkers, defaultWorkerUrl } from './basemap/workerpool.ts';\nimport {\n destroyedEngine,\n type EngineClass,\n type EngineKind,\n engineUrl,\n gridUrl,\n loadEngine,\n rendererKind,\n tessUrl,\n} from './engine-loader.ts';\nimport { IGN_PRESETS } from './geoplateforme.ts';\nimport type { Grid } from './grids.ts';\nimport { CustomLayer, type CustomLayerInterface } from './layers/custom.ts';\nimport { ExtrusionLayer, type ExtrusionOptions, extrusionStyle } from './layers/extrusions.ts';\nimport {\n CircleLayer,\n type CircleOptions,\n circleStyle,\n type Feature,\n FillLayer,\n type FillOptions,\n fillStyle,\n LineLayer,\n type LineOptions,\n lineStyle,\n} from './layers/features.ts';\nimport { FlowLayer, type FlowOptions } from './layers/flow.ts';\nimport type { Glyphs } from './layers/glyphs.ts';\nimport { GroundLayer, type GroundOptions } from './layers/ground.ts';\nimport type { Icons, ImageOptions, Pixels } from './layers/icons.ts';\nimport type { Layer } from './layers/layers.ts';\nimport { ModelLayer, type ModelOptions } from './layers/models.ts';\nimport { NetworkLayer } from './layers/network.ts';\nimport { loadPanoramas, type PanoramaOptions, type Panoramas } from './layers/panoramas.ts';\nimport { addPhoto, type PhotoOptions } from './layers/photos.ts';\nimport { PointCloudLayer, type PointCloudOptions } from './layers/pointclouds.ts';\nimport { RasterLayer } from './layers/raster.ts';\nimport { SymbolLayer, type SymbolOptions, symbolStyle } from './layers/symbols.ts';\nimport { Tiles3dLayer } from './layers/tiles3d.ts';\nimport { addTrees, type TreeOptions } from './layers/trees.ts';\nimport { VectorLayer } from './layers/vectors.ts';\nimport { BasemapLayers } from './map/basemap-layers.ts';\nimport { createCanvas, labelCanvas, watchContext, watchPixelRatio } from './map/canvas.ts';\nimport { checkBasemap, report, validateNetwork } from './map/checks.ts';\nimport { applyClipVolume, ClipVolumeHandles } from './map/clip-volume.ts';\nimport { Credits } from './map/credits.ts';\nimport { mapSettings, sendHeaders } from './map/engine-settings.ts';\nimport { MapEngines } from './map/engines.ts';\nimport { MapListeners } from './map/events.ts';\nimport { FrameLoop } from './map/frame-loop.ts';\nimport { HoverPick, type HoverPicking, pickOnce } from './map/hover-pick.ts';\nimport { addSpec, type LayerSpec } from './map/layer-spec.ts';\nimport { LayerStack } from './map/layer-stack.ts';\nimport { OverlayHost } from './map/overlay-host.ts';\nimport { panoramaHost } from './map/panorama-host.ts';\nimport { QUALITY, type QualitySettings, QualityWatch, startLevel } from './map/quality.ts';\nimport { rasterSource } from './map/raster-source.ts';\nimport { SymbolAtlases } from './map/symbol-atlases.ts';\nimport { applyViewshed } from './map/viewshed.ts';\nimport { MapWorkers } from './map/workers.ts';\nimport { atmosphereSettings, rgb, type Settings, terrainSettings } from './settings.ts';\nimport type {\n AnimationOptions,\n AtmosphereOptions,\n Basemap,\n CelestialBody,\n ClipVolume,\n FeatureHit,\n FirstPersonView,\n FlyToOptions,\n GeoMapOptions,\n LoadingMode,\n LonLat,\n MapEvents,\n MapGpuTimings,\n MapMemory,\n NetworkOptions,\n PickOptions,\n Point,\n Projection,\n Quality,\n RasterOptions,\n SunOptions,\n SwipeOptions,\n TerrainModel,\n TerrainOptions,\n Tiles3dOptions,\n ViewshedOptions,\n} from './types.ts';\nimport { AttributionControl, type Control, type ControlPosition } from './ui/controls.ts';\nimport { Interaction } from './ui/interaction.ts';\nimport type { Positioned } from './ui/overlay.ts';\nimport { easeTo, flyTo, type Step } from './util/animation.ts';\nimport { RAD } from './util/geo.ts';\nimport { clamp } from './util/math.ts';\nimport { onHeaderRules } from './util/requests.ts';\nimport { sunPosition } from './util/sun.ts';\nimport type { Camera, Engine, PickHit, RasterLayerStats } from './wasm/isard_webgpu.js';\n\nexport type { LayerSpec } from './map/layer-spec.ts';\n\n/** Where a map of the Earth opens without a camera given: Saint-Mandé, the IGN's home, its streets in view; of another\n * body, all of it */\nconst EARTH_START: Camera = { center: [2.4246, 48.8457], zoom: 13, pitch: 0, bearing: 0 };\nconst BODY_START: Camera = { center: [0, 0], zoom: 2, pitch: 0, bearing: 0 };\n\n/** The eye's pitch at street level (degrees from straight down): off the vertical, where its heading means nothing */\nconst FIRST_PERSON_PITCH: [min: number, max: number] = [1, 179];\n\n/** The eye's field of view at street level (degrees): from a telephoto to a wide angle, the projection still sane */\nconst FIRST_PERSON_FOV: [min: number, max: number] = [10, 140];\n\n/** The least GPU memory budget a lost device leaves the map (bytes, `lighten`) */\nconst MIN_MEMORY = 64 * 2 ** 20;\n\n/** A network's defaults: the values past which it is unreached (half an hour of travel, in seconds), its halo's\n * opacity at the middle of a line (a glow, not a second line) */\nconst NETWORK_MAX = 1800;\nconst NETWORK_HALO_OPACITY = 0.11;\n\n/** A layer whose picked features come back with their properties (lines, circles, fills, extrusions, 3D Tiles…) */\nconst hasFeatures = (layer: Layer): layer is Layer & { featureAt(index: number): Feature | undefined } =>\n 'featureAt' in layer && typeof layer.featureAt === 'function';\n\n/** A map (see `GeoMap.create`); layers take it as their host */\n/** The parts of a frame by their code in the engine's GPU timings (`Engine.gpuTimings`) */\nconst GPU_PARTS = ['backdrop', 'ground', 'layer', 'shadows', 'panorama', 'viewshed'] as const;\n\n/** Turns the GPU timing of an engine on or off: whether it times, false for an engine built without it (only a build to\n * profile has `setGpuTiming`) */\nconst engineGpuTiming = (engine: Engine, on: boolean): boolean => {\n const set: unknown = Reflect.get(engine, 'setGpuTiming');\n\n return typeof set === 'function' && Reflect.apply(set, engine, [on]) === true;\n};\n\nexport class GeoMap {\n readonly canvas: HTMLCanvasElement;\n #engine: Engine;\n /** The frames' parts timed on the GPU (`setGpuTiming`), again on a new engine */\n private gpuTiming = false;\n /** The work the map waits on before it is idle (`track`) */\n #working = 0;\n /** The engine, made asynchronously, and the workers decoding its 3D Tiles */\n private readonly engines: MapEngines;\n /** The layers in drawing order and those kept on top */\n private readonly stack = new LayerStack(() => this.#engine);\n /** The basemap and the hillshade */\n private readonly basemaps: BasemapLayers;\n /** The glyphs and icons of the symbol layers */\n private readonly atlases: SymbolAtlases;\n /** The workers of the vector tiles, the relief and the reprojected rasters */\n private readonly workers: MapWorkers;\n private readonly container: HTMLElement;\n /** The canvas in the container, the markers and popups over it, the controls in its corners */\n private readonly overlays: OverlayHost;\n private readonly settings: Settings;\n /** @internal Where the basemap workers load the tessellation module from (`isard_tess_bg.wasm`) */\n readonly tessUrl: string;\n /** @internal Where the workers load the grid module from (`isard_grid_bg.wasm`) */\n readonly gridUrl: string;\n /** The GPU is lost (the WebGL context, the WebGPU device): nothing is drawn until a new engine is there */\n private lost = false;\n private gone = false;\n private readonly listeners = new MapListeners();\n /** Frames drawn on demand, with their events */\n private readonly frames: FrameLoop;\n private readonly resizeObserver: ResizeObserver;\n private readonly interaction: Interaction | undefined;\n /** The map is of the Earth: a basemap by default */\n private readonly earth: boolean;\n /** The body, as the option named it */\n private readonly body: CelestialBody | undefined;\n /** Credits of the raster layers that have some, and the attribution controls told when they change */\n private readonly credits = new Credits();\n /** The picking for 'hoverfeature', its answer emitted on a later frame */\n private readonly hoverPick = new HoverPick(\n () => this.engine,\n () => this.lost,\n (result) =>\n this.emit('hoverfeature', {\n point: [result.x, result.y],\n lonLat: result.lonLat,\n hit: result.hit && this.featureHit(result.hit),\n }),\n );\n /** What 'hoverfeature' looks for: within `radius` CSS pixels, in `layers` only if given */\n hoverPicking: HoverPicking = {};\n /** Vector tiles made by `vectorTiles()`, destroyed with the map */\n private readonly vectorSets = new Set<VectorTiles>();\n /** Stops watching the device pixel ratio */\n private readonly unwatchRatio: () => void;\n /** Stops following the page's request headers (`setRequestHeaders`) */\n private unwatchHeaders: () => void = () => undefined;\n /** Stops listening to the canvas's context loss and restoration */\n private readonly unwatchContext: () => void;\n\n /** Loads the engine (once per page) and creates a map filling `container` */\n static async create(container: HTMLElement, given: GeoMapOptions = {}): Promise<GeoMap> {\n // A preset under the options given\n const options: GeoMapOptions = given.preset ? { ...IGN_PRESETS[given.preset], ...given } : given;\n // Before anything is created\n if (options.basemap !== undefined) checkBasemap(options.basemap);\n\n // The engine on wgpu (#146): WebGPU, else wgpu's WebGL2 fallback\n const kind = await rendererKind(options.renderer);\n const bindings = await loadEngine(kind, engineUrl(kind, options));\n const map = new GeoMap(container, options, bindings.Engine, kind);\n\n // Its device asked for: the map started on a placeholder meanwhile, its layers created on the engine once it is\n // there (as after a context loss)\n map.adopt(await map.engines.create(map.canvas, () => map.requestRender(), map.settings));\n\n // A profiling script's page (`window.__isardProfile` set before isard loads): its maps, to time\n if (Reflect.get(globalThis, '__isardProfile')) {\n const maps: unknown = Reflect.get(globalThis, '__isardMaps');\n\n Reflect.set(globalThis, '__isardMaps', [...(Array.isArray(maps) ? maps : []), map]);\n }\n\n return map;\n }\n\n private constructor(container: HTMLElement, options: GeoMapOptions, engineClass: EngineClass, renderer: EngineKind) {\n this.engines = new MapEngines(engineClass, renderer, options);\n\n const workerUrl = options.basemapWorkerUrl ?? defaultWorkerUrl(options.assetsUrl);\n\n this.tessUrl = tessUrl(options);\n this.gridUrl = gridUrl(options);\n\n this.workers = new MapWorkers(\n workerUrl,\n options.workers,\n () => this.gone,\n this,\n () => this.quality.workers,\n );\n this.basemaps = new BasemapLayers(this, this.stack, workerUrl, options.basemapTileSize);\n this.container = container;\n this.canvas = createCanvas();\n // The engine takes the canvas for itself: it says how large a texture its device takes\n this.atlases = new SymbolAtlases(\n () => this.#engine.maxTextureSize(),\n options.glyphs,\n () => this.#engine,\n );\n this.overlays = new OverlayHost(container, this.canvas, this);\n this.earth = (options.body ?? 'earth') === 'earth';\n this.body = options.body;\n this.settings = mapSettings(options, this.earth, this.workers.terrainLoader);\n this.frames = new FrameLoop(\n {\n engine: () => this.engine,\n camera: () => this.getCamera(),\n lost: () => this.lost,\n interacting: () => this.interaction?.active === true,\n customLayers: () => this.layers.some((layer) => layer instanceof CustomLayer),\n working: () => this.#working > 0,\n drawn: (hovered) => {\n this.qualityWatch?.frame(performance.now(), this.movingNow);\n // The picking pass sees the frame just drawn; its answer comes on a later frame\n if (hovered && this.listeners.has('hoverfeature')) this.hoverPick.request(hovered, this.hoverPicking);\n // Overlays follow the frame just drawn\n this.overlays.positionAll();\n },\n },\n this.listeners,\n );\n // The engine is made asynchronously (`GeoMap.create` adopts it): a placeholder meanwhile\n this.#engine = destroyedEngine(EARTH_START);\n // Once it has an engine: a map whose creation failed before is not left following them\n this.unwatchHeaders = onHeaderRules((rules) => sendHeaders(this.#engine, rules));\n // The browser may take the GPU away (driver reset, background tab on mobile): the map waits, then rebuilds. A\n // WebGPU device lost is watched with each engine (`adopt`)\n this.unwatchContext = watchContext(\n this.canvas,\n () => this.gpuLost(),\n () => this.restore(),\n );\n\n const start = this.earth ? EARTH_START : BODY_START;\n\n this.setCamera({ ...start, ...options });\n this.setBasemap(options.basemap ?? (this.earth ? 'osm-positron' : 'none'), options.hillshade ?? 0);\n if (options.sun) this.setSun(options.sun);\n this.resizeObserver = new ResizeObserver(() => this.resize());\n this.resizeObserver.observe(container);\n this.#quality = startLevel(options.quality);\n if (options.quality === 'auto') {\n this.qualityWatch = new QualityWatch('high', (level) => this.applyQuality(level));\n // The frames measured are those of a move\n this.on('movestart', () => {\n this.movingNow = true;\n });\n this.on('moveend', () => {\n this.movingNow = false;\n });\n }\n this.unwatchRatio = watchPixelRatio(() => this.resize());\n this.resize();\n\n const interactive = options.interactive ?? true;\n const keyboard = interactive && (options.keyboard ?? true);\n\n this.interaction = interactive ? new Interaction(this, { keyboard }) : undefined;\n labelCanvas(this.canvas, keyboard, options.ariaLabel ?? 'Map');\n\n const attribution = options.attributionControl ?? true;\n\n if (attribution !== false) {\n this.addControl(new AttributionControl(attribution === true ? {} : attribution), 'bottom-right');\n }\n }\n\n /** The element the map was created in */\n getContainer(): HTMLElement {\n return this.container;\n }\n\n getCanvas(): HTMLCanvasElement {\n return this.canvas;\n }\n\n /** @internal The engine (replaced after a context loss) */\n get engine(): Engine {\n return this.#engine;\n }\n\n /** Layers in drawing order (bottom first) */\n private get layers(): readonly Layer[] {\n return this.stack.layers;\n }\n\n /** Layers new layers go under */\n private get onTop(): Set<Layer> {\n return this.stack.onTop;\n }\n\n /** WebGPU devices lost so far: each one makes the next engine lighter (`lighten`) */\n #losses = 0;\n\n /** What the map draws through: `'webgpu'`, or `'webgl2'` (the fallback of a browser without WebGPU, or of a device\n * WebGPU kept losing) */\n get renderer(): 'webgpu' | 'webgl2' {\n return this.engines.renderer;\n }\n\n /** The GPU is lost: nothing drawn, the engine dropped (`dropLostEngine`) */\n private gpuLost(): void {\n this.lost = true;\n this.frames.cancel();\n this.dropLostEngine();\n }\n\n /**\n * Follows the loss of `engine`'s WebGPU device (a phone taking its memory back, a driver reset, the GPU process\n * gone): while it is the map's, the map drops it and makes a new one at once, WebGPU having no event for the GPU\n * given back, lighter so as not to lose it again (`lighten`). The device of an engine the map freed itself\n * (replaced, the map destroyed) is lost too: not the map's any more, left be\n */\n private watchDevice(engine: Engine): void {\n void engine\n .gpuDevice()\n ?.lost.then(async (info) => {\n if (this.gone || this.#engine !== engine) return;\n this.gpuLost();\n\n const recovery = await this.lighten();\n\n console.warn(\n `isard: the GPU device was lost (${info.reason}: ${info.message}), the map made again (${recovery})`,\n );\n this.emit('gpulost', { reason: info.reason, message: info.message, losses: this.#losses, recovery });\n this.restore();\n })\n // The fallback's module not loaded: told, as a failed restore is\n .catch(report);\n }\n\n /**\n * After a device lost, the next engine lighter, the same scene then holding less: at the first loss the low quality\n * (one pixel a CSS pixel, no sun's shadows, one worker, fewer tiles far away) and half the GPU memory budget; at the\n * next one, the WebGL2 fallback (a phone whose WebGPU keeps losing its device: Safari's GPU process taking its\n * memory back) and half the budget again. What it did: `'lighter'` or `'webgl2'`\n */\n private async lighten(): Promise<'lighter' | 'webgl2'> {\n this.#losses += 1;\n this.settings.memory = Math.max(MIN_MEMORY, this.settings.memory / 2);\n if (this.#losses === 1 || this.engines.renderer === 'webgl2') {\n this.qualityWatch = undefined;\n this.applyQuality('low');\n\n return 'lighter';\n }\n await this.engines.fallBack();\n\n return 'webgl2';\n }\n\n /**\n * The context is lost: its engine freed at once, the map's calls going to one that does nothing until `restore`\n * builds the next. The old engine's GPU objects went with the context: deleted now, it is silent (on the context\n * restored, each one warns); its 3D Tiles downloads stop. Its layers' updates meanwhile (a tile uploaded, labels)\n * would fail on the lost context, whose limits read 0\n */\n private dropLostEngine(): void {\n this.hoverPick.cancel();\n\n const camera = this.getCamera();\n\n this.#engine.free();\n this.#engine = destroyedEngine(camera);\n // Glyph ranges and icons arriving meanwhile upload to it, not to the freed engine\n this.atlases.attach(this.#engine);\n }\n\n /** After the GPU lost: a new engine with the same camera, settings and layers (same handles, same order); the engine\n * made asynchronously, adopted once there */\n private restore(): void {\n if (this.gone) return;\n\n const make = () => this.engines.create(this.canvas, () => this.requestRender(), this.settings);\n\n make()\n .catch(async (error: unknown) => {\n // WebGPU giving no new device after a loss (an adapter refused): the WebGL2 fallback\n if (this.engines.renderer === 'webgl2') throw error;\n console.warn(`isard: no new WebGPU device (${String(error)}), the map made again through WebGL2`);\n await this.engines.fallBack();\n this.emit('gpulost', { reason: 'unknown', message: String(error), losses: this.#losses, recovery: 'webgl2' });\n\n return make();\n })\n .then((engine) => this.adopt(engine))\n .catch(report);\n }\n\n /** A new engine in place of the map's (a placeholder, or a lost one): the same camera, settings and layers (same\n * handles, same order) */\n private adopt(engine: Engine): void {\n if (this.gone) {\n engine.free();\n\n return;\n }\n this.hoverPick.cancel();\n\n const camera = this.getCamera();\n\n this.#engine.free();\n this.#engine = engine;\n this.lost = false;\n this.watchDevice(engine);\n // Still timed (profiling)\n if (this.gpuTiming) engineGpuTiming(engine, true);\n this.setCamera(camera);\n this.atlases.attach(this.#engine);\n this.stack.reattach(this.#engine);\n this.applySwipe();\n // A street-level eye stays one in the new engine\n if (this.#firstPerson) this.setFirstPerson(this.#firstPerson);\n // What the old engine drew over the scene: the viewshed, the sun's shadows, the panoramas shown\n if (this.viewshed) this.setViewshed(this.viewshed);\n applyClipVolume(this.engine, this.clipVolume, this.settings.body.radius);\n if (this.sun) this.setSun(this.sun);\n this.panoramaSets.forEach((set) => {\n if (set.current) void set.show(set.current.index).catch(report);\n });\n this.resize();\n this.requestRender();\n }\n\n /** The street-level eye, while there is one (`setFirstPerson`) */\n #firstPerson: Required<FirstPersonView> | undefined;\n\n /** The street-level eye, if the camera is one */\n get firstPerson(): Readonly<Required<FirstPersonView>> | undefined {\n return this.#firstPerson;\n }\n\n /**\n * Puts the camera at street level: an eye `height` metres above the ground, looking `bearing` and `pitch`, the\n * drag turning it around (the wheel narrows or widens its field of view); undefined gives back the camera turning\n * around a point, above where the eye stood, facing the same way\n */\n setFirstPerson(view: FirstPersonView | undefined): void {\n if (!view) {\n const was = this.#firstPerson;\n\n this.#firstPerson = undefined;\n if (was) this.setCamera({ center: was.lonLat, zoom: 18, pitch: 60, bearing: was.bearing });\n\n return;\n }\n\n const lonLat: LonLat = [view.lonLat[0], view.lonLat[1]];\n const eye = { height: 1.7, pitch: 90, fov: 75, ...view, lonLat };\n\n eye.pitch = clamp(eye.pitch, ...FIRST_PERSON_PITCH);\n eye.fov = clamp(eye.fov, ...FIRST_PERSON_FOV);\n eye.bearing = ((eye.bearing % 360) + 360) % 360;\n this.#firstPerson = eye;\n this.engine.setFirstPerson(eye.lonLat[0], eye.lonLat[1], eye.height, eye.bearing, eye.pitch, eye.fov);\n this.requestRender();\n }\n\n /** The swipe set (`setSwipe`), applied again with the layers' ids of a new engine */\n private swipe: SwipeOptions | undefined;\n\n /**\n * Compares two states of a place: `layers` shown on one side of a vertical line only, at `position` CSS pixels\n * from the left of the map (left of it by default, `side: 'right'` for the other), the layers beneath them on the\n * other side; `other`: layers shown on the other side only (two meshes of a place, each on its side). Set again as\n * the line moves (a slider, a drag); undefined stops\n */\n setSwipe(options: SwipeOptions | undefined): void {\n const used = options && (options.layers.length > 0 || (options.other?.length ?? 0) > 0);\n\n this.swipe = used ? { ...options, layers: [...options.layers], other: [...(options.other ?? [])] } : undefined;\n this.applySwipe();\n this.requestRender();\n }\n\n private applySwipe(): void {\n const s = this.swipe;\n const idsOf = (layers: readonly Layer[] | undefined) =>\n Uint32Array.from(\n (layers ?? []).filter((l) => l.id >= 0),\n (l) => l.id,\n );\n const ids = idsOf(s?.layers);\n const others = idsOf(s?.other);\n const shown = ids.length > 0 || others.length > 0;\n\n this.engine.setSwipe(s && shown ? s.position : Number.NaN, s?.side === 'right', ids, others);\n }\n\n /** @internal Forgets a removed layer */\n detach(layer: Layer): void {\n this.stack.forget(layer);\n this.credits.forget(layer);\n }\n\n /** @internal The layer is on the map */\n hasLayer(layer: Layer): boolean {\n return !this.gone && this.stack.has(layer);\n }\n\n private addLayer<L extends Layer>(layer: L): L {\n try {\n layer.attach(this.engine);\n } catch (error) {\n // A context lost before the browser says so (its event comes later): nothing could be made on it, the layer is\n // made with the others on the next engine (`restore`). Any other failure is the caller's\n if (!this.contextLost()) throw error;\n }\n // Under the layers kept on top (the basemap's labels)\n this.stack.add(layer);\n this.requestRender();\n\n return layer;\n }\n\n /** Whether the canvas's WebGL context is lost, its event come or not */\n private contextLost(): boolean {\n // On a WebGPU canvas, no WebGL context: null, nothing taken\n return this.lost || this.canvas.getContext('webgl2')?.isContextLost() === true;\n }\n\n /** @internal Keeps a layer above the layers added after it (they go under it), as the labels of a basemap */\n keepOnTop(layer: Layer): void {\n this.onTop.add(layer);\n }\n\n /** @internal Moves a layer under `before`, or on top of all */\n moveLayer(layer: Layer, before: Layer | undefined): void {\n this.stack.move(layer, before);\n this.requestRender();\n }\n\n /** @internal See `LayerHost.replaceLayer` */\n replaceLayer(layer: Layer, old: number): void {\n this.stack.replace(layer, old);\n }\n\n // ── Events ──\n\n /** Listens to an event; returns the function that stops listening */\n on<K extends keyof MapEvents>(type: K, listener: (event: MapEvents[K]) => void): () => void {\n return this.listeners.on(type, listener);\n }\n\n /** @internal Calls the listeners; one that throws is reported and does not stop the others nor the frame */\n emit<K extends keyof MapEvents>(type: K, event: MapEvents[K]): void {\n this.listeners.emit(type, event);\n }\n\n // ── Camera ──\n\n #quality: Quality = 'high';\n /** 'auto': the frames watched, the map stepped down while they stay slow */\n private qualityWatch: QualityWatch | undefined;\n private movingNow = false;\n\n /** The map's quality: `'high'`, `'medium'` or `'low'` (as `GeoMapOptions.quality` says; `'auto'` the level it\n * stepped down to) */\n getQuality(): Quality {\n return this.#quality;\n }\n\n /** @internal What its quality draws */\n get quality(): QualitySettings {\n return QUALITY[this.#quality];\n }\n\n /** Sets the map's quality (`GeoMapOptions.quality`); `'auto'` starts again from `'high'` */\n setQuality(quality: Quality | 'auto'): void {\n this.qualityWatch = quality === 'auto' ? new QualityWatch('high', (level) => this.applyQuality(level)) : undefined;\n this.applyQuality(quality === 'auto' ? 'high' : quality);\n }\n\n private applyQuality(quality: Quality): void {\n if (quality === this.#quality) return;\n this.#quality = quality;\n // The canvas at its pixel ratio, the sun's shadows, the layers' detail\n this.resize();\n if (this.sun) this.setSun(this.sun);\n this.layers.forEach((layer) => {\n layer.qualityChanged();\n });\n this.emit('quality', { quality });\n this.requestRender();\n }\n\n getCamera(): Camera {\n return this.frames.camera ?? this.engine.camera();\n }\n\n setCamera(camera: Partial<Camera>): void {\n const c = { ...this.getCamera(), ...camera };\n\n this.engine.setCamera(c.center[0], c.center[1], c.zoom, c.pitch, c.bearing);\n this.requestRender();\n }\n\n /** Animated move to a camera: over `duration` milliseconds (or the options), ease-out by default */\n easeTo(camera: Partial<Camera>, options: number | AnimationOptions = 600): void {\n const from = this.getCamera();\n const to = { ...from, ...camera };\n\n this.animate(easeTo(() => this.engine, from, to, options));\n // The destination's tiles load during the flight (as Cesium does)\n this.engine.preload(to.center[0], to.center[1], to.zoom, to.pitch, to.bearing);\n }\n\n /**\n * Flight to a camera that zooms out on its way and back in (van Wijk and Nuij's optimal path, as MapLibre's\n * `flyTo`): long moves stay readable. Pitch and bearing follow the progress.\n */\n flyTo(camera: Partial<Camera>, options: FlyToOptions = {}): void {\n const from = this.getCamera();\n const to = { ...from, ...camera };\n const viewport = Math.max(this.canvas.clientWidth, this.canvas.clientHeight);\n\n this.animate(flyTo(() => this.engine, from, to, viewport, options));\n this.engine.preload(to.center[0], to.center[1], to.zoom, to.pitch, to.bearing);\n }\n\n /** Longitudes and latitudes the view covers on the ground: `[west, south, east, north]` */\n getBounds(): [west: number, south: number, east: number, north: number] {\n const [west = -180, south = -85, east = 180, north = 85] = this.engine.bounds();\n\n return [west, south, east, north];\n }\n\n /** Lowest zoom the camera accepts (the widest view) */\n setMinZoom(zoom: number): void {\n this.settings.zoomRange[0] = zoom;\n this.engine.setZoomRange(...this.settings.zoomRange);\n this.requestRender();\n }\n\n setMaxZoom(zoom: number): void {\n this.settings.zoomRange[1] = zoom;\n this.engine.setZoomRange(...this.settings.zoomRange);\n this.requestRender();\n }\n\n /** Highest pitch, degrees, up to 85 */\n setMaxPitch(pitch: number): void {\n this.settings.maxPitch = pitch;\n this.engine.setMaxPitch(pitch);\n this.requestRender();\n }\n\n /** Sky over the plane and the fog of the ground (see `GeoMapOptions.atmosphere`); undefined to remove them */\n setAtmosphere(options: AtmosphereOptions | undefined): void {\n this.settings.atmosphere = atmosphereSettings(options);\n this.engine.setAtmosphere(this.settings.atmosphere);\n this.requestRender();\n }\n\n setProjection(projection: Projection): void {\n this.settings.globe = projection === 'globe';\n this.engine.setGlobe(this.settings.globe);\n this.requestRender();\n }\n\n /** How tiles load and show (see `LoadingMode`) */\n setLoading(mode: LoadingMode): void {\n this.settings.loading = mode;\n this.engine.setImmediateLoading(mode === 'immediate');\n this.requestRender();\n }\n\n /** Space behind the globe (stars, atmosphere halo) */\n setSky(enabled: boolean): void {\n this.settings.sky = enabled;\n this.engine.setSky(enabled);\n this.requestRender();\n }\n\n /** The viewshed set, set again in a new engine */\n private viewshed: ViewshedOptions | readonly ViewshedOptions[] | undefined;\n\n /** The sun set, set again in a new engine */\n private sun: SunOptions | undefined;\n\n /**\n * The sun casting shadows: the buildings, trees, models, 3D Tiles and the relief shade the ground and one another,\n * the walls turned away from it are in their own shade; the labels stay over them. The sun stands where it is at\n * `date` over the map's center (now by default), or at `azimuth` and `altitude`. As it sets the night falls (`night`\n * to set it by hand): the scene tinted in its blue, the windows of the buildings and the streets of `vectors()` lit,\n * the labels light on dark.\n * The shadows cover the ground around the view's center, fading out away from it, and cost two more depth passes\n * of the solid scene each frame. Undefined removes them\n */\n setSun(options: SunOptions | undefined): void {\n this.sun = options;\n if (!options) {\n this.engine.setSun(Number.NaN, Number.NaN, 0, 0);\n this.requestRender();\n\n return;\n }\n\n const { azimuth, altitude } =\n options.azimuth !== undefined && options.altitude !== undefined\n ? { azimuth: options.azimuth, altitude: options.altitude }\n : sunPosition(options.date ?? new Date(), this.getCamera().center);\n // The twilight: from 6° above the horizon to 6° under it, smoothly\n const dusk = Math.min(1, Math.max(0, (6 - altitude) / 12));\n const night = Math.min(1, Math.max(0, options.night ?? dusk * dusk * (3 - 2 * dusk)));\n // The shadows fade with the sun's light; none at a low quality (its light and the night stay)\n const opacity = this.quality.shadows ? Math.min(1, Math.max(0, options.opacity ?? 0.35)) * (1 - night) : 0;\n\n this.engine.setSun(azimuth, altitude, opacity, night);\n this.requestRender();\n }\n\n /** Tints what can be seen from a point and what is hidden from it, within a range, all around or within a cone\n * (`direction`): the relief, extrusions, 3D Tiles and models hide what lies behind them (only what the map has\n * loaded for its view). Several observers (16 at most): what any of them sees is seen, what is hidden from all those\n * that reach it is hidden, in the colors and opacity of the first. Undefined or none removes it */\n setViewshed(options: ViewshedOptions | readonly ViewshedOptions[] | undefined): void {\n this.viewshed = options;\n if (applyViewshed(this.engine, options)) this.requestRender();\n }\n\n private clipVolume: ClipVolume | undefined;\n /** The clipping volume's handles over the map, while it has them */\n private clipHandles: ClipVolumeHandles | undefined;\n\n /** Cuts the 3D layers (models, 3D Tiles, extrusions, point clouds) by a volume, a box, a cylinder or a prism on a\n * polygon: what lies inside it, or outside it (`cut`), the faces the cut opens filled; with `handles`, sized and\n * moved with the pointer (`'clipvolume'` tells each change). Undefined removes it */\n setClipVolume(volume: ClipVolume | undefined): void {\n this.clipVolume = volume;\n applyClipVolume(this.engine, volume, this.settings.body.radius);\n if (volume?.handles) {\n this.clipHandles ??= this.addClipHandles(volume);\n this.clipHandles.set(volume);\n this.overlays.position(this.clipHandles);\n } else if (this.clipHandles) {\n this.overlays.detach(this.clipHandles, this.clipHandles.element);\n this.clipHandles = undefined;\n }\n this.requestRender();\n }\n\n /** The clipping volume set (`setClipVolume`), as its handles left it */\n getClipVolume(): ClipVolume | undefined {\n return this.clipVolume;\n }\n\n private addClipHandles(volume: ClipVolume): ClipVolumeHandles {\n const handles = new ClipVolumeHandles(\n {\n project: (lonLat, height) => this.project(lonLat, height),\n unproject: (point) => this.unproject(point),\n elevationAt: (lonLat) => this.elevationAt(lonLat),\n getCanvas: () => this.canvas,\n moved: (moved) => {\n this.setClipVolume(moved);\n this.emit('clipvolume', moved);\n },\n },\n volume,\n this.settings.body.radius,\n );\n\n this.overlays.attach(handles, handles.element);\n\n return handles;\n }\n\n /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles, NASA's\n * on the Moon and Mars), one of the Earth's models by name (`'ign'`), its options, or false; on another body, its\n * options with a `url` */\n setTerrain(terrain: boolean | TerrainModel | TerrainOptions): void {\n this.settings.terrain = terrainSettings(terrain, this.body, this.settings.body.radius, this.workers.terrainLoader);\n\n const t = this.settings.terrain;\n\n this.engine.setTerrain(t?.url, t?.exaggeration ?? 1, t?.maxZoom, t?.geoid, t?.loader);\n this.credits.changed();\n this.requestRender();\n }\n\n /** @internal Whether a relief is under the basemap: the fills of vector tiles drawn as geometry need their prisms */\n get hasRelief(): boolean {\n return this.settings.terrain !== undefined;\n }\n\n /** @internal The credits of the raster layers (the basemap first) and of the relief in use, each once */\n attributions(): string[] {\n return this.credits.of(this.layers, this.settings.terrain?.attribution);\n }\n\n /** @internal Calls `listener` when the credits change; returns what stops it */\n onAttributionChange(listener: () => void): () => void {\n return this.credits.onChange(listener);\n }\n\n /** Color behind the map, a CSS color (its alpha ignored) */\n setBackground(color: string): void {\n this.settings.background = rgb(color);\n this.engine.setBackground(...this.settings.background);\n this.requestRender();\n }\n\n /** The GPU memory its layers hold (bytes): the tiles of the 3D Tiles and point clouds, kept within the budget\n * (`GeoMapOptions.memory`), the rasters' pools */\n memory(): MapMemory {\n // Two numbers a layer, its id and its bytes, the relief's (id 0) last\n const pairs = this.engine.memory();\n const byId = new Map(Array.from({ length: pairs.length / 2 }, (_, i) => [pairs[2 * i], pairs[2 * i + 1] ?? 0]));\n const layers = this.layers.flatMap((layer) => {\n const bytes = layer.id >= 0 ? byId.get(layer.id) : undefined;\n\n return bytes === undefined ? [] : [{ layer, bytes }];\n });\n\n return {\n budget: this.settings.memory,\n held: [...byId.values()].reduce((sum, bytes) => sum + bytes, 0),\n layers,\n };\n }\n\n /** Tile counters of the raster layers, for diagnostics */\n stats(): RasterLayerStats[] {\n return this.engine.stats();\n }\n\n /** Times the parts of each frame on the GPU, for profiling (`gpuTimings`): timer queries, read a few frames later.\n * An engine built to profile only (`PROFILE=1 bun run build`); false without one, or if the browser cannot\n * (`EXT_disjoint_timer_query_webgl2`) */\n setGpuTiming(on: boolean): boolean {\n this.gpuTiming = engineGpuTiming(this.engine, on);\n\n return this.gpuTiming;\n }\n\n /** The GPU time of the last frame measured (`setGpuTiming`), in all and by part: the backdrop, the ground (the raster\n * layers over the relief), each layer, the shadows, the panorama, the viewshed (ms) */\n gpuTimings(): MapGpuTimings | undefined {\n // The frame's number, then each part's code, layer id (-1 for none) and milliseconds\n const read: unknown = Reflect.get(this.engine, 'gpuTimings');\n const flat: unknown = typeof read === 'function' ? Reflect.apply(read, this.engine, []) : undefined;\n\n if (!(flat instanceof Float64Array) || flat.length === 0) return undefined;\n\n const parts = Array.from({ length: (flat.length - 1) / 3 }, (_, k) => {\n const [code = 0, id = -1, ms = 0] = flat.subarray(1 + k * 3, 4 + k * 3);\n const layer = id >= 0 ? this.layers.find((l) => l.id === id) : undefined;\n\n return { part: GPU_PARTS[code] ?? 'layer', ms, ...(layer && { layer }) };\n });\n\n return { frame: flat[0] ?? 0, ms: parts.reduce((sum, p) => sum + p.ms, 0), parts };\n }\n\n /**\n * The feature under a screen point (CSS pixels), undefined if none: its layer id and index. Reads the pixels around\n * the point of an offscreen picking pass, whatever the number of features, once the GPU is done (a frame or two\n * later: the GPU is not waited for). On hover, listen to 'hoverfeature' instead.\n */\n async pick(point: Point, { radius = 0, layers }: PickOptions = {}): Promise<PickHit | undefined> {\n const only = layers && Uint32Array.from(layers.map((l) => l.id));\n\n return (await pickOnce(() => this.engine, point, radius, only))?.hit;\n }\n\n /**\n * The feature under a screen point (CSS pixels), or the nearest one within `radius` pixels: its layer handle, its\n * index there and, for line, circle and fill layers, the feature itself; undefined if none. `layers` restricts the\n * search to some layers (the others hide nothing).\n */\n async pickFeature(point: Point, options: PickOptions = {}): Promise<FeatureHit | undefined> {\n const hit = await this.pick(point, options);\n\n return hit && this.featureHit(hit);\n }\n\n /** A hit with its layer handle and feature; undefined if the layer is gone */\n private featureHit(hit: PickHit): FeatureHit | undefined {\n const layer = this.layers.find((l) => l.id === hit.layer);\n\n if (!layer) return undefined;\n\n const feature = hasFeatures(layer) ? layer.featureAt(hit.index) : undefined;\n\n return { layer, index: hit.index, feature };\n }\n\n /** Screen point (CSS pixels) of a position on the ground (the relief), or `height` metres above it, undefined\n * behind the camera */\n project(lonLat: LonLat, height = 0): Point | undefined {\n return this.engine.project(lonLat[0], lonLat[1], height);\n }\n\n /** Position under a screen point (CSS pixels), undefined above the horizon */\n unproject(point: Point): LonLat | undefined {\n return this.engine.ground(point[0], point[1]);\n }\n\n /**\n * Street-level panoramas (oriented images of a vehicle's cameras, the iTowns immersive format): their positions\n * and calibrations loaded, none shown until `show`, which projects one onto the scene around it\n */\n async addPanoramas(options: PanoramaOptions): Promise<Panoramas> {\n const host = panoramaHost(this, (lon, lat) => this.engines.geoidHeight(lon, lat));\n const panoramas = await loadPanoramas(host, options);\n\n this.panoramaSets.add(panoramas);\n panoramas.whenRemoved.push(() => {\n this.panoramaSets.delete(panoramas);\n });\n\n return panoramas;\n }\n\n /** The panorama sets, their panorama shown again in a new engine */\n private readonly panoramaSets = new Set<Panoramas>();\n\n /** Altitude of the relief at a position, in metres (exaggeration included): from the copy of its tiles the map\n * keeps, as fine as the tiles loaded there; undefined without relief or where none is loaded yet */\n elevationAt(lonLat: LonLat): number | undefined {\n return this.engine.elevationAt(lonLat[0], lonLat[1]);\n }\n\n /** Metres on the ground per CSS pixel at a screen point (default the center of the map), across the screen: for a\n * scale bar; undefined above the horizon */\n metersPerPixel(point?: Point): number | undefined {\n const [x, y] = point ?? [this.canvas.clientWidth / 2, this.canvas.clientHeight / 2];\n const a = this.unproject([x - 0.5, y]);\n const b = this.unproject([x + 0.5, y]);\n\n if (!a || !b) return undefined;\n\n // Haversine, on the mean radius of the body\n const [dLat, dLon] = [(b[1] - a[1]) * RAD, (b[0] - a[0]) * RAD];\n const h = Math.sin(dLat / 2) ** 2 + Math.cos(a[1] * RAD) * Math.cos(b[1] * RAD) * Math.sin(dLon / 2) ** 2;\n\n return 2 * this.settings.body.radius * Math.asin(Math.min(1, Math.sqrt(h)));\n }\n\n /** Whether a double click zooms in (Shift: out), on by default: off while a drawing takes double clicks */\n setDoubleClickZoom(enabled: boolean): void {\n if (this.interaction) this.interaction.doubleClickZoom = enabled;\n }\n\n /** Whether a drag that turns and tilts the map (right button, Ctrl or Shift) goes around what is under the pointer\n * where it starts, a roof or a mesh as the relief (on by default), or around the screen center */\n setRotateAroundPointer(enabled: boolean): void {\n if (this.interaction) this.interaction.rotateAroundPointer = enabled;\n }\n\n /** What is drawn under a screen point (CSS pixels), on the relief or standing on it (a roof, a wall, a mesh): its\n * position and its height above the relief, in metres; undefined where nothing was drawn. Read from the last copy of\n * the scene's depth (a frame or two old, a pixel every 4 CSS pixels): at once, without waiting for the GPU */\n pickSurface(point: Point): { lonLat: LonLat; height: number } | undefined {\n const hit = this.engine.surface(point[0], point[1]);\n\n return hit && { lonLat: [hit[0], hit[1]], height: hit[2] };\n }\n\n /** The height above the relief, in metres, of the top of what stands at a position: a roof, a mesh, 0 on the bare\n * ground; undefined where nothing of the last frame is there, or until measured: the scene is drawn looking down at\n * it after a frame and read back a frame or two later, the answer kept and measured again every 250 ms at most (ask\n * again on the next `render` event) */\n surfaceAt(lonLat: LonLat): number | undefined {\n return this.engine.surfaceAt(lonLat[0], lonLat[1]);\n }\n\n // ── Overlays and controls ──\n\n /** Adds a control in a corner of the map; controls stack from the corner inward */\n addControl(control: Control, position: ControlPosition = 'top-right'): this {\n this.overlays.addControl(control, position);\n\n return this;\n }\n\n removeControl(control: Control): this {\n this.overlays.removeControl(control);\n\n return this;\n }\n\n /** @internal Shows a marker or popup, placed after every frame from now on */\n attachOverlay(item: Positioned, element: HTMLElement): void {\n this.overlays.attach(item, element);\n }\n\n /** @internal */\n detachOverlay(item: Positioned, element: HTMLElement): void {\n this.overlays.detach(item, element);\n }\n\n /** @internal Places one overlay now (it moved), without drawing a frame */\n positionOverlay(item: Positioned): void {\n this.overlays.position(item);\n }\n\n // ── Layers ──\n\n /** Replaces the basemap and the IGN hillshade, under the other layers (hillshade by default: 0, none). The former\n * names of the Géoplateforme basemaps throw, naming the new ones */\n setBasemap(basemap: Basemap, hillshade = 0): void {\n const name = checkBasemap(basemap);\n\n this.basemaps.replace(name);\n // Off the Earth, the body's own color\n if (this.earth) this.settings.globeColor = SEA[name];\n this.engine.setGlobeColor(...this.settings.globeColor);\n this.basemaps.addHillshade(hillshade);\n this.credits.changed();\n }\n\n /** Raster tiles ({z}, {x}, {y} URL; Web Mercator, or reprojected from another `grid`: longitudes and latitudes,\n * Lambert-93, UTM…), over the layers already added */\n addRaster(options: RasterOptions): RasterLayer {\n const { url, opacity = 1, saturation = 1, size, before, ground = true } = options;\n const { loader, minZoom, maxZoom } = rasterSource(options, this.workers.remoteReprojection);\n const layer = new RasterLayer(this, { url, minZoom, maxZoom, opacity, saturation, size, loader, ground });\n\n this.place(layer, before);\n if (options.attribution) this.credits.set(layer, options.attribution);\n\n return layer;\n }\n\n /**\n * A PMTiles archive (v3) read by range requests: a raster layer of its images, or vector tiles drawn with `style` (by\n * default a plain style of the archive's layers) with their labels. Its header decides which unless `kind` says;\n * `url` with or without `pmtiles://`, relative to the page, or a `blob:` URL. `addRaster({ url: 'pmtiles://…' })` and\n * a style source `pmtiles://…` in `vectorTiles` read archives too\n */\n addPmtiles(options: PmtilesOptions): Promise<RasterLayer | VectorTiles> {\n return pmtilesLayer(this, options);\n }\n\n /** Line network colored by a value per node; `layer.setValues` recolors it in one texture upload */\n addNetwork(options: NetworkOptions): NetworkLayer {\n const { nodes, edges, lines, costs, edgeWidths, width = 2, max = NETWORK_MAX, contour = 0, opacity = 1 } = options;\n const {\n halo = 0,\n haloOpacity = NETWORK_HALO_OPACITY,\n ramp,\n unreachedColor = 'rgba(140, 140, 140, 0.25)',\n fade = 0,\n } = options;\n const style = { width, max, contour, opacity, halo, haloOpacity, ramp, unreachedColor, fade };\n\n validateNetwork(nodes, edges);\n\n return this.place(new NetworkLayer(this, { nodes, edges, lines }, costs, style, edgeWidths), options.before);\n }\n\n /**\n * A layer from its description, as an application's configuration gives it: `{ type, ...options }`, the options of\n * the `add…` method of that type (`'lines'` for `addLines`, `'tiles3d'` for `addTiles3d`…); `before` to go under\n * another layer. The layer's `ready` resolves once the map has drawn it\n */\n add<P = Record<string, unknown>>(spec: LayerSpec<P>): Layer {\n return addSpec<P>(this, spec);\n }\n\n /** @internal A layer made anew from its description, in the place of `old` in the drawing order (old removed) */\n rebuildLayer<P = Record<string, unknown>>(old: Layer, spec: LayerSpec<P>): Layer {\n const index = this.layers.indexOf(old);\n // The first layer above that goes not with it: its companions are removed with it\n const above = index >= 0 ? this.layers.slice(index + 1).find((l) => !old.companions.includes(l)) : undefined;\n const layer = this.add(spec);\n\n if (!('before' in spec && spec.before) && index >= 0) layer.moveBefore(above);\n old.remove();\n\n return layer;\n }\n\n /**\n * @internal Work the map waits on before it is idle (the vector tiles cut in the workers, uploaded over frames): the\n * engine knows only the tiles it holds, not those coming (an engine made anew holds none until the workers cut them\n * again from their cache, no request on the network meanwhile); a frame once it is done, to tell\n */\n track<T>(work: Promise<T>): Promise<T> {\n this.#working += 1;\n\n const done = () => {\n this.#working -= 1;\n this.requestRender();\n };\n\n work.then(done, done);\n\n return work;\n }\n\n /** @internal Resolves once the map is idle (everything in view loaded and drawn) */\n whenIdle(): Promise<void> {\n if (this.gone) return Promise.resolve();\n\n return new Promise((resolve) => {\n const off = this.on('idle', () => {\n off();\n resolve();\n });\n\n this.frames.requestIdle();\n });\n }\n\n /** Lines from GeoJSON (line strings, and polygon outlines), styled per feature */\n addLines<P = Record<string, unknown>>(options: LineOptions<P>): LineLayer<P> {\n return this.place(\n new LineLayer<P>(this, options.data, lineStyle(options), options.altitudeReference),\n options.before,\n );\n }\n\n /** Discs from GeoJSON points, styled per feature */\n addCircles<P = Record<string, unknown>>(options: CircleOptions<P>): CircleLayer<P> {\n return this.place(new CircleLayer<P>(this, options.data, circleStyle(options)), options.before);\n }\n\n /** Filled polygons from GeoJSON (holes included), styled per feature; over the relief they lie on the ground */\n addFills<P = Record<string, unknown>>(options: FillOptions<P>): FillLayer<P> {\n return this.place(new FillLayer<P>(this, options.data, fillStyle(options)), options.before);\n }\n\n /** The application's fragment shader over the ground (see `GroundOptions`); under `before` if given */\n addGround(options: GroundOptions): GroundLayer {\n return this.place(new GroundLayer(this, options), options.before);\n }\n\n /** Polygons raised into blocks with depth (buildings), styled per feature; tiles of them come with `setTile` */\n addExtrusions<P = Record<string, unknown>>(options: ExtrusionOptions<P> = {}): ExtrusionLayer<P> {\n return this.place(\n new ExtrusionLayer<P>(this, options.data, extrusionStyle(options), options.drape),\n options.before,\n );\n }\n\n /** Text labels from GeoJSON (points, the middle of lines, the center of polygons), placed without overlaps */\n addSymbols<P = Record<string, unknown>>(options: SymbolOptions<P>): SymbolLayer<P> {\n return this.place(new SymbolLayer<P>(this, options.data, symbolStyle(options)), options.before);\n }\n\n /** @internal The glyphs of the symbol layers, loaded on first use */\n get glyphs(): Glyphs {\n return this.atlases.glyphs;\n }\n\n /** @internal The icons of the symbol layers: the application's images and the vector basemaps' sprites */\n get icons(): Icons {\n return this.atlases.icons;\n }\n\n /**\n * An image for the symbol layers' icons (`icon: name`), as MapLibre's `addImage`: its pixels (an image, a canvas,\n * `ImageData`, or RGBA bytes with their size), `pixelRatio` 2 for an image drawn at twice its CSS size; `sdf` for a\n * signed distance field drawn in the `iconColor`; `stretchX`, `stretchY` and `content` for an icon stretched around its\n * text. An image of the same name is replaced\n */\n addImage(\n name: string,\n image: Pixels | (CanvasImageSource & { width: number; height: number }),\n options: ImageOptions = {},\n ): void {\n this.atlases.addImage(name, image, options);\n }\n\n hasImage(name: string): boolean {\n return this.atlases.hasImage(name);\n }\n\n removeImage(name: string): void {\n this.atlases.removeImage(name);\n }\n\n /**\n * Vector tiles with a MapLibre style (OpenFreeMap's Positron by default): `tiles.raster(…)` draws its fills and lines\n * (or a subset) as a raster layer, `tiles.vectors(…)` as geometry, `tiles.labels(…)` its labels.\n * `setBasemap('osm-positron')` draws the basemap with a raster layer and the labels.\n */\n vectorTiles(options: VectorTilesOptions = {}): VectorTiles {\n const tiles = new VectorTiles(this, {\n ...(this.workers.url ? { workerUrl: this.workers.url } : {}),\n ...options,\n });\n\n // Its workers stop with the map\n this.vectorSets.add(tiles);\n\n return tiles;\n }\n\n /** @internal The geometry of a `VectorTiles` (`vectors`), under `before` if given */\n addVectorLayer(before?: Layer): VectorLayer {\n return this.place(new VectorLayer(this), before);\n }\n\n /** @internal Forgets a destroyed `VectorTiles` */\n dropVectorTiles(tiles: VectorTiles): void {\n this.vectorSets.delete(tiles);\n }\n\n /**\n * @internal The workers for a `VectorTiles`: the map's shared pool, or a pool of its own (`own`, to stop with it)\n * when it asks for another count or URL\n */\n basemapWorkers(count?: number, url?: string | URL): { pool: BasemapWorkers; own: boolean } {\n return this.workers.pool(count, url);\n }\n\n /** Adds a layer, under `before` if given */\n private place<L extends Layer>(layer: L, before: Layer | undefined): L {\n this.addLayer(layer);\n if (before) this.moveLayer(layer, before);\n\n return layer;\n }\n\n /** Textured meshes in 3D Tiles (photogrammetry, buildings), drawn with depth over the basemap */\n addTiles3d(options: Tiles3dOptions): Tiles3dLayer {\n const {\n url,\n maxScreenSpaceError = 16,\n opacity = 1,\n pointSize,\n color,\n geoid = false,\n facades = false,\n drape,\n } = options;\n\n return this.place(\n new Tiles3dLayer(\n this,\n url,\n geoid,\n {\n maxScreenSpaceError,\n opacity,\n ...(pointSize !== undefined ? { pointSize } : {}),\n ...(color !== undefined ? { color } : {}),\n },\n facades,\n drape,\n ),\n options.before,\n );\n }\n\n /**\n * A point cloud (see `PointCloudOptions`): a COPC file read by range requests (IGN's LiDAR HD…), or 3D Tiles\n * points; with depth; under `before` if given\n */\n addPointCloud(options: PointCloudOptions): PointCloudLayer {\n return this.place(new PointCloudLayer(this, options), options.before);\n }\n\n /**\n * The grids of a GRIB2 or classic NetCDF file (its URL, or its bytes): a weather or ocean model's fields on grids of\n * longitudes and latitudes, read in a worker by the grid module (loaded with the first file). GRIB2 on a regular\n * latitude/longitude grid, packed simply, in groups or in groups of spatial differences (NOAA's GFS); NetCDF-3 with\n * the CF conventions. `windFields` pairs a wind's components into the fields of `addFlow`\n */\n readGrids(source: string | URL | ArrayBuffer | Uint8Array, options: { signal?: AbortSignal } = {}): Promise<Grid[]> {\n return this.workers.readGrids(source, this.gridUrl, options.signal);\n }\n\n /** Particles carried by a field of velocities (a wind, a current), their trails animated and colored by speed on\n * the globe and the relief (see `FlowOptions`) */\n addFlow(options: FlowOptions): FlowLayer {\n return this.place(new FlowLayer(this, options), options.before);\n }\n\n /** A glTF model drawn at positions (see `ModelOptions`), with depth */\n addModels(options: ModelOptions): ModelLayer {\n return this.place(new ModelLayer(this, options), options.before);\n }\n\n /** Trees at the points of a source that has them (a city's street trees), broadleaved or conifers by their data,\n * scaled to their height (see `TreeOptions`); the conifers on a layer that goes with the one returned */\n addTrees<P = Record<string, unknown>>(options: TreeOptions<P>): ModelLayer {\n return addTrees((o) => this.addModels(o), options);\n }\n\n /** A photo standing where it was taken, facing its way (see `PhotoOptions`): flat on a frame across its field of\n * view, a 360° one on a band round its camera; resolves once its image is read */\n addPhoto(options: PhotoOptions): Promise<ModelLayer> {\n return addPhoto((o) => this.addModels(o), options);\n }\n\n /**\n * The page's own WebGPU drawing at its place among the layers, in every frame (see `CustomLayerInterface`): raw\n * WebGPU, three.js's WebGPU renderer… with the map's device and the matrices of the frame (`frame.matrixAt`); under\n * `before` if given. Not drawn on the WebGL2 fallback\n */\n addCustomLayer(layer: CustomLayerInterface, options: { before?: Layer } = {}): CustomLayer {\n const custom = new CustomLayer(\n this,\n layer,\n this,\n (lon, lat, altitude) => this.engines.customMatrix(lon, lat, altitude),\n () => this.getCamera(),\n );\n\n return this.place(custom, options.before);\n }\n\n // ── Frames ──\n\n /** Asks for a frame; several calls before the next frame draw it once */\n requestRender(): void {\n this.frames.request();\n }\n\n /** @internal Runs `step` every frame until it returns false; replaces the running animation */\n animate(step: Step | undefined): void {\n this.frames.animate(step);\n }\n\n /** @internal The pointer moved over the map (undefined: it left). Without 'hover' and 'hoverfeature' listeners,\n * nothing is drawn: a still map stays idle under a moving mouse */\n hover(point: Point | undefined): void {\n if (!point) {\n this.frames.hover(undefined);\n this.hoverPick.cancel();\n\n return;\n }\n if (!this.listeners.has('hover') && !this.listeners.has('hoverfeature')) return;\n this.frames.hover(point);\n this.requestRender();\n }\n\n private resize(): void {\n if (this.lost) return;\n\n const { clientWidth: width, clientHeight: height } = this.canvas;\n const ratio = Math.min(window.devicePixelRatio || 1, this.quality.pixelRatio);\n\n this.canvas.width = Math.round(width * ratio);\n this.canvas.height = Math.round(height * ratio);\n this.engine.resize(width, height, ratio);\n this.overlays.size = [width, height];\n this.emit('resize', { width, height });\n // Draw at once: a resized canvas is cleared, waiting one frame would flash\n this.frames.drawNow();\n }\n\n destroy(): void {\n if (this.gone) return;\n this.gone = true;\n // A context restored later rebuilds nothing\n this.unwatchContext();\n\n const camera = this.getCamera();\n\n this.frames.stop();\n this.hoverPick.cancel();\n this.basemaps.destroy();\n [...this.vectorSets].forEach((tiles) => {\n tiles.remove();\n });\n this.vectorSets.clear();\n this.workers.terminate();\n this.unwatchRatio();\n this.unwatchHeaders();\n this.resizeObserver.disconnect();\n this.interaction?.destroy();\n this.engines.destroy();\n // Custom layers free their GPU objects, models their data, while the device is there\n this.stack.dispose();\n this.engine.free();\n // Work still under way (labels being shaped, tiles arriving, timers) may call the engine after this: it finds one\n // that does nothing, and nothing is drawn again\n this.#engine = destroyedEngine(camera);\n // Glyph ranges still arriving upload to it, not to the freed engine\n this.atlases.attach(this.#engine);\n this.lost = true;\n this.overlays.destroy();\n this.listeners.clear();\n }\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -523,6 +523,15 @@ export interface MapEvents {
523
523
  quality: {
524
524
  quality: Quality;
525
525
  };
526
+ /** The WebGPU device was lost (a phone taking its memory back, the GPU process gone): the map made again at once,
527
+ * lighter (`recovery`): `'lighter'`, the low quality and half the GPU memory budget (the first loss); `'webgl2'`,
528
+ * through the WebGL2 fallback (a loss after it, or no new WebGPU device). `losses`: how many so far */
529
+ gpulost: {
530
+ reason: string;
531
+ message: string;
532
+ losses: number;
533
+ recovery: 'lighter' | 'webgl2';
534
+ };
526
535
  /** Everything in view is loaded and drawn, nothing moves: the end of a load, once after each change (as MapLibre's
527
536
  * `idle`). Tiles requested by the first frame count, so it never fires before they arrive. */
528
537
  idle: Record<string, never>;
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,0CAA0C","sourcesContent":["/** Public types of the `isard` package */\n\nimport type { TileGrid } from './basemap/grid.ts';\nimport type { DecoderUrls } from './decoding/decoders.ts';\nimport type { Feature, Ramp, Size } from './layers/features.ts';\nimport type { Layer } from './layers/layers.ts';\nimport type { RasterLayer } from './layers/raster.ts';\nimport type { QualitySettings } from './map/quality.ts';\nimport type { AttributionOptions } from './ui/controls.ts';\nimport type { Camera, Engine } from './wasm/isard_webgpu.js';\n\nexport type LonLat = [lon: number, lat: number];\nexport type Point = [x: number, y: number];\n\n/**\n * The named basemaps. OpenFreeMap's vector styles, OpenStreetMap data worldwide, their labels above the other layers:\n * `osm-positron` (light grey, quiet: data over it reads first), `osm-liberty` and `osm-bright` (in colour), `osm-dark`\n * (near black: bright data over it, a wind's particles, lights). The\n * Géoplateforme's (IGN, France): rasters (`ign-plan`, `ign-plan-grey`, `ign-ortho`, the aerial photographs) or vector\n * tiles with their labels (`ign-plan-vector`, `ign-plan-grey-vector`, the PLAN.IGN styles).\n */\nexport type BasemapName =\n | 'osm-positron'\n | 'osm-liberty'\n | 'osm-bright'\n | 'osm-dark'\n | 'ign-plan'\n | 'ign-plan-grey'\n | 'ign-ortho'\n | 'ign-plan-vector'\n | 'ign-plan-grey-vector'\n | 'none';\n\n/** A basemap by name (see `BasemapName`) */\nexport type Basemap = BasemapName;\n\n/**\n * The Earth's named terrain models. `'terrain-tiles'`: worldwide, the Terrain Tiles of AWS's open data registry\n * (SRTM, EU-DEM, GMTED… merged by Mapzen, 30 m in most places), the sea floor flattened at sea level. `'ign'`: France,\n * the IGN's RGE ALTI from the Géoplateforme (1 to 5 m), raised by the RAF20 geoid to heights above the ellipsoid.\n */\nexport type TerrainModel = 'terrain-tiles' | 'ign';\n\n/** How tiles encode their altitudes: `'float32'`, raw little-endian floats (`image/x-bil;bits=32`, an ArcGIS raw\n * grid); `'terrarium'`, the colors of a PNG, `R × 256 + G + B / 256 - 32768`; `'mapbox'`, those of Terrain-RGB,\n * `(R × 65536 + G × 256 + B) / 10 - 10000` */\nexport type TerrainEncoding = 'float32' | 'terrarium' | 'mapbox';\n\n/**\n * How tiles load and show. 'immediate' (default): everything visible loads, tiles show as soon as they arrive.\n * 'smooth': during flights the levels flown through are skipped, off-center tiles wait while the camera moves, tiles\n * fade in; fewer downloads, for slow networks or GPUs.\n */\nexport type LoadingMode = 'immediate' | 'smooth';\n\n/** 'globe': a sphere at low zoom, blending into Web Mercator between zooms 5 and 7, up to three levels later under a\n * tilted camera (it sees much farther than its center: the horizon stays curved) */\nexport type Projection = 'globe' | 'mercator';\n\n/** A body to draw the map on, other than the named ones (`CelestialBody`) */\nexport interface BodyOptions {\n /** Equatorial radius, metres */\n radius: number;\n /** Flattening of its ellipsoid, 0 for a sphere (default 0) */\n flattening?: number;\n /** An atmosphere: its halo around the globe, true for the Earth's light blue, or a CSS color (its alpha the\n * halo's strength) (default false) */\n atmosphere?: boolean | string;\n /** Color of the globe where no tile covers it (past the Web Mercator latitudes, 85°), a CSS color (default\n * `#808080`) */\n color?: string;\n /** Lowest and highest altitudes of its ground, metres around the ellipsoid: what its relief may raise into view\n * (default ±1 % of the radius) */\n relief?: [lowest: number, highest: number];\n}\n\n/**\n * The body the map is drawn on: 'earth' (WGS 84, the default), 'moon' (a sphere of 1 737 400 m, no atmosphere),\n * 'mars' (a sphere of 3 396 190 m, its equatorial radius, a thin dusty halo; planetocentric latitudes) or another\n * one. Zoom levels keep their meaning on screen (the Web Mercator tile pyramid), their metres follow the body:\n * altitudes, relief, buildings, 3D Tiles. Off the Earth, the map has none of the Earth's defaults: no basemap, no\n * credits, and space for its background; the Moon and Mars have NASA's relief for `terrain: true`.\n */\nexport type CelestialBody = 'earth' | 'moon' | 'mars' | BodyOptions;\n\n/** A level of the map's quality (`GeoMapOptions.quality`) */\nexport type Quality = 'high' | 'medium' | 'low';\n\nexport interface GeoMapOptions extends Partial<Camera> {\n /** The body the map is drawn on (default 'earth'); set at creation */\n body?: CelestialBody;\n /** Default 'globe' */\n projection?: Projection;\n /** Default 'immediate' */\n loading?: LoadingMode;\n /** The basemap (default 'osm-positron'; 'none' off the Earth) */\n basemap?: Basemap;\n /** Opacity of the IGN hillshade over the basemap (France, Géoplateforme), 0 for none (default 0) */\n hillshade?: number;\n /** Color behind the map (sky of tilted flat views), a CSS color (default `#f2f2f0`; black off the Earth) */\n background?: string;\n /** Space behind the globe: stars and atmosphere halo, fading out as the globe turns flat (default true) */\n sky?: boolean;\n /** The sun casting the shadows of buildings, trees, models and the relief (`setSun`); none by default */\n sun?: SunOptions;\n /** What the map draws less of on a device that cannot keep up (`setQuality`): `'high'` (the default) all of it;\n * `'medium'` at most 1.5 device pixels a CSS pixel, the 3D Tiles coarser far away; `'low'` one device pixel a CSS\n * pixel, no sun's shadows, the 3D Tiles coarser still; `'auto'` high, a level lower each time the frames stay slow\n * while the map moves (`'quality'` event) */\n quality?: Quality | 'auto';\n /** The GPU memory, megabytes, the layers' tiles (3D Tiles, point clouds, vector tiles) and the rasters' tiles may\n * hold all together: past it the tiles drawn least recently are unloaded, whichever their layer, the vector tiles\n * (those of the view) kept (`GeoMap.memory`). `'auto'` (the default): 256 on a touch screen (a phone, a tablet: iOS\n * closes a page past about a gigabyte, the page's workers included), 1024 elsewhere. Set at creation */\n memory?: number | 'auto';\n /** Multisampled antialiasing of the canvas (default true): the edges of the buildings, 3D Tiles and models smooth.\n * False draws each pixel once (lines and halos antialias themselves): wide translucent layers, a network's halo over\n * a region, cost up to four times less on an integrated GPU (MapLibre's default). Set at creation */\n antialias?: boolean;\n /** The engine on wgpu (#146): 'auto' (default) WebGPU where the browser gives an adapter, else wgpu's WebGL2 fallback;\n * 'webgpu' or 'webgl' forces one */\n renderer?: 'auto' | 'webgpu' | 'webgl2';\n /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles; NASA's on\n * the Moon and Mars: LOLA, MOLA), one of the Earth's models by name (`'ign'`: France, RGE ALTI), or its options\n * (default false; on another body, its `url` is required). Network layers are draped on it */\n terrain?: boolean | TerrainModel | TerrainOptions;\n minZoom?: number;\n maxZoom?: number;\n /** Highest pitch, degrees, up to 85 (default 70) */\n maxPitch?: number;\n /** Sky over the plane, seen when the camera is tilted towards the horizon, and the fog the ground fades into\n * (MapLibre's `setSky`); default none: the background color */\n atmosphere?: AtmosphereOptions;\n /** Mouse, touch and keyboard controls (default true) */\n interactive?: boolean;\n /** Keyboard controls once the map has the focus (it is reached with Tab): arrows pan, Shift + arrows rotate and\n * tilt, + and - zoom (Shift: two levels), 0 faces north and levels the view (default true; none when not\n * `interactive`) */\n keyboard?: boolean;\n /** Accessible name of the map, read by screen readers (default 'Map') */\n ariaLabel?: string;\n /** A preset of map options (`IGN_PRESETS`: `'ign'`, `'ign-3d'`, `'ign-ortho-3d'`), the other options over it */\n preset?: 'ign' | 'ign-3d' | 'ign-ortho-3d';\n /** The folder isard's files are served from (its engines, `isard_webgpu_bg.wasm`, `isard_webgl2_bg.wasm`, its\n * modules, `isard_points_bg.wasm`, `isard_tiles3d_bg.wasm`, `isard_tess_bg.wasm`, `isard_grid_bg.wasm`, and its\n * workers, `decoder.worker.js`, `basemap.worker.js`): one option for a bundler that moves them, the `…Url` options\n * below for each one. `isard/vite` sets it for the whole page; default next to the module */\n assetsUrl?: string | URL;\n /** Where to load the engine on WebGPU from (`isard_webgpu_bg.wasm`), when a bundler does not resolve the default URL */\n webgpuWasmUrl?: string | URL;\n /** Where to load the engine's WebGL2 fallback from (`isard_webgl2_bg.wasm`, for a browser without WebGPU), when a\n * bundler does not resolve the default URL */\n webgl2WasmUrl?: string | URL;\n /** Where the decoding workers load the point cloud module from (`isard_points_bg.wasm`, the LAZ decoder of COPC),\n * when a bundler does not resolve the default URL. Loaded with the first point cloud only */\n pointsWasmUrl?: string | URL;\n /** Where the decoding workers load the 3D Tiles module from (`isard_tiles3d_bg.wasm`: a tile's content decoded for\n * the GPU), when a bundler does not resolve the default URL. Loaded with the first tile */\n tiles3dWasmUrl?: string | URL;\n /** Where the basemap workers load the tessellation module from (`isard_tess_bg.wasm`: the vector tiles drawn as\n * geometry, `vectorTiles().vectors()`, made ready for the GPU off the main thread), when a bundler does not resolve\n * the default URL. Loaded with the first tile of geometry; without it, the main thread does that work */\n tessWasmUrl?: string | URL;\n /** Where the workers load the grid module from (`isard_grid_bg.wasm`: GRIB2 and NetCDF files read by\n * `map.readGrids`), when a bundler does not resolve the default URL. Loaded with the first file */\n gridWasmUrl?: string | URL;\n /** Where to load the vector basemap worker from, when a bundler does not resolve the default URL */\n basemapWorkerUrl?: string | URL;\n /** Texture size of the vector basemap's tiles, pixels (default 512: lines and edges sharp at every zoom on a screen\n * of pixel ratio 1). 256: a quarter of the drawing in the workers, of the uploads and of the GPU memory, for lines\n * and edges a little softer between two zoom levels (the tiles are shown 181 to 362 CSS pixels wide) */\n basemapTileSize?: number;\n /** Glyphs of the symbol layers: a URL with `{fontstack}` and `{range}` (MapLibre's glyph format; default\n * OpenFreeMap's fonts, Noto Sans). A vector basemap's labels take the glyphs of its style */\n glyphs?: string;\n /** Workers decoding 3D Tiles off the main thread: a count, or false to decode on the main thread (default: cores - 1,\n * 1 to 4). False (or 0) also decodes the PNG relief and reprojects the equirectangular rasters on the main thread,\n * else done by the vector basemap's workers */\n workers?: number | false;\n /** Where to load the decoding worker from, when a bundler does not resolve the default URL */\n workerUrl?: string | URL;\n /** Folders of the Draco and Basis Universal decoders, loaded by the workers on first use (default: the official\n * builds on gstatic.com and jsDelivr; self-host them for offline or locked-down networks). They run through\n * `new Function`: a Content Security Policy needs `'unsafe-eval'` (see `DecoderUrls`) */\n decoders?: Partial<DecoderUrls>;\n /** Credits at the bottom right: false for none, or its options (default true: the credits of the basemap,\n * hillshade and relief in use, compact on maps narrower than 640 px) */\n attributionControl?: boolean | AttributionOptions;\n}\n\nexport interface TerrainOptions {\n /** One of the Earth's named models (default `'terrain-tiles'` on the Earth); unused with a `url` */\n model?: TerrainModel;\n /** Altitudes of 256 × 256 tiles in `encoding`: a WMS GetMap URL with {bbox} (EPSG:3857 on the Earth, the body's\n * Mercator metres elsewhere: the sphere of its radius), a tile URL with {z}, {x} and {y}, or an ArcGIS image service\n * (a URL ending in `/ImageServer`), asked for raw altitudes in the body's Mercator (default: the `model`'s; on the\n * Moon and Mars, NASA's Trek LOLA and MOLA models) */\n url?: string;\n /** How the tiles of `url` encode their altitudes (default `'float32'`); `'terrarium'` and `'mapbox'` take a URL with\n * {z}, {x} and {y} */\n encoding?: TerrainEncoding;\n /** Vertical exaggeration, 1 for the true relief (default 1) */\n exaggeration?: number;\n /** Finest level of the relief, up to 15 (default 15; 14 for the Terrain Tiles, 8 for the Moon's and Mars's models). It\n * starts at level 6 on the Earth, coarser on bodies of a larger relief for their size (3 on the Moon and Mars) */\n maxZoom?: number;\n /** Altitudes over mainland France raised by the height of the RAF20 geoid (the French one, 0 away from France), to\n * heights above the ellipsoid (those of 3D Tiles); false keeps the altitudes as served (NGF-IGN69 for the IGN's)\n * (default true for the `'ign'` model, false otherwise) */\n geoid?: boolean;\n}\n\n/** Sky, horizon and fog over the plane, with the names and meanings of MapLibre's `setSky` */\nexport interface AtmosphereOptions {\n /** A CSS color (default `#9cc7ec`) */\n skyColor?: string;\n /** (default `#e8f1f8`) */\n horizonColor?: string;\n /** (default `#f2f5f8`) */\n fogColor?: string;\n /** Blend from the horizon to the sky color, share of the field of view above the horizon, 0-1 (default 0.6) */\n skyHorizonBlend?: number;\n /** Blend from the horizon to the fog color below the horizon, 0-1 (default 0.7) */\n horizonFogBlend?: number;\n /** Share of the distance to the far plane over which the ground fades into the fog, 0-1 (default 0.4) */\n fogGroundBlend?: number;\n}\n\n/** The sun casting shadows (`GeoMap.setSun`): where it stands, by date or by hand, and how dark its shadows are */\nexport interface SunOptions {\n /** The time: the sun where it stands then over the map's center (default now, unless `azimuth` and `altitude`) */\n date?: Date;\n /** Degrees clockwise from north, with `altitude`: the sun placed by hand */\n azimuth?: number;\n /** Degrees above the horizon; at or under it, no shadows */\n altitude?: number;\n /** How dark the shadows are, 0 to 1 (default 0.35) */\n opacity?: number;\n /** How dark the night is, 0 to 1: the scene tinted in its blue, the windows of the buildings and the streets of\n * `vectors()` lit, the labels light on dark. By default from the sun's altitude: falling from 6° above the horizon\n * to 6° under it */\n night?: number;\n}\n\n/** What can be seen from a point (`GeoMap.setViewshed`); with several observers, the colors, the opacity and the\n * cone's color are the first one's */\nexport interface ViewshedOptions {\n /** The observer */\n position: LonLat;\n /** Metres above the ground (default 1.7, eye level) */\n height?: number;\n /** Metres around the observer that are tinted (default 1000) */\n range?: number;\n /** A CSS color for what is seen (default `#2f9e44`) */\n visibleColor?: string;\n /** A CSS color for what is hidden (default `#e03131`) */\n hiddenColor?: string;\n /** How strongly the colors tint the scene, multiplied into it so that its textures and shading stay, 0-1 (default\n * 0.7) */\n opacity?: number;\n /** A CSS color for the cone drawn in 3D (one way only): its fan through the axis, at the eye's height and tilted\n * with it, from the eye to the range; solid where nothing hides it, faint behind the scene; none by default */\n coneColor?: string;\n /** To look one way only (a camera, a lookout), degrees clockwise from north; all around without it */\n direction?: number;\n /** Degrees above the horizon the cone looks, negative below (default 0) */\n tilt?: number;\n /** Angle of view across, degrees (default 60) */\n fov?: number;\n /** Angle of view up and down, degrees (default 40) */\n verticalFov?: number;\n}\n\n/** What every clipping volume has (`ClipVolume`) */\ninterface ClipVolumeBase {\n /** Metres of its foot above the ground (or above the ellipsoid, `altitudeReference: 'sea'`); 0 by default */\n altitude?: number;\n /** What the altitude is above: `'ground'` (the relief, the default) or `'sea'` (the ellipsoid), as the models' */\n altitudeReference?: 'ground' | 'sea';\n /** Metres up from its foot */\n height: number;\n /** What is cut: `'inside'` (the default) what lies inside the volume, `'outside'` what lies outside it */\n cut?: 'inside' | 'outside';\n /** A CSS color for the faces the cut opens, the inside of walls and floors (default `#d9cfc1`); `null` leaves them\n * open */\n sectionColor?: string | null;\n /** Handles on the volume to size and move it with the pointer: a disc on each of a box's faces, on a cylinder's rim,\n * on each of a polygon's vertices, on the top and the bottom, and one at its middle to move it; the map tells each\n * change by `'clipvolume'`. None by default */\n handles?: boolean;\n}\n\n/** A box: its foot's center, its size, its heading */\nexport interface ClipBox extends ClipVolumeBase {\n shape: 'box';\n /** The center of its foot */\n position: LonLat;\n /** Metres across its heading */\n width: number;\n /** Metres along its heading */\n length: number;\n /** Degrees clockwise from north of its length; 0 by default */\n heading?: number;\n}\n\n/** A cylinder standing up: its foot's center, its radius */\nexport interface ClipCylinder extends ClipVolumeBase {\n shape: 'cylinder';\n /** The center of its foot */\n position: LonLat;\n /** Metres */\n radius: number;\n}\n\n/** A prism standing on a polygon: a building's outline, a plot */\nexport interface ClipPolygon extends ClipVolumeBase {\n shape: 'polygon';\n /** Its vertices, 3 to 16, open (its last not repeating its first) */\n polygon: LonLat[];\n}\n\n/**\n * A volume cutting the map's 3D layers (`GeoMap.setClipVolume`): a box, a cylinder or a prism on a polygon. The models,\n * the 3D Tiles, the extrusions and the point clouds are cut; the ground and the flat layers stay whole. What lies\n * inside it is cut, all around it stays (a cutaway, to look into a building or under the ground), or what lies outside\n * it (a BIM viewer's section box); the faces the cut opens filled, as a section on a plan.\n */\nexport type ClipVolume = ClipBox | ClipCylinder | ClipPolygon;\n\n/** An eye at street level (`GeoMap.setFirstPerson`) */\nexport interface FirstPersonView {\n /** Where it stands */\n lonLat: LonLat;\n /** Metres above the ground (default 1.7) */\n height?: number;\n /** Degrees clockwise from north it looks to */\n bearing: number;\n /** Degrees from straight down: 90 level (the default), 180 straight up */\n pitch?: number;\n /** Vertical field of view, degrees (default 75) */\n fov?: number;\n}\n\n/** Layers shown on one side of a vertical line only (`GeoMap.setSwipe`) */\nexport interface SwipeOptions {\n /** CSS pixels from the left of the map */\n position: number;\n layers: readonly Layer[];\n /** The side they show on (default 'left') */\n side?: 'left' | 'right';\n /** Layers shown on the other side only: two meshes of the same place, each on its side, never drawn over each other */\n other?: readonly Layer[];\n}\n\n/** Animation of a camera move */\nexport interface AnimationOptions {\n /** Milliseconds */\n duration?: number;\n /** Progress over time, both 0 to 1 */\n easing?: (t: number) => number;\n}\n\nexport interface FlyToOptions extends AnimationOptions {\n /** How far the flight zooms out on its way, as MapLibre's `curve` (default 1.42) */\n curve?: number;\n /** Average speed in screens per second when `duration` is not given (default 1.2) */\n speed?: number;\n}\n\n/**\n * Tile grid of a raster's URL. 'mercator': Web Mercator (XYZ, WMTS PM), the engine's own. 'equirectangular':\n * longitudes and latitudes (Plate Carrée, EPSG:4326-like), two 256 px tiles side by side at level 0, rows from the\n * north (NASA's Trek WMTS, WorldCRS84Quad). A `TileGrid`: the tile matrices of a WMTS in any CRS (Lambert-93…), or a\n * WMS asked for each tile's box in its CRS. The last two are reprojected into Web Mercator tiles by the map's workers\n * (in the page with `workers: false`).\n */\nexport type RasterGrid = 'mercator' | 'equirectangular' | TileGrid;\n\n/** The GPU memory of a map's layers (`GeoMap.memory`), bytes */\nexport interface MapMemory {\n /** What they may hold (`GeoMapOptions.memory`) */\n budget: number;\n /** What they hold: the tiles of the 3D Tiles, point clouds and vector tiles, the pools of the rasters' tiles (the\n * relief's included), each one's full from its creation */\n held: number;\n /** Each layer's, bottom first */\n layers: { layer: Layer; bytes: number }[];\n}\n\n/** What `RasterLayer.setStyle` changes */\nexport interface RasterStyle {\n opacity: number;\n /** 0 = greyscale, 1 = original colors */\n saturation: number;\n}\n\n/** Where a new layer goes: under `before`, or on top of the others (under the labels kept on top) */\nexport interface Placement {\n before?: Layer;\n}\n\nexport interface RasterOptions extends Placement {\n /** Tile URL with {z}, {x} and {y} (256 px tiles); unused with a `loader` */\n url: string;\n /** Tile grid of `url` (default 'mercator'); with 'equirectangular', `minZoom` and `maxZoom` are levels of that\n * grid; with a `TileGrid`, they are map zooms, by default those its matrices span */\n grid?: RasterGrid;\n minZoom?: number;\n maxZoom?: number;\n opacity?: number;\n /** 0 = greyscale, 1 = original colors */\n saturation?: number;\n /** Side of the tiles' textures, pixels (default 256): more for sharper tiles drawn by a `loader` */\n size?: number;\n /** Draws each tile instead of fetching `url`: an image of `size` × `size`, null for nothing there; a rejection is\n * retried like a network error */\n loader?: (z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>;\n /** Credits of the tiles, HTML: shown by the attribution control while the layer is on the map */\n attribution?: string;\n /** Drawn on the ground (default true); false: only on the 3D layers it is draped on (`Tiles3dOptions.drape`), its\n * tiles still loaded as the ground's would be: a solar potential on the roofs only */\n ground?: boolean;\n}\n\nexport interface NetworkStyle {\n /** Line width, CSS pixels, or zoom stops `[[zoom, width], …]` (default 2) */\n width: Size;\n /** Values above are drawn as unreached (default 1800) */\n max: number;\n /** Darker line every `contour` value units, 0 for none (default 0) */\n contour: number;\n opacity: number;\n /** Width of the halo drawn under the lines, CSS pixels or zoom stops, 0 for none (default 0): wide and faint, the\n * reached streets add up into a heat map that fills the blocks */\n halo: Size;\n /** Opacity of the halo at the middle of a line, fading quadratically to its sides (default 0.11) */\n haloOpacity: number;\n /** Colors from 0 to `max`: `[[fraction of max, color], …]` (default green to red) */\n ramp: Ramp | undefined;\n /** Color of the parts beyond `max` or unreached (default `rgba(140, 140, 140, 0.25)`) */\n unreachedColor: string;\n /** Share of `max` over which the colors fade out before it, 0 to 1 (default 0) */\n fade: number;\n}\n\nexport interface NetworkOptions extends Partial<NetworkStyle>, Placement {\n /** Node coordinates in degrees: lon0, lat0, lon1, lat1… */\n nodes: Float64Array;\n /** Edges as node index pairs: a0, b0, a1, b1… */\n edges: Uint32Array;\n /** Line of each edge, from A to B: the points of edge e are `points[start[e] .. start[e + 1]]` (lon, lat pairs,\n * counted in points); with fewer than two points an edge is straight. Default: all straight. */\n lines?: { start: Uint32Array; points: Float64Array };\n /** Per edge, the cost of travelling it from A to B then from B to A, in value units (Infinity: closed that way;\n * closed both ways: not drawn). A point along an edge then takes the quickest way there, min(value(A) + cost from\n * A, value(B) + cost from B), as a travel time does. Without costs, values are interpolated along the edges. */\n costs?: Float32Array;\n /** Width factor of each edge (default 1): rail lines wider than streets */\n edgeWidths?: Float32Array;\n}\n\nexport interface Tiles3dStyle {\n /** Screen-space error (CSS pixels) above which a tile is refined: 16 by default, lower is finer and heavier */\n maxScreenSpaceError: number;\n opacity: number;\n /** Size of the points of point cloud tiles (`.pnts`, glTF points), CSS pixels: 2 by default */\n pointSize?: number;\n /** A CSS color multiplying the textures of the meshes, the color of the untextured ones (buildings without\n * textures are light grey without it); none by default */\n color?: string;\n /** Each feature's color from its properties (a building's height, its use: a thematic map), in place of `color`: a\n * CSS color, or undefined for the layer's. Asked once for each feature of a tile, when the tile is first drawn, and\n * again for every tile when it changes (in React, keep the same function from one render to the next) */\n featureColor?: FeatureColor | undefined;\n}\n\n/** A feature's color from its properties and its index in its tile (`Tiles3dStyle.featureColor`) */\nexport type FeatureColor = (properties: Record<string, unknown>, feature: number) => string | undefined;\n\nexport interface Tiles3dOptions extends Partial<Tiles3dStyle>, Placement {\n /** URL of a `tileset.json` (3D Tiles 1.0 b3dm and pnts, 1.1 glb meshes and points, external tilesets) */\n url: string;\n /** Its heights are altitudes above the geoid (NGF-IGN69), as the IGN's Bâtiments 3D, rather than above the\n * ellipsoid (3D Tiles as specified): each tile raised by the RAF20 geoid, onto the IGN relief (default false) */\n geoid?: boolean;\n /** The walls of its untextured meshes show windows: glass by day, some lit at night (`setFacades`; default false) */\n facades?: boolean;\n /** A raster layer draped on its meshes (`setDrape`): an ortho or a solar potential on the roofs */\n drape?: Drape | undefined;\n}\n\n/** A raster layer draped on a 3D layer's faces (3D Tiles, extrusions, a vector tiles layer's buildings, models), as\n * Cesium's imagery on 3D Tiles: each point of a face takes the raster's color where it stands (its longitude and\n * latitude, whatever its height) */\nexport interface Drape {\n /** The raster layer, on the same map (with `ground: false`, on the 3D layers only) */\n raster: RasterLayer;\n /** 'up': the faces looking up, the roofs (default); 'all': the walls too, the raster stretched down them */\n faces?: 'up' | 'all';\n /** 0 to 1 (default 1), times the raster layer's opacity */\n opacity?: number;\n}\n\nexport interface MapPointerEvent {\n point: Point;\n /** Undefined above the horizon */\n lonLat: LonLat | undefined;\n}\n\n/** What 'hoverfeature' found under the pointer */\nexport interface MapHoverFeatureEvent extends MapPointerEvent {\n /** The feature under the pointer (see `GeoMap.pickFeature`), undefined if none */\n hit: FeatureHit | undefined;\n}\n\n/** The GPU time of a frame (`GeoMap.gpuTimings`), in all and by part (ms) */\nexport interface MapGpuTimings {\n /** The frame's number */\n frame: number;\n ms: number;\n /** The backdrop (sky, globe), the ground (the raster layers over the relief), each layer (with its handle), the\n * shadows, the panorama, the viewshed */\n parts: { part: 'backdrop' | 'ground' | 'layer' | 'shadows' | 'panorama' | 'viewshed'; layer?: Layer; ms: number }[];\n}\n\n/** What a pick looks at: within `radius` CSS pixels of the point (default 0), among `layers` (default every layer;\n * the others hide nothing) */\nexport interface PickOptions {\n radius?: number;\n layers?: readonly Layer[];\n}\n\n/** A picked feature: its layer handle, its index there and, for line, circle, fill, extrusion, point cloud and 3D\n * Tiles layers, the feature itself (a building of 3D Tiles with its properties) */\nexport interface FeatureHit {\n layer: Layer;\n index: number;\n feature: Feature | undefined;\n}\n\nexport interface MapEvents {\n /** The camera started moving (a gesture, an animation or `setCamera`) */\n movestart: Camera;\n /** The camera moved */\n move: Camera;\n /** The camera stopped: no gesture held, no animation running */\n moveend: Camera;\n /** The map changed size (CSS pixels) */\n resize: { width: number; height: number };\n /** The pointer moved over the map (at most once per frame, not while dragging) */\n hover: MapPointerEvent;\n /** What is under the pointer, picked without stalling the GPU: a frame or two after 'hover', only while listened to\n * (radius and layers in `GeoMap.hoverPicking`) */\n hoverfeature: MapHoverFeatureEvent;\n /** Click without drag */\n click: MapPointerEvent;\n /** A frame was drawn; duration of the engine call in milliseconds */\n render: { ms: number };\n /** The map's quality changed, by `setQuality` or stepped down by `'auto'` */\n quality: { quality: Quality };\n /** Everything in view is loaded and drawn, nothing moves: the end of a load, once after each change (as MapLibre's\n * `idle`). Tiles requested by the first frame count, so it never fires before they arrive. */\n idle: Record<string, never>;\n /** The pointer left the canvas (a mouse going out of the map, or onto a control or marker) */\n leave: Record<string, never>;\n /** The clipping volume moved or was sized by its handles (`ClipVolume.handles`): the volume now set */\n clipvolume: ClipVolume;\n}\n\n/** What a layer handle needs from its map */\nexport interface LayerHost {\n readonly engine: Engine;\n requestRender(): void;\n /** Forgets a removed layer */\n detach(layer: Layer): void;\n /** Moves a layer under `before`, or on top */\n moveLayer(layer: Layer, before: Layer | undefined): void;\n /** A layer created again in the engine (new id): put at the place of its old id, which is removed */\n replaceLayer(layer: Layer, old: number): void;\n /** Resolves once the map is idle (everything in view loaded and drawn) */\n whenIdle(): Promise<void>;\n /** Work the map waits on before it is idle (`GeoMap.track`) */\n track<T>(work: Promise<T>): Promise<T>;\n /** What its quality draws (`GeoMap.setQuality`) */\n readonly quality: QualitySettings;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,0CAA0C","sourcesContent":["/** Public types of the `isard` package */\n\nimport type { TileGrid } from './basemap/grid.ts';\nimport type { DecoderUrls } from './decoding/decoders.ts';\nimport type { Feature, Ramp, Size } from './layers/features.ts';\nimport type { Layer } from './layers/layers.ts';\nimport type { RasterLayer } from './layers/raster.ts';\nimport type { QualitySettings } from './map/quality.ts';\nimport type { AttributionOptions } from './ui/controls.ts';\nimport type { Camera, Engine } from './wasm/isard_webgpu.js';\n\nexport type LonLat = [lon: number, lat: number];\nexport type Point = [x: number, y: number];\n\n/**\n * The named basemaps. OpenFreeMap's vector styles, OpenStreetMap data worldwide, their labels above the other layers:\n * `osm-positron` (light grey, quiet: data over it reads first), `osm-liberty` and `osm-bright` (in colour), `osm-dark`\n * (near black: bright data over it, a wind's particles, lights). The\n * Géoplateforme's (IGN, France): rasters (`ign-plan`, `ign-plan-grey`, `ign-ortho`, the aerial photographs) or vector\n * tiles with their labels (`ign-plan-vector`, `ign-plan-grey-vector`, the PLAN.IGN styles).\n */\nexport type BasemapName =\n | 'osm-positron'\n | 'osm-liberty'\n | 'osm-bright'\n | 'osm-dark'\n | 'ign-plan'\n | 'ign-plan-grey'\n | 'ign-ortho'\n | 'ign-plan-vector'\n | 'ign-plan-grey-vector'\n | 'none';\n\n/** A basemap by name (see `BasemapName`) */\nexport type Basemap = BasemapName;\n\n/**\n * The Earth's named terrain models. `'terrain-tiles'`: worldwide, the Terrain Tiles of AWS's open data registry\n * (SRTM, EU-DEM, GMTED… merged by Mapzen, 30 m in most places), the sea floor flattened at sea level. `'ign'`: France,\n * the IGN's RGE ALTI from the Géoplateforme (1 to 5 m), raised by the RAF20 geoid to heights above the ellipsoid.\n */\nexport type TerrainModel = 'terrain-tiles' | 'ign';\n\n/** How tiles encode their altitudes: `'float32'`, raw little-endian floats (`image/x-bil;bits=32`, an ArcGIS raw\n * grid); `'terrarium'`, the colors of a PNG, `R × 256 + G + B / 256 - 32768`; `'mapbox'`, those of Terrain-RGB,\n * `(R × 65536 + G × 256 + B) / 10 - 10000` */\nexport type TerrainEncoding = 'float32' | 'terrarium' | 'mapbox';\n\n/**\n * How tiles load and show. 'immediate' (default): everything visible loads, tiles show as soon as they arrive.\n * 'smooth': during flights the levels flown through are skipped, off-center tiles wait while the camera moves, tiles\n * fade in; fewer downloads, for slow networks or GPUs.\n */\nexport type LoadingMode = 'immediate' | 'smooth';\n\n/** 'globe': a sphere at low zoom, blending into Web Mercator between zooms 5 and 7, up to three levels later under a\n * tilted camera (it sees much farther than its center: the horizon stays curved) */\nexport type Projection = 'globe' | 'mercator';\n\n/** A body to draw the map on, other than the named ones (`CelestialBody`) */\nexport interface BodyOptions {\n /** Equatorial radius, metres */\n radius: number;\n /** Flattening of its ellipsoid, 0 for a sphere (default 0) */\n flattening?: number;\n /** An atmosphere: its halo around the globe, true for the Earth's light blue, or a CSS color (its alpha the\n * halo's strength) (default false) */\n atmosphere?: boolean | string;\n /** Color of the globe where no tile covers it (past the Web Mercator latitudes, 85°), a CSS color (default\n * `#808080`) */\n color?: string;\n /** Lowest and highest altitudes of its ground, metres around the ellipsoid: what its relief may raise into view\n * (default ±1 % of the radius) */\n relief?: [lowest: number, highest: number];\n}\n\n/**\n * The body the map is drawn on: 'earth' (WGS 84, the default), 'moon' (a sphere of 1 737 400 m, no atmosphere),\n * 'mars' (a sphere of 3 396 190 m, its equatorial radius, a thin dusty halo; planetocentric latitudes) or another\n * one. Zoom levels keep their meaning on screen (the Web Mercator tile pyramid), their metres follow the body:\n * altitudes, relief, buildings, 3D Tiles. Off the Earth, the map has none of the Earth's defaults: no basemap, no\n * credits, and space for its background; the Moon and Mars have NASA's relief for `terrain: true`.\n */\nexport type CelestialBody = 'earth' | 'moon' | 'mars' | BodyOptions;\n\n/** A level of the map's quality (`GeoMapOptions.quality`) */\nexport type Quality = 'high' | 'medium' | 'low';\n\nexport interface GeoMapOptions extends Partial<Camera> {\n /** The body the map is drawn on (default 'earth'); set at creation */\n body?: CelestialBody;\n /** Default 'globe' */\n projection?: Projection;\n /** Default 'immediate' */\n loading?: LoadingMode;\n /** The basemap (default 'osm-positron'; 'none' off the Earth) */\n basemap?: Basemap;\n /** Opacity of the IGN hillshade over the basemap (France, Géoplateforme), 0 for none (default 0) */\n hillshade?: number;\n /** Color behind the map (sky of tilted flat views), a CSS color (default `#f2f2f0`; black off the Earth) */\n background?: string;\n /** Space behind the globe: stars and atmosphere halo, fading out as the globe turns flat (default true) */\n sky?: boolean;\n /** The sun casting the shadows of buildings, trees, models and the relief (`setSun`); none by default */\n sun?: SunOptions;\n /** What the map draws less of on a device that cannot keep up (`setQuality`): `'high'` (the default) all of it;\n * `'medium'` at most 1.5 device pixels a CSS pixel, the 3D Tiles coarser far away; `'low'` one device pixel a CSS\n * pixel, no sun's shadows, the 3D Tiles coarser still; `'auto'` high, a level lower each time the frames stay slow\n * while the map moves (`'quality'` event) */\n quality?: Quality | 'auto';\n /** The GPU memory, megabytes, the layers' tiles (3D Tiles, point clouds, vector tiles) and the rasters' tiles may\n * hold all together: past it the tiles drawn least recently are unloaded, whichever their layer, the vector tiles\n * (those of the view) kept (`GeoMap.memory`). `'auto'` (the default): 256 on a touch screen (a phone, a tablet: iOS\n * closes a page past about a gigabyte, the page's workers included), 1024 elsewhere. Set at creation */\n memory?: number | 'auto';\n /** Multisampled antialiasing of the canvas (default true): the edges of the buildings, 3D Tiles and models smooth.\n * False draws each pixel once (lines and halos antialias themselves): wide translucent layers, a network's halo over\n * a region, cost up to four times less on an integrated GPU (MapLibre's default). Set at creation */\n antialias?: boolean;\n /** The engine on wgpu (#146): 'auto' (default) WebGPU where the browser gives an adapter, else wgpu's WebGL2 fallback;\n * 'webgpu' or 'webgl' forces one */\n renderer?: 'auto' | 'webgpu' | 'webgl2';\n /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles; NASA's on\n * the Moon and Mars: LOLA, MOLA), one of the Earth's models by name (`'ign'`: France, RGE ALTI), or its options\n * (default false; on another body, its `url` is required). Network layers are draped on it */\n terrain?: boolean | TerrainModel | TerrainOptions;\n minZoom?: number;\n maxZoom?: number;\n /** Highest pitch, degrees, up to 85 (default 70) */\n maxPitch?: number;\n /** Sky over the plane, seen when the camera is tilted towards the horizon, and the fog the ground fades into\n * (MapLibre's `setSky`); default none: the background color */\n atmosphere?: AtmosphereOptions;\n /** Mouse, touch and keyboard controls (default true) */\n interactive?: boolean;\n /** Keyboard controls once the map has the focus (it is reached with Tab): arrows pan, Shift + arrows rotate and\n * tilt, + and - zoom (Shift: two levels), 0 faces north and levels the view (default true; none when not\n * `interactive`) */\n keyboard?: boolean;\n /** Accessible name of the map, read by screen readers (default 'Map') */\n ariaLabel?: string;\n /** A preset of map options (`IGN_PRESETS`: `'ign'`, `'ign-3d'`, `'ign-ortho-3d'`), the other options over it */\n preset?: 'ign' | 'ign-3d' | 'ign-ortho-3d';\n /** The folder isard's files are served from (its engines, `isard_webgpu_bg.wasm`, `isard_webgl2_bg.wasm`, its\n * modules, `isard_points_bg.wasm`, `isard_tiles3d_bg.wasm`, `isard_tess_bg.wasm`, `isard_grid_bg.wasm`, and its\n * workers, `decoder.worker.js`, `basemap.worker.js`): one option for a bundler that moves them, the `…Url` options\n * below for each one. `isard/vite` sets it for the whole page; default next to the module */\n assetsUrl?: string | URL;\n /** Where to load the engine on WebGPU from (`isard_webgpu_bg.wasm`), when a bundler does not resolve the default URL */\n webgpuWasmUrl?: string | URL;\n /** Where to load the engine's WebGL2 fallback from (`isard_webgl2_bg.wasm`, for a browser without WebGPU), when a\n * bundler does not resolve the default URL */\n webgl2WasmUrl?: string | URL;\n /** Where the decoding workers load the point cloud module from (`isard_points_bg.wasm`, the LAZ decoder of COPC),\n * when a bundler does not resolve the default URL. Loaded with the first point cloud only */\n pointsWasmUrl?: string | URL;\n /** Where the decoding workers load the 3D Tiles module from (`isard_tiles3d_bg.wasm`: a tile's content decoded for\n * the GPU), when a bundler does not resolve the default URL. Loaded with the first tile */\n tiles3dWasmUrl?: string | URL;\n /** Where the basemap workers load the tessellation module from (`isard_tess_bg.wasm`: the vector tiles drawn as\n * geometry, `vectorTiles().vectors()`, made ready for the GPU off the main thread), when a bundler does not resolve\n * the default URL. Loaded with the first tile of geometry; without it, the main thread does that work */\n tessWasmUrl?: string | URL;\n /** Where the workers load the grid module from (`isard_grid_bg.wasm`: GRIB2 and NetCDF files read by\n * `map.readGrids`), when a bundler does not resolve the default URL. Loaded with the first file */\n gridWasmUrl?: string | URL;\n /** Where to load the vector basemap worker from, when a bundler does not resolve the default URL */\n basemapWorkerUrl?: string | URL;\n /** Texture size of the vector basemap's tiles, pixels (default 512: lines and edges sharp at every zoom on a screen\n * of pixel ratio 1). 256: a quarter of the drawing in the workers, of the uploads and of the GPU memory, for lines\n * and edges a little softer between two zoom levels (the tiles are shown 181 to 362 CSS pixels wide) */\n basemapTileSize?: number;\n /** Glyphs of the symbol layers: a URL with `{fontstack}` and `{range}` (MapLibre's glyph format; default\n * OpenFreeMap's fonts, Noto Sans). A vector basemap's labels take the glyphs of its style */\n glyphs?: string;\n /** Workers decoding 3D Tiles off the main thread: a count, or false to decode on the main thread (default: cores - 1,\n * 1 to 4). False (or 0) also decodes the PNG relief and reprojects the equirectangular rasters on the main thread,\n * else done by the vector basemap's workers */\n workers?: number | false;\n /** Where to load the decoding worker from, when a bundler does not resolve the default URL */\n workerUrl?: string | URL;\n /** Folders of the Draco and Basis Universal decoders, loaded by the workers on first use (default: the official\n * builds on gstatic.com and jsDelivr; self-host them for offline or locked-down networks). They run through\n * `new Function`: a Content Security Policy needs `'unsafe-eval'` (see `DecoderUrls`) */\n decoders?: Partial<DecoderUrls>;\n /** Credits at the bottom right: false for none, or its options (default true: the credits of the basemap,\n * hillshade and relief in use, compact on maps narrower than 640 px) */\n attributionControl?: boolean | AttributionOptions;\n}\n\nexport interface TerrainOptions {\n /** One of the Earth's named models (default `'terrain-tiles'` on the Earth); unused with a `url` */\n model?: TerrainModel;\n /** Altitudes of 256 × 256 tiles in `encoding`: a WMS GetMap URL with {bbox} (EPSG:3857 on the Earth, the body's\n * Mercator metres elsewhere: the sphere of its radius), a tile URL with {z}, {x} and {y}, or an ArcGIS image service\n * (a URL ending in `/ImageServer`), asked for raw altitudes in the body's Mercator (default: the `model`'s; on the\n * Moon and Mars, NASA's Trek LOLA and MOLA models) */\n url?: string;\n /** How the tiles of `url` encode their altitudes (default `'float32'`); `'terrarium'` and `'mapbox'` take a URL with\n * {z}, {x} and {y} */\n encoding?: TerrainEncoding;\n /** Vertical exaggeration, 1 for the true relief (default 1) */\n exaggeration?: number;\n /** Finest level of the relief, up to 15 (default 15; 14 for the Terrain Tiles, 8 for the Moon's and Mars's models). It\n * starts at level 6 on the Earth, coarser on bodies of a larger relief for their size (3 on the Moon and Mars) */\n maxZoom?: number;\n /** Altitudes over mainland France raised by the height of the RAF20 geoid (the French one, 0 away from France), to\n * heights above the ellipsoid (those of 3D Tiles); false keeps the altitudes as served (NGF-IGN69 for the IGN's)\n * (default true for the `'ign'` model, false otherwise) */\n geoid?: boolean;\n}\n\n/** Sky, horizon and fog over the plane, with the names and meanings of MapLibre's `setSky` */\nexport interface AtmosphereOptions {\n /** A CSS color (default `#9cc7ec`) */\n skyColor?: string;\n /** (default `#e8f1f8`) */\n horizonColor?: string;\n /** (default `#f2f5f8`) */\n fogColor?: string;\n /** Blend from the horizon to the sky color, share of the field of view above the horizon, 0-1 (default 0.6) */\n skyHorizonBlend?: number;\n /** Blend from the horizon to the fog color below the horizon, 0-1 (default 0.7) */\n horizonFogBlend?: number;\n /** Share of the distance to the far plane over which the ground fades into the fog, 0-1 (default 0.4) */\n fogGroundBlend?: number;\n}\n\n/** The sun casting shadows (`GeoMap.setSun`): where it stands, by date or by hand, and how dark its shadows are */\nexport interface SunOptions {\n /** The time: the sun where it stands then over the map's center (default now, unless `azimuth` and `altitude`) */\n date?: Date;\n /** Degrees clockwise from north, with `altitude`: the sun placed by hand */\n azimuth?: number;\n /** Degrees above the horizon; at or under it, no shadows */\n altitude?: number;\n /** How dark the shadows are, 0 to 1 (default 0.35) */\n opacity?: number;\n /** How dark the night is, 0 to 1: the scene tinted in its blue, the windows of the buildings and the streets of\n * `vectors()` lit, the labels light on dark. By default from the sun's altitude: falling from 6° above the horizon\n * to 6° under it */\n night?: number;\n}\n\n/** What can be seen from a point (`GeoMap.setViewshed`); with several observers, the colors, the opacity and the\n * cone's color are the first one's */\nexport interface ViewshedOptions {\n /** The observer */\n position: LonLat;\n /** Metres above the ground (default 1.7, eye level) */\n height?: number;\n /** Metres around the observer that are tinted (default 1000) */\n range?: number;\n /** A CSS color for what is seen (default `#2f9e44`) */\n visibleColor?: string;\n /** A CSS color for what is hidden (default `#e03131`) */\n hiddenColor?: string;\n /** How strongly the colors tint the scene, multiplied into it so that its textures and shading stay, 0-1 (default\n * 0.7) */\n opacity?: number;\n /** A CSS color for the cone drawn in 3D (one way only): its fan through the axis, at the eye's height and tilted\n * with it, from the eye to the range; solid where nothing hides it, faint behind the scene; none by default */\n coneColor?: string;\n /** To look one way only (a camera, a lookout), degrees clockwise from north; all around without it */\n direction?: number;\n /** Degrees above the horizon the cone looks, negative below (default 0) */\n tilt?: number;\n /** Angle of view across, degrees (default 60) */\n fov?: number;\n /** Angle of view up and down, degrees (default 40) */\n verticalFov?: number;\n}\n\n/** What every clipping volume has (`ClipVolume`) */\ninterface ClipVolumeBase {\n /** Metres of its foot above the ground (or above the ellipsoid, `altitudeReference: 'sea'`); 0 by default */\n altitude?: number;\n /** What the altitude is above: `'ground'` (the relief, the default) or `'sea'` (the ellipsoid), as the models' */\n altitudeReference?: 'ground' | 'sea';\n /** Metres up from its foot */\n height: number;\n /** What is cut: `'inside'` (the default) what lies inside the volume, `'outside'` what lies outside it */\n cut?: 'inside' | 'outside';\n /** A CSS color for the faces the cut opens, the inside of walls and floors (default `#d9cfc1`); `null` leaves them\n * open */\n sectionColor?: string | null;\n /** Handles on the volume to size and move it with the pointer: a disc on each of a box's faces, on a cylinder's rim,\n * on each of a polygon's vertices, on the top and the bottom, and one at its middle to move it; the map tells each\n * change by `'clipvolume'`. None by default */\n handles?: boolean;\n}\n\n/** A box: its foot's center, its size, its heading */\nexport interface ClipBox extends ClipVolumeBase {\n shape: 'box';\n /** The center of its foot */\n position: LonLat;\n /** Metres across its heading */\n width: number;\n /** Metres along its heading */\n length: number;\n /** Degrees clockwise from north of its length; 0 by default */\n heading?: number;\n}\n\n/** A cylinder standing up: its foot's center, its radius */\nexport interface ClipCylinder extends ClipVolumeBase {\n shape: 'cylinder';\n /** The center of its foot */\n position: LonLat;\n /** Metres */\n radius: number;\n}\n\n/** A prism standing on a polygon: a building's outline, a plot */\nexport interface ClipPolygon extends ClipVolumeBase {\n shape: 'polygon';\n /** Its vertices, 3 to 16, open (its last not repeating its first) */\n polygon: LonLat[];\n}\n\n/**\n * A volume cutting the map's 3D layers (`GeoMap.setClipVolume`): a box, a cylinder or a prism on a polygon. The models,\n * the 3D Tiles, the extrusions and the point clouds are cut; the ground and the flat layers stay whole. What lies\n * inside it is cut, all around it stays (a cutaway, to look into a building or under the ground), or what lies outside\n * it (a BIM viewer's section box); the faces the cut opens filled, as a section on a plan.\n */\nexport type ClipVolume = ClipBox | ClipCylinder | ClipPolygon;\n\n/** An eye at street level (`GeoMap.setFirstPerson`) */\nexport interface FirstPersonView {\n /** Where it stands */\n lonLat: LonLat;\n /** Metres above the ground (default 1.7) */\n height?: number;\n /** Degrees clockwise from north it looks to */\n bearing: number;\n /** Degrees from straight down: 90 level (the default), 180 straight up */\n pitch?: number;\n /** Vertical field of view, degrees (default 75) */\n fov?: number;\n}\n\n/** Layers shown on one side of a vertical line only (`GeoMap.setSwipe`) */\nexport interface SwipeOptions {\n /** CSS pixels from the left of the map */\n position: number;\n layers: readonly Layer[];\n /** The side they show on (default 'left') */\n side?: 'left' | 'right';\n /** Layers shown on the other side only: two meshes of the same place, each on its side, never drawn over each other */\n other?: readonly Layer[];\n}\n\n/** Animation of a camera move */\nexport interface AnimationOptions {\n /** Milliseconds */\n duration?: number;\n /** Progress over time, both 0 to 1 */\n easing?: (t: number) => number;\n}\n\nexport interface FlyToOptions extends AnimationOptions {\n /** How far the flight zooms out on its way, as MapLibre's `curve` (default 1.42) */\n curve?: number;\n /** Average speed in screens per second when `duration` is not given (default 1.2) */\n speed?: number;\n}\n\n/**\n * Tile grid of a raster's URL. 'mercator': Web Mercator (XYZ, WMTS PM), the engine's own. 'equirectangular':\n * longitudes and latitudes (Plate Carrée, EPSG:4326-like), two 256 px tiles side by side at level 0, rows from the\n * north (NASA's Trek WMTS, WorldCRS84Quad). A `TileGrid`: the tile matrices of a WMTS in any CRS (Lambert-93…), or a\n * WMS asked for each tile's box in its CRS. The last two are reprojected into Web Mercator tiles by the map's workers\n * (in the page with `workers: false`).\n */\nexport type RasterGrid = 'mercator' | 'equirectangular' | TileGrid;\n\n/** The GPU memory of a map's layers (`GeoMap.memory`), bytes */\nexport interface MapMemory {\n /** What they may hold (`GeoMapOptions.memory`) */\n budget: number;\n /** What they hold: the tiles of the 3D Tiles, point clouds and vector tiles, the pools of the rasters' tiles (the\n * relief's included), each one's full from its creation */\n held: number;\n /** Each layer's, bottom first */\n layers: { layer: Layer; bytes: number }[];\n}\n\n/** What `RasterLayer.setStyle` changes */\nexport interface RasterStyle {\n opacity: number;\n /** 0 = greyscale, 1 = original colors */\n saturation: number;\n}\n\n/** Where a new layer goes: under `before`, or on top of the others (under the labels kept on top) */\nexport interface Placement {\n before?: Layer;\n}\n\nexport interface RasterOptions extends Placement {\n /** Tile URL with {z}, {x} and {y} (256 px tiles); unused with a `loader` */\n url: string;\n /** Tile grid of `url` (default 'mercator'); with 'equirectangular', `minZoom` and `maxZoom` are levels of that\n * grid; with a `TileGrid`, they are map zooms, by default those its matrices span */\n grid?: RasterGrid;\n minZoom?: number;\n maxZoom?: number;\n opacity?: number;\n /** 0 = greyscale, 1 = original colors */\n saturation?: number;\n /** Side of the tiles' textures, pixels (default 256): more for sharper tiles drawn by a `loader` */\n size?: number;\n /** Draws each tile instead of fetching `url`: an image of `size` × `size`, null for nothing there; a rejection is\n * retried like a network error */\n loader?: (z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>;\n /** Credits of the tiles, HTML: shown by the attribution control while the layer is on the map */\n attribution?: string;\n /** Drawn on the ground (default true); false: only on the 3D layers it is draped on (`Tiles3dOptions.drape`), its\n * tiles still loaded as the ground's would be: a solar potential on the roofs only */\n ground?: boolean;\n}\n\nexport interface NetworkStyle {\n /** Line width, CSS pixels, or zoom stops `[[zoom, width], …]` (default 2) */\n width: Size;\n /** Values above are drawn as unreached (default 1800) */\n max: number;\n /** Darker line every `contour` value units, 0 for none (default 0) */\n contour: number;\n opacity: number;\n /** Width of the halo drawn under the lines, CSS pixels or zoom stops, 0 for none (default 0): wide and faint, the\n * reached streets add up into a heat map that fills the blocks */\n halo: Size;\n /** Opacity of the halo at the middle of a line, fading quadratically to its sides (default 0.11) */\n haloOpacity: number;\n /** Colors from 0 to `max`: `[[fraction of max, color], …]` (default green to red) */\n ramp: Ramp | undefined;\n /** Color of the parts beyond `max` or unreached (default `rgba(140, 140, 140, 0.25)`) */\n unreachedColor: string;\n /** Share of `max` over which the colors fade out before it, 0 to 1 (default 0) */\n fade: number;\n}\n\nexport interface NetworkOptions extends Partial<NetworkStyle>, Placement {\n /** Node coordinates in degrees: lon0, lat0, lon1, lat1… */\n nodes: Float64Array;\n /** Edges as node index pairs: a0, b0, a1, b1… */\n edges: Uint32Array;\n /** Line of each edge, from A to B: the points of edge e are `points[start[e] .. start[e + 1]]` (lon, lat pairs,\n * counted in points); with fewer than two points an edge is straight. Default: all straight. */\n lines?: { start: Uint32Array; points: Float64Array };\n /** Per edge, the cost of travelling it from A to B then from B to A, in value units (Infinity: closed that way;\n * closed both ways: not drawn). A point along an edge then takes the quickest way there, min(value(A) + cost from\n * A, value(B) + cost from B), as a travel time does. Without costs, values are interpolated along the edges. */\n costs?: Float32Array;\n /** Width factor of each edge (default 1): rail lines wider than streets */\n edgeWidths?: Float32Array;\n}\n\nexport interface Tiles3dStyle {\n /** Screen-space error (CSS pixels) above which a tile is refined: 16 by default, lower is finer and heavier */\n maxScreenSpaceError: number;\n opacity: number;\n /** Size of the points of point cloud tiles (`.pnts`, glTF points), CSS pixels: 2 by default */\n pointSize?: number;\n /** A CSS color multiplying the textures of the meshes, the color of the untextured ones (buildings without\n * textures are light grey without it); none by default */\n color?: string;\n /** Each feature's color from its properties (a building's height, its use: a thematic map), in place of `color`: a\n * CSS color, or undefined for the layer's. Asked once for each feature of a tile, when the tile is first drawn, and\n * again for every tile when it changes (in React, keep the same function from one render to the next) */\n featureColor?: FeatureColor | undefined;\n}\n\n/** A feature's color from its properties and its index in its tile (`Tiles3dStyle.featureColor`) */\nexport type FeatureColor = (properties: Record<string, unknown>, feature: number) => string | undefined;\n\nexport interface Tiles3dOptions extends Partial<Tiles3dStyle>, Placement {\n /** URL of a `tileset.json` (3D Tiles 1.0 b3dm and pnts, 1.1 glb meshes and points, external tilesets) */\n url: string;\n /** Its heights are altitudes above the geoid (NGF-IGN69), as the IGN's Bâtiments 3D, rather than above the\n * ellipsoid (3D Tiles as specified): each tile raised by the RAF20 geoid, onto the IGN relief (default false) */\n geoid?: boolean;\n /** The walls of its untextured meshes show windows: glass by day, some lit at night (`setFacades`; default false) */\n facades?: boolean;\n /** A raster layer draped on its meshes (`setDrape`): an ortho or a solar potential on the roofs */\n drape?: Drape | undefined;\n}\n\n/** A raster layer draped on a 3D layer's faces (3D Tiles, extrusions, a vector tiles layer's buildings, models), as\n * Cesium's imagery on 3D Tiles: each point of a face takes the raster's color where it stands (its longitude and\n * latitude, whatever its height) */\nexport interface Drape {\n /** The raster layer, on the same map (with `ground: false`, on the 3D layers only) */\n raster: RasterLayer;\n /** 'up': the faces looking up, the roofs (default); 'all': the walls too, the raster stretched down them */\n faces?: 'up' | 'all';\n /** 0 to 1 (default 1), times the raster layer's opacity */\n opacity?: number;\n}\n\nexport interface MapPointerEvent {\n point: Point;\n /** Undefined above the horizon */\n lonLat: LonLat | undefined;\n}\n\n/** What 'hoverfeature' found under the pointer */\nexport interface MapHoverFeatureEvent extends MapPointerEvent {\n /** The feature under the pointer (see `GeoMap.pickFeature`), undefined if none */\n hit: FeatureHit | undefined;\n}\n\n/** The GPU time of a frame (`GeoMap.gpuTimings`), in all and by part (ms) */\nexport interface MapGpuTimings {\n /** The frame's number */\n frame: number;\n ms: number;\n /** The backdrop (sky, globe), the ground (the raster layers over the relief), each layer (with its handle), the\n * shadows, the panorama, the viewshed */\n parts: { part: 'backdrop' | 'ground' | 'layer' | 'shadows' | 'panorama' | 'viewshed'; layer?: Layer; ms: number }[];\n}\n\n/** What a pick looks at: within `radius` CSS pixels of the point (default 0), among `layers` (default every layer;\n * the others hide nothing) */\nexport interface PickOptions {\n radius?: number;\n layers?: readonly Layer[];\n}\n\n/** A picked feature: its layer handle, its index there and, for line, circle, fill, extrusion, point cloud and 3D\n * Tiles layers, the feature itself (a building of 3D Tiles with its properties) */\nexport interface FeatureHit {\n layer: Layer;\n index: number;\n feature: Feature | undefined;\n}\n\nexport interface MapEvents {\n /** The camera started moving (a gesture, an animation or `setCamera`) */\n movestart: Camera;\n /** The camera moved */\n move: Camera;\n /** The camera stopped: no gesture held, no animation running */\n moveend: Camera;\n /** The map changed size (CSS pixels) */\n resize: { width: number; height: number };\n /** The pointer moved over the map (at most once per frame, not while dragging) */\n hover: MapPointerEvent;\n /** What is under the pointer, picked without stalling the GPU: a frame or two after 'hover', only while listened to\n * (radius and layers in `GeoMap.hoverPicking`) */\n hoverfeature: MapHoverFeatureEvent;\n /** Click without drag */\n click: MapPointerEvent;\n /** A frame was drawn; duration of the engine call in milliseconds */\n render: { ms: number };\n /** The map's quality changed, by `setQuality` or stepped down by `'auto'` */\n quality: { quality: Quality };\n /** The WebGPU device was lost (a phone taking its memory back, the GPU process gone): the map made again at once,\n * lighter (`recovery`): `'lighter'`, the low quality and half the GPU memory budget (the first loss); `'webgl2'`,\n * through the WebGL2 fallback (a loss after it, or no new WebGPU device). `losses`: how many so far */\n gpulost: { reason: string; message: string; losses: number; recovery: 'lighter' | 'webgl2' };\n /** Everything in view is loaded and drawn, nothing moves: the end of a load, once after each change (as MapLibre's\n * `idle`). Tiles requested by the first frame count, so it never fires before they arrive. */\n idle: Record<string, never>;\n /** The pointer left the canvas (a mouse going out of the map, or onto a control or marker) */\n leave: Record<string, never>;\n /** The clipping volume moved or was sized by its handles (`ClipVolume.handles`): the volume now set */\n clipvolume: ClipVolume;\n}\n\n/** What a layer handle needs from its map */\nexport interface LayerHost {\n readonly engine: Engine;\n requestRender(): void;\n /** Forgets a removed layer */\n detach(layer: Layer): void;\n /** Moves a layer under `before`, or on top */\n moveLayer(layer: Layer, before: Layer | undefined): void;\n /** A layer created again in the engine (new id): put at the place of its old id, which is removed */\n replaceLayer(layer: Layer, old: number): void;\n /** Resolves once the map is idle (everything in view loaded and drawn) */\n whenIdle(): Promise<void>;\n /** Work the map waits on before it is idle (`GeoMap.track`) */\n track<T>(work: Promise<T>): Promise<T>;\n /** What its quality draws (`GeoMap.setQuality`) */\n readonly quality: QualitySettings;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isard",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "A WebGL2 map engine for large, interactive data layers, labels and 3D Tiles over raster or vector basemaps (Rust core in WebAssembly)",
5
5
  "license": "MIT",
6
6
  "author": "Kevin Graff",