isard 1.0.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 (268) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/{basemaps.d.ts → basemap/basemaps.d.ts} +3 -3
  3. package/dist/{basemaps.js → basemap/basemaps.js} +3 -3
  4. package/dist/basemap/basemaps.js.map +1 -0
  5. package/dist/{grid.d.ts → basemap/grid.d.ts} +6 -6
  6. package/dist/{grid.js → basemap/grid.js} +61 -67
  7. package/dist/basemap/grid.js.map +1 -0
  8. package/dist/{mvt.d.ts → basemap/mvt.d.ts} +1 -1
  9. package/dist/{mvt.js → basemap/mvt.js} +6 -6
  10. package/dist/basemap/mvt.js.map +1 -0
  11. package/dist/{pmtiles.d.ts → basemap/pmtiles.d.ts} +16 -10
  12. package/dist/{pmtiles.js → basemap/pmtiles.js} +41 -33
  13. package/dist/basemap/pmtiles.js.map +1 -0
  14. package/dist/{resample.d.ts → basemap/resample.d.ts} +11 -2
  15. package/dist/{resample.js → basemap/resample.js} +18 -16
  16. package/dist/basemap/resample.js.map +1 -0
  17. package/dist/{terrain.d.ts → basemap/terrain.d.ts} +3 -3
  18. package/dist/{terrain.js → basemap/terrain.js} +7 -7
  19. package/dist/basemap/terrain.js.map +1 -0
  20. package/dist/{vectorstyle.d.ts → basemap/vectorstyle.d.ts} +12 -10
  21. package/dist/{vectorstyle.js → basemap/vectorstyle.js} +129 -111
  22. package/dist/basemap/vectorstyle.js.map +1 -0
  23. package/dist/{vectortiles.d.ts → basemap/vectortiles.d.ts} +18 -18
  24. package/dist/{vectortiles.js → basemap/vectortiles.js} +157 -109
  25. package/dist/basemap/vectortiles.js.map +1 -0
  26. package/dist/{wmts.d.ts → basemap/wmts.d.ts} +3 -3
  27. package/dist/{wmts.js → basemap/wmts.js} +19 -14
  28. package/dist/basemap/wmts.js.map +1 -0
  29. package/dist/basemap.worker.js +2 -2
  30. package/dist/basemap.worker.js.map +14 -13
  31. package/dist/bind/layers.d.ts +46 -0
  32. package/dist/bind/layers.js +154 -0
  33. package/dist/bind/layers.js.map +1 -0
  34. package/dist/{crs.d.ts → data/crs.d.ts} +11 -11
  35. package/dist/{crs.js → data/crs.js} +38 -34
  36. package/dist/data/crs.js.map +1 -0
  37. package/dist/{gpx.d.ts → data/gpx.d.ts} +2 -2
  38. package/dist/{gpx.js → data/gpx.js} +20 -20
  39. package/dist/data/gpx.js.map +1 -0
  40. package/dist/{kml.d.ts → data/kml.d.ts} +2 -2
  41. package/dist/{kml.js → data/kml.js} +42 -39
  42. package/dist/data/kml.js.map +1 -0
  43. package/dist/{topojson.d.ts → data/topojson.d.ts} +2 -2
  44. package/dist/{topojson.js → data/topojson.js} +15 -10
  45. package/dist/data/topojson.js.map +1 -0
  46. package/dist/{xml.d.ts → data/xml.d.ts} +5 -5
  47. package/dist/{xml.js → data/xml.js} +19 -18
  48. package/dist/data/xml.js.map +1 -0
  49. package/dist/decoder.worker.js +4 -4
  50. package/dist/decoder.worker.js.map +7 -7
  51. package/dist/{decoders.d.ts → engine/decoders.d.ts} +3 -3
  52. package/dist/{decoders.js → engine/decoders.js} +28 -25
  53. package/dist/engine/decoders.js.map +1 -0
  54. package/dist/{loader.d.ts → engine/loader.d.ts} +1 -1
  55. package/dist/{loader.js → engine/loader.js} +17 -14
  56. package/dist/engine/loader.js.map +1 -0
  57. package/dist/{protocol.d.ts → engine/protocol.d.ts} +1 -1
  58. package/dist/engine/protocol.js +3 -0
  59. package/dist/engine/protocol.js.map +1 -0
  60. package/dist/{requests.d.ts → engine/requests.d.ts} +1 -1
  61. package/dist/{requests.js → engine/requests.js} +19 -16
  62. package/dist/engine/requests.js.map +1 -0
  63. package/dist/engine-loader.d.ts +13 -9
  64. package/dist/engine-loader.js +30 -30
  65. package/dist/engine-loader.js.map +1 -1
  66. package/dist/formats.d.ts +3 -3
  67. package/dist/formats.js +3 -3
  68. package/dist/formats.js.map +1 -1
  69. package/dist/geoplateforme.d.ts +13 -13
  70. package/dist/geoplateforme.js +23 -21
  71. package/dist/geoplateforme.js.map +1 -1
  72. package/dist/index.d.ts +30 -29
  73. package/dist/index.js +18 -18
  74. package/dist/index.js.map +1 -1
  75. package/dist/isard_bg.wasm +0 -0
  76. package/dist/isard_core_bg.wasm +0 -0
  77. package/dist/isard_points_bg.wasm +0 -0
  78. package/dist/{extrusions.d.ts → layers/extrusions.d.ts} +1 -1
  79. package/dist/{extrusions.js → layers/extrusions.js} +10 -5
  80. package/dist/layers/extrusions.js.map +1 -0
  81. package/dist/{features.d.ts → layers/features.d.ts} +10 -10
  82. package/dist/{features.js → layers/features.js} +44 -45
  83. package/dist/layers/features.js.map +1 -0
  84. package/dist/{glyphs.d.ts → layers/glyphs.d.ts} +6 -6
  85. package/dist/{glyphs.js → layers/glyphs.js} +45 -41
  86. package/dist/layers/glyphs.js.map +1 -0
  87. package/dist/{icons.d.ts → layers/icons.d.ts} +10 -10
  88. package/dist/{icons.js → layers/icons.js} +84 -69
  89. package/dist/layers/icons.js.map +1 -0
  90. package/dist/{layers.d.ts → layers/layers.d.ts} +9 -4
  91. package/dist/{layers.js → layers/layers.js} +35 -31
  92. package/dist/layers/layers.js.map +1 -0
  93. package/dist/{panoramas.d.ts → layers/panoramas.d.ts} +3 -3
  94. package/dist/{panoramas.js → layers/panoramas.js} +54 -43
  95. package/dist/layers/panoramas.js.map +1 -0
  96. package/dist/{pointclouds.d.ts → layers/pointclouds.d.ts} +5 -5
  97. package/dist/{pointclouds.js → layers/pointclouds.js} +26 -34
  98. package/dist/layers/pointclouds.js.map +1 -0
  99. package/dist/{symbols.d.ts → layers/symbols.d.ts} +3 -3
  100. package/dist/{symbols.js → layers/symbols.js} +69 -72
  101. package/dist/layers/symbols.js.map +1 -0
  102. package/dist/map/basemap-layers.d.ts +26 -0
  103. package/dist/map/basemap-layers.js +61 -0
  104. package/dist/map/basemap-layers.js.map +1 -0
  105. package/dist/map/canvas.d.ts +17 -0
  106. package/dist/map/canvas.js +56 -0
  107. package/dist/map/canvas.js.map +1 -0
  108. package/dist/map/checks.d.ts +11 -0
  109. package/dist/map/checks.js +39 -0
  110. package/dist/map/checks.js.map +1 -0
  111. package/dist/map/credits.d.ts +17 -0
  112. package/dist/map/credits.js +34 -0
  113. package/dist/map/credits.js.map +1 -0
  114. package/dist/map/engine-settings.d.ts +15 -0
  115. package/dist/map/engine-settings.js +45 -0
  116. package/dist/map/engine-settings.js.map +1 -0
  117. package/dist/map/engines.d.ts +41 -0
  118. package/dist/map/engines.js +77 -0
  119. package/dist/map/engines.js.map +1 -0
  120. package/dist/map/events.d.ts +14 -0
  121. package/dist/map/events.js +46 -0
  122. package/dist/map/events.js.map +1 -0
  123. package/dist/map/frame-loop.d.ts +61 -0
  124. package/dist/map/frame-loop.js +139 -0
  125. package/dist/map/frame-loop.js.map +1 -0
  126. package/dist/map/hover-pick.d.ts +30 -0
  127. package/dist/map/hover-pick.js +56 -0
  128. package/dist/map/hover-pick.js.map +1 -0
  129. package/dist/map/layer-spec.d.ts +42 -0
  130. package/dist/map/layer-spec.js +34 -0
  131. package/dist/map/layer-spec.js.map +1 -0
  132. package/dist/map/layer-stack.d.ts +36 -0
  133. package/dist/map/layer-stack.js +101 -0
  134. package/dist/map/layer-stack.js.map +1 -0
  135. package/dist/map/overlay-host.d.ts +36 -0
  136. package/dist/map/overlay-host.js +101 -0
  137. package/dist/map/overlay-host.js.map +1 -0
  138. package/dist/map/panorama-host.d.ts +5 -0
  139. package/dist/map/panorama-host.js +32 -0
  140. package/dist/map/panorama-host.js.map +1 -0
  141. package/dist/map/raster-source.d.ts +11 -0
  142. package/dist/map/raster-source.js +26 -0
  143. package/dist/map/raster-source.js.map +1 -0
  144. package/dist/map/symbol-atlases.d.ts +26 -0
  145. package/dist/map/symbol-atlases.js +59 -0
  146. package/dist/map/symbol-atlases.js.map +1 -0
  147. package/dist/map/viewshed.d.ts +5 -0
  148. package/dist/map/viewshed.js +28 -0
  149. package/dist/map/viewshed.js.map +1 -0
  150. package/dist/map/workers.d.ts +46 -0
  151. package/dist/map/workers.js +73 -0
  152. package/dist/map/workers.js.map +1 -0
  153. package/dist/map.d.ts +46 -127
  154. package/dist/map.js +183 -698
  155. package/dist/map.js.map +1 -1
  156. package/dist/projections.d.ts +3 -3
  157. package/dist/projections.js +2 -2
  158. package/dist/projections.js.map +1 -1
  159. package/dist/react/Control.d.ts +11 -0
  160. package/dist/react/Control.js +18 -0
  161. package/dist/react/Control.js.map +1 -0
  162. package/dist/react/CustomLayer.d.ts +11 -0
  163. package/dist/react/CustomLayer.js +30 -0
  164. package/dist/react/CustomLayer.js.map +1 -0
  165. package/dist/react/IsardMap.d.ts +43 -0
  166. package/dist/react/IsardMap.js +146 -0
  167. package/dist/react/IsardMap.js.map +1 -0
  168. package/dist/react/Layer.d.ts +42 -0
  169. package/dist/react/Layer.js +74 -0
  170. package/dist/react/Layer.js.map +1 -0
  171. package/dist/react/Marker.d.ts +24 -0
  172. package/dist/react/Marker.js +53 -0
  173. package/dist/react/Marker.js.map +1 -0
  174. package/dist/react/Panel.d.ts +11 -0
  175. package/dist/react/Panel.js +37 -0
  176. package/dist/react/Panel.js.map +1 -0
  177. package/dist/react/Popup.d.ts +18 -0
  178. package/dist/react/Popup.js +60 -0
  179. package/dist/react/Popup.js.map +1 -0
  180. package/dist/react/Swipe.d.ts +9 -0
  181. package/dist/react/Swipe.js +41 -0
  182. package/dist/react/Swipe.js.map +1 -0
  183. package/dist/react/Viewshed.d.ts +5 -0
  184. package/dist/react/Viewshed.js +28 -0
  185. package/dist/react/Viewshed.js.map +1 -0
  186. package/dist/react/context.d.ts +32 -0
  187. package/dist/react/context.js +20 -0
  188. package/dist/react/context.js.map +1 -0
  189. package/dist/react/index.d.ts +26 -0
  190. package/dist/react/index.js +22 -0
  191. package/dist/react/index.js.map +1 -0
  192. package/dist/settings.d.ts +6 -10
  193. package/dist/settings.js +19 -17
  194. package/dist/settings.js.map +1 -1
  195. package/dist/types.d.ts +8 -8
  196. package/dist/types.js +1 -0
  197. package/dist/types.js.map +1 -1
  198. package/dist/{controls.d.ts → ui/controls.d.ts} +1 -1
  199. package/dist/{controls.js → ui/controls.js} +6 -4
  200. package/dist/ui/controls.js.map +1 -0
  201. package/dist/{interaction.d.ts → ui/interaction.d.ts} +9 -5
  202. package/dist/{interaction.js → ui/interaction.js} +9 -8
  203. package/dist/ui/interaction.js.map +1 -0
  204. package/dist/{overlay.d.ts → ui/overlay.d.ts} +2 -2
  205. package/dist/{overlay.js → ui/overlay.js} +18 -20
  206. package/dist/ui/overlay.js.map +1 -0
  207. package/dist/{style.d.ts → ui/style.d.ts} +1 -1
  208. package/dist/{style.js → ui/style.js} +2 -2
  209. package/dist/ui/style.js.map +1 -0
  210. package/dist/{animation.d.ts → util/animation.d.ts} +9 -5
  211. package/dist/{animation.js → util/animation.js} +6 -6
  212. package/dist/util/animation.js.map +1 -0
  213. package/dist/{color.d.ts → util/color.d.ts} +1 -1
  214. package/dist/{color.js → util/color.js} +14 -16
  215. package/dist/util/color.js.map +1 -0
  216. package/dist/{geo.d.ts → util/geo.d.ts} +6 -6
  217. package/dist/{geo.js → util/geo.js} +12 -12
  218. package/dist/util/geo.js.map +1 -0
  219. package/dist/util/guards.d.ts +7 -0
  220. package/dist/util/guards.js +8 -0
  221. package/dist/util/guards.js.map +1 -0
  222. package/dist/util/lru.js.map +1 -0
  223. package/dist/wasm/isard.d.ts +168 -0
  224. package/dist/wasm/isard.js +146 -0
  225. package/dist/wasm/isard_core.d.ts +144 -0
  226. package/dist/wasm/isard_core.js +122 -0
  227. package/dist/{basemap.worker.d.ts → workers/basemap.worker.d.ts} +17 -7
  228. package/dist/workers/basemap.worker.js +658 -0
  229. package/dist/workers/basemap.worker.js.map +1 -0
  230. package/package.json +24 -1
  231. package/vite.js +1 -1
  232. package/dist/animation.js.map +0 -1
  233. package/dist/basemaps.js.map +0 -1
  234. package/dist/color.js.map +0 -1
  235. package/dist/controls.js.map +0 -1
  236. package/dist/crs.js.map +0 -1
  237. package/dist/decoders.js.map +0 -1
  238. package/dist/extrusions.js.map +0 -1
  239. package/dist/features.js.map +0 -1
  240. package/dist/geo.js.map +0 -1
  241. package/dist/glyphs.js.map +0 -1
  242. package/dist/gpx.js.map +0 -1
  243. package/dist/grid.js.map +0 -1
  244. package/dist/icons.js.map +0 -1
  245. package/dist/interaction.js.map +0 -1
  246. package/dist/kml.js.map +0 -1
  247. package/dist/layers.js.map +0 -1
  248. package/dist/loader.js.map +0 -1
  249. package/dist/lru.js.map +0 -1
  250. package/dist/mvt.js.map +0 -1
  251. package/dist/overlay.js.map +0 -1
  252. package/dist/panoramas.js.map +0 -1
  253. package/dist/pmtiles.js.map +0 -1
  254. package/dist/pointclouds.js.map +0 -1
  255. package/dist/protocol.js +0 -2
  256. package/dist/protocol.js.map +0 -1
  257. package/dist/requests.js.map +0 -1
  258. package/dist/resample.js.map +0 -1
  259. package/dist/style.js.map +0 -1
  260. package/dist/symbols.js.map +0 -1
  261. package/dist/terrain.js.map +0 -1
  262. package/dist/topojson.js.map +0 -1
  263. package/dist/vectorstyle.js.map +0 -1
  264. package/dist/vectortiles.js.map +0 -1
  265. package/dist/wmts.js.map +0 -1
  266. package/dist/xml.js.map +0 -1
  267. /package/dist/{lru.d.ts → util/lru.d.ts} +0 -0
  268. /package/dist/{lru.js → util/lru.js} +0 -0
@@ -1,5 +1,9 @@
1
1
  /* @ts-self-types="./isard.d.ts" */
2
2
 
3
+ /**
4
+ * A map on one canvas: its WebGL2 context, camera, ground (raster layers over the relief) and the layers over it.
5
+ * Draws only when `render` is called (the JavaScript side calls it after `redraw` asks for a frame)
6
+ */
3
7
  export class Engine {
4
8
  __destroy_into_raw() {
5
9
  const ptr = this.__wbg_ptr;
@@ -13,6 +17,11 @@ export class Engine {
13
17
  }
14
18
  /**
15
19
  * Circle layer of `feature_count` features: points (Mercator [0, 1], interleaved) and the feature of each
20
+ *
21
+ * # Errors
22
+ *
23
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
24
+ * info log), or when `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
16
25
  * @param {Float64Array} points
17
26
  * @param {Uint32Array} feature
18
27
  * @param {number} feature_count
@@ -43,6 +52,11 @@ export class Engine {
43
52
  }
44
53
  /**
45
54
  * An empty extrusion layer: its blocks come in batches (`setExtrusionBatch`)
55
+ *
56
+ * # Errors
57
+ *
58
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
59
+ * info log)
46
60
  * @returns {number}
47
61
  */
48
62
  addExtrusions() {
@@ -56,6 +70,11 @@ export class Engine {
56
70
  * Fill layer of `feature_count` features: polygons given by their points (Mercator [0, 1], interleaved), the first
57
71
  * point of each ring (`ring_start`, one more entry than rings), the first ring of each polygon (`polygon_start`,
58
72
  * one more entry than polygons; the first ring is the outer one, the others holes) and the feature of each polygon
73
+ *
74
+ * # Errors
75
+ *
76
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
77
+ * info log), or when `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
59
78
  * @param {Float64Array} points
60
79
  * @param {Uint32Array} ring_start
61
80
  * @param {Uint32Array} polygon_start
@@ -82,6 +101,10 @@ export class Engine {
82
101
  * Ground layer running `code` (GLSL ES 3.0 defining `vec4 ground(vec2 offset)`, see `render::ground`) over the
83
102
  * ground; `anchor`: Mercator point the offsets are taken from; bounds: Mercator box it shows in. Compilation errors
84
103
  * come back with the shader's info log (line numbers of `code`)
104
+ *
105
+ * # Errors
106
+ *
107
+ * Throws (to JavaScript) when `code` does not compile or link, with the shader's info log
85
108
  * @param {string} code
86
109
  * @param {number} anchor_x
87
110
  * @param {number} anchor_y
@@ -103,6 +126,11 @@ export class Engine {
103
126
  /**
104
127
  * Line layer of `feature_count` features: polylines given by their points (Mercator [0, 1], interleaved), the
105
128
  * first point of each (`start`, one more entry than lines) and the feature each one belongs to
129
+ *
130
+ * # Errors
131
+ *
132
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
133
+ * info log), or when the features or the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
106
134
  * @param {Float64Array} points
107
135
  * @param {Uint32Array} start
108
136
  * @param {Uint32Array} feature
@@ -126,6 +154,11 @@ export class Engine {
126
154
  * A glTF / GLB model (its URL, a `blob:` one for data of the page) drawn at each instance of `instances`
127
155
  * (`INSTANCE_NUMBERS` numbers each: longitude, latitude, altitude, heading, pitch, roll in degrees, scale);
128
156
  * `ground`: altitudes above the relief, else above the ellipsoid
157
+ *
158
+ * # Errors
159
+ *
160
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
161
+ * info log). A model that fails to load or decode does not throw: the layer stays empty
129
162
  * @param {string} url
130
163
  * @param {Float64Array} instances
131
164
  * @param {boolean} ground
@@ -148,6 +181,12 @@ export class Engine {
148
181
  * edges (node index pairs, interleaved). `line_start` and `line_points`: the line of each edge from A to B, points
149
182
  * `line_start[e] .. line_start[e + 1]` of `line_points` (Mercator, interleaved; straight if fewer than two). `costs`: per edge, the
150
183
  * cost of travelling it from A to B then from B to A; without, values are interpolated along the edges.
184
+ *
185
+ * # Errors
186
+ *
187
+ * Throws (to JavaScript) when `style` is not 25 numbers, `edges` is not node pairs or names a node past
188
+ * those of `mercator`, the nodes or edges need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or when
189
+ * a WebGL object cannot be created or a shader fails to compile (the error carries its info log)
151
190
  * @param {Float64Array} mercator
152
191
  * @param {Uint32Array} edges
153
192
  * @param {Uint32Array | null | undefined} line_start
@@ -179,6 +218,11 @@ export class Engine {
179
218
  * A COPC point cloud from its URL (HTTP range requests). `resolve(wkt)` gives the CRS of the file from its WKT
180
219
  * (undefined if it has none): its inverse projection, whether its altitudes are above the geoid, the metres of
181
220
  * a unit of z; it may throw (an unknown CRS), the layer then stays empty
221
+ *
222
+ * # Errors
223
+ *
224
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
225
+ * info log). The file itself is read later: a bad file, or a `resolve` that throws, leaves the layer empty
182
226
  * @param {string} url
183
227
  * @param {(wkt: string | undefined) => PointCloudCrs} resolve
184
228
  * @returns {number}
@@ -196,6 +240,10 @@ export class Engine {
196
240
  * Raster tiles in Web Mercator; `url` holds {z}, {x} and {y}. `size`: side of the tiles' textures (256 by
197
241
  * default); `loader`: draws each tile instead of fetching `url`, `(z, x, y, signal) => Promise<ImageBitmap |
198
242
  * null>`, an image of `size` × `size` (null: nothing there)
243
+ *
244
+ * # Errors
245
+ *
246
+ * Throws (to JavaScript) when the texture holding the layer's tiles cannot be created
199
247
  * @param {string} url
200
248
  * @param {number} min_z
201
249
  * @param {number} max_z
@@ -216,6 +264,11 @@ export class Engine {
216
264
  }
217
265
  /**
218
266
  * An empty symbol layer
267
+ *
268
+ * # Errors
269
+ *
270
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
271
+ * info log)
219
272
  * @returns {number}
220
273
  */
221
274
  addSymbols() {
@@ -229,6 +282,11 @@ export class Engine {
229
282
  * 3D Tiles (b3dm / glb textured meshes, external tilesets) from the URL of a `tileset.json`. `max_error`:
230
283
  * screen-space error (CSS pixels) above which a tile is refined; 16 is the usual value, lower is finer.
231
284
  * `geoid`: its heights are altitudes (NGF-IGN69), each tile raised by the RAF20 geoid onto the relief.
285
+ *
286
+ * # Errors
287
+ *
288
+ * Throws (to JavaScript) when one of the layer's programs fails to compile or link (the error carries
289
+ * its info log). The tileset itself is read later: a bad one leaves the layer empty, it does not throw
232
290
  * @param {string} url
233
291
  * @param {number} max_error
234
292
  * @param {boolean | null} [geoid]
@@ -255,6 +313,7 @@ export class Engine {
255
313
  return v1;
256
314
  }
257
315
  /**
316
+ * The camera as set or moved: center (degrees), zoom, pitch and bearing (degrees)
258
317
  * @returns {Camera}
259
318
  */
260
319
  camera() {
@@ -267,6 +326,9 @@ export class Engine {
267
326
  clearPanorama() {
268
327
  wasm.engine_clearPanorama(this.__wbg_ptr);
269
328
  }
329
+ /**
330
+ * Stops loading the tiles of the flight's destination (`preload`)
331
+ */
270
332
  clearPreload() {
271
333
  wasm.engine_clearPreload(this.__wbg_ptr);
272
334
  }
@@ -371,6 +433,11 @@ export class Engine {
371
433
  }
372
434
  /**
373
435
  * `redraw` is called when the engine needs a new frame (a tile arrived)
436
+ *
437
+ * # Errors
438
+ *
439
+ * Throws (to JavaScript) when the canvas gives no WebGL2 context ("WebGL2 is not available"), or when a WebGL
440
+ * object of the globe, the sky or the raster pass cannot be created or one of their shaders fails to compile
374
441
  * @param {HTMLCanvasElement} canvas
375
442
  * @param {() => void} redraw
376
443
  */
@@ -473,6 +540,7 @@ export class Engine {
473
540
  return ret;
474
541
  }
475
542
  /**
543
+ * Removes batch `key` of an extrusion layer (nothing if there is none)
476
544
  * @param {number} id
477
545
  * @param {number} key
478
546
  */
@@ -480,12 +548,15 @@ export class Engine {
480
548
  wasm.engine_removeExtrusionBatch(this.__wbg_ptr, id, key);
481
549
  }
482
550
  /**
551
+ * Removes a layer and frees its GPU objects; the other layers forget it (a layer that referred to it)
483
552
  * @param {number} id
484
553
  */
485
554
  removeLayer(id) {
486
555
  wasm.engine_removeLayer(this.__wbg_ptr, id);
487
556
  }
488
557
  /**
558
+ * Draws a frame: the backdrop, the ground and the layers over it bottom to top, then the panorama and the
559
+ * viewshed; returns true while tiles are still loading (a new frame will be asked through `redraw`)
489
560
  * @returns {boolean}
490
561
  */
491
562
  render() {
@@ -536,6 +607,7 @@ export class Engine {
536
607
  wasm.engine_setAtmosphere(this.__wbg_ptr, ptr0, len0);
537
608
  }
538
609
  /**
610
+ * Color the canvas is cleared to (RGB 0-1), where neither ground nor sky is drawn
539
611
  * @param {number} r
540
612
  * @param {number} g
541
613
  * @param {number} b
@@ -561,6 +633,8 @@ export class Engine {
561
633
  wasm.engine_setBody(this.__wbg_ptr, radius, flattening, ptr0, len0, lowest, highest);
562
634
  }
563
635
  /**
636
+ * Sets the camera (degrees, the conventions of `MapLibre`): leaves a street-level view, and the camera keeps this
637
+ * center as the relief comes in
564
638
  * @param {number} lon
565
639
  * @param {number} lat
566
640
  * @param {number} zoom
@@ -593,6 +667,11 @@ export class Engine {
593
667
  }
594
668
  /**
595
669
  * Anchors of batch `key` on the linked network: per feature, node A, node B, cost from A, cost from B
670
+ *
671
+ * # Errors
672
+ *
673
+ * Throws (to JavaScript) when the batch's features need an anchor texture past the GPU's
674
+ * `MAX_TEXTURE_SIZE`, or when it cannot be created
596
675
  * @param {number} id
597
676
  * @param {number} key
598
677
  * @param {Float32Array} anchors
@@ -608,6 +687,11 @@ export class Engine {
608
687
  /**
609
688
  * Adds or replaces batch `key` of an extrusion layer: polygons as for `addFills`, `feature_count` features (the
610
689
  * feature style gives each its height and base height as its two sizes, metres)
690
+ *
691
+ * # Errors
692
+ *
693
+ * Throws (to JavaScript) when a WebGL buffer or vertex array of the batch cannot be created, or when
694
+ * `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
611
695
  * @param {number} id
612
696
  * @param {number} key
613
697
  * @param {Float64Array} points
@@ -744,6 +828,10 @@ export class Engine {
744
828
  /**
745
829
  * The glyph atlas shared by the symbol layers, one page: `width` × `height` bytes of signed distances
746
830
  * (allocated again, filled with `data` if given)
831
+ *
832
+ * # Errors
833
+ *
834
+ * Throws (to JavaScript) as `setGlyphPages` does: a size that is not positive, or the texture not created
747
835
  * @param {number} width
748
836
  * @param {number} height
749
837
  * @param {Uint8Array | null} [data]
@@ -760,6 +848,11 @@ export class Engine {
760
848
  * The glyph atlas shared by the symbol layers, `pages` pages of `width` × `height` bytes of signed distances,
761
849
  * allocated again and empty (`updateGlyphPage` fills them). A glyph on page `p` at row `v` has the atlas
762
850
  * coordinate `v + p × height`
851
+ *
852
+ * # Errors
853
+ *
854
+ * Throws (to JavaScript) when `width` or `height` is not positive (or their product overflows), `pages`
855
+ * is not 1 to 256, or the atlas texture cannot be created
763
856
  * @param {number} width
764
857
  * @param {number} height
765
858
  * @param {number} pages
@@ -771,6 +864,7 @@ export class Engine {
771
864
  }
772
865
  }
773
866
  /**
867
+ * Moves the Mercator box (0-1) a ground layer shows in
774
868
  * @param {number} id
775
869
  * @param {number} min_x
776
870
  * @param {number} min_y
@@ -784,6 +878,11 @@ export class Engine {
784
878
  * Creates the texture of sampler `name` (`format`: r8, r8ui, r16ui, r16i, r32ui, r32f, rg16ui, rg32f, rgba8,
785
879
  * rgba8ui, rgba16ui, rgba32f; `depth` 0 for 2D, else a 2D array of that many layers; `linear` filtering for the
786
880
  * non-integer formats); `data`: its texels as bytes, or undefined for an empty texture
881
+ *
882
+ * # Errors
883
+ *
884
+ * Throws (to JavaScript) on an unknown `format`, a size not positive (or overflowing), `data` shorter
885
+ * than the texels, more textures than the layer takes, or a texture WebGL cannot create
787
886
  * @param {number} id
788
887
  * @param {string} name
789
888
  * @param {string} format
@@ -807,6 +906,11 @@ export class Engine {
807
906
  }
808
907
  /**
809
908
  * A uniform of a ground layer's code, as numbers
909
+ *
910
+ * # Errors
911
+ *
912
+ * Throws (to JavaScript) when the shader has no uniform `name` (one its code does not use is removed
913
+ * by the compiler)
810
914
  * @param {number} id
811
915
  * @param {string} name
812
916
  * @param {Float64Array} values
@@ -822,6 +926,7 @@ export class Engine {
822
926
  }
823
927
  }
824
928
  /**
929
+ * Shows or hides a ground layer (kept, with its uniforms and textures)
825
930
  * @param {number} id
826
931
  * @param {boolean} visible
827
932
  */
@@ -831,6 +936,11 @@ export class Engine {
831
936
  /**
832
937
  * The icon atlas shared by the symbol layers: `width` × `height` RGBA texels, premultiplied, allocated again
833
938
  * and empty (`updateIconAtlas` fills it)
939
+ *
940
+ * # Errors
941
+ *
942
+ * Throws (to JavaScript) when `width` or `height` is not positive (or their product overflows), or the
943
+ * atlas texture cannot be created
834
944
  * @param {number} width
835
945
  * @param {number} height
836
946
  */
@@ -859,6 +969,11 @@ export class Engine {
859
969
  }
860
970
  /**
861
971
  * New lines for a line layer (same arguments as `addLines`, the same features)
972
+ *
973
+ * # Errors
974
+ *
975
+ * Throws (to JavaScript) when the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
976
+ * when it cannot be created; the layer then keeps its lines
862
977
  * @param {number} id
863
978
  * @param {Float64Array} points
864
979
  * @param {Uint32Array} start
@@ -948,6 +1063,10 @@ export class Engine {
948
1063
  }
949
1064
  /**
950
1065
  * The image of camera `index` of the panorama (the images sharing the size of the first)
1066
+ *
1067
+ * # Errors
1068
+ *
1069
+ * Throws (to JavaScript) when WebGL refuses the upload of `image` into the panorama's texture
951
1070
  * @param {number} index
952
1071
  * @param {ImageBitmap} image
953
1072
  */
@@ -963,6 +1082,11 @@ export class Engine {
963
1082
  * frame, row-major, 9; position in it, 3; focal x, y; center x, y; skew; image width, height; principal point of
964
1083
  * the distortion x, y; its coefficients r³, r⁵, r⁷; its limit, pixels), a backdrop sphere of `radius` metres, at
965
1084
  * `opacity`. Its images come after (`setPanoramaImage`)
1085
+ *
1086
+ * # Errors
1087
+ *
1088
+ * Throws (to JavaScript) when `rotation` holds fewer than 9 numbers, or when a WebGL object cannot be created or a
1089
+ * shader fails to compile (the error carries its info log)
966
1090
  * @param {number} lon
967
1091
  * @param {number} lat
968
1092
  * @param {number} height
@@ -999,6 +1123,7 @@ export class Engine {
999
1123
  wasm.engine_setPointCloudStyle(this.__wbg_ptr, id, ptr0, len0, ptr1, len1, ptr2, len2);
1000
1124
  }
1001
1125
  /**
1126
+ * Opacity and saturation (0-1) of a raster layer; nothing for another id
1002
1127
  * @param {number} id
1003
1128
  * @param {number} opacity
1004
1129
  * @param {number} saturation
@@ -1062,6 +1187,11 @@ export class Engine {
1062
1187
  * Labels of a symbol layer, shaped by the page: anchors (Mercator, interleaved), their texts' boxes (min x, min y,
1063
1188
  * max x, max y, CSS pixels from the anchor), styles (36 floats each, see `LABEL_FLOATS`) and glyph and icon quads
1064
1189
  * (11 floats each, see `QUAD_FLOATS`)
1190
+ *
1191
+ * # Errors
1192
+ *
1193
+ * Throws (to JavaScript) when the labels need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
1194
+ * when it cannot be created; the layer then keeps its labels
1065
1195
  * @param {number} id
1066
1196
  * @param {Float64Array} anchors
1067
1197
  * @param {Float32Array} boxes
@@ -1091,6 +1221,10 @@ export class Engine {
1091
1221
  * above the ellipsoid, those of 3D Tiles; over France, on the Earth only), else left as served (the default);
1092
1222
  * `loader`: gives the
1093
1223
  * altitudes of each tile instead of fetching `url` (an encoding decoded by the page: Terrarium, Terrain-RGB)
1224
+ *
1225
+ * # Errors
1226
+ *
1227
+ * Throws (to JavaScript) when the texture holding the relief's tiles cannot be created
1094
1228
  * @param {string | null | undefined} url
1095
1229
  * @param {number} exaggeration
1096
1230
  * @param {number | null | undefined} max_z
@@ -1134,6 +1268,11 @@ export class Engine {
1134
1268
  * only heading, tilt, angles of view across and up (degrees), the heading NaN to look all around. What some
1135
1269
  * observer sees is tinted with `visible`, what is hidden from all those that reach it with `hidden` (RGB 0-1),
1136
1270
  * at `opacity`; `outline` (RGB 0-1, or empty) the color of the cones' edges drawn in 3D
1271
+ *
1272
+ * # Errors
1273
+ *
1274
+ * Throws (to JavaScript) when, on the first call, a WebGL object cannot be created or a shader fails to compile
1275
+ * (the error carries its info log)
1137
1276
  * @param {Float64Array} observers
1138
1277
  * @param {Float32Array} visible
1139
1278
  * @param {Float32Array} hidden
@@ -1155,6 +1294,7 @@ export class Engine {
1155
1294
  }
1156
1295
  }
1157
1296
  /**
1297
+ * Lowest and highest zoom levels the camera accepts
1158
1298
  * @param {number} min
1159
1299
  * @param {number} max
1160
1300
  */
@@ -1251,6 +1391,11 @@ export class Engine {
1251
1391
  }
1252
1392
  /**
1253
1393
  * Replaces a region of a ground layer's texture (one layer of a 2D array)
1394
+ *
1395
+ * # Errors
1396
+ *
1397
+ * Throws (to JavaScript) when there is no texture `name`, or when the region is out of its bounds or
1398
+ * `data` holds too few bytes
1254
1399
  * @param {number} id
1255
1400
  * @param {string} name
1256
1401
  * @param {number} x
@@ -1296,6 +1441,7 @@ export class Engine {
1296
1441
  return v1;
1297
1442
  }
1298
1443
  /**
1444
+ * Zooms by `delta` levels around a screen point (CSS pixels), which keeps the same ground point under it
1299
1445
  * @param {number} delta
1300
1446
  * @param {number} x
1301
1447
  * @param {number} y