isard 1.3.0 → 1.4.0

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +2 -0
  3. package/dist/basemap/basemaps.js +1 -0
  4. package/dist/basemap/basemaps.js.map +1 -1
  5. package/dist/basemap/vectortiles.d.ts +26 -0
  6. package/dist/basemap/vectortiles.js +125 -1
  7. package/dist/basemap/vectortiles.js.map +1 -1
  8. package/dist/basemap/workerpool.js +9 -0
  9. package/dist/basemap/workerpool.js.map +1 -1
  10. package/dist/basemap.worker.js +2 -2
  11. package/dist/basemap.worker.js.map +7 -4
  12. package/dist/bind/layers.js +10 -0
  13. package/dist/bind/layers.js.map +1 -1
  14. package/dist/decoder.worker.js +3 -3
  15. package/dist/decoder.worker.js.map +3 -3
  16. package/dist/engine-loader.d.ts +4 -1
  17. package/dist/engine-loader.js +9 -0
  18. package/dist/engine-loader.js.map +1 -1
  19. package/dist/grid-module.d.ts +44 -0
  20. package/dist/grid-module.js +63 -0
  21. package/dist/grid-module.js.map +1 -0
  22. package/dist/grids.d.ts +51 -0
  23. package/dist/grids.js +88 -0
  24. package/dist/grids.js.map +1 -0
  25. package/dist/index.d.ts +3 -0
  26. package/dist/index.js +2 -0
  27. package/dist/index.js.map +1 -1
  28. package/dist/isard_bg.wasm +0 -0
  29. package/dist/isard_core_bg.wasm +0 -0
  30. package/dist/isard_grid_bg.wasm +0 -0
  31. package/dist/layers/flow.d.ts +111 -0
  32. package/dist/layers/flow.js +222 -0
  33. package/dist/layers/flow.js.map +1 -0
  34. package/dist/layers/symbols.d.ts +2 -0
  35. package/dist/layers/symbols.js +2 -1
  36. package/dist/layers/symbols.js.map +1 -1
  37. package/dist/map/layer-spec.d.ts +4 -1
  38. package/dist/map/layer-spec.js +2 -0
  39. package/dist/map/layer-spec.js.map +1 -1
  40. package/dist/map/workers.d.ts +4 -0
  41. package/dist/map/workers.js +35 -0
  42. package/dist/map/workers.js.map +1 -1
  43. package/dist/map.d.ts +14 -0
  44. package/dist/map.js +19 -1
  45. package/dist/map.js.map +1 -1
  46. package/dist/react/Layer.d.ts +2 -0
  47. package/dist/react/Layer.js.map +1 -1
  48. package/dist/types.d.ts +7 -3
  49. package/dist/types.js.map +1 -1
  50. package/dist/wasm/isard.d.ts +42 -0
  51. package/dist/wasm/isard.js +91 -1
  52. package/dist/wasm/isard_core.d.ts +42 -0
  53. package/dist/wasm/isard_core.js +91 -1
  54. package/dist/wasm/isard_grid.d.ts +101 -0
  55. package/dist/wasm/isard_grid.js +375 -0
  56. package/dist/workers/basemap/street.d.ts +19 -0
  57. package/dist/workers/basemap.worker.d.ts +21 -0
  58. package/dist/workers/basemap.worker.js +23 -4
  59. package/dist/workers/basemap.worker.js.map +1 -1
  60. package/package.json +2 -1
  61. package/vite.js +3 -2
@@ -4,6 +4,9 @@
4
4
  */
5
5
  import { encodedTerrainLoader } from "../basemap/terrain.js";
6
6
  import { BasemapWorkers, defaultWorkerCount } from "../basemap/workerpool.js";
7
+ import { withHeaders } from "../engine/requests.js";
8
+ import { decodeGrids } from "../grid-module.js";
9
+ import { gridOf } from "../grids.js";
7
10
  /** The workers of a map, created on first use */
8
11
  export class MapWorkers {
9
12
  /** URL of the workers' script */
@@ -57,6 +60,38 @@ export class MapWorkers {
57
60
  return loader;
58
61
  };
59
62
  remoteHeights = (url, encoding, floor, tile, signal) => this.decodingPool()?.heights(url, encoding, floor, tile, signal, this.owner);
63
+ /** A GRIB2 or NetCDF file read into grids by the grid module (`module`), in a worker (in the page without them, or if
64
+ * the worker fails) */
65
+ async readGrids(source, module, signal) {
66
+ const pool = this.decodingPool();
67
+ const url = typeof source === 'string' || source instanceof URL ? String(source) : undefined;
68
+ const copy = source instanceof Uint8Array ? source.slice().buffer : undefined;
69
+ const bytes = copy ?? (source instanceof ArrayBuffer ? source : undefined);
70
+ // Against the page: the workers fetch it, and a relative URL would be theirs
71
+ const absolute = url && typeof document !== 'undefined' ? new URL(url, document.baseURI).href : url;
72
+ const fetchFile = async (at) => {
73
+ const response = await fetch(at, withHeaders(at, signal ? { signal } : {}));
74
+ if (!response.ok)
75
+ throw new Error(`isard: ${at}: ${response.status}`);
76
+ return response.arrayBuffer();
77
+ };
78
+ const inPage = async () => decodeGrids(new Uint8Array(bytes ?? (await fetchFile(absolute ?? ''))), module);
79
+ const read = async () => {
80
+ if (!pool)
81
+ return inPage();
82
+ return pool
83
+ .grids(absolute ? { url: absolute } : { bytes: bytes ?? new ArrayBuffer(0) }, module, signal, this.owner)
84
+ .catch((error) => {
85
+ // A worker's failure (the module not fetched, a worker of an older build): read again in the page, unless
86
+ // cancelled or its bytes handed over
87
+ if (signal?.aborted || bytes?.byteLength === 0)
88
+ throw error;
89
+ return inPage();
90
+ });
91
+ };
92
+ const { grids, values } = await read();
93
+ return grids.map((g, i) => gridOf(g, values[i] ?? new Float32Array()));
94
+ }
60
95
  /**
61
96
  * The workers decoding the relief and reprojecting rasters: the shared pool, unless the map has no workers
62
97
  * (`workers: false` or 0, or none in this browser): that is done in the page then
@@ -1 +1 @@
1
- {"version":3,"file":"workers.js","sourceRoot":"","sources":["../../src/map/workers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,oBAAoB,EAAwC,MAAM,uBAAuB,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9E,iDAAiD;AACjD,MAAM,OAAO,UAAU;IACrB,iCAAiC;IACxB,GAAG,CAAe;IACV,OAAO,CAA2B;IACnD,gEAAgE;IAC/C,IAAI,CAAgB;IACrC,8DAA8D;IAC7C,KAAK,CAAS;IAC/B,4CAA4C;IACpC,MAAM,CAA6B;IAC3C;mDAC+C;IAC9B,cAAc,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEnE,4EAA4E;IAC5E,YAAY,GAAiB,EAAE,OAAiC,EAAE,IAAmB,EAAE,KAAa;QAClG,IAAI,C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AAiB,EAAE;QAC7F,MAAM,GAAG,GAAG,GAAG,QAAQ,IAAI,KAAK,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE5C,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;QAE1B,MAAM,MAAM,GAAG,oBAAoB,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE9E,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAErC,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEe,aAAa,GAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CACrF,IAAI,CAAC,YAAY,EAAE,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAE/E;;;OAGG;IACK,YAAY;QAClB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,IAAI,CAAC,IAAI,EAAE,IAAI,OAAO,KAAK,KAAK,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,CAAC;YAAE,OAAO,SAAS,CAAC;QAClG,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,eAAe,KAAK,WAAW;YAAE,OAAO,SAAS,CAAC;QAE9F,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/**\n * A map's workers: the pool drawing vector tiles, shared by the map's `VectorTiles`, which also decodes the relief and\n * reprojects rasters off the page; and the loaders of the relief, one per tile source.\n */\n\nimport type { RemoteReprojection } from '../basemap/grid.ts';\nimport { encodedTerrainLoader, type PngEncoding, type RemoteHeights } from '../basemap/terrain.ts';\nimport { BasemapWorkers, defaultWorkerCount } from '../basemap/workerpool.ts';\nimport type { TerrainLoader } from '../settings.ts';\nimport type { GeoMapOptions } from '../types.ts';\n\n/** The workers of a map, created on first use */\nexport class MapWorkers {\n /** URL of the workers' script */\n readonly url: string | URL;\n private readonly workers: GeoMapOptions['workers'];\n /** The map is destroyed: nothing more is sent to the workers */\n private readonly gone: () => boolean;\n /** Whose requests the workers' answer (cancelled together) */\n private readonly owner: object;\n /** The shared pool, created on first use */\n private shared: BasemapWorkers | undefined;\n /** The loaders of the relief by encoding, URL and floor: the same loader for the same tiles (the engine keeps its\n * tiles when only the exaggeration changes) */\n private readonly terrainLoaders = new Map<string, TerrainLoader>();\n\n /** `workers`: the map's option (false or 0, no worker); `owner`: the map */\n constructor(url: string | URL, workers: GeoMapOptions['workers'], gone: () => boolean, owner: object) {\n this.url = url;\n this.workers = workers;\n this.gone = gone;\n this.owner = owner;\n }\n\n /**\n * The workers for a `VectorTiles`: the shared pool, or a pool of its own (`own`, to stop with it) when it asks for\n * another count or URL\n */\n pool(count?: number, url?: string | URL): { pool: BasemapWorkers; own: boolean } {\n const shared = defaultWorkerCount();\n const workers = Math.max(1, count ?? shared);\n const workerUrl = url ?? this.url;\n\n if (workers === shared && String(workerUrl) === String(this.url)) {\n this.shared ??= new BasemapWorkers(shared, this.url);\n\n return { pool: this.shared, own: false };\n }\n\n return { pool: new BasemapWorkers(workers, workerUrl), own: true };\n }\n\n /** Stops the shared pool */\n terminate(): void {\n this.shared?.terminate();\n this.shared = undefined;\n }\n\n /** Rasters reprojected by the workers (in the page without them) */\n readonly remoteReprojection: RemoteReprojection = (job, tile, signal) =>\n this.decodingPool()?.reproject(job, tile, signal, this.owner);\n\n /** The loader of the relief tiles of `url` in a PNG encoding (one per URL, encoding and floor) */\n readonly terrainLoader = (url: string, encoding: PngEncoding, floor?: number): TerrainLoader => {\n const key = `${encoding} ${floor ?? ''} ${url}`;\n const cached = this.terrainLoaders.get(key);\n\n if (cached) return cached;\n\n const loader = encodedTerrainLoader(url, encoding, floor, this.remoteHeights);\n\n this.terrainLoaders.set(key, loader);\n\n return loader;\n };\n\n private readonly remoteHeights: RemoteHeights = (url, encoding, floor, tile, signal) =>\n this.decodingPool()?.heights(url, encoding, floor, tile, signal, this.owner);\n\n /**\n * The workers decoding the relief and reprojecting rasters: the shared pool, unless the map has no workers\n * (`workers: false` or 0, or none in this browser): that is done in the page then\n */\n private decodingPool(): BasemapWorkers | undefined {\n const workers = this.workers;\n\n if (this.gone() || workers === false || (workers !== undefined && workers <= 0)) return undefined;\n if (typeof Worker === 'undefined' || typeof OffscreenCanvas === 'undefined') return undefined;\n\n return this.pool().pool;\n }\n}\n"]}
1
+ {"version":3,"file":"workers.js","sourceRoot":"","sources":["../../src/map/workers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,oBAAoB,EAAwC,MAAM,uBAAuB,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAa,MAAM,EAAE,MAAM,aAAa,CAAC;AAIhD,iDAAiD;AACjD,MAAM,OAAO,UAAU;IACrB,iCAAiC;IACxB,GAAG,CAAe;IACV,OAAO,CAA2B;IACnD,gEAAgE;IAC/C,IAAI,CAAgB;IACrC,8DAA8D;IAC7C,KAAK,CAAS;IAC/B,4CAA4C;IACpC,MAAM,CAA6B;IAC3C;mDAC+C;IAC9B,cAAc,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEnE,4EAA4E;IAC5E,YAAY,GAAiB,EAAE,OAAiC,EAAE,IAAmB,EAAE,KAAa;QAClG,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CA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QACF,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QAEvC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC;IACzE,CAAC;IAED;;;OAGG;IACK,YAAY;QAClB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,IAAI,CAAC,IAAI,EAAE,IAAI,OAAO,KAAK,KAAK,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,CAAC;YAAE,OAAO,SAAS,CAAC;QAClG,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,eAAe,KAAK,WAAW;YAAE,OAAO,SAAS,CAAC;QAE9F,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/**\n * A map's workers: the pool drawing vector tiles, shared by the map's `VectorTiles`, which also decodes the relief and\n * reprojects rasters off the page; and the loaders of the relief, one per tile source.\n */\n\nimport type { RemoteReprojection } from '../basemap/grid.ts';\nimport { encodedTerrainLoader, type PngEncoding, type RemoteHeights } from '../basemap/terrain.ts';\nimport { BasemapWorkers, defaultWorkerCount } from '../basemap/workerpool.ts';\nimport { withHeaders } from '../engine/requests.ts';\nimport { decodeGrids } from '../grid-module.ts';\nimport { type Grid, gridOf } from '../grids.ts';\nimport type { TerrainLoader } from '../settings.ts';\nimport type { GeoMapOptions } from '../types.ts';\n\n/** The workers of a map, created on first use */\nexport class MapWorkers {\n /** URL of the workers' script */\n readonly url: string | URL;\n private readonly workers: GeoMapOptions['workers'];\n /** The map is destroyed: nothing more is sent to the workers */\n private readonly gone: () => boolean;\n /** Whose requests the workers' answer (cancelled together) */\n private readonly owner: object;\n /** The shared pool, created on first use */\n private shared: BasemapWorkers | undefined;\n /** The loaders of the relief by encoding, URL and floor: the same loader for the same tiles (the engine keeps its\n * tiles when only the exaggeration changes) */\n private readonly terrainLoaders = new Map<string, TerrainLoader>();\n\n /** `workers`: the map's option (false or 0, no worker); `owner`: the map */\n constructor(url: string | URL, workers: GeoMapOptions['workers'], gone: () => boolean, owner: object) {\n this.url = url;\n this.workers = workers;\n this.gone = gone;\n this.owner = owner;\n }\n\n /**\n * The workers for a `VectorTiles`: the shared pool, or a pool of its own (`own`, to stop with it) when it asks for\n * another count or URL\n */\n pool(count?: number, url?: string | URL): { pool: BasemapWorkers; own: boolean } {\n const shared = defaultWorkerCount();\n const workers = Math.max(1, count ?? shared);\n const workerUrl = url ?? this.url;\n\n if (workers === shared && String(workerUrl) === String(this.url)) {\n this.shared ??= new BasemapWorkers(shared, this.url);\n\n return { pool: this.shared, own: false };\n }\n\n return { pool: new BasemapWorkers(workers, workerUrl), own: true };\n }\n\n /** Stops the shared pool */\n terminate(): void {\n this.shared?.terminate();\n this.shared = undefined;\n }\n\n /** Rasters reprojected by the workers (in the page without them) */\n readonly remoteReprojection: RemoteReprojection = (job, tile, signal) =>\n this.decodingPool()?.reproject(job, tile, signal, this.owner);\n\n /** The loader of the relief tiles of `url` in a PNG encoding (one per URL, encoding and floor) */\n readonly terrainLoader = (url: string, encoding: PngEncoding, floor?: number): TerrainLoader => {\n const key = `${encoding} ${floor ?? ''} ${url}`;\n const cached = this.terrainLoaders.get(key);\n\n if (cached) return cached;\n\n const loader = encodedTerrainLoader(url, encoding, floor, this.remoteHeights);\n\n this.terrainLoaders.set(key, loader);\n\n return loader;\n };\n\n private readonly remoteHeights: RemoteHeights = (url, encoding, floor, tile, signal) =>\n this.decodingPool()?.heights(url, encoding, floor, tile, signal, this.owner);\n\n /** A GRIB2 or NetCDF file read into grids by the grid module (`module`), in a worker (in the page without them, or if\n * the worker fails) */\n async readGrids(\n source: string | URL | ArrayBuffer | Uint8Array,\n module: string,\n signal?: AbortSignal,\n ): Promise<Grid[]> {\n const pool = this.decodingPool();\n const url = typeof source === 'string' || source instanceof URL ? String(source) : undefined;\n const copy = source instanceof Uint8Array ? source.slice().buffer : undefined;\n const bytes = copy ?? (source instanceof ArrayBuffer ? source : undefined);\n // Against the page: the workers fetch it, and a relative URL would be theirs\n const absolute = url && typeof document !== 'undefined' ? new URL(url, document.baseURI).href : url;\n const fetchFile = async (at: string) => {\n const response = await fetch(at, withHeaders(at, signal ? { signal } : {}));\n\n if (!response.ok) throw new Error(`isard: ${at}: ${response.status}`);\n\n return response.arrayBuffer();\n };\n const inPage = async () => decodeGrids(new Uint8Array(bytes ?? (await fetchFile(absolute ?? ''))), module);\n const read = async () => {\n if (!pool) return inPage();\n\n return pool\n .grids(absolute ? { url: absolute } : { bytes: bytes ?? new ArrayBuffer(0) }, module, signal, this.owner)\n .catch((error: unknown) => {\n // A worker's failure (the module not fetched, a worker of an older build): read again in the page, unless\n // cancelled or its bytes handed over\n if (signal?.aborted || bytes?.byteLength === 0) throw error;\n\n return inPage();\n });\n };\n const { grids, values } = await read();\n\n return grids.map((g, i) => gridOf(g, values[i] ?? new Float32Array()));\n }\n\n /**\n * The workers decoding the relief and reprojecting rasters: the shared pool, unless the map has no workers\n * (`workers: false` or 0, or none in this browser): that is done in the page then\n */\n private decodingPool(): BasemapWorkers | undefined {\n const workers = this.workers;\n\n if (this.gone() || workers === false || (workers !== undefined && workers <= 0)) return undefined;\n if (typeof Worker === 'undefined' || typeof OffscreenCanvas === 'undefined') return undefined;\n\n return this.pool().pool;\n }\n}\n"]}
package/dist/map.d.ts CHANGED
@@ -7,8 +7,10 @@
7
7
  */
8
8
  import { type PmtilesOptions } from './basemap/pmtileslayer.ts';
9
9
  import { VectorTiles, type VectorTilesOptions } from './basemap/vectortiles.ts';
10
+ import type { Grid } from './grids.ts';
10
11
  import { ExtrusionLayer, type ExtrusionOptions } from './layers/extrusions.ts';
11
12
  import { CircleLayer, type CircleOptions, FillLayer, type FillOptions, LineLayer, type LineOptions } from './layers/features.ts';
13
+ import { FlowLayer, type FlowOptions } from './layers/flow.ts';
12
14
  import type { ImageOptions, Pixels } from './layers/icons.ts';
13
15
  import { CustomLayer, type CustomLayerInterface, GroundLayer, type GroundOptions, type Layer, ModelLayer, type ModelOptions, NetworkLayer, RasterLayer, Tiles3dLayer } from './layers/layers.ts';
14
16
  import { type PanoramaOptions, type Panoramas } from './layers/panoramas.ts';
@@ -309,6 +311,18 @@ export declare class GeoMap {
309
311
  addPointCloud(options: PointCloudOptions & {
310
312
  before?: Layer;
311
313
  }): PointCloudLayer;
314
+ /**
315
+ * The grids of a GRIB2 or classic NetCDF file (its URL, or its bytes): a weather or ocean model's fields on grids of
316
+ * longitudes and latitudes, read in a worker by the grid module (loaded with the first file). GRIB2 on a regular
317
+ * latitude/longitude grid, packed simply, in groups or in groups of spatial differences (NOAA's GFS); NetCDF-3 with
318
+ * the CF conventions. `windFields` pairs a wind's components into the fields of `addFlow`
319
+ */
320
+ readGrids(source: string | URL | ArrayBuffer | Uint8Array, options?: {
321
+ signal?: AbortSignal;
322
+ }): Promise<Grid[]>;
323
+ /** Particles carried by a field of velocities (a wind, a current), their trails animated and colored by speed on
324
+ * the globe and the relief (see `FlowOptions`) */
325
+ addFlow(options: FlowOptions): FlowLayer;
312
326
  /** A glTF model drawn at positions (see `ModelOptions`), with depth; on the engine with 3D Tiles, as they are */
313
327
  addModels(options: ModelOptions & {
314
328
  before?: Layer;
package/dist/map.js CHANGED
@@ -10,10 +10,11 @@ import { pmtilesLayer } from "./basemap/pmtileslayer.js";
10
10
  import { VectorTiles } from "./basemap/vectortiles.js";
11
11
  import { defaultWorkerUrl } from "./basemap/workerpool.js";
12
12
  import { onHeaderRules } from "./engine/requests.js";
13
- import { destroyedEngine, engineUrl, loadEngine, tessUrl } from "./engine-loader.js";
13
+ import { destroyedEngine, engineUrl, gridUrl, loadEngine, tessUrl } from "./engine-loader.js";
14
14
  import { IGN_PRESETS } from "./geoplateforme.js";
15
15
  import { ExtrusionLayer, extrusionStyle } from "./layers/extrusions.js";
16
16
  import { CircleLayer, circleStyle, FillLayer, fillStyle, LineLayer, lineStyle, } from "./layers/features.js";
17
+ import { FlowLayer } from "./layers/flow.js";
17
18
  import { CustomLayer, GroundLayer, ModelLayer, NetworkLayer, RasterLayer, Tiles3dLayer, } from "./layers/layers.js";
18
19
  import { loadPanoramas } from "./layers/panoramas.js";
19
20
  import { PointCloudLayer } from "./layers/pointclouds.js";
@@ -63,6 +64,8 @@ export class GeoMap {
63
64
  settings;
64
65
  /** @internal Where the basemap workers load the tessellation module from (`isard_tess_bg.wasm`) */
65
66
  tessUrl;
67
+ /** @internal Where the workers load the grid module from (`isard_grid_bg.wasm`) */
68
+ gridUrl;
66
69
  /** The WebGL context is lost: nothing is drawn until it is restored */
67
70
  lost = false;
68
71
  gone = false;
@@ -113,6 +116,7 @@ export class GeoMap {
113
116
  this.engines = new MapEngines(engineClass, tiles3dModule, options, () => this.gone);
114
117
  const workerUrl = options.basemapWorkerUrl ?? defaultWorkerUrl(options.assetsUrl);
115
118
  this.tessUrl = tessUrl(options);
119
+ this.gridUrl = gridUrl(options);
116
120
  this.workers = new MapWorkers(workerUrl, options.workers, () => this.gone, this);
117
121
  this.basemaps = new BasemapLayers(this, this.stack, workerUrl, options.basemapTileSize);
118
122
  this.container = container;
@@ -794,6 +798,20 @@ export class GeoMap {
794
798
  addPointCloud(options) {
795
799
  return this.place(new PointCloudLayer(this, options), options.before);
796
800
  }
801
+ /**
802
+ * The grids of a GRIB2 or classic NetCDF file (its URL, or its bytes): a weather or ocean model's fields on grids of
803
+ * longitudes and latitudes, read in a worker by the grid module (loaded with the first file). GRIB2 on a regular
804
+ * latitude/longitude grid, packed simply, in groups or in groups of spatial differences (NOAA's GFS); NetCDF-3 with
805
+ * the CF conventions. `windFields` pairs a wind's components into the fields of `addFlow`
806
+ */
807
+ readGrids(source, options = {}) {
808
+ return this.workers.readGrids(source, this.gridUrl, options.signal);
809
+ }
810
+ /** Particles carried by a field of velocities (a wind, a current), their trails animated and colored by speed on
811
+ * the globe and the relief (see `FlowOptions`) */
812
+ addFlow(options) {
813
+ return this.place(new FlowLayer(this, options), options.before);
814
+ }
797
815
  /** A glTF model drawn at positions (see `ModelOptions`), with depth; on the engine with 3D Tiles, as they are */
798
816
  addModels(options) {
799
817
  return this.place(new ModelLayer(this, options), options.before);
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,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAoB,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAyB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EACL,WAAW,EAEX,WAAW,EAEX,SAAS,EAET,SAAS,EACT,SAAS,EAET,SAAS,GACV,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,WAAW,EAEX,WAAW,EAGX,UAAU,EAEV,YAAY,EACZ,WAAW,EACX,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAwC,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EAAE,eAAe,EAA0B,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAsB,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,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zB,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,wFAAwF;QACxF,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 { onHeaderRules } from './engine/requests.ts';\nimport { destroyedEngine, type EngineClass, engineUrl, loadEngine, tessUrl } from './engine-loader.ts';\nimport { IGN_PRESETS } from './geoplateforme.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 type { Glyphs } from './layers/glyphs.ts';\nimport type { Icons, ImageOptions, Pixels } from './layers/icons.ts';\nimport {\n CustomLayer,\n type CustomLayerInterface,\n GroundLayer,\n type GroundOptions,\n type Layer,\n ModelLayer,\n type ModelOptions,\n NetworkLayer,\n RasterLayer,\n Tiles3dLayer,\n} from './layers/layers.ts';\nimport { loadPanoramas, type PanoramaOptions, type Panoramas } from './layers/panoramas.ts';\nimport { PointCloudLayer, type PointCloudOptions } from './layers/pointclouds.ts';\nimport { SymbolLayer, type SymbolOptions, symbolStyle } from './layers/symbols.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 { 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 } 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 { 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 FeatureHit,\n FirstPersonView,\n FlyToOptions,\n GeoMapOptions,\n LoadingMode,\n LonLat,\n MapEvents,\n NetworkOptions,\n Point,\n Projection,\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 { sunPosition } from './util/sun.ts';\nimport type { Camera, Engine, PickHit, RasterLayerStats } from './wasm/isard.js';\n\nexport type { LayerSpec } from './map/layer-spec.ts';\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 */\nexport class GeoMap {\n readonly canvas: HTMLCanvasElement;\n #engine: Engine;\n /** The engine class (core, or with 3D Tiles) and the engine with 3D Tiles loaded when needed */\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 /** The WebGL context is lost: nothing is drawn until it is restored */\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 // With 3D Tiles from the start when asked, or when only that engine's URL is given (as before the core engine)\n const full = options.tiles3d === true || (options.wasmUrl !== undefined && options.coreWasmUrl === undefined);\n\n // Before anything is created\n if (options.basemap !== undefined) checkBasemap(options.basemap);\n\n const kind = full ? 'full' : 'core';\n const bindings = await loadEngine(kind, engineUrl(kind, options));\n const map = new GeoMap(container, options, bindings.Engine, full ? bindings.module : undefined);\n\n if (options.tiles3d === 'preload' && !full) map.preloadTiles3d();\n\n return map;\n }\n\n private constructor(\n container: HTMLElement,\n options: GeoMapOptions,\n engineClass: EngineClass,\n tiles3dModule: WebAssembly.Module | undefined,\n ) {\n this.engines = new MapEngines(engineClass, tiles3dModule, options, () => this.gone);\n\n const workerUrl = options.basemapWorkerUrl ?? defaultWorkerUrl(options.assetsUrl);\n\n this.tessUrl = tessUrl(options);\n\n this.workers = new MapWorkers(workerUrl, options.workers, () => this.gone, this);\n this.basemaps = new BasemapLayers(this, this.stack, workerUrl, options.basemapTileSize);\n this.container = container;\n this.canvas = createCanvas();\n this.atlases = new SymbolAtlases(this.canvas, options.glyphs, () => this.#engine);\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 upgrading: () => this.engines.upgrading !== undefined,\n drawn: (hovered) => {\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 this.#engine = this.createEngine();\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\n this.unwatchContext = watchContext(\n this.canvas,\n () => {\n this.lost = true;\n this.frames.cancel();\n },\n () => this.restore(),\n );\n\n const start: Camera = this.earth\n ? { center: [2.4246, 48.8457], zoom: 13, pitch: 0, bearing: 0 }\n : { center: [0, 0], zoom: 2, pitch: 0, bearing: 0 };\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.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 private createEngine(): Engine {\n return this.engines.create(this.canvas, () => this.requestRender(), this.settings);\n }\n\n /** A 3D Tiles layer or a model on the core engine: loads the engine with 3D Tiles, then rebuilds the map on it\n * (camera, settings and layers kept, as after a context loss); the layer is created then */\n private upgrade(): void {\n this.engines.upgrade(\n () => {\n // A lost context: the engine is rebuilt on it once restored\n if (!this.lost) this.restore();\n },\n (error) => {\n // The 3D Tiles layers stay empty; the next one added tries again\n report(error);\n this.requestRender();\n },\n );\n }\n\n /** Downloads and compiles the engine with 3D Tiles once the map is idle (`tiles3d: 'preload'`), without running\n * it: the first 3D Tiles layer then only instantiates it */\n private preloadTiles3d(): void {\n if (this.frames.settled) this.engines.preload();\n else {\n const off = this.on('idle', () => {\n off();\n this.engines.preload();\n });\n }\n }\n\n /** After a context loss: a new engine with the same camera, settings and layers (same handles, same order) */\n private restore(): void {\n if (this.gone) return;\n this.hoverPick.cancel();\n\n const camera = this.getCamera();\n\n this.#engine.free();\n this.#engine = this.createEngine();\n this.lost = false;\n this.setCamera(camera);\n this.atlases.attach(this.#engine);\n // Those still waiting for the engine with 3D Tiles (loading, or failed) are created with it\n this.stack.reattach(this.#engine, (layer) => layer.needsFullEngine && !this.engines.tiles3d);\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 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 }\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 = Math.max(1, Math.min(179, eye.pitch));\n eye.fov = Math.max(10, Math.min(140, eye.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 // On the core engine, a 3D Tiles layer or a model waits for the engine with 3D Tiles: it is created with the\n // others on it\n if (layer.needsFullEngine && !this.engines.tiles3d) this.upgrade();\n else layer.attach(this.engine);\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 /** @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 /**\n * The camera's methods together: `get`, `set`, `easeTo`, `flyTo`, `bounds`, `firstPerson` and `setFirstPerson`\n * (street level), `project`, `unproject`; the same as the map's own (`getCamera`, `setCamera`…)\n */\n readonly camera = {\n get: (): Camera => this.getCamera(),\n set: (camera: Partial<Camera>): void => this.setCamera(camera),\n easeTo: (camera: Partial<Camera>, options?: number | AnimationOptions): void => this.easeTo(camera, options),\n flyTo: (camera: Partial<Camera>, options?: FlyToOptions): void => this.flyTo(camera, options),\n bounds: (): [west: number, south: number, east: number, north: number] => this.getBounds(),\n firstPerson: (): Readonly<Required<FirstPersonView>> | undefined => this.firstPerson,\n setFirstPerson: (view: FirstPersonView | undefined): void => this.setFirstPerson(view),\n project: (lonLat: LonLat, height?: number): Point | undefined => this.project(lonLat, height),\n unproject: (point: Point): LonLat | undefined => this.unproject(point),\n } as const;\n\n /**\n * What lies under a point or at a position, together: `feature` (`pickFeature`), `surface` (`pickSurface`),\n * `surfaceAt`, `elevationAt`, `metersPerPixel`\n */\n readonly query = {\n feature: (point: Point, options?: { radius?: number; layers?: readonly Layer[] }): FeatureHit | undefined =>\n this.pickFeature(point, options),\n surface: (point: Point): { lonLat: LonLat; height: number } | undefined => this.pickSurface(point),\n surfaceAt: (lonLat: LonLat): number | undefined => this.surfaceAt(lonLat),\n elevationAt: (lonLat: LonLat): number | undefined => this.elevationAt(lonLat),\n metersPerPixel: (point?: Point): number | undefined => this.metersPerPixel(point),\n } as const;\n\n /** What is drawn over the scene, together: `viewshed` (`setViewshed`), `sun` (`setSun`), `swipe` (`setSwipe`) */\n readonly effects = {\n viewshed: (options: ViewshedOptions | readonly ViewshedOptions[] | undefined): void => this.setViewshed(options),\n sun: (options: SunOptions | undefined): void => this.setSun(options),\n swipe: (options: SwipeOptions | undefined): void => this.setSwipe(options),\n } as const;\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\n const opacity = Math.min(1, Math.max(0, options.opacity ?? 0.35)) * (1 - night);\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 /** 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 /** Tile counters of the raster layers, for diagnostics */\n stats(): RasterLayerStats[] {\n return this.engine.stats();\n }\n\n /**\n * The feature under a screen point (CSS pixels), undefined if none: its layer id and index. Reads one pixel of an\n * offscreen picking pass, whatever the number of features, but waits for the GPU to finish the frame (a stall): for\n * clicks and one-off queries. On hover, listen to 'hoverfeature' instead, which picks without waiting.\n */\n pick(point: Point, radius = 0, layers?: readonly Layer[]): PickHit | undefined {\n const only = layers && Uint32Array.from(layers.map((l) => l.id));\n\n return this.engine.pick(point[0], point[1], radius, only);\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 pickFeature(point: Point, options: { radius?: number; layers?: readonly Layer[] } = {}): FeatureHit | undefined {\n const hit = this.pick(point, options.radius ?? 0, options.layers);\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 // Drawn by the engine with 3D Tiles: loaded first if needed\n if (!this.engines.tiles3d) {\n this.upgrade();\n await this.engines.upgrading;\n if (!this.engines.tiles3d)\n throw new Error('isard: panoramas need the engine with 3D Tiles, which failed to load');\n }\n\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\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 rad = Math.PI / 180;\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 /** 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. The last frame's scene is\n * drawn again and read back, waiting for the GPU (a stall): for clicks and drags */\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. The scene is drawn from above into a single pixel and\n * read back: cheap, but it waits for the GPU */\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 & { before?: Layer }): RasterLayer {\n const { url, opacity = 1, saturation = 1, size, before } = options;\n const { loader, minZoom, maxZoom } = rasterSource(options, this.workers.remoteReprojection);\n const layer = new RasterLayer(this, { url, minZoom, maxZoom, opacity, saturation, size, loader });\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(url: string, options: PmtilesOptions = {}): Promise<RasterLayer | VectorTiles> {\n return pmtilesLayer(this, url, 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 = 1800, contour = 0, opacity = 1 } = options;\n const { halo = 0, haloOpacity = 0.11, ramp, unreachedColor = 'rgba(140, 140, 140, 0.25)', fade = 0 } = options;\n const style = { width, max, contour, opacity, halo, haloOpacity, ramp, unreachedColor, fade };\n\n validateNetwork(nodes, edges);\n\n return this.addLayer(new NetworkLayer(this, { nodes, edges, lines }, costs, style, edgeWidths));\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 const above = index >= 0 ? this.layers[index + 1] : undefined;\n const layer = this.add(spec);\n\n if (!('before' in spec && spec.before) && index >= 0) this.moveLayer(layer, above);\n old.remove();\n\n return layer;\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(new LineLayer<P>(this, options.data, lineStyle(options)), options.before);\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 & { before?: Layer }): 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(new ExtrusionLayer<P>(this, options.data, extrusionStyle(options)), options.before);\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 { url, maxScreenSpaceError = 16, opacity = 1, pointSize, color, geoid = false } = options;\n\n return this.addLayer(\n new Tiles3dLayer(this, url, geoid, {\n maxScreenSpaceError,\n opacity,\n ...(pointSize !== undefined ? { pointSize } : {}),\n ...(color !== undefined ? { color } : {}),\n }),\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, on the engine with 3D Tiles; under `before` if given\n */\n addPointCloud(options: PointCloudOptions & { before?: Layer }): PointCloudLayer {\n return this.place(new PointCloudLayer(this, options), options.before);\n }\n\n /** A glTF model drawn at positions (see `ModelOptions`), with depth; on the engine with 3D Tiles, as they are */\n addModels(options: ModelOptions & { before?: Layer }): ModelLayer {\n return this.place(new ModelLayer(this, options), options.before);\n }\n\n /**\n * The page's own WebGL drawing at its place among the layers, in every frame (see `CustomLayerInterface`): raw\n * WebGL, three.js… with the matrices of the frame (`frame.matrixAt`); under `before` if given\n */\n addCustomLayer(layer: CustomLayerInterface, options: { before?: Layer } = {}): CustomLayer {\n const custom = new CustomLayer(\n this,\n layer,\n this.canvas,\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 = window.devicePixelRatio || 1;\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.destroy();\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 WebGL objects, models their data, while the context 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.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;QACxB,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACrC,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,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,wFAAwF;QACxF,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 { onHeaderRules } from './engine/requests.ts';\nimport { destroyedEngine, type EngineClass, engineUrl, gridUrl, loadEngine, tessUrl } from './engine-loader.ts';\nimport { IGN_PRESETS } from './geoplateforme.ts';\nimport type { Grid } from './grids.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 type { Icons, ImageOptions, Pixels } from './layers/icons.ts';\nimport {\n CustomLayer,\n type CustomLayerInterface,\n GroundLayer,\n type GroundOptions,\n type Layer,\n ModelLayer,\n type ModelOptions,\n NetworkLayer,\n RasterLayer,\n Tiles3dLayer,\n} from './layers/layers.ts';\nimport { loadPanoramas, type PanoramaOptions, type Panoramas } from './layers/panoramas.ts';\nimport { PointCloudLayer, type PointCloudOptions } from './layers/pointclouds.ts';\nimport { SymbolLayer, type SymbolOptions, symbolStyle } from './layers/symbols.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 { 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 } 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 { 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 FeatureHit,\n FirstPersonView,\n FlyToOptions,\n GeoMapOptions,\n LoadingMode,\n LonLat,\n MapEvents,\n NetworkOptions,\n Point,\n Projection,\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 { sunPosition } from './util/sun.ts';\nimport type { Camera, Engine, PickHit, RasterLayerStats } from './wasm/isard.js';\n\nexport type { LayerSpec } from './map/layer-spec.ts';\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 */\nexport class GeoMap {\n readonly canvas: HTMLCanvasElement;\n #engine: Engine;\n /** The engine class (core, or with 3D Tiles) and the engine with 3D Tiles loaded when needed */\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 WebGL context is lost: nothing is drawn until it is restored */\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 // With 3D Tiles from the start when asked, or when only that engine's URL is given (as before the core engine)\n const full = options.tiles3d === true || (options.wasmUrl !== undefined && options.coreWasmUrl === undefined);\n\n // Before anything is created\n if (options.basemap !== undefined) checkBasemap(options.basemap);\n\n const kind = full ? 'full' : 'core';\n const bindings = await loadEngine(kind, engineUrl(kind, options));\n const map = new GeoMap(container, options, bindings.Engine, full ? bindings.module : undefined);\n\n if (options.tiles3d === 'preload' && !full) map.preloadTiles3d();\n\n return map;\n }\n\n private constructor(\n container: HTMLElement,\n options: GeoMapOptions,\n engineClass: EngineClass,\n tiles3dModule: WebAssembly.Module | undefined,\n ) {\n this.engines = new MapEngines(engineClass, tiles3dModule, options, () => this.gone);\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(workerUrl, options.workers, () => this.gone, this);\n this.basemaps = new BasemapLayers(this, this.stack, workerUrl, options.basemapTileSize);\n this.container = container;\n this.canvas = createCanvas();\n this.atlases = new SymbolAtlases(this.canvas, options.glyphs, () => this.#engine);\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 upgrading: () => this.engines.upgrading !== undefined,\n drawn: (hovered) => {\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 this.#engine = this.createEngine();\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\n this.unwatchContext = watchContext(\n this.canvas,\n () => {\n this.lost = true;\n this.frames.cancel();\n },\n () => this.restore(),\n );\n\n const start: Camera = this.earth\n ? { center: [2.4246, 48.8457], zoom: 13, pitch: 0, bearing: 0 }\n : { center: [0, 0], zoom: 2, pitch: 0, bearing: 0 };\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.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 private createEngine(): Engine {\n return this.engines.create(this.canvas, () => this.requestRender(), this.settings);\n }\n\n /** A 3D Tiles layer or a model on the core engine: loads the engine with 3D Tiles, then rebuilds the map on it\n * (camera, settings and layers kept, as after a context loss); the layer is created then */\n private upgrade(): void {\n this.engines.upgrade(\n () => {\n // A lost context: the engine is rebuilt on it once restored\n if (!this.lost) this.restore();\n },\n (error) => {\n // The 3D Tiles layers stay empty; the next one added tries again\n report(error);\n this.requestRender();\n },\n );\n }\n\n /** Downloads and compiles the engine with 3D Tiles once the map is idle (`tiles3d: 'preload'`), without running\n * it: the first 3D Tiles layer then only instantiates it */\n private preloadTiles3d(): void {\n if (this.frames.settled) this.engines.preload();\n else {\n const off = this.on('idle', () => {\n off();\n this.engines.preload();\n });\n }\n }\n\n /** After a context loss: a new engine with the same camera, settings and layers (same handles, same order) */\n private restore(): void {\n if (this.gone) return;\n this.hoverPick.cancel();\n\n const camera = this.getCamera();\n\n this.#engine.free();\n this.#engine = this.createEngine();\n this.lost = false;\n this.setCamera(camera);\n this.atlases.attach(this.#engine);\n // Those still waiting for the engine with 3D Tiles (loading, or failed) are created with it\n this.stack.reattach(this.#engine, (layer) => layer.needsFullEngine && !this.engines.tiles3d);\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 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 }\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 = Math.max(1, Math.min(179, eye.pitch));\n eye.fov = Math.max(10, Math.min(140, eye.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 // On the core engine, a 3D Tiles layer or a model waits for the engine with 3D Tiles: it is created with the\n // others on it\n if (layer.needsFullEngine && !this.engines.tiles3d) this.upgrade();\n else layer.attach(this.engine);\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 /** @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 /**\n * The camera's methods together: `get`, `set`, `easeTo`, `flyTo`, `bounds`, `firstPerson` and `setFirstPerson`\n * (street level), `project`, `unproject`; the same as the map's own (`getCamera`, `setCamera`…)\n */\n readonly camera = {\n get: (): Camera => this.getCamera(),\n set: (camera: Partial<Camera>): void => this.setCamera(camera),\n easeTo: (camera: Partial<Camera>, options?: number | AnimationOptions): void => this.easeTo(camera, options),\n flyTo: (camera: Partial<Camera>, options?: FlyToOptions): void => this.flyTo(camera, options),\n bounds: (): [west: number, south: number, east: number, north: number] => this.getBounds(),\n firstPerson: (): Readonly<Required<FirstPersonView>> | undefined => this.firstPerson,\n setFirstPerson: (view: FirstPersonView | undefined): void => this.setFirstPerson(view),\n project: (lonLat: LonLat, height?: number): Point | undefined => this.project(lonLat, height),\n unproject: (point: Point): LonLat | undefined => this.unproject(point),\n } as const;\n\n /**\n * What lies under a point or at a position, together: `feature` (`pickFeature`), `surface` (`pickSurface`),\n * `surfaceAt`, `elevationAt`, `metersPerPixel`\n */\n readonly query = {\n feature: (point: Point, options?: { radius?: number; layers?: readonly Layer[] }): FeatureHit | undefined =>\n this.pickFeature(point, options),\n surface: (point: Point): { lonLat: LonLat; height: number } | undefined => this.pickSurface(point),\n surfaceAt: (lonLat: LonLat): number | undefined => this.surfaceAt(lonLat),\n elevationAt: (lonLat: LonLat): number | undefined => this.elevationAt(lonLat),\n metersPerPixel: (point?: Point): number | undefined => this.metersPerPixel(point),\n } as const;\n\n /** What is drawn over the scene, together: `viewshed` (`setViewshed`), `sun` (`setSun`), `swipe` (`setSwipe`) */\n readonly effects = {\n viewshed: (options: ViewshedOptions | readonly ViewshedOptions[] | undefined): void => this.setViewshed(options),\n sun: (options: SunOptions | undefined): void => this.setSun(options),\n swipe: (options: SwipeOptions | undefined): void => this.setSwipe(options),\n } as const;\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\n const opacity = Math.min(1, Math.max(0, options.opacity ?? 0.35)) * (1 - night);\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 /** 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 /** Tile counters of the raster layers, for diagnostics */\n stats(): RasterLayerStats[] {\n return this.engine.stats();\n }\n\n /**\n * The feature under a screen point (CSS pixels), undefined if none: its layer id and index. Reads one pixel of an\n * offscreen picking pass, whatever the number of features, but waits for the GPU to finish the frame (a stall): for\n * clicks and one-off queries. On hover, listen to 'hoverfeature' instead, which picks without waiting.\n */\n pick(point: Point, radius = 0, layers?: readonly Layer[]): PickHit | undefined {\n const only = layers && Uint32Array.from(layers.map((l) => l.id));\n\n return this.engine.pick(point[0], point[1], radius, only);\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 pickFeature(point: Point, options: { radius?: number; layers?: readonly Layer[] } = {}): FeatureHit | undefined {\n const hit = this.pick(point, options.radius ?? 0, options.layers);\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 // Drawn by the engine with 3D Tiles: loaded first if needed\n if (!this.engines.tiles3d) {\n this.upgrade();\n await this.engines.upgrading;\n if (!this.engines.tiles3d)\n throw new Error('isard: panoramas need the engine with 3D Tiles, which failed to load');\n }\n\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\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 rad = Math.PI / 180;\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 /** 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. The last frame's scene is\n * drawn again and read back, waiting for the GPU (a stall): for clicks and drags */\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. The scene is drawn from above into a single pixel and\n * read back: cheap, but it waits for the GPU */\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 & { before?: Layer }): RasterLayer {\n const { url, opacity = 1, saturation = 1, size, before } = options;\n const { loader, minZoom, maxZoom } = rasterSource(options, this.workers.remoteReprojection);\n const layer = new RasterLayer(this, { url, minZoom, maxZoom, opacity, saturation, size, loader });\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(url: string, options: PmtilesOptions = {}): Promise<RasterLayer | VectorTiles> {\n return pmtilesLayer(this, url, 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 = 1800, contour = 0, opacity = 1 } = options;\n const { halo = 0, haloOpacity = 0.11, ramp, unreachedColor = 'rgba(140, 140, 140, 0.25)', fade = 0 } = options;\n const style = { width, max, contour, opacity, halo, haloOpacity, ramp, unreachedColor, fade };\n\n validateNetwork(nodes, edges);\n\n return this.addLayer(new NetworkLayer(this, { nodes, edges, lines }, costs, style, edgeWidths));\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 const above = index >= 0 ? this.layers[index + 1] : undefined;\n const layer = this.add(spec);\n\n if (!('before' in spec && spec.before) && index >= 0) this.moveLayer(layer, above);\n old.remove();\n\n return layer;\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(new LineLayer<P>(this, options.data, lineStyle(options)), options.before);\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 & { before?: Layer }): 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(new ExtrusionLayer<P>(this, options.data, extrusionStyle(options)), options.before);\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 { url, maxScreenSpaceError = 16, opacity = 1, pointSize, color, geoid = false } = options;\n\n return this.addLayer(\n new Tiles3dLayer(this, url, geoid, {\n maxScreenSpaceError,\n opacity,\n ...(pointSize !== undefined ? { pointSize } : {}),\n ...(color !== undefined ? { color } : {}),\n }),\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, on the engine with 3D Tiles; under `before` if given\n */\n addPointCloud(options: PointCloudOptions & { before?: Layer }): 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; on the engine with 3D Tiles, as they are */\n addModels(options: ModelOptions & { before?: Layer }): ModelLayer {\n return this.place(new ModelLayer(this, options), options.before);\n }\n\n /**\n * The page's own WebGL drawing at its place among the layers, in every frame (see `CustomLayerInterface`): raw\n * WebGL, three.js… with the matrices of the frame (`frame.matrixAt`); under `before` if given\n */\n addCustomLayer(layer: CustomLayerInterface, options: { before?: Layer } = {}): CustomLayer {\n const custom = new CustomLayer(\n this,\n layer,\n this.canvas,\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 = window.devicePixelRatio || 1;\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.destroy();\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 WebGL objects, models their data, while the context 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"]}
@@ -4,6 +4,7 @@ import { type ReactNode, type Ref } from 'react';
4
4
  import { type BoundLayerSpec } from '../bind/layers.ts';
5
5
  import type { ExtrusionLayer } from '../layers/extrusions.ts';
6
6
  import type { CircleLayer, FillLayer, LineLayer } from '../layers/features.ts';
7
+ import type { FlowLayer } from '../layers/flow.ts';
7
8
  import type { GroundLayer, ModelLayer, NetworkLayer, RasterLayer, Tiles3dLayer } from '../layers/layers.ts';
8
9
  import type { PointCloudLayer } from '../layers/pointclouds.ts';
9
10
  import type { SymbolLayer } from '../layers/symbols.ts';
@@ -21,6 +22,7 @@ export interface LayerHandles<P = Record<string, unknown>> {
21
22
  tiles3d: Tiles3dLayer;
22
23
  pointcloud: PointCloudLayer;
23
24
  models: ModelLayer;
25
+ flow: FlowLayer;
24
26
  }
25
27
  export type LayerType = LayerSpec['type'];
26
28
  export type LayerProps<P = Record<string, unknown>, T extends LayerType = LayerType> = Extract<BoundLayerSpec<P>, {