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
@@ -62,10 +62,19 @@ export interface PickResult {
62
62
 
63
63
 
64
64
 
65
+ /**
66
+ * A map on one canvas: its WebGL2 context, camera, ground (raster layers over the relief) and the layers over it.
67
+ * Draws only when `render` is called (the JavaScript side calls it after `redraw` asks for a frame)
68
+ */
65
69
  export class Engine {
66
70
  free(): void;
67
71
  /**
68
72
  * Circle layer of `feature_count` features: points (Mercator [0, 1], interleaved) and the feature of each
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`
69
78
  */
70
79
  addCircles(points: Float64Array, feature: Uint32Array, feature_count: number): number;
71
80
  /**
@@ -76,23 +85,42 @@ export class Engine {
76
85
  addCustomLayer(render: () => void, depth: boolean): number;
77
86
  /**
78
87
  * An empty extrusion layer: its blocks come in batches (`setExtrusionBatch`)
88
+ *
89
+ * # Errors
90
+ *
91
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
92
+ * info log)
79
93
  */
80
94
  addExtrusions(): number;
81
95
  /**
82
96
  * Fill layer of `feature_count` features: polygons given by their points (Mercator [0, 1], interleaved), the first
83
97
  * point of each ring (`ring_start`, one more entry than rings), the first ring of each polygon (`polygon_start`,
84
98
  * one more entry than polygons; the first ring is the outer one, the others holes) and the feature of each polygon
99
+ *
100
+ * # Errors
101
+ *
102
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
103
+ * info log), or when `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
85
104
  */
86
105
  addFills(points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, feature: Uint32Array, feature_count: number): number;
87
106
  /**
88
107
  * Ground layer running `code` (GLSL ES 3.0 defining `vec4 ground(vec2 offset)`, see `render::ground`) over the
89
108
  * ground; `anchor`: Mercator point the offsets are taken from; bounds: Mercator box it shows in. Compilation errors
90
109
  * come back with the shader's info log (line numbers of `code`)
110
+ *
111
+ * # Errors
112
+ *
113
+ * Throws (to JavaScript) when `code` does not compile or link, with the shader's info log
91
114
  */
92
115
  addGround(code: string, anchor_x: number, anchor_y: number, min_x: number, min_y: number, max_x: number, max_y: number): number;
93
116
  /**
94
117
  * Line layer of `feature_count` features: polylines given by their points (Mercator [0, 1], interleaved), the
95
118
  * first point of each (`start`, one more entry than lines) and the feature each one belongs to
119
+ *
120
+ * # Errors
121
+ *
122
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
123
+ * info log), or when the features or the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
96
124
  */
97
125
  addLines(points: Float64Array, start: Uint32Array, feature: Uint32Array, feature_count: number): number;
98
126
  /**
@@ -101,24 +129,54 @@ export class Engine {
101
129
  * edges (node index pairs, interleaved). `line_start` and `line_points`: the line of each edge from A to B, points
102
130
  * `line_start[e] .. line_start[e + 1]` of `line_points` (Mercator, interleaved; straight if fewer than two). `costs`: per edge, the
103
131
  * cost of travelling it from A to B then from B to A; without, values are interpolated along the edges.
132
+ *
133
+ * # Errors
134
+ *
135
+ * Throws (to JavaScript) when `style` is not 25 numbers, `edges` is not node pairs or names a node past
136
+ * those of `mercator`, the nodes or edges need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or when
137
+ * a WebGL object cannot be created or a shader fails to compile (the error carries its info log)
104
138
  */
105
139
  addNetwork(mercator: Float64Array, edges: Uint32Array, line_start: Uint32Array | null | undefined, line_points: Float64Array | null | undefined, costs: Float32Array | null | undefined, style: Float32Array): number;
106
140
  /**
107
141
  * Raster tiles in Web Mercator; `url` holds {z}, {x} and {y}. `size`: side of the tiles' textures (256 by
108
142
  * default); `loader`: draws each tile instead of fetching `url`, `(z, x, y, signal) => Promise<ImageBitmap |
109
143
  * null>`, an image of `size` × `size` (null: nothing there)
144
+ *
145
+ * # Errors
146
+ *
147
+ * Throws (to JavaScript) when the texture holding the layer's tiles cannot be created
110
148
  */
111
149
  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;
112
150
  /**
113
151
  * An empty symbol layer
152
+ *
153
+ * # Errors
154
+ *
155
+ * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
156
+ * info log)
114
157
  */
115
158
  addSymbols(): number;
159
+ /**
160
+ * An empty layer of vector tiles drawn as geometry: its style layers come with `setVectorSublayers`, its tiles
161
+ * with `setVectorTile`
162
+ *
163
+ * # Errors
164
+ *
165
+ * Throws (to JavaScript) when a shader fails to compile (the error carries its info log)
166
+ */
167
+ addVectorTiles(): number;
116
168
  /**
117
169
  * Longitudes and latitudes the view covers on the ground, `[west, south, east, north]` (degrees): the screen's
118
170
  * border cast on the ground, or on the far plane where it passes the horizon
119
171
  */
120
172
  bounds(): Float64Array;
173
+ /**
174
+ * The camera as set or moved: center (degrees), zoom, pitch and bearing (degrees)
175
+ */
121
176
  camera(): Camera;
177
+ /**
178
+ * Stops loading the tiles of the flight's destination (`preload`)
179
+ */
122
180
  clearPreload(): void;
123
181
  /**
124
182
  * Removes the viewshed
@@ -166,6 +224,11 @@ export class Engine {
166
224
  networkStats(id: number): NetworkStats | undefined;
167
225
  /**
168
226
  * `redraw` is called when the engine needs a new frame (a tile arrived)
227
+ *
228
+ * # Errors
229
+ *
230
+ * Throws (to JavaScript) when the canvas gives no WebGL2 context ("WebGL2 is not available"), or when a WebGL
231
+ * object of the globe, the sky or the raster pass cannot be created or one of their shaders fails to compile
169
232
  */
170
233
  constructor(canvas: HTMLCanvasElement, redraw: () => void);
171
234
  /**
@@ -194,8 +257,22 @@ export class Engine {
194
257
  * Screen point (CSS pixels) of a ground position, or `height` metres above it, undefined behind the camera
195
258
  */
196
259
  project(lon: number, lat: number, height?: number | null): [x: number, y: number] | undefined;
260
+ /**
261
+ * Removes batch `key` of an extrusion layer (nothing if there is none)
262
+ */
197
263
  removeExtrusionBatch(id: number, key: number): void;
264
+ /**
265
+ * Removes a layer and frees its GPU objects; the other layers forget it (a layer that referred to it)
266
+ */
198
267
  removeLayer(id: number): void;
268
+ /**
269
+ * Removes tile `key` of a vector tile layer (nothing if there is none)
270
+ */
271
+ removeVectorTile(id: number, key: number): void;
272
+ /**
273
+ * Draws a frame: the backdrop, the ground and the layers over it bottom to top, then the panorama and the
274
+ * viewshed; returns true while tiles are still loading (a new frame will be asked through `redraw`)
275
+ */
199
276
  render(): boolean;
200
277
  /**
201
278
  * Asks what is under a screen point without waiting for the GPU (as `pick`, with the position there): the
@@ -216,6 +293,9 @@ export class Engine {
216
293
  * then the sky-horizon, horizon-fog and fog-ground blends; `undefined` for none (the background color shows)
217
294
  */
218
295
  setAtmosphere(settings?: Float32Array | null): void;
296
+ /**
297
+ * Color the canvas is cleared to (RGB 0-1), where neither ground nor sky is drawn
298
+ */
219
299
  setBackground(r: number, g: number, b: number): void;
220
300
  /**
221
301
  * The body the map is drawn on: its equatorial radius (metres) and flattening (0 for a sphere), the halo of its
@@ -225,6 +305,10 @@ export class Engine {
225
305
  * relief, whose shaders may take its size (`ISARD_CIRCUMFERENCE` of the ground layers)
226
306
  */
227
307
  setBody(radius: number, flattening: number, halo: Float32Array | null | undefined, lowest: number, highest: number): void;
308
+ /**
309
+ * Sets the camera (degrees, the conventions of `MapLibre`): leaves a street-level view, and the camera keeps this
310
+ * center as the relief comes in
311
+ */
228
312
  setCamera(lon: number, lat: number, zoom: number, pitch: number, bearing: number): void;
229
313
  /**
230
314
  * Circles lying on the ground (true) or facing the screen
@@ -236,11 +320,21 @@ export class Engine {
236
320
  setCircles(id: number, points: Float64Array, feature: Uint32Array): void;
237
321
  /**
238
322
  * Anchors of batch `key` on the linked network: per feature, node A, node B, cost from A, cost from B
323
+ *
324
+ * # Errors
325
+ *
326
+ * Throws (to JavaScript) when the batch's features need an anchor texture past the GPU's
327
+ * `MAX_TEXTURE_SIZE`, or when it cannot be created
239
328
  */
240
329
  setExtrusionAnchors(id: number, key: number, anchors: Float32Array): void;
241
330
  /**
242
331
  * Adds or replaces batch `key` of an extrusion layer: polygons as for `addFills`, `feature_count` features (the
243
332
  * feature style gives each its height and base height as its two sizes, metres)
333
+ *
334
+ * # Errors
335
+ *
336
+ * Throws (to JavaScript) when a WebGL buffer or vertex array of the batch cannot be created, or when
337
+ * `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
244
338
  */
245
339
  setExtrusionBatch(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, feature: Uint32Array, feature_count: number): void;
246
340
  /**
@@ -257,10 +351,10 @@ export class Engine {
257
351
  */
258
352
  setFeatureRamp(id: number, rgba: Uint8Array | null | undefined, min: number, max: number): void;
259
353
  /**
260
- * Style of the features of a line, circle, fill or extrusion layer (batch `key` of the latter): 32 floats per
261
- * feature, its color (RGBA 0-1), its second color (a circle's stroke), then two sizes as zoom stops (four zooms,
262
- * four values each): a line's width; a circle's radius and stroke width, CSS pixels; a block's height and base
263
- * height, metres
354
+ * Style of the features of a line, circle, fill, extrusion or vector tile layer (batch or tile `key` of the last
355
+ * two): 32 floats per feature, its color (RGBA 0-1), its second color (a circle's stroke), then two sizes as zoom
356
+ * stops (four zooms, four values each): a line's width; a circle's radius and stroke width, CSS pixels; a block's
357
+ * height and base height, metres
264
358
  */
265
359
  setFeatureStyle(id: number, style: Float32Array, key?: number | null): void;
266
360
  /**
@@ -288,29 +382,59 @@ export class Engine {
288
382
  /**
289
383
  * The glyph atlas shared by the symbol layers, one page: `width` × `height` bytes of signed distances
290
384
  * (allocated again, filled with `data` if given)
385
+ *
386
+ * # Errors
387
+ *
388
+ * Throws (to JavaScript) as `setGlyphPages` does: a size that is not positive, or the texture not created
291
389
  */
292
390
  setGlyphAtlas(width: number, height: number, data?: Uint8Array | null): void;
293
391
  /**
294
392
  * The glyph atlas shared by the symbol layers, `pages` pages of `width` × `height` bytes of signed distances,
295
393
  * allocated again and empty (`updateGlyphPage` fills them). A glyph on page `p` at row `v` has the atlas
296
394
  * coordinate `v + p × height`
395
+ *
396
+ * # Errors
397
+ *
398
+ * Throws (to JavaScript) when `width` or `height` is not positive (or their product overflows), `pages`
399
+ * is not 1 to 256, or the atlas texture cannot be created
297
400
  */
298
401
  setGlyphPages(width: number, height: number, pages: number): void;
402
+ /**
403
+ * Moves the Mercator box (0-1) a ground layer shows in
404
+ */
299
405
  setGroundBounds(id: number, min_x: number, min_y: number, max_x: number, max_y: number): void;
300
406
  /**
301
407
  * Creates the texture of sampler `name` (`format`: r8, r8ui, r16ui, r16i, r32ui, r32f, rg16ui, rg32f, rgba8,
302
408
  * rgba8ui, rgba16ui, rgba32f; `depth` 0 for 2D, else a 2D array of that many layers; `linear` filtering for the
303
409
  * non-integer formats); `data`: its texels as bytes, or undefined for an empty texture
410
+ *
411
+ * # Errors
412
+ *
413
+ * Throws (to JavaScript) on an unknown `format`, a size not positive (or overflowing), `data` shorter
414
+ * than the texels, more textures than the layer takes, or a texture WebGL cannot create
304
415
  */
305
416
  setGroundTexture(id: number, name: string, format: string, width: number, height: number, depth: number, linear: boolean, data?: Uint8Array | null): void;
306
417
  /**
307
418
  * A uniform of a ground layer's code, as numbers
419
+ *
420
+ * # Errors
421
+ *
422
+ * Throws (to JavaScript) when the shader has no uniform `name` (one its code does not use is removed
423
+ * by the compiler)
308
424
  */
309
425
  setGroundUniform(id: number, name: string, values: Float64Array): void;
426
+ /**
427
+ * Shows or hides a ground layer (kept, with its uniforms and textures)
428
+ */
310
429
  setGroundVisible(id: number, visible: boolean): void;
311
430
  /**
312
431
  * The icon atlas shared by the symbol layers: `width` × `height` RGBA texels, premultiplied, allocated again
313
432
  * and empty (`updateIconAtlas` fills it)
433
+ *
434
+ * # Errors
435
+ *
436
+ * Throws (to JavaScript) when `width` or `height` is not positive (or their product overflows), or the
437
+ * atlas texture cannot be created
314
438
  */
315
439
  setIconAtlas(width: number, height: number): void;
316
440
  /**
@@ -324,6 +448,11 @@ export class Engine {
324
448
  setLineDash(id: number, dash: number, gap: number): void;
325
449
  /**
326
450
  * New lines for a line layer (same arguments as `addLines`, the same features)
451
+ *
452
+ * # Errors
453
+ *
454
+ * Throws (to JavaScript) when the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
455
+ * when it cannot be created; the layer then keeps its lines
327
456
  */
328
457
  setLines(id: number, points: Float64Array, start: Uint32Array, feature: Uint32Array): void;
329
458
  /**
@@ -352,6 +481,9 @@ export class Engine {
352
481
  * One value per node; negative = unreached
353
482
  */
354
483
  setNetworkValues(id: number, values: Float32Array): void;
484
+ /**
485
+ * Opacity and saturation (0-1) of a raster layer; nothing for another id
486
+ */
355
487
  setRasterStyle(id: number, opacity: number, saturation: number): void;
356
488
  /**
357
489
  * The headers added to the engine's requests by URL prefix (`setRequestHeaders`, the same for every map of the
@@ -362,11 +494,22 @@ export class Engine {
362
494
  * Space behind the globe (stars, atmosphere halo), in the globe projection
363
495
  */
364
496
  setSky(enabled: boolean): void;
497
+ /**
498
+ * The sun casting shadows and the night: its azimuth (degrees clockwise from north) and altitude (degrees above
499
+ * the horizon), the shadows' opacity (0 to 1; none under the horizon or not a number), how dark the night is (0 to
500
+ * 1: the frame tinted, the lights of the layers on). Neither shadows nor night: nothing drawn
501
+ *
502
+ * # Errors
503
+ *
504
+ * Throws (to JavaScript) when a WebGL object cannot be created or the pass fails to compile
505
+ */
506
+ setSun(azimuth: number, altitude: number, opacity: number, night: number): void;
365
507
  /**
366
508
  * Shows `layers` on one side of a vertical line only, the others beneath on the other side (comparing two states
367
- * of a place): left of `x` (CSS pixels from the left of the canvas), or right of it; a non-finite `x` stops
509
+ * of a place): left of `x` (CSS pixels from the left of the canvas), or right of it; `others` on the other side
510
+ * only (two meshes of the same place, each on its side, never drawn over each other); a non-finite `x` stops
368
511
  */
369
- setSwipe(x: number, right: boolean, layers: Uint32Array): void;
512
+ setSwipe(x: number, right: boolean, layers: Uint32Array, others: Uint32Array): void;
370
513
  /**
371
514
  * Layer-wide style of a symbol layer: size scale and opacity as zoom stops (four zooms then four values each),
372
515
  * zoom range, visibility
@@ -376,6 +519,11 @@ export class Engine {
376
519
  * Labels of a symbol layer, shaped by the page: anchors (Mercator, interleaved), their texts' boxes (min x, min y,
377
520
  * max x, max y, CSS pixels from the anchor), styles (36 floats each, see `LABEL_FLOATS`) and glyph and icon quads
378
521
  * (11 floats each, see `QUAD_FLOATS`)
522
+ *
523
+ * # Errors
524
+ *
525
+ * Throws (to JavaScript) when the labels need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
526
+ * when it cannot be created; the layer then keeps its labels
379
527
  */
380
528
  setSymbols(id: number, anchors: Float64Array, boxes: Float32Array, styles: Float32Array, quads: Float32Array): void;
381
529
  /**
@@ -387,16 +535,66 @@ export class Engine {
387
535
  * above the ellipsoid, those of 3D Tiles; over France, on the Earth only), else left as served (the default);
388
536
  * `loader`: gives the
389
537
  * altitudes of each tile instead of fetching `url` (an encoding decoded by the page: Terrarium, Terrain-RGB)
538
+ *
539
+ * # Errors
540
+ *
541
+ * Throws (to JavaScript) when the texture holding the relief's tiles cannot be created
390
542
  */
391
543
  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;
544
+ /**
545
+ * The style layers of a vector tile layer, in drawing order: per layer, its kind (0 fill, 1 line, 2 extrusion), its zoom range
546
+ * (two numbers: shown from the first, included, to the second, excluded), whether it shows (0 or 1), its dashes
547
+ * (four numbers: dash, gap, dash, gap, in line widths; 0: solid), its opacity as zoom stops (four zooms then four
548
+ * values; missing: opaque), the caps of its lines' ends (0 butt, 1 round, 2 square; missing: round), whether its
549
+ * lines glow at night (streets; 0 or 1)
550
+ */
551
+ setVectorSublayers(id: number, kinds: Uint8Array, zooms: Float64Array, visible: Uint8Array, dashes: Float32Array, opacities: Float32Array, caps: Uint8Array, lit: Uint8Array): void;
552
+ /**
553
+ * Adds or replaces tile `key` of a vector tile layer ready for the GPU, as the basemap workers make it (the
554
+ * tessellation module): its polygons as for `setVectorTile` (picked here; their prisms built here if drawn in
555
+ * relief while `prism` is false), the vertices of its fills (`shapes::Vertex` as bytes, each with its feature),
556
+ * their triangles, per sublayer its top cap and the rest of its prism (`fill_ranges`: four numbers, first and
557
+ * end of each), its line pieces (`pieces::Piece` as bytes), the line table (feature and length of each line),
558
+ * per sublayer its pieces (`line_ranges`: first, end), the blocks of its extrusion sublayers (`shapes::Block` as
559
+ * bytes), their triangles, per sublayer its blocks' triangles (`block_ranges`: first, end), the extent of its
560
+ * points (`bounds`: min x, min y, max x, max y), `feature_count` features
561
+ *
562
+ * # Errors
563
+ *
564
+ * Throws (to JavaScript) when the vertices, pieces or blocks are cut short, when a WebGL object of the tile cannot be
565
+ * created, or when its features or lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
566
+ */
567
+ 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;
568
+ /**
569
+ * Adds or replaces tile `key` of a vector tile layer: its polygons as for `addFills` (`fill_start`: the first
570
+ * polygon of each sublayer, and the end; those of an extrusion sublayer raised into blocks), its lines as for
571
+ * `addLines` (`line_start`: the first line of each sublayer, and the end), `feature_count` features, styled as an
572
+ * extrusion layer's (`setFeatureStyle` with the key: a color, then a line's width or a block's height and base);
573
+ * `tile`: the corners of the tile they are cut to (west, north, east, south; empty: none), along whose edges no
574
+ * wall of a block rises
575
+ *
576
+ * # Errors
577
+ *
578
+ * Throws (to JavaScript) when a WebGL object of the tile cannot be created, or when its features or lines need a
579
+ * table texture past the GPU's `MAX_TEXTURE_SIZE`
580
+ */
581
+ 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;
392
582
  /**
393
583
  * Shows what can be seen from points, each within its range: `observers` holds 8 numbers per observer
394
584
  * (16 at most): longitude, latitude (degrees), metres above the ground, range (metres), then to look one way
395
585
  * only heading, tilt, angles of view across and up (degrees), the heading NaN to look all around. What some
396
586
  * observer sees is tinted with `visible`, what is hidden from all those that reach it with `hidden` (RGB 0-1),
397
587
  * at `opacity`; `outline` (RGB 0-1, or empty) the color of the cones' edges drawn in 3D
588
+ *
589
+ * # Errors
590
+ *
591
+ * Throws (to JavaScript) when, on the first call, a WebGL object cannot be created or a shader fails to compile
592
+ * (the error carries its info log)
398
593
  */
399
594
  setViewshed(observers: Float64Array, visible: Float32Array, hidden: Float32Array, opacity: number, outline: Float32Array): void;
595
+ /**
596
+ * Lowest and highest zoom levels the camera accepts
597
+ */
400
598
  setZoomRange(min: number, max: number): void;
401
599
  /**
402
600
  * Tile counters of the raster layers, for diagnostics
@@ -424,17 +622,31 @@ export class Engine {
424
622
  updateGlyphPage(page: number, x: number, y: number, width: number, height: number, data: Uint8Array): void;
425
623
  /**
426
624
  * Replaces a region of a ground layer's texture (one layer of a 2D array)
625
+ *
626
+ * # Errors
627
+ *
628
+ * Throws (to JavaScript) when there is no texture `name`, or when the region is out of its bounds or
629
+ * `data` holds too few bytes
427
630
  */
428
631
  updateGroundTexture(id: number, name: string, x: number, y: number, layer: number, width: number, height: number, data: Uint8Array): void;
429
632
  /**
430
633
  * A region of the icon atlas: `width` × `height` RGBA texels (premultiplied) at (`x`, `y`)
431
634
  */
432
635
  updateIconAtlas(x: number, y: number, width: number, height: number, data: Uint8Array): void;
636
+ /**
637
+ * Vector tiles (512 CSS pixels across at their level, as `MapLibre`'s) for the view of the last frame (else the
638
+ * camera's), levels `min_z` to `max_z`, three numbers per tile (z, x, y), the nearest to the eye first: what a
639
+ * vector tile layer draws (`addVectorTiles`), coarser far away in a tilted view as the raster layers
640
+ */
641
+ vectorTilesInView(min_z: number, max_z: number): Uint32Array;
433
642
  /**
434
643
  * Tiles a raster layer wants for the view of the last frame, three numbers per tile (z, x, y), the nearest to
435
644
  * the eye first: the level each area of the ground is drawn at, for the labels of a vector style to follow it
436
645
  */
437
646
  wantedTiles(id: number): Uint32Array;
647
+ /**
648
+ * Zooms by `delta` levels around a screen point (CSS pixels), which keeps the same ground point under it
649
+ */
438
650
  zoomAt(delta: number, x: number, y: number): void;
439
651
  }
440
652
 
@@ -452,6 +664,7 @@ export interface InitOutput {
452
664
  readonly engine_addNetwork: (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) => [number, number, number];
453
665
  readonly engine_addRaster: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
454
666
  readonly engine_addSymbols: (a: number) => [number, number, number];
667
+ readonly engine_addVectorTiles: (a: number) => [number, number, number];
455
668
  readonly engine_bounds: (a: number) => [number, number];
456
669
  readonly engine_camera: (a: number) => any;
457
670
  readonly engine_clearPreload: (a: number) => void;
@@ -472,6 +685,7 @@ export interface InitOutput {
472
685
  readonly engine_project: (a: number, b: number, c: number, d: number, e: number) => any;
473
686
  readonly engine_removeExtrusionBatch: (a: number, b: number, c: number) => void;
474
687
  readonly engine_removeLayer: (a: number, b: number) => void;
688
+ readonly engine_removeVectorTile: (a: number, b: number, c: number) => void;
475
689
  readonly engine_render: (a: number) => number;
476
690
  readonly engine_requestPick: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
477
691
  readonly engine_resize: (a: number, b: number, c: number, d: number) => void;
@@ -512,10 +726,14 @@ export interface InitOutput {
512
726
  readonly engine_setRasterStyle: (a: number, b: number, c: number, d: number) => void;
513
727
  readonly engine_setRequestHeaders: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
514
728
  readonly engine_setSky: (a: number, b: number) => void;
515
- readonly engine_setSwipe: (a: number, b: number, c: number, d: number, e: number) => void;
729
+ readonly engine_setSun: (a: number, b: number, c: number, d: number, e: number) => [number, number];
730
+ readonly engine_setSwipe: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
516
731
  readonly engine_setSymbolLayer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
517
732
  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];
518
733
  readonly engine_setTerrain: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
734
+ 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;
735
+ 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];
736
+ 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];
519
737
  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];
520
738
  readonly engine_setZoomRange: (a: number, b: number, c: number) => void;
521
739
  readonly engine_stats: (a: number) => any;
@@ -525,6 +743,7 @@ export interface InitOutput {
525
743
  readonly engine_updateGlyphPage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
526
744
  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];
527
745
  readonly engine_updateIconAtlas: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
746
+ readonly engine_vectorTilesInView: (a: number, b: number, c: number) => [number, number];
528
747
  readonly engine_wantedTiles: (a: number, b: number) => [number, number];
529
748
  readonly engine_zoomAt: (a: number, b: number, c: number, d: number) => void;
530
749
  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;