isard 1.1.0 → 1.3.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 (254) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/README.md +44 -39
  3. package/dist/basemap/basemaps.d.ts +1 -1
  4. package/dist/basemap/basemaps.js +2 -2
  5. package/dist/basemap/basemaps.js.map +1 -1
  6. package/dist/basemap/grid.d.ts +5 -5
  7. package/dist/basemap/grid.js +59 -65
  8. package/dist/basemap/grid.js.map +1 -1
  9. package/dist/basemap/mvt.d.ts +1 -1
  10. package/dist/basemap/mvt.js +6 -6
  11. package/dist/basemap/mvt.js.map +1 -1
  12. package/dist/basemap/pmtiles.d.ts +10 -10
  13. package/dist/basemap/pmtiles.js +39 -31
  14. package/dist/basemap/pmtiles.js.map +1 -1
  15. package/dist/basemap/pmtileslayer.d.ts +33 -0
  16. package/dist/basemap/pmtileslayer.js +97 -0
  17. package/dist/basemap/pmtileslayer.js.map +1 -0
  18. package/dist/basemap/resample.d.ts +2 -2
  19. package/dist/basemap/resample.js +16 -14
  20. package/dist/basemap/resample.js.map +1 -1
  21. package/dist/basemap/terrain.d.ts +3 -3
  22. package/dist/basemap/terrain.js +6 -6
  23. package/dist/basemap/terrain.js.map +1 -1
  24. package/dist/basemap/trees.d.ts +26 -0
  25. package/dist/basemap/trees.js +141 -0
  26. package/dist/basemap/trees.js.map +1 -0
  27. package/dist/basemap/vectorstyle.d.ts +22 -10
  28. package/dist/basemap/vectorstyle.js +163 -110
  29. package/dist/basemap/vectorstyle.js.map +1 -1
  30. package/dist/basemap/vectortiles.d.ts +70 -47
  31. package/dist/basemap/vectortiles.js +480 -358
  32. package/dist/basemap/vectortiles.js.map +1 -1
  33. package/dist/basemap/wmts.d.ts +3 -3
  34. package/dist/basemap/wmts.js +16 -11
  35. package/dist/basemap/wmts.js.map +1 -1
  36. package/dist/basemap/workerpool.d.ts +17 -0
  37. package/dist/basemap/workerpool.js +194 -0
  38. package/dist/basemap/workerpool.js.map +1 -0
  39. package/dist/basemap.worker.js +2 -2
  40. package/dist/basemap.worker.js.map +21 -13
  41. package/dist/bind/layers.d.ts +13 -4
  42. package/dist/bind/layers.js +64 -40
  43. package/dist/bind/layers.js.map +1 -1
  44. package/dist/data/crs.d.ts +10 -10
  45. package/dist/data/crs.js +38 -34
  46. package/dist/data/crs.js.map +1 -1
  47. package/dist/data/gpx.d.ts +1 -1
  48. package/dist/data/gpx.js +20 -20
  49. package/dist/data/gpx.js.map +1 -1
  50. package/dist/data/kml.d.ts +1 -1
  51. package/dist/data/kml.js +42 -39
  52. package/dist/data/kml.js.map +1 -1
  53. package/dist/data/topojson.d.ts +1 -1
  54. package/dist/data/topojson.js +15 -10
  55. package/dist/data/topojson.js.map +1 -1
  56. package/dist/data/xml.d.ts +5 -5
  57. package/dist/data/xml.js +19 -18
  58. package/dist/data/xml.js.map +1 -1
  59. package/dist/decoder.worker.js +4 -4
  60. package/dist/decoder.worker.js.map +6 -6
  61. package/dist/engine/decoders.d.ts +2 -2
  62. package/dist/engine/decoders.js +28 -25
  63. package/dist/engine/decoders.js.map +1 -1
  64. package/dist/engine/loader.js +13 -14
  65. package/dist/engine/loader.js.map +1 -1
  66. package/dist/engine/requests.d.ts +1 -1
  67. package/dist/engine/requests.js +19 -16
  68. package/dist/engine/requests.js.map +1 -1
  69. package/dist/engine-loader.d.ts +13 -9
  70. package/dist/engine-loader.js +38 -28
  71. package/dist/engine-loader.js.map +1 -1
  72. package/dist/geoplateforme.d.ts +26 -10
  73. package/dist/geoplateforme.js +45 -20
  74. package/dist/geoplateforme.js.map +1 -1
  75. package/dist/index.d.ts +12 -4
  76. package/dist/index.js +9 -2
  77. package/dist/index.js.map +1 -1
  78. package/dist/isard_bg.wasm +0 -0
  79. package/dist/isard_core_bg.wasm +0 -0
  80. package/dist/isard_points_bg.wasm +0 -0
  81. package/dist/isard_tess_bg.wasm +0 -0
  82. package/dist/layers/extrusions.d.ts +1 -1
  83. package/dist/layers/extrusions.js +10 -5
  84. package/dist/layers/extrusions.js.map +1 -1
  85. package/dist/layers/features.d.ts +10 -10
  86. package/dist/layers/features.js +41 -42
  87. package/dist/layers/features.js.map +1 -1
  88. package/dist/layers/glyphs.d.ts +3 -3
  89. package/dist/layers/glyphs.js +34 -40
  90. package/dist/layers/glyphs.js.map +1 -1
  91. package/dist/layers/icons.d.ts +8 -8
  92. package/dist/layers/icons.js +76 -68
  93. package/dist/layers/icons.js.map +1 -1
  94. package/dist/layers/layers.d.ts +1 -1
  95. package/dist/layers/layers.js +42 -29
  96. package/dist/layers/layers.js.map +1 -1
  97. package/dist/layers/panoramas.d.ts +2 -2
  98. package/dist/layers/panoramas.js +52 -41
  99. package/dist/layers/panoramas.js.map +1 -1
  100. package/dist/layers/pointclouds.d.ts +3 -3
  101. package/dist/layers/pointclouds.js +25 -33
  102. package/dist/layers/pointclouds.js.map +1 -1
  103. package/dist/layers/symbols.d.ts +1 -1
  104. package/dist/layers/symbols.js +68 -71
  105. package/dist/layers/symbols.js.map +1 -1
  106. package/dist/layers/vectors.d.ts +60 -0
  107. package/dist/layers/vectors.js +130 -0
  108. package/dist/layers/vectors.js.map +1 -0
  109. package/dist/map/basemap-layers.d.ts +26 -0
  110. package/dist/map/basemap-layers.js +61 -0
  111. package/dist/map/basemap-layers.js.map +1 -0
  112. package/dist/map/canvas.d.ts +17 -0
  113. package/dist/map/canvas.js +56 -0
  114. package/dist/map/canvas.js.map +1 -0
  115. package/dist/map/checks.d.ts +11 -0
  116. package/dist/map/checks.js +39 -0
  117. package/dist/map/checks.js.map +1 -0
  118. package/dist/map/credits.d.ts +17 -0
  119. package/dist/map/credits.js +34 -0
  120. package/dist/map/credits.js.map +1 -0
  121. package/dist/map/engine-settings.d.ts +15 -0
  122. package/dist/map/engine-settings.js +45 -0
  123. package/dist/map/engine-settings.js.map +1 -0
  124. package/dist/map/engines.d.ts +41 -0
  125. package/dist/map/engines.js +77 -0
  126. package/dist/map/engines.js.map +1 -0
  127. package/dist/map/events.d.ts +14 -0
  128. package/dist/map/events.js +46 -0
  129. package/dist/map/events.js.map +1 -0
  130. package/dist/map/frame-loop.d.ts +64 -0
  131. package/dist/map/frame-loop.js +145 -0
  132. package/dist/map/frame-loop.js.map +1 -0
  133. package/dist/map/hover-pick.d.ts +30 -0
  134. package/dist/map/hover-pick.js +56 -0
  135. package/dist/map/hover-pick.js.map +1 -0
  136. package/dist/map/layer-spec.d.ts +42 -0
  137. package/dist/map/layer-spec.js +34 -0
  138. package/dist/map/layer-spec.js.map +1 -0
  139. package/dist/map/layer-stack.d.ts +36 -0
  140. package/dist/map/layer-stack.js +101 -0
  141. package/dist/map/layer-stack.js.map +1 -0
  142. package/dist/map/overlay-host.d.ts +36 -0
  143. package/dist/map/overlay-host.js +101 -0
  144. package/dist/map/overlay-host.js.map +1 -0
  145. package/dist/map/panorama-host.d.ts +5 -0
  146. package/dist/map/panorama-host.js +32 -0
  147. package/dist/map/panorama-host.js.map +1 -0
  148. package/dist/map/raster-source.d.ts +11 -0
  149. package/dist/map/raster-source.js +26 -0
  150. package/dist/map/raster-source.js.map +1 -0
  151. package/dist/map/symbol-atlases.d.ts +26 -0
  152. package/dist/map/symbol-atlases.js +59 -0
  153. package/dist/map/symbol-atlases.js.map +1 -0
  154. package/dist/map/viewshed.d.ts +5 -0
  155. package/dist/map/viewshed.js +28 -0
  156. package/dist/map/viewshed.js.map +1 -0
  157. package/dist/map/workers.d.ts +46 -0
  158. package/dist/map/workers.js +73 -0
  159. package/dist/map/workers.js.map +1 -0
  160. package/dist/map.d.ts +54 -126
  161. package/dist/map.js +227 -698
  162. package/dist/map.js.map +1 -1
  163. package/dist/react/Control.d.ts +11 -0
  164. package/dist/react/Control.js +18 -0
  165. package/dist/react/Control.js.map +1 -0
  166. package/dist/react/CustomLayer.d.ts +11 -0
  167. package/dist/react/CustomLayer.js +30 -0
  168. package/dist/react/CustomLayer.js.map +1 -0
  169. package/dist/react/IsardMap.d.ts +43 -0
  170. package/dist/react/IsardMap.js +147 -0
  171. package/dist/react/IsardMap.js.map +1 -0
  172. package/dist/react/Layer.d.ts +42 -0
  173. package/dist/react/Layer.js +74 -0
  174. package/dist/react/Layer.js.map +1 -0
  175. package/dist/react/Marker.d.ts +24 -0
  176. package/dist/react/Marker.js +53 -0
  177. package/dist/react/Marker.js.map +1 -0
  178. package/dist/react/Panel.d.ts +11 -0
  179. package/dist/react/Panel.js +37 -0
  180. package/dist/react/Panel.js.map +1 -0
  181. package/dist/react/Popup.d.ts +18 -0
  182. package/dist/react/Popup.js +60 -0
  183. package/dist/react/Popup.js.map +1 -0
  184. package/dist/react/Swipe.d.ts +16 -0
  185. package/dist/react/Swipe.js +52 -0
  186. package/dist/react/Swipe.js.map +1 -0
  187. package/dist/react/VectorGeometry.d.ts +35 -0
  188. package/dist/react/VectorGeometry.js +82 -0
  189. package/dist/react/VectorGeometry.js.map +1 -0
  190. package/dist/react/Viewshed.d.ts +5 -0
  191. package/dist/react/Viewshed.js +28 -0
  192. package/dist/react/Viewshed.js.map +1 -0
  193. package/dist/react/context.d.ts +33 -0
  194. package/dist/react/context.js +20 -0
  195. package/dist/react/context.js.map +1 -0
  196. package/dist/react/index.d.ts +16 -108
  197. package/dist/react/index.js +11 -397
  198. package/dist/react/index.js.map +1 -1
  199. package/dist/settings.d.ts +5 -9
  200. package/dist/settings.js +17 -15
  201. package/dist/settings.js.map +1 -1
  202. package/dist/types.d.ts +27 -4
  203. package/dist/types.js.map +1 -1
  204. package/dist/ui/controls.js +6 -4
  205. package/dist/ui/controls.js.map +1 -1
  206. package/dist/ui/interaction.d.ts +2 -2
  207. package/dist/ui/interaction.js +8 -7
  208. package/dist/ui/interaction.js.map +1 -1
  209. package/dist/ui/minimap.d.ts +25 -0
  210. package/dist/ui/minimap.js +90 -0
  211. package/dist/ui/minimap.js.map +1 -0
  212. package/dist/ui/overlay.js +18 -20
  213. package/dist/ui/overlay.js.map +1 -1
  214. package/dist/ui/scale.d.ts +19 -0
  215. package/dist/ui/scale.js +44 -0
  216. package/dist/ui/scale.js.map +1 -0
  217. package/dist/ui/search.d.ts +25 -0
  218. package/dist/ui/search.js +119 -0
  219. package/dist/ui/search.js.map +1 -0
  220. package/dist/ui/style.d.ts +1 -1
  221. package/dist/ui/style.js +19 -2
  222. package/dist/ui/style.js.map +1 -1
  223. package/dist/util/animation.d.ts +3 -3
  224. package/dist/util/animation.js +6 -6
  225. package/dist/util/animation.js.map +1 -1
  226. package/dist/util/color.d.ts +1 -1
  227. package/dist/util/color.js +14 -16
  228. package/dist/util/color.js.map +1 -1
  229. package/dist/util/geo.d.ts +6 -6
  230. package/dist/util/geo.js +12 -12
  231. package/dist/util/geo.js.map +1 -1
  232. package/dist/util/guards.d.ts +7 -0
  233. package/dist/util/guards.js +8 -0
  234. package/dist/util/guards.js.map +1 -0
  235. package/dist/util/lru.js.map +1 -1
  236. package/dist/util/sun.d.ts +11 -0
  237. package/dist/util/sun.js +26 -0
  238. package/dist/util/sun.js.map +1 -0
  239. package/dist/wasm/isard.d.ts +250 -7
  240. package/dist/wasm/isard.js +375 -8
  241. package/dist/wasm/isard_core.d.ts +226 -7
  242. package/dist/wasm/isard_core.js +351 -8
  243. package/dist/wasm/isard_tess.d.ts +109 -0
  244. package/dist/wasm/isard_tess.js +398 -0
  245. package/dist/workers/basemap/geometry.d.ts +72 -0
  246. package/dist/workers/basemap/labels.d.ts +8 -0
  247. package/dist/workers/basemap/raster.d.ts +10 -0
  248. package/dist/workers/basemap/tiles.d.ts +65 -0
  249. package/dist/workers/basemap/trees.d.ts +19 -0
  250. package/dist/workers/basemap.worker.d.ts +126 -22
  251. package/dist/workers/basemap.worker.js +76 -544
  252. package/dist/workers/basemap.worker.js.map +1 -1
  253. package/package.json +5 -4
  254. package/vite.js +10 -2
@@ -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,40 +344,80 @@ 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;
396
+ /**
397
+ * An empty layer of vector tiles drawn as geometry: its style layers come with `setVectorSublayers`, its tiles
398
+ * with `setVectorTile`
399
+ *
400
+ * # Errors
401
+ *
402
+ * Throws (to JavaScript) when a shader fails to compile (the error carries its info log)
403
+ */
404
+ addVectorTiles(): number;
338
405
  /**
339
406
  * Longitudes and latitudes the view covers on the ground, `[west, south, east, north]` (degrees): the screen's
340
407
  * border cast on the ground, or on the far plane where it passes the horizon
341
408
  */
342
409
  bounds(): Float64Array;
410
+ /**
411
+ * The camera as set or moved: center (degrees), zoom, pitch and bearing (degrees)
412
+ */
343
413
  camera(): Camera;
344
414
  /**
345
415
  * Removes the panorama
346
416
  */
347
417
  clearPanorama(): void;
418
+ /**
419
+ * Stops loading the tiles of the flight's destination (`preload`)
420
+ */
348
421
  clearPreload(): void;
349
422
  /**
350
423
  * Removes the viewshed
@@ -392,6 +465,11 @@ export class Engine {
392
465
  networkStats(id: number): NetworkStats | undefined;
393
466
  /**
394
467
  * `redraw` is called when the engine needs a new frame (a tile arrived)
468
+ *
469
+ * # Errors
470
+ *
471
+ * Throws (to JavaScript) when the canvas gives no WebGL2 context ("WebGL2 is not available"), or when a WebGL
472
+ * object of the globe, the sky or the raster pass cannot be created or one of their shaders fails to compile
395
473
  */
396
474
  constructor(canvas: HTMLCanvasElement, redraw: () => void);
397
475
  /**
@@ -433,8 +511,22 @@ export class Engine {
433
511
  * Screen point (CSS pixels) of a ground position, or `height` metres above it, undefined behind the camera
434
512
  */
435
513
  project(lon: number, lat: number, height?: number | null): [x: number, y: number] | undefined;
514
+ /**
515
+ * Removes batch `key` of an extrusion layer (nothing if there is none)
516
+ */
436
517
  removeExtrusionBatch(id: number, key: number): void;
518
+ /**
519
+ * Removes a layer and frees its GPU objects; the other layers forget it (a layer that referred to it)
520
+ */
437
521
  removeLayer(id: number): void;
522
+ /**
523
+ * Removes tile `key` of a vector tile layer (nothing if there is none)
524
+ */
525
+ removeVectorTile(id: number, key: number): void;
526
+ /**
527
+ * Draws a frame: the backdrop, the ground and the layers over it bottom to top, then the panorama and the
528
+ * viewshed; returns true while tiles are still loading (a new frame will be asked through `redraw`)
529
+ */
438
530
  render(): boolean;
439
531
  /**
440
532
  * Asks what is under a screen point without waiting for the GPU (as `pick`, with the position there): the
@@ -455,6 +547,9 @@ export class Engine {
455
547
  * then the sky-horizon, horizon-fog and fog-ground blends; `undefined` for none (the background color shows)
456
548
  */
457
549
  setAtmosphere(settings?: Float32Array | null): void;
550
+ /**
551
+ * Color the canvas is cleared to (RGB 0-1), where neither ground nor sky is drawn
552
+ */
458
553
  setBackground(r: number, g: number, b: number): void;
459
554
  /**
460
555
  * The body the map is drawn on: its equatorial radius (metres) and flattening (0 for a sphere), the halo of its
@@ -464,6 +559,10 @@ export class Engine {
464
559
  * relief, whose shaders may take its size (`ISARD_CIRCUMFERENCE` of the ground layers)
465
560
  */
466
561
  setBody(radius: number, flattening: number, halo: Float32Array | null | undefined, lowest: number, highest: number): void;
562
+ /**
563
+ * Sets the camera (degrees, the conventions of `MapLibre`): leaves a street-level view, and the camera keeps this
564
+ * center as the relief comes in
565
+ */
467
566
  setCamera(lon: number, lat: number, zoom: number, pitch: number, bearing: number): void;
468
567
  /**
469
568
  * Circles lying on the ground (true) or facing the screen
@@ -475,11 +574,21 @@ export class Engine {
475
574
  setCircles(id: number, points: Float64Array, feature: Uint32Array): void;
476
575
  /**
477
576
  * Anchors of batch `key` on the linked network: per feature, node A, node B, cost from A, cost from B
577
+ *
578
+ * # Errors
579
+ *
580
+ * Throws (to JavaScript) when the batch's features need an anchor texture past the GPU's
581
+ * `MAX_TEXTURE_SIZE`, or when it cannot be created
478
582
  */
479
583
  setExtrusionAnchors(id: number, key: number, anchors: Float32Array): void;
480
584
  /**
481
585
  * Adds or replaces batch `key` of an extrusion layer: polygons as for `addFills`, `feature_count` features (the
482
586
  * feature style gives each its height and base height as its two sizes, metres)
587
+ *
588
+ * # Errors
589
+ *
590
+ * Throws (to JavaScript) when a WebGL buffer or vertex array of the batch cannot be created, or when
591
+ * `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
483
592
  */
484
593
  setExtrusionBatch(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, feature: Uint32Array, feature_count: number): void;
485
594
  /**
@@ -496,10 +605,10 @@ export class Engine {
496
605
  */
497
606
  setFeatureRamp(id: number, rgba: Uint8Array | null | undefined, min: number, max: number): void;
498
607
  /**
499
- * Style of the features of a line, circle, fill or extrusion layer (batch `key` of the latter): 32 floats per
500
- * feature, its color (RGBA 0-1), its second color (a circle's stroke), then two sizes as zoom stops (four zooms,
501
- * four values each): a line's width; a circle's radius and stroke width, CSS pixels; a block's height and base
502
- * height, metres
608
+ * Style of the features of a line, circle, fill, extrusion or vector tile layer (batch or tile `key` of the last
609
+ * two): 32 floats per feature, its color (RGBA 0-1), its second color (a circle's stroke), then two sizes as zoom
610
+ * stops (four zooms, four values each): a line's width; a circle's radius and stroke width, CSS pixels; a block's
611
+ * height and base height, metres
503
612
  */
504
613
  setFeatureStyle(id: number, style: Float32Array, key?: number | null): void;
505
614
  /**
@@ -527,29 +636,59 @@ export class Engine {
527
636
  /**
528
637
  * The glyph atlas shared by the symbol layers, one page: `width` × `height` bytes of signed distances
529
638
  * (allocated again, filled with `data` if given)
639
+ *
640
+ * # Errors
641
+ *
642
+ * Throws (to JavaScript) as `setGlyphPages` does: a size that is not positive, or the texture not created
530
643
  */
531
644
  setGlyphAtlas(width: number, height: number, data?: Uint8Array | null): void;
532
645
  /**
533
646
  * The glyph atlas shared by the symbol layers, `pages` pages of `width` × `height` bytes of signed distances,
534
647
  * allocated again and empty (`updateGlyphPage` fills them). A glyph on page `p` at row `v` has the atlas
535
648
  * coordinate `v + p × height`
649
+ *
650
+ * # Errors
651
+ *
652
+ * Throws (to JavaScript) when `width` or `height` is not positive (or their product overflows), `pages`
653
+ * is not 1 to 256, or the atlas texture cannot be created
536
654
  */
537
655
  setGlyphPages(width: number, height: number, pages: number): void;
656
+ /**
657
+ * Moves the Mercator box (0-1) a ground layer shows in
658
+ */
538
659
  setGroundBounds(id: number, min_x: number, min_y: number, max_x: number, max_y: number): void;
539
660
  /**
540
661
  * Creates the texture of sampler `name` (`format`: r8, r8ui, r16ui, r16i, r32ui, r32f, rg16ui, rg32f, rgba8,
541
662
  * rgba8ui, rgba16ui, rgba32f; `depth` 0 for 2D, else a 2D array of that many layers; `linear` filtering for the
542
663
  * non-integer formats); `data`: its texels as bytes, or undefined for an empty texture
664
+ *
665
+ * # Errors
666
+ *
667
+ * Throws (to JavaScript) on an unknown `format`, a size not positive (or overflowing), `data` shorter
668
+ * than the texels, more textures than the layer takes, or a texture WebGL cannot create
543
669
  */
544
670
  setGroundTexture(id: number, name: string, format: string, width: number, height: number, depth: number, linear: boolean, data?: Uint8Array | null): void;
545
671
  /**
546
672
  * A uniform of a ground layer's code, as numbers
673
+ *
674
+ * # Errors
675
+ *
676
+ * Throws (to JavaScript) when the shader has no uniform `name` (one its code does not use is removed
677
+ * by the compiler)
547
678
  */
548
679
  setGroundUniform(id: number, name: string, values: Float64Array): void;
680
+ /**
681
+ * Shows or hides a ground layer (kept, with its uniforms and textures)
682
+ */
549
683
  setGroundVisible(id: number, visible: boolean): void;
550
684
  /**
551
685
  * The icon atlas shared by the symbol layers: `width` × `height` RGBA texels, premultiplied, allocated again
552
686
  * and empty (`updateIconAtlas` fills it)
687
+ *
688
+ * # Errors
689
+ *
690
+ * Throws (to JavaScript) when `width` or `height` is not positive (or their product overflows), or the
691
+ * atlas texture cannot be created
553
692
  */
554
693
  setIconAtlas(width: number, height: number): void;
555
694
  /**
@@ -563,6 +702,11 @@ export class Engine {
563
702
  setLineDash(id: number, dash: number, gap: number): void;
564
703
  /**
565
704
  * New lines for a line layer (same arguments as `addLines`, the same features)
705
+ *
706
+ * # Errors
707
+ *
708
+ * Throws (to JavaScript) when the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
709
+ * when it cannot be created; the layer then keeps its lines
566
710
  */
567
711
  setLines(id: number, points: Float64Array, start: Uint32Array, feature: Uint32Array): void;
568
712
  /**
@@ -597,6 +741,10 @@ export class Engine {
597
741
  setNetworkValues(id: number, values: Float32Array): void;
598
742
  /**
599
743
  * The image of camera `index` of the panorama (the images sharing the size of the first)
744
+ *
745
+ * # Errors
746
+ *
747
+ * Throws (to JavaScript) when WebGL refuses the upload of `image` into the panorama's texture
600
748
  */
601
749
  setPanoramaImage(index: number, image: ImageBitmap): void;
602
750
  /**
@@ -605,6 +753,11 @@ export class Engine {
605
753
  * frame, row-major, 9; position in it, 3; focal x, y; center x, y; skew; image width, height; principal point of
606
754
  * the distortion x, y; its coefficients r³, r⁵, r⁷; its limit, pixels), a backdrop sphere of `radius` metres, at
607
755
  * `opacity`. Its images come after (`setPanoramaImage`)
756
+ *
757
+ * # Errors
758
+ *
759
+ * Throws (to JavaScript) when `rotation` holds fewer than 9 numbers, or when a WebGL object cannot be created or a
760
+ * shader fails to compile (the error carries its info log)
608
761
  */
609
762
  setPanorama(lon: number, lat: number, height: number, rotation: Float64Array, cameras: Float64Array, radius: number, opacity: number): void;
610
763
  /**
@@ -612,6 +765,9 @@ export class Engine {
612
765
  * alpha 0 hides a class) and the ramp of the altitudes (256 RGBA texels)
613
766
  */
614
767
  setPointCloudStyle(id: number, style: Float64Array, palette: Uint8Array, ramp: Uint8Array): void;
768
+ /**
769
+ * Opacity and saturation (0-1) of a raster layer; nothing for another id
770
+ */
615
771
  setRasterStyle(id: number, opacity: number, saturation: number): void;
616
772
  /**
617
773
  * The headers added to the engine's requests by URL prefix (`setRequestHeaders`, the same for every map of the
@@ -622,11 +778,22 @@ export class Engine {
622
778
  * Space behind the globe (stars, atmosphere halo), in the globe projection
623
779
  */
624
780
  setSky(enabled: boolean): void;
781
+ /**
782
+ * The sun casting shadows and the night: its azimuth (degrees clockwise from north) and altitude (degrees above
783
+ * the horizon), the shadows' opacity (0 to 1; none under the horizon or not a number), how dark the night is (0 to
784
+ * 1: the frame tinted, the lights of the layers on). Neither shadows nor night: nothing drawn
785
+ *
786
+ * # Errors
787
+ *
788
+ * Throws (to JavaScript) when a WebGL object cannot be created or the pass fails to compile
789
+ */
790
+ setSun(azimuth: number, altitude: number, opacity: number, night: number): void;
625
791
  /**
626
792
  * Shows `layers` on one side of a vertical line only, the others beneath on the other side (comparing two states
627
- * of a place): left of `x` (CSS pixels from the left of the canvas), or right of it; a non-finite `x` stops
793
+ * of a place): left of `x` (CSS pixels from the left of the canvas), or right of it; `others` on the other side
794
+ * only (two meshes of the same place, each on its side, never drawn over each other); a non-finite `x` stops
628
795
  */
629
- setSwipe(x: number, right: boolean, layers: Uint32Array): void;
796
+ setSwipe(x: number, right: boolean, layers: Uint32Array, others: Uint32Array): void;
630
797
  /**
631
798
  * Layer-wide style of a symbol layer: size scale and opacity as zoom stops (four zooms then four values each),
632
799
  * zoom range, visibility
@@ -636,6 +803,11 @@ export class Engine {
636
803
  * Labels of a symbol layer, shaped by the page: anchors (Mercator, interleaved), their texts' boxes (min x, min y,
637
804
  * max x, max y, CSS pixels from the anchor), styles (36 floats each, see `LABEL_FLOATS`) and glyph and icon quads
638
805
  * (11 floats each, see `QUAD_FLOATS`)
806
+ *
807
+ * # Errors
808
+ *
809
+ * Throws (to JavaScript) when the labels need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
810
+ * when it cannot be created; the layer then keeps its labels
639
811
  */
640
812
  setSymbols(id: number, anchors: Float64Array, boxes: Float32Array, styles: Float32Array, quads: Float32Array): void;
641
813
  /**
@@ -647,6 +819,10 @@ export class Engine {
647
819
  * above the ellipsoid, those of 3D Tiles; over France, on the Earth only), else left as served (the default);
648
820
  * `loader`: gives the
649
821
  * altitudes of each tile instead of fetching `url` (an encoding decoded by the page: Terrarium, Terrain-RGB)
822
+ *
823
+ * # Errors
824
+ *
825
+ * Throws (to JavaScript) when the texture holding the relief's tiles cannot be created
650
826
  */
651
827
  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
828
  /**
@@ -660,14 +836,60 @@ export class Engine {
660
836
  * for none: it tints the textures and colors the untextured meshes) of a 3D Tiles layer
661
837
  */
662
838
  setTiles3dStyle(id: number, max_error: number, opacity: number, point_size: number | null | undefined, color: Float32Array): void;
839
+ /**
840
+ * The style layers of a vector tile layer, in drawing order: per layer, its kind (0 fill, 1 line, 2 extrusion), its zoom range
841
+ * (two numbers: shown from the first, included, to the second, excluded), whether it shows (0 or 1), its dashes
842
+ * (four numbers: dash, gap, dash, gap, in line widths; 0: solid), its opacity as zoom stops (four zooms then four
843
+ * values; missing: opaque), the caps of its lines' ends (0 butt, 1 round, 2 square; missing: round), whether its
844
+ * lines glow at night (streets; 0 or 1)
845
+ */
846
+ setVectorSublayers(id: number, kinds: Uint8Array, zooms: Float64Array, visible: Uint8Array, dashes: Float32Array, opacities: Float32Array, caps: Uint8Array, lit: Uint8Array): void;
847
+ /**
848
+ * Adds or replaces tile `key` of a vector tile layer ready for the GPU, as the basemap workers make it (the
849
+ * tessellation module): its polygons as for `setVectorTile` (picked here; their prisms built here if drawn in
850
+ * relief while `prism` is false), the vertices of its fills (`shapes::Vertex` as bytes, each with its feature),
851
+ * their triangles, per sublayer its top cap and the rest of its prism (`fill_ranges`: four numbers, first and
852
+ * end of each), its line pieces (`pieces::Piece` as bytes), the line table (feature and length of each line),
853
+ * per sublayer its pieces (`line_ranges`: first, end), the blocks of its extrusion sublayers (`shapes::Block` as
854
+ * bytes), their triangles, per sublayer its blocks' triangles (`block_ranges`: first, end), the extent of its
855
+ * points (`bounds`: min x, min y, max x, max y), `feature_count` features
856
+ *
857
+ * # Errors
858
+ *
859
+ * Throws (to JavaScript) when the vertices, pieces or blocks are cut short, when a WebGL object of the tile cannot be
860
+ * created, or when its features or lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
861
+ */
862
+ setVectorTileMesh(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, vertices: Uint8Array, indices: Uint32Array, fill_ranges: Uint32Array, prism: boolean, pieces: Uint8Array, line_table: Float32Array, line_ranges: Uint32Array, blocks: Uint8Array, block_indices: Uint32Array, block_ranges: Uint32Array, bounds: Float64Array, feature_count: number): void;
863
+ /**
864
+ * Adds or replaces tile `key` of a vector tile layer: its polygons as for `addFills` (`fill_start`: the first
865
+ * polygon of each sublayer, and the end; those of an extrusion sublayer raised into blocks), its lines as for
866
+ * `addLines` (`line_start`: the first line of each sublayer, and the end), `feature_count` features, styled as an
867
+ * extrusion layer's (`setFeatureStyle` with the key: a color, then a line's width or a block's height and base);
868
+ * `tile`: the corners of the tile they are cut to (west, north, east, south; empty: none), along whose edges no
869
+ * wall of a block rises
870
+ *
871
+ * # Errors
872
+ *
873
+ * Throws (to JavaScript) when a WebGL object of the tile cannot be created, or when its features or lines need a
874
+ * table texture past the GPU's `MAX_TEXTURE_SIZE`
875
+ */
876
+ setVectorTile(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, line_points: Float64Array, line_first: Uint32Array, line_feature: Uint32Array, line_start: Uint32Array, feature_count: number, tile: Float64Array): void;
663
877
  /**
664
878
  * Shows what can be seen from points, each within its range: `observers` holds 8 numbers per observer
665
879
  * (16 at most): longitude, latitude (degrees), metres above the ground, range (metres), then to look one way
666
880
  * only heading, tilt, angles of view across and up (degrees), the heading NaN to look all around. What some
667
881
  * observer sees is tinted with `visible`, what is hidden from all those that reach it with `hidden` (RGB 0-1),
668
882
  * at `opacity`; `outline` (RGB 0-1, or empty) the color of the cones' edges drawn in 3D
883
+ *
884
+ * # Errors
885
+ *
886
+ * Throws (to JavaScript) when, on the first call, a WebGL object cannot be created or a shader fails to compile
887
+ * (the error carries its info log)
669
888
  */
670
889
  setViewshed(observers: Float64Array, visible: Float32Array, hidden: Float32Array, opacity: number, outline: Float32Array): void;
890
+ /**
891
+ * Lowest and highest zoom levels the camera accepts
892
+ */
671
893
  setZoomRange(min: number, max: number): void;
672
894
  /**
673
895
  * Tile counters of the raster layers, for diagnostics
@@ -709,17 +931,31 @@ export class Engine {
709
931
  updateGlyphPage(page: number, x: number, y: number, width: number, height: number, data: Uint8Array): void;
710
932
  /**
711
933
  * Replaces a region of a ground layer's texture (one layer of a 2D array)
934
+ *
935
+ * # Errors
936
+ *
937
+ * Throws (to JavaScript) when there is no texture `name`, or when the region is out of its bounds or
938
+ * `data` holds too few bytes
712
939
  */
713
940
  updateGroundTexture(id: number, name: string, x: number, y: number, layer: number, width: number, height: number, data: Uint8Array): void;
714
941
  /**
715
942
  * A region of the icon atlas: `width` × `height` RGBA texels (premultiplied) at (`x`, `y`)
716
943
  */
717
944
  updateIconAtlas(x: number, y: number, width: number, height: number, data: Uint8Array): void;
945
+ /**
946
+ * Vector tiles (512 CSS pixels across at their level, as `MapLibre`'s) for the view of the last frame (else the
947
+ * camera's), levels `min_z` to `max_z`, three numbers per tile (z, x, y), the nearest to the eye first: what a
948
+ * vector tile layer draws (`addVectorTiles`), coarser far away in a tilted view as the raster layers
949
+ */
950
+ vectorTilesInView(min_z: number, max_z: number): Uint32Array;
718
951
  /**
719
952
  * Tiles a raster layer wants for the view of the last frame, three numbers per tile (z, x, y), the nearest to
720
953
  * the eye first: the level each area of the ground is drawn at, for the labels of a vector style to follow it
721
954
  */
722
955
  wantedTiles(id: number): Uint32Array;
956
+ /**
957
+ * Zooms by `delta` levels around a screen point (CSS pixels), which keeps the same ground point under it
958
+ */
723
959
  zoomAt(delta: number, x: number, y: number): void;
724
960
  }
725
961
 
@@ -756,6 +992,7 @@ export interface InitOutput {
756
992
  readonly engine_addRaster: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
757
993
  readonly engine_addSymbols: (a: number) => [number, number, number];
758
994
  readonly engine_addTiles3d: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
995
+ readonly engine_addVectorTiles: (a: number) => [number, number, number];
759
996
  readonly engine_bounds: (a: number) => [number, number];
760
997
  readonly engine_camera: (a: number) => any;
761
998
  readonly engine_clearPanorama: (a: number) => void;
@@ -780,6 +1017,7 @@ export interface InitOutput {
780
1017
  readonly engine_project: (a: number, b: number, c: number, d: number, e: number) => any;
781
1018
  readonly engine_removeExtrusionBatch: (a: number, b: number, c: number) => void;
782
1019
  readonly engine_removeLayer: (a: number, b: number) => void;
1020
+ readonly engine_removeVectorTile: (a: number, b: number, c: number) => void;
783
1021
  readonly engine_render: (a: number) => number;
784
1022
  readonly engine_requestPick: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
785
1023
  readonly engine_resize: (a: number, b: number, c: number, d: number) => void;
@@ -824,12 +1062,16 @@ export interface InitOutput {
824
1062
  readonly engine_setRasterStyle: (a: number, b: number, c: number, d: number) => void;
825
1063
  readonly engine_setRequestHeaders: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
826
1064
  readonly engine_setSky: (a: number, b: number) => void;
827
- readonly engine_setSwipe: (a: number, b: number, c: number, d: number, e: number) => void;
1065
+ readonly engine_setSun: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1066
+ readonly engine_setSwipe: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
828
1067
  readonly engine_setSymbolLayer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
829
1068
  readonly engine_setSymbols: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
830
1069
  readonly engine_setTerrain: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
831
1070
  readonly engine_setTileLoader: (a: number, b: any) => void;
832
1071
  readonly engine_setTiles3dStyle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
1072
+ readonly engine_setVectorSublayers: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => void;
1073
+ readonly engine_setVectorTile: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number) => [number, number];
1074
+ readonly engine_setVectorTileMesh: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number) => [number, number];
833
1075
  readonly engine_setViewshed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
834
1076
  readonly engine_setZoomRange: (a: number, b: number, c: number) => void;
835
1077
  readonly engine_stats: (a: number) => any;
@@ -842,6 +1084,7 @@ export interface InitOutput {
842
1084
  readonly engine_updateGlyphPage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
843
1085
  readonly engine_updateGroundTexture: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number];
844
1086
  readonly engine_updateIconAtlas: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
1087
+ readonly engine_vectorTilesInView: (a: number, b: number, c: number) => [number, number];
845
1088
  readonly engine_wantedTiles: (a: number, b: number) => [number, number];
846
1089
  readonly engine_zoomAt: (a: number, b: number, c: number, d: number) => void;
847
1090
  readonly wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___js_sys_b1e1c29ba6b0e6b3___Function_fn_wasm_bindgen_2e566c63402fe7fa___JsValue_____wasm_bindgen_2e566c63402fe7fa___sys__Undefined___js_sys_b1e1c29ba6b0e6b3___Function_fn_wasm_bindgen_2e566c63402fe7fa___JsValue_____wasm_bindgen_2e566c63402fe7fa___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;