isard 1.1.0 → 1.2.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 (216) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/basemap/basemaps.d.ts +1 -1
  3. package/dist/basemap/basemaps.js +2 -2
  4. package/dist/basemap/basemaps.js.map +1 -1
  5. package/dist/basemap/grid.d.ts +5 -5
  6. package/dist/basemap/grid.js +59 -65
  7. package/dist/basemap/grid.js.map +1 -1
  8. package/dist/basemap/mvt.d.ts +1 -1
  9. package/dist/basemap/mvt.js +6 -6
  10. package/dist/basemap/mvt.js.map +1 -1
  11. package/dist/basemap/pmtiles.d.ts +10 -10
  12. package/dist/basemap/pmtiles.js +39 -31
  13. package/dist/basemap/pmtiles.js.map +1 -1
  14. package/dist/basemap/resample.d.ts +2 -2
  15. package/dist/basemap/resample.js +16 -14
  16. package/dist/basemap/resample.js.map +1 -1
  17. package/dist/basemap/terrain.d.ts +3 -3
  18. package/dist/basemap/terrain.js +6 -6
  19. package/dist/basemap/terrain.js.map +1 -1
  20. package/dist/basemap/vectorstyle.d.ts +12 -10
  21. package/dist/basemap/vectorstyle.js +128 -110
  22. package/dist/basemap/vectorstyle.js.map +1 -1
  23. package/dist/basemap/vectortiles.d.ts +11 -11
  24. package/dist/basemap/vectortiles.js +141 -103
  25. package/dist/basemap/vectortiles.js.map +1 -1
  26. package/dist/basemap/wmts.d.ts +3 -3
  27. package/dist/basemap/wmts.js +16 -11
  28. package/dist/basemap/wmts.js.map +1 -1
  29. package/dist/basemap.worker.js +2 -2
  30. package/dist/basemap.worker.js.map +14 -13
  31. package/dist/bind/layers.d.ts +13 -4
  32. package/dist/bind/layers.js +64 -40
  33. package/dist/bind/layers.js.map +1 -1
  34. package/dist/data/crs.d.ts +10 -10
  35. package/dist/data/crs.js +38 -34
  36. package/dist/data/crs.js.map +1 -1
  37. package/dist/data/gpx.d.ts +1 -1
  38. package/dist/data/gpx.js +20 -20
  39. package/dist/data/gpx.js.map +1 -1
  40. package/dist/data/kml.d.ts +1 -1
  41. package/dist/data/kml.js +42 -39
  42. package/dist/data/kml.js.map +1 -1
  43. package/dist/data/topojson.d.ts +1 -1
  44. package/dist/data/topojson.js +15 -10
  45. package/dist/data/topojson.js.map +1 -1
  46. package/dist/data/xml.d.ts +5 -5
  47. package/dist/data/xml.js +19 -18
  48. package/dist/data/xml.js.map +1 -1
  49. package/dist/decoder.worker.js +4 -4
  50. package/dist/decoder.worker.js.map +6 -6
  51. package/dist/engine/decoders.d.ts +2 -2
  52. package/dist/engine/decoders.js +28 -25
  53. package/dist/engine/decoders.js.map +1 -1
  54. package/dist/engine/loader.js +13 -14
  55. package/dist/engine/loader.js.map +1 -1
  56. package/dist/engine/requests.d.ts +1 -1
  57. package/dist/engine/requests.js +19 -16
  58. package/dist/engine/requests.js.map +1 -1
  59. package/dist/engine-loader.d.ts +8 -8
  60. package/dist/engine-loader.js +27 -27
  61. package/dist/engine-loader.js.map +1 -1
  62. package/dist/geoplateforme.d.ts +10 -10
  63. package/dist/geoplateforme.js +22 -20
  64. package/dist/geoplateforme.js.map +1 -1
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.js.map +1 -1
  67. package/dist/isard_bg.wasm +0 -0
  68. package/dist/isard_core_bg.wasm +0 -0
  69. package/dist/isard_points_bg.wasm +0 -0
  70. package/dist/layers/extrusions.d.ts +1 -1
  71. package/dist/layers/extrusions.js +10 -5
  72. package/dist/layers/extrusions.js.map +1 -1
  73. package/dist/layers/features.d.ts +10 -10
  74. package/dist/layers/features.js +41 -42
  75. package/dist/layers/features.js.map +1 -1
  76. package/dist/layers/glyphs.d.ts +3 -3
  77. package/dist/layers/glyphs.js +34 -40
  78. package/dist/layers/glyphs.js.map +1 -1
  79. package/dist/layers/icons.d.ts +8 -8
  80. package/dist/layers/icons.js +76 -68
  81. package/dist/layers/icons.js.map +1 -1
  82. package/dist/layers/layers.d.ts +1 -1
  83. package/dist/layers/layers.js +33 -29
  84. package/dist/layers/layers.js.map +1 -1
  85. package/dist/layers/panoramas.d.ts +2 -2
  86. package/dist/layers/panoramas.js +52 -41
  87. package/dist/layers/panoramas.js.map +1 -1
  88. package/dist/layers/pointclouds.d.ts +3 -3
  89. package/dist/layers/pointclouds.js +25 -33
  90. package/dist/layers/pointclouds.js.map +1 -1
  91. package/dist/layers/symbols.d.ts +1 -1
  92. package/dist/layers/symbols.js +68 -71
  93. package/dist/layers/symbols.js.map +1 -1
  94. package/dist/map/basemap-layers.d.ts +26 -0
  95. package/dist/map/basemap-layers.js +61 -0
  96. package/dist/map/basemap-layers.js.map +1 -0
  97. package/dist/map/canvas.d.ts +17 -0
  98. package/dist/map/canvas.js +56 -0
  99. package/dist/map/canvas.js.map +1 -0
  100. package/dist/map/checks.d.ts +11 -0
  101. package/dist/map/checks.js +39 -0
  102. package/dist/map/checks.js.map +1 -0
  103. package/dist/map/credits.d.ts +17 -0
  104. package/dist/map/credits.js +34 -0
  105. package/dist/map/credits.js.map +1 -0
  106. package/dist/map/engine-settings.d.ts +15 -0
  107. package/dist/map/engine-settings.js +45 -0
  108. package/dist/map/engine-settings.js.map +1 -0
  109. package/dist/map/engines.d.ts +41 -0
  110. package/dist/map/engines.js +77 -0
  111. package/dist/map/engines.js.map +1 -0
  112. package/dist/map/events.d.ts +14 -0
  113. package/dist/map/events.js +46 -0
  114. package/dist/map/events.js.map +1 -0
  115. package/dist/map/frame-loop.d.ts +61 -0
  116. package/dist/map/frame-loop.js +139 -0
  117. package/dist/map/frame-loop.js.map +1 -0
  118. package/dist/map/hover-pick.d.ts +30 -0
  119. package/dist/map/hover-pick.js +56 -0
  120. package/dist/map/hover-pick.js.map +1 -0
  121. package/dist/map/layer-spec.d.ts +42 -0
  122. package/dist/map/layer-spec.js +34 -0
  123. package/dist/map/layer-spec.js.map +1 -0
  124. package/dist/map/layer-stack.d.ts +36 -0
  125. package/dist/map/layer-stack.js +101 -0
  126. package/dist/map/layer-stack.js.map +1 -0
  127. package/dist/map/overlay-host.d.ts +36 -0
  128. package/dist/map/overlay-host.js +101 -0
  129. package/dist/map/overlay-host.js.map +1 -0
  130. package/dist/map/panorama-host.d.ts +5 -0
  131. package/dist/map/panorama-host.js +32 -0
  132. package/dist/map/panorama-host.js.map +1 -0
  133. package/dist/map/raster-source.d.ts +11 -0
  134. package/dist/map/raster-source.js +26 -0
  135. package/dist/map/raster-source.js.map +1 -0
  136. package/dist/map/symbol-atlases.d.ts +26 -0
  137. package/dist/map/symbol-atlases.js +59 -0
  138. package/dist/map/symbol-atlases.js.map +1 -0
  139. package/dist/map/viewshed.d.ts +5 -0
  140. package/dist/map/viewshed.js +28 -0
  141. package/dist/map/viewshed.js.map +1 -0
  142. package/dist/map/workers.d.ts +46 -0
  143. package/dist/map/workers.js +73 -0
  144. package/dist/map/workers.js.map +1 -0
  145. package/dist/map.d.ts +33 -120
  146. package/dist/map.js +164 -689
  147. package/dist/map.js.map +1 -1
  148. package/dist/react/Control.d.ts +11 -0
  149. package/dist/react/Control.js +18 -0
  150. package/dist/react/Control.js.map +1 -0
  151. package/dist/react/CustomLayer.d.ts +11 -0
  152. package/dist/react/CustomLayer.js +30 -0
  153. package/dist/react/CustomLayer.js.map +1 -0
  154. package/dist/react/IsardMap.d.ts +43 -0
  155. package/dist/react/IsardMap.js +146 -0
  156. package/dist/react/IsardMap.js.map +1 -0
  157. package/dist/react/Layer.d.ts +42 -0
  158. package/dist/react/Layer.js +74 -0
  159. package/dist/react/Layer.js.map +1 -0
  160. package/dist/react/Marker.d.ts +24 -0
  161. package/dist/react/Marker.js +53 -0
  162. package/dist/react/Marker.js.map +1 -0
  163. package/dist/react/Panel.d.ts +11 -0
  164. package/dist/react/Panel.js +37 -0
  165. package/dist/react/Panel.js.map +1 -0
  166. package/dist/react/Popup.d.ts +18 -0
  167. package/dist/react/Popup.js +60 -0
  168. package/dist/react/Popup.js.map +1 -0
  169. package/dist/react/Swipe.d.ts +9 -0
  170. package/dist/react/Swipe.js +41 -0
  171. package/dist/react/Swipe.js.map +1 -0
  172. package/dist/react/Viewshed.d.ts +5 -0
  173. package/dist/react/Viewshed.js +28 -0
  174. package/dist/react/Viewshed.js.map +1 -0
  175. package/dist/react/context.d.ts +32 -0
  176. package/dist/react/context.js +20 -0
  177. package/dist/react/context.js.map +1 -0
  178. package/dist/react/index.d.ts +15 -108
  179. package/dist/react/index.js +10 -397
  180. package/dist/react/index.js.map +1 -1
  181. package/dist/settings.d.ts +5 -9
  182. package/dist/settings.js +17 -15
  183. package/dist/settings.js.map +1 -1
  184. package/dist/types.d.ts +3 -3
  185. package/dist/types.js.map +1 -1
  186. package/dist/ui/controls.js +6 -4
  187. package/dist/ui/controls.js.map +1 -1
  188. package/dist/ui/interaction.d.ts +2 -2
  189. package/dist/ui/interaction.js +8 -7
  190. package/dist/ui/interaction.js.map +1 -1
  191. package/dist/ui/overlay.js +18 -20
  192. package/dist/ui/overlay.js.map +1 -1
  193. package/dist/ui/style.d.ts +1 -1
  194. package/dist/ui/style.js +2 -2
  195. package/dist/ui/style.js.map +1 -1
  196. package/dist/util/animation.d.ts +3 -3
  197. package/dist/util/animation.js +6 -6
  198. package/dist/util/animation.js.map +1 -1
  199. package/dist/util/color.d.ts +1 -1
  200. package/dist/util/color.js +14 -16
  201. package/dist/util/color.js.map +1 -1
  202. package/dist/util/geo.d.ts +6 -6
  203. package/dist/util/geo.js +12 -12
  204. package/dist/util/geo.js.map +1 -1
  205. package/dist/util/guards.d.ts +7 -0
  206. package/dist/util/guards.js +8 -0
  207. package/dist/util/guards.js.map +1 -0
  208. package/dist/util/lru.js.map +1 -1
  209. package/dist/wasm/isard.d.ts +168 -0
  210. package/dist/wasm/isard.js +146 -0
  211. package/dist/wasm/isard_core.d.ts +144 -0
  212. package/dist/wasm/isard_core.js +122 -0
  213. package/dist/workers/basemap.worker.d.ts +3 -3
  214. package/dist/workers/basemap.worker.js +94 -83
  215. package/dist/workers/basemap.worker.js.map +1 -1
  216. package/package.json +1 -1
@@ -266,10 +266,19 @@ export interface PickResult {
266
266
 
267
267
 
268
268
 
269
+ /**
270
+ * A map on one canvas: its WebGL2 context, camera, ground (raster layers over the relief) and the layers over it.
271
+ * Draws only when `render` is called (the JavaScript side calls it after `redraw` asks for a frame)
272
+ */
269
273
  export class Engine {
270
274
  free(): void;
271
275
  /**
272
276
  * Circle layer of `feature_count` features: points (Mercator [0, 1], interleaved) and the feature of each
277
+ *
278
+ * # Errors
279
+ *
280
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
281
+ * info log), or when `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
273
282
  */
274
283
  addCircles(points: Float64Array, feature: Uint32Array, feature_count: number): number;
275
284
  /**
@@ -280,29 +289,53 @@ export class Engine {
280
289
  addCustomLayer(render: () => void, depth: boolean): number;
281
290
  /**
282
291
  * An empty extrusion layer: its blocks come in batches (`setExtrusionBatch`)
292
+ *
293
+ * # Errors
294
+ *
295
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
296
+ * info log)
283
297
  */
284
298
  addExtrusions(): number;
285
299
  /**
286
300
  * Fill layer of `feature_count` features: polygons given by their points (Mercator [0, 1], interleaved), the first
287
301
  * point of each ring (`ring_start`, one more entry than rings), the first ring of each polygon (`polygon_start`,
288
302
  * one more entry than polygons; the first ring is the outer one, the others holes) and the feature of each polygon
303
+ *
304
+ * # Errors
305
+ *
306
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
307
+ * info log), or when `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
289
308
  */
290
309
  addFills(points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, feature: Uint32Array, feature_count: number): number;
291
310
  /**
292
311
  * Ground layer running `code` (GLSL ES 3.0 defining `vec4 ground(vec2 offset)`, see `render::ground`) over the
293
312
  * ground; `anchor`: Mercator point the offsets are taken from; bounds: Mercator box it shows in. Compilation errors
294
313
  * come back with the shader's info log (line numbers of `code`)
314
+ *
315
+ * # Errors
316
+ *
317
+ * Throws (to JavaScript) when `code` does not compile or link, with the shader's info log
295
318
  */
296
319
  addGround(code: string, anchor_x: number, anchor_y: number, min_x: number, min_y: number, max_x: number, max_y: number): number;
297
320
  /**
298
321
  * Line layer of `feature_count` features: polylines given by their points (Mercator [0, 1], interleaved), the
299
322
  * first point of each (`start`, one more entry than lines) and the feature each one belongs to
323
+ *
324
+ * # Errors
325
+ *
326
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
327
+ * info log), or when the features or the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
300
328
  */
301
329
  addLines(points: Float64Array, start: Uint32Array, feature: Uint32Array, feature_count: number): number;
302
330
  /**
303
331
  * A glTF / GLB model (its URL, a `blob:` one for data of the page) drawn at each instance of `instances`
304
332
  * (`INSTANCE_NUMBERS` numbers each: longitude, latitude, altitude, heading, pitch, roll in degrees, scale);
305
333
  * `ground`: altitudes above the relief, else above the ellipsoid
334
+ *
335
+ * # Errors
336
+ *
337
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
338
+ * info log). A model that fails to load or decode does not throw: the layer stays empty
306
339
  */
307
340
  addModels(url: string, instances: Float64Array, ground: boolean): number;
308
341
  /**
@@ -311,28 +344,53 @@ export class Engine {
311
344
  * edges (node index pairs, interleaved). `line_start` and `line_points`: the line of each edge from A to B, points
312
345
  * `line_start[e] .. line_start[e + 1]` of `line_points` (Mercator, interleaved; straight if fewer than two). `costs`: per edge, the
313
346
  * cost of travelling it from A to B then from B to A; without, values are interpolated along the edges.
347
+ *
348
+ * # Errors
349
+ *
350
+ * Throws (to JavaScript) when `style` is not 25 numbers, `edges` is not node pairs or names a node past
351
+ * those of `mercator`, the nodes or edges need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or when
352
+ * a WebGL object cannot be created or a shader fails to compile (the error carries its info log)
314
353
  */
315
354
  addNetwork(mercator: Float64Array, edges: Uint32Array, line_start: Uint32Array | null | undefined, line_points: Float64Array | null | undefined, costs: Float32Array | null | undefined, style: Float32Array): number;
316
355
  /**
317
356
  * A COPC point cloud from its URL (HTTP range requests). `resolve(wkt)` gives the CRS of the file from its WKT
318
357
  * (undefined if it has none): its inverse projection, whether its altitudes are above the geoid, the metres of
319
358
  * a unit of z; it may throw (an unknown CRS), the layer then stays empty
359
+ *
360
+ * # Errors
361
+ *
362
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
363
+ * info log). The file itself is read later: a bad file, or a `resolve` that throws, leaves the layer empty
320
364
  */
321
365
  addPointCloud(url: string, resolve: (wkt: string | undefined) => PointCloudCrs): number;
322
366
  /**
323
367
  * Raster tiles in Web Mercator; `url` holds {z}, {x} and {y}. `size`: side of the tiles' textures (256 by
324
368
  * default); `loader`: draws each tile instead of fetching `url`, `(z, x, y, signal) => Promise<ImageBitmap |
325
369
  * null>`, an image of `size` × `size` (null: nothing there)
370
+ *
371
+ * # Errors
372
+ *
373
+ * Throws (to JavaScript) when the texture holding the layer's tiles cannot be created
326
374
  */
327
375
  addRaster(url: string, min_z: number, max_z: number, opacity: number, saturation: number, size: number | null | undefined, loader: ((z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>) | undefined): number;
328
376
  /**
329
377
  * An empty symbol layer
378
+ *
379
+ * # Errors
380
+ *
381
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
382
+ * info log)
330
383
  */
331
384
  addSymbols(): number;
332
385
  /**
333
386
  * 3D Tiles (b3dm / glb textured meshes, external tilesets) from the URL of a `tileset.json`. `max_error`:
334
387
  * screen-space error (CSS pixels) above which a tile is refined; 16 is the usual value, lower is finer.
335
388
  * `geoid`: its heights are altitudes (NGF-IGN69), each tile raised by the RAF20 geoid onto the relief.
389
+ *
390
+ * # Errors
391
+ *
392
+ * Throws (to JavaScript) when one of the layer's programs fails to compile or link (the error carries
393
+ * its info log). The tileset itself is read later: a bad one leaves the layer empty, it does not throw
336
394
  */
337
395
  addTiles3d(url: string, max_error: number, geoid?: boolean | null): number;
338
396
  /**
@@ -340,11 +398,17 @@ export class Engine {
340
398
  * border cast on the ground, or on the far plane where it passes the horizon
341
399
  */
342
400
  bounds(): Float64Array;
401
+ /**
402
+ * The camera as set or moved: center (degrees), zoom, pitch and bearing (degrees)
403
+ */
343
404
  camera(): Camera;
344
405
  /**
345
406
  * Removes the panorama
346
407
  */
347
408
  clearPanorama(): void;
409
+ /**
410
+ * Stops loading the tiles of the flight's destination (`preload`)
411
+ */
348
412
  clearPreload(): void;
349
413
  /**
350
414
  * Removes the viewshed
@@ -392,6 +456,11 @@ export class Engine {
392
456
  networkStats(id: number): NetworkStats | undefined;
393
457
  /**
394
458
  * `redraw` is called when the engine needs a new frame (a tile arrived)
459
+ *
460
+ * # Errors
461
+ *
462
+ * Throws (to JavaScript) when the canvas gives no WebGL2 context ("WebGL2 is not available"), or when a WebGL
463
+ * object of the globe, the sky or the raster pass cannot be created or one of their shaders fails to compile
395
464
  */
396
465
  constructor(canvas: HTMLCanvasElement, redraw: () => void);
397
466
  /**
@@ -433,8 +502,18 @@ export class Engine {
433
502
  * Screen point (CSS pixels) of a ground position, or `height` metres above it, undefined behind the camera
434
503
  */
435
504
  project(lon: number, lat: number, height?: number | null): [x: number, y: number] | undefined;
505
+ /**
506
+ * Removes batch `key` of an extrusion layer (nothing if there is none)
507
+ */
436
508
  removeExtrusionBatch(id: number, key: number): void;
509
+ /**
510
+ * Removes a layer and frees its GPU objects; the other layers forget it (a layer that referred to it)
511
+ */
437
512
  removeLayer(id: number): void;
513
+ /**
514
+ * Draws a frame: the backdrop, the ground and the layers over it bottom to top, then the panorama and the
515
+ * viewshed; returns true while tiles are still loading (a new frame will be asked through `redraw`)
516
+ */
438
517
  render(): boolean;
439
518
  /**
440
519
  * Asks what is under a screen point without waiting for the GPU (as `pick`, with the position there): the
@@ -455,6 +534,9 @@ export class Engine {
455
534
  * then the sky-horizon, horizon-fog and fog-ground blends; `undefined` for none (the background color shows)
456
535
  */
457
536
  setAtmosphere(settings?: Float32Array | null): void;
537
+ /**
538
+ * Color the canvas is cleared to (RGB 0-1), where neither ground nor sky is drawn
539
+ */
458
540
  setBackground(r: number, g: number, b: number): void;
459
541
  /**
460
542
  * The body the map is drawn on: its equatorial radius (metres) and flattening (0 for a sphere), the halo of its
@@ -464,6 +546,10 @@ export class Engine {
464
546
  * relief, whose shaders may take its size (`ISARD_CIRCUMFERENCE` of the ground layers)
465
547
  */
466
548
  setBody(radius: number, flattening: number, halo: Float32Array | null | undefined, lowest: number, highest: number): void;
549
+ /**
550
+ * Sets the camera (degrees, the conventions of `MapLibre`): leaves a street-level view, and the camera keeps this
551
+ * center as the relief comes in
552
+ */
467
553
  setCamera(lon: number, lat: number, zoom: number, pitch: number, bearing: number): void;
468
554
  /**
469
555
  * Circles lying on the ground (true) or facing the screen
@@ -475,11 +561,21 @@ export class Engine {
475
561
  setCircles(id: number, points: Float64Array, feature: Uint32Array): void;
476
562
  /**
477
563
  * Anchors of batch `key` on the linked network: per feature, node A, node B, cost from A, cost from B
564
+ *
565
+ * # Errors
566
+ *
567
+ * Throws (to JavaScript) when the batch's features need an anchor texture past the GPU's
568
+ * `MAX_TEXTURE_SIZE`, or when it cannot be created
478
569
  */
479
570
  setExtrusionAnchors(id: number, key: number, anchors: Float32Array): void;
480
571
  /**
481
572
  * Adds or replaces batch `key` of an extrusion layer: polygons as for `addFills`, `feature_count` features (the
482
573
  * feature style gives each its height and base height as its two sizes, metres)
574
+ *
575
+ * # Errors
576
+ *
577
+ * Throws (to JavaScript) when a WebGL buffer or vertex array of the batch cannot be created, or when
578
+ * `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
483
579
  */
484
580
  setExtrusionBatch(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, feature: Uint32Array, feature_count: number): void;
485
581
  /**
@@ -527,29 +623,59 @@ export class Engine {
527
623
  /**
528
624
  * The glyph atlas shared by the symbol layers, one page: `width` × `height` bytes of signed distances
529
625
  * (allocated again, filled with `data` if given)
626
+ *
627
+ * # Errors
628
+ *
629
+ * Throws (to JavaScript) as `setGlyphPages` does: a size that is not positive, or the texture not created
530
630
  */
531
631
  setGlyphAtlas(width: number, height: number, data?: Uint8Array | null): void;
532
632
  /**
533
633
  * The glyph atlas shared by the symbol layers, `pages` pages of `width` × `height` bytes of signed distances,
534
634
  * allocated again and empty (`updateGlyphPage` fills them). A glyph on page `p` at row `v` has the atlas
535
635
  * coordinate `v + p × height`
636
+ *
637
+ * # Errors
638
+ *
639
+ * Throws (to JavaScript) when `width` or `height` is not positive (or their product overflows), `pages`
640
+ * is not 1 to 256, or the atlas texture cannot be created
536
641
  */
537
642
  setGlyphPages(width: number, height: number, pages: number): void;
643
+ /**
644
+ * Moves the Mercator box (0-1) a ground layer shows in
645
+ */
538
646
  setGroundBounds(id: number, min_x: number, min_y: number, max_x: number, max_y: number): void;
539
647
  /**
540
648
  * Creates the texture of sampler `name` (`format`: r8, r8ui, r16ui, r16i, r32ui, r32f, rg16ui, rg32f, rgba8,
541
649
  * rgba8ui, rgba16ui, rgba32f; `depth` 0 for 2D, else a 2D array of that many layers; `linear` filtering for the
542
650
  * non-integer formats); `data`: its texels as bytes, or undefined for an empty texture
651
+ *
652
+ * # Errors
653
+ *
654
+ * Throws (to JavaScript) on an unknown `format`, a size not positive (or overflowing), `data` shorter
655
+ * than the texels, more textures than the layer takes, or a texture WebGL cannot create
543
656
  */
544
657
  setGroundTexture(id: number, name: string, format: string, width: number, height: number, depth: number, linear: boolean, data?: Uint8Array | null): void;
545
658
  /**
546
659
  * A uniform of a ground layer's code, as numbers
660
+ *
661
+ * # Errors
662
+ *
663
+ * Throws (to JavaScript) when the shader has no uniform `name` (one its code does not use is removed
664
+ * by the compiler)
547
665
  */
548
666
  setGroundUniform(id: number, name: string, values: Float64Array): void;
667
+ /**
668
+ * Shows or hides a ground layer (kept, with its uniforms and textures)
669
+ */
549
670
  setGroundVisible(id: number, visible: boolean): void;
550
671
  /**
551
672
  * The icon atlas shared by the symbol layers: `width` × `height` RGBA texels, premultiplied, allocated again
552
673
  * and empty (`updateIconAtlas` fills it)
674
+ *
675
+ * # Errors
676
+ *
677
+ * Throws (to JavaScript) when `width` or `height` is not positive (or their product overflows), or the
678
+ * atlas texture cannot be created
553
679
  */
554
680
  setIconAtlas(width: number, height: number): void;
555
681
  /**
@@ -563,6 +689,11 @@ export class Engine {
563
689
  setLineDash(id: number, dash: number, gap: number): void;
564
690
  /**
565
691
  * New lines for a line layer (same arguments as `addLines`, the same features)
692
+ *
693
+ * # Errors
694
+ *
695
+ * Throws (to JavaScript) when the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
696
+ * when it cannot be created; the layer then keeps its lines
566
697
  */
567
698
  setLines(id: number, points: Float64Array, start: Uint32Array, feature: Uint32Array): void;
568
699
  /**
@@ -597,6 +728,10 @@ export class Engine {
597
728
  setNetworkValues(id: number, values: Float32Array): void;
598
729
  /**
599
730
  * The image of camera `index` of the panorama (the images sharing the size of the first)
731
+ *
732
+ * # Errors
733
+ *
734
+ * Throws (to JavaScript) when WebGL refuses the upload of `image` into the panorama's texture
600
735
  */
601
736
  setPanoramaImage(index: number, image: ImageBitmap): void;
602
737
  /**
@@ -605,6 +740,11 @@ export class Engine {
605
740
  * frame, row-major, 9; position in it, 3; focal x, y; center x, y; skew; image width, height; principal point of
606
741
  * the distortion x, y; its coefficients r³, r⁵, r⁷; its limit, pixels), a backdrop sphere of `radius` metres, at
607
742
  * `opacity`. Its images come after (`setPanoramaImage`)
743
+ *
744
+ * # Errors
745
+ *
746
+ * Throws (to JavaScript) when `rotation` holds fewer than 9 numbers, or when a WebGL object cannot be created or a
747
+ * shader fails to compile (the error carries its info log)
608
748
  */
609
749
  setPanorama(lon: number, lat: number, height: number, rotation: Float64Array, cameras: Float64Array, radius: number, opacity: number): void;
610
750
  /**
@@ -612,6 +752,9 @@ export class Engine {
612
752
  * alpha 0 hides a class) and the ramp of the altitudes (256 RGBA texels)
613
753
  */
614
754
  setPointCloudStyle(id: number, style: Float64Array, palette: Uint8Array, ramp: Uint8Array): void;
755
+ /**
756
+ * Opacity and saturation (0-1) of a raster layer; nothing for another id
757
+ */
615
758
  setRasterStyle(id: number, opacity: number, saturation: number): void;
616
759
  /**
617
760
  * The headers added to the engine's requests by URL prefix (`setRequestHeaders`, the same for every map of the
@@ -636,6 +779,11 @@ export class Engine {
636
779
  * Labels of a symbol layer, shaped by the page: anchors (Mercator, interleaved), their texts' boxes (min x, min y,
637
780
  * max x, max y, CSS pixels from the anchor), styles (36 floats each, see `LABEL_FLOATS`) and glyph and icon quads
638
781
  * (11 floats each, see `QUAD_FLOATS`)
782
+ *
783
+ * # Errors
784
+ *
785
+ * Throws (to JavaScript) when the labels need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
786
+ * when it cannot be created; the layer then keeps its labels
639
787
  */
640
788
  setSymbols(id: number, anchors: Float64Array, boxes: Float32Array, styles: Float32Array, quads: Float32Array): void;
641
789
  /**
@@ -647,6 +795,10 @@ export class Engine {
647
795
  * above the ellipsoid, those of 3D Tiles; over France, on the Earth only), else left as served (the default);
648
796
  * `loader`: gives the
649
797
  * altitudes of each tile instead of fetching `url` (an encoding decoded by the page: Terrarium, Terrain-RGB)
798
+ *
799
+ * # Errors
800
+ *
801
+ * Throws (to JavaScript) when the texture holding the relief's tiles cannot be created
650
802
  */
651
803
  setTerrain(url: string | null | undefined, exaggeration: number, max_z: number | null | undefined, geoid: boolean | null | undefined, loader: ((z: number, x: number, y: number, signal: AbortSignal) => Promise<Float32Array | null>) | undefined): void;
652
804
  /**
@@ -666,8 +818,16 @@ export class Engine {
666
818
  * only heading, tilt, angles of view across and up (degrees), the heading NaN to look all around. What some
667
819
  * observer sees is tinted with `visible`, what is hidden from all those that reach it with `hidden` (RGB 0-1),
668
820
  * at `opacity`; `outline` (RGB 0-1, or empty) the color of the cones' edges drawn in 3D
821
+ *
822
+ * # Errors
823
+ *
824
+ * Throws (to JavaScript) when, on the first call, a WebGL object cannot be created or a shader fails to compile
825
+ * (the error carries its info log)
669
826
  */
670
827
  setViewshed(observers: Float64Array, visible: Float32Array, hidden: Float32Array, opacity: number, outline: Float32Array): void;
828
+ /**
829
+ * Lowest and highest zoom levels the camera accepts
830
+ */
671
831
  setZoomRange(min: number, max: number): void;
672
832
  /**
673
833
  * Tile counters of the raster layers, for diagnostics
@@ -709,6 +869,11 @@ export class Engine {
709
869
  updateGlyphPage(page: number, x: number, y: number, width: number, height: number, data: Uint8Array): void;
710
870
  /**
711
871
  * Replaces a region of a ground layer's texture (one layer of a 2D array)
872
+ *
873
+ * # Errors
874
+ *
875
+ * Throws (to JavaScript) when there is no texture `name`, or when the region is out of its bounds or
876
+ * `data` holds too few bytes
712
877
  */
713
878
  updateGroundTexture(id: number, name: string, x: number, y: number, layer: number, width: number, height: number, data: Uint8Array): void;
714
879
  /**
@@ -720,6 +885,9 @@ export class Engine {
720
885
  * the eye first: the level each area of the ground is drawn at, for the labels of a vector style to follow it
721
886
  */
722
887
  wantedTiles(id: number): Uint32Array;
888
+ /**
889
+ * Zooms by `delta` levels around a screen point (CSS pixels), which keeps the same ground point under it
890
+ */
723
891
  zoomAt(delta: number, x: number, y: number): void;
724
892
  }
725
893