isard 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/README.md +46 -39
  3. package/dist/basemap/basemaps.js +1 -0
  4. package/dist/basemap/basemaps.js.map +1 -1
  5. package/dist/basemap/pmtileslayer.d.ts +33 -0
  6. package/dist/basemap/pmtileslayer.js +97 -0
  7. package/dist/basemap/pmtileslayer.js.map +1 -0
  8. package/dist/basemap/trees.d.ts +26 -0
  9. package/dist/basemap/trees.js +141 -0
  10. package/dist/basemap/trees.js.map +1 -0
  11. package/dist/basemap/vectorstyle.d.ts +10 -0
  12. package/dist/basemap/vectorstyle.js +35 -0
  13. package/dist/basemap/vectorstyle.js.map +1 -1
  14. package/dist/basemap/vectortiles.d.ts +93 -44
  15. package/dist/basemap/vectortiles.js +511 -303
  16. package/dist/basemap/vectortiles.js.map +1 -1
  17. package/dist/basemap/workerpool.d.ts +17 -0
  18. package/dist/basemap/workerpool.js +203 -0
  19. package/dist/basemap/workerpool.js.map +1 -0
  20. package/dist/basemap.worker.js +2 -2
  21. package/dist/basemap.worker.js.map +18 -8
  22. package/dist/bind/layers.js +10 -0
  23. package/dist/bind/layers.js.map +1 -1
  24. package/dist/decoder.worker.js +4 -4
  25. package/dist/decoder.worker.js.map +3 -3
  26. package/dist/engine-loader.d.ts +8 -1
  27. package/dist/engine-loader.js +20 -1
  28. package/dist/engine-loader.js.map +1 -1
  29. package/dist/geoplateforme.d.ts +16 -0
  30. package/dist/geoplateforme.js +23 -0
  31. package/dist/geoplateforme.js.map +1 -1
  32. package/dist/grid-module.d.ts +44 -0
  33. package/dist/grid-module.js +63 -0
  34. package/dist/grid-module.js.map +1 -0
  35. package/dist/grids.d.ts +51 -0
  36. package/dist/grids.js +88 -0
  37. package/dist/grids.js.map +1 -0
  38. package/dist/index.d.ts +14 -4
  39. package/dist/index.js +11 -2
  40. package/dist/index.js.map +1 -1
  41. package/dist/isard_bg.wasm +0 -0
  42. package/dist/isard_core_bg.wasm +0 -0
  43. package/dist/isard_grid_bg.wasm +0 -0
  44. package/dist/isard_tess_bg.wasm +0 -0
  45. package/dist/layers/flow.d.ts +111 -0
  46. package/dist/layers/flow.js +222 -0
  47. package/dist/layers/flow.js.map +1 -0
  48. package/dist/layers/layers.js +9 -0
  49. package/dist/layers/layers.js.map +1 -1
  50. package/dist/layers/symbols.d.ts +2 -0
  51. package/dist/layers/symbols.js +2 -1
  52. package/dist/layers/symbols.js.map +1 -1
  53. package/dist/layers/vectors.d.ts +60 -0
  54. package/dist/layers/vectors.js +130 -0
  55. package/dist/layers/vectors.js.map +1 -0
  56. package/dist/map/frame-loop.d.ts +3 -0
  57. package/dist/map/frame-loop.js +6 -0
  58. package/dist/map/frame-loop.js.map +1 -1
  59. package/dist/map/layer-spec.d.ts +4 -1
  60. package/dist/map/layer-spec.js +2 -0
  61. package/dist/map/layer-spec.js.map +1 -1
  62. package/dist/map/raster-source.js +1 -1
  63. package/dist/map/raster-source.js.map +1 -1
  64. package/dist/map/workers.d.ts +5 -1
  65. package/dist/map/workers.js +36 -1
  66. package/dist/map/workers.js.map +1 -1
  67. package/dist/map.d.ts +35 -6
  68. package/dist/map.js +83 -11
  69. package/dist/map.js.map +1 -1
  70. package/dist/react/IsardMap.js +1 -0
  71. package/dist/react/IsardMap.js.map +1 -1
  72. package/dist/react/Layer.d.ts +2 -0
  73. package/dist/react/Layer.js.map +1 -1
  74. package/dist/react/Swipe.d.ts +11 -4
  75. package/dist/react/Swipe.js +26 -15
  76. package/dist/react/Swipe.js.map +1 -1
  77. package/dist/react/VectorGeometry.d.ts +35 -0
  78. package/dist/react/VectorGeometry.js +82 -0
  79. package/dist/react/VectorGeometry.js.map +1 -0
  80. package/dist/react/context.d.ts +2 -1
  81. package/dist/react/context.js.map +1 -1
  82. package/dist/react/index.d.ts +2 -1
  83. package/dist/react/index.js +2 -1
  84. package/dist/react/index.js.map +1 -1
  85. package/dist/types.d.ts +30 -3
  86. package/dist/types.js.map +1 -1
  87. package/dist/ui/minimap.d.ts +25 -0
  88. package/dist/ui/minimap.js +90 -0
  89. package/dist/ui/minimap.js.map +1 -0
  90. package/dist/ui/scale.d.ts +19 -0
  91. package/dist/ui/scale.js +44 -0
  92. package/dist/ui/scale.js.map +1 -0
  93. package/dist/ui/search.d.ts +25 -0
  94. package/dist/ui/search.js +119 -0
  95. package/dist/ui/search.js.map +1 -0
  96. package/dist/ui/style.js +17 -0
  97. package/dist/ui/style.js.map +1 -1
  98. package/dist/util/sun.d.ts +11 -0
  99. package/dist/util/sun.js +26 -0
  100. package/dist/util/sun.js.map +1 -0
  101. package/dist/wasm/isard.d.ts +124 -7
  102. package/dist/wasm/isard.js +319 -8
  103. package/dist/wasm/isard_core.d.ts +124 -7
  104. package/dist/wasm/isard_core.js +319 -8
  105. package/dist/wasm/isard_grid.d.ts +101 -0
  106. package/dist/wasm/isard_grid.js +375 -0
  107. package/dist/wasm/isard_tess.d.ts +109 -0
  108. package/dist/wasm/isard_tess.js +398 -0
  109. package/dist/workers/basemap/geometry.d.ts +72 -0
  110. package/dist/workers/basemap/labels.d.ts +8 -0
  111. package/dist/workers/basemap/raster.d.ts +10 -0
  112. package/dist/workers/basemap/street.d.ts +19 -0
  113. package/dist/workers/basemap/tiles.d.ts +65 -0
  114. package/dist/workers/basemap/trees.d.ts +19 -0
  115. package/dist/workers/basemap.worker.d.ts +147 -22
  116. package/dist/workers/basemap.worker.js +93 -553
  117. package/dist/workers/basemap.worker.js.map +1 -1
  118. package/package.json +6 -4
  119. package/vite.js +11 -2
@@ -0,0 +1,398 @@
1
+ /* @ts-self-types="./isard_tess.d.ts" */
2
+
3
+ /**
4
+ * A vector tile ready for the GPU (`geo::mesh::vector_tiles::TileMesh`), as the engine's `setVectorTileMesh` takes it
5
+ */
6
+ export class TessellatedTile {
7
+ static __wrap(ptr) {
8
+ const obj = Object.create(TessellatedTile.prototype);
9
+ obj.__wbg_ptr = ptr;
10
+ TessellatedTileFinalization.register(obj, obj.__wbg_ptr, obj);
11
+ return obj;
12
+ }
13
+ __destroy_into_raw() {
14
+ const ptr = this.__wbg_ptr;
15
+ this.__wbg_ptr = 0;
16
+ TessellatedTileFinalization.unregister(this);
17
+ return ptr;
18
+ }
19
+ free() {
20
+ const ptr = this.__destroy_into_raw();
21
+ wasm.__wbg_tessellatedtile_free(ptr, 0);
22
+ }
23
+ /**
24
+ * Their triangles
25
+ * @returns {Uint32Array}
26
+ */
27
+ blockIndices() {
28
+ const ret = wasm.tessellatedtile_blockIndices(this.__wbg_ptr);
29
+ return ret;
30
+ }
31
+ /**
32
+ * Per sublayer: its blocks' indices, first and end
33
+ * @returns {Uint32Array}
34
+ */
35
+ blockRanges() {
36
+ const ret = wasm.tessellatedtile_blockRanges(this.__wbg_ptr);
37
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
38
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
39
+ return v1;
40
+ }
41
+ /**
42
+ * The blocks of the raised sublayers (`shapes::Block`, 32 bytes each), as bytes
43
+ * @returns {Uint8Array}
44
+ */
45
+ blocks() {
46
+ const ret = wasm.tessellatedtile_blocks(this.__wbg_ptr);
47
+ return ret;
48
+ }
49
+ /**
50
+ * The extent of the tile's points: min x, min y, max x, max y
51
+ * @returns {Float64Array}
52
+ */
53
+ bounds() {
54
+ const ret = wasm.tessellatedtile_bounds(this.__wbg_ptr);
55
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
56
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
57
+ return v1;
58
+ }
59
+ /**
60
+ * Per sublayer: its top cap and the rest of its prism, first and end of each (four numbers)
61
+ * @returns {Uint32Array}
62
+ */
63
+ fillRanges() {
64
+ const ret = wasm.tessellatedtile_fillRanges(this.__wbg_ptr);
65
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
66
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
67
+ return v1;
68
+ }
69
+ /**
70
+ * The fill triangles
71
+ * @returns {Uint32Array}
72
+ */
73
+ indices() {
74
+ const ret = wasm.tessellatedtile_indices(this.__wbg_ptr);
75
+ return ret;
76
+ }
77
+ /**
78
+ * Per sublayer: its pieces, first and end
79
+ * @returns {Uint32Array}
80
+ */
81
+ lineRanges() {
82
+ const ret = wasm.tessellatedtile_lineRanges(this.__wbg_ptr);
83
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
84
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
85
+ return v1;
86
+ }
87
+ /**
88
+ * Feature and length of each line
89
+ * @returns {Float32Array}
90
+ */
91
+ lineTable() {
92
+ const ret = wasm.tessellatedtile_lineTable(this.__wbg_ptr);
93
+ return ret;
94
+ }
95
+ /**
96
+ * The line pieces (`pieces::Piece`, 28 bytes each), as bytes
97
+ * @returns {Uint8Array}
98
+ */
99
+ pieces() {
100
+ const ret = wasm.tessellatedtile_pieces(this.__wbg_ptr);
101
+ return ret;
102
+ }
103
+ /**
104
+ * Whether the prisms were built
105
+ * @returns {boolean}
106
+ */
107
+ prism() {
108
+ const ret = wasm.tessellatedtile_prism(this.__wbg_ptr);
109
+ return ret !== 0;
110
+ }
111
+ /**
112
+ * The fill vertices (`shapes::Vertex`, 24 bytes each), as bytes
113
+ * @returns {Uint8Array}
114
+ */
115
+ vertices() {
116
+ const ret = wasm.tessellatedtile_vertices(this.__wbg_ptr);
117
+ return ret;
118
+ }
119
+ }
120
+ if (Symbol.dispose) TessellatedTile.prototype[Symbol.dispose] = TessellatedTile.prototype.free;
121
+
122
+ /**
123
+ * The geometry of a vector tile made ready for the GPU, as the engine's `setVectorTile` takes it: its polygons
124
+ * (interleaved points, `ring_start`, `polygon_start`, the feature of each, `fill_start`: the first polygon of each
125
+ * sublayer and the end), its lines (interleaved points, `line_first`: the first point of each, the feature of each,
126
+ * `line_start`: the first line of each sublayer and the end); `raised`: per sublayer, whether its polygons are extruded
127
+ * into blocks rather than filled; `prism`: with the prisms the fills need over the relief; `tile`: the corners of the
128
+ * tile they are cut to (west, north, east, south, Mercator; empty: none), along whose edges no wall of a block rises
129
+ * @param {Float64Array} points
130
+ * @param {Uint32Array} ring_start
131
+ * @param {Uint32Array} polygon_start
132
+ * @param {Uint32Array} polygon_feature
133
+ * @param {Uint32Array} fill_start
134
+ * @param {Float64Array} line_points
135
+ * @param {Uint32Array} line_first
136
+ * @param {Uint32Array} line_feature
137
+ * @param {Uint32Array} line_start
138
+ * @param {Uint8Array} raised
139
+ * @param {boolean} prism
140
+ * @param {Float64Array} tile
141
+ * @returns {TessellatedTile}
142
+ */
143
+ export function tessellateVectorTile(points, ring_start, polygon_start, polygon_feature, fill_start, line_points, line_first, line_feature, line_start, raised, prism, tile) {
144
+ const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
145
+ const len0 = WASM_VECTOR_LEN;
146
+ const ptr1 = passArray32ToWasm0(ring_start, wasm.__wbindgen_malloc);
147
+ const len1 = WASM_VECTOR_LEN;
148
+ const ptr2 = passArray32ToWasm0(polygon_start, wasm.__wbindgen_malloc);
149
+ const len2 = WASM_VECTOR_LEN;
150
+ const ptr3 = passArray32ToWasm0(polygon_feature, wasm.__wbindgen_malloc);
151
+ const len3 = WASM_VECTOR_LEN;
152
+ const ptr4 = passArray32ToWasm0(fill_start, wasm.__wbindgen_malloc);
153
+ const len4 = WASM_VECTOR_LEN;
154
+ const ptr5 = passArrayF64ToWasm0(line_points, wasm.__wbindgen_malloc);
155
+ const len5 = WASM_VECTOR_LEN;
156
+ const ptr6 = passArray32ToWasm0(line_first, wasm.__wbindgen_malloc);
157
+ const len6 = WASM_VECTOR_LEN;
158
+ const ptr7 = passArray32ToWasm0(line_feature, wasm.__wbindgen_malloc);
159
+ const len7 = WASM_VECTOR_LEN;
160
+ const ptr8 = passArray32ToWasm0(line_start, wasm.__wbindgen_malloc);
161
+ const len8 = WASM_VECTOR_LEN;
162
+ const ptr9 = passArray8ToWasm0(raised, wasm.__wbindgen_malloc);
163
+ const len9 = WASM_VECTOR_LEN;
164
+ const ptr10 = passArrayF64ToWasm0(tile, wasm.__wbindgen_malloc);
165
+ const len10 = WASM_VECTOR_LEN;
166
+ const ret = wasm.tessellateVectorTile(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, prism, ptr10, len10);
167
+ return TessellatedTile.__wrap(ret);
168
+ }
169
+ function __wbg_get_imports() {
170
+ const import0 = {
171
+ __proto__: null,
172
+ __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
173
+ throw new Error(getStringFromWasm0(arg0, arg1));
174
+ },
175
+ __wbg_new_from_slice_37a3c3a194266cb8: function(arg0, arg1) {
176
+ const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
177
+ return ret;
178
+ },
179
+ __wbg_new_from_slice_9a868026ffa4208a: function(arg0, arg1) {
180
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
181
+ return ret;
182
+ },
183
+ __wbg_new_from_slice_ca6ad97db1f4779a: function(arg0, arg1) {
184
+ const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
185
+ return ret;
186
+ },
187
+ __wbindgen_init_externref_table: function() {
188
+ const table = wasm.__wbindgen_externrefs;
189
+ const offset = table.grow(4);
190
+ table.set(0, undefined);
191
+ table.set(offset + 0, undefined);
192
+ table.set(offset + 1, null);
193
+ table.set(offset + 2, true);
194
+ table.set(offset + 3, false);
195
+ },
196
+ };
197
+ return {
198
+ __proto__: null,
199
+ "./isard_tess_bg.js": import0,
200
+ };
201
+ }
202
+
203
+ const TessellatedTileFinalization = (typeof FinalizationRegistry === 'undefined')
204
+ ? { register: () => {}, unregister: () => {} }
205
+ : new FinalizationRegistry(ptr => wasm.__wbg_tessellatedtile_free(ptr, 1));
206
+
207
+ function getArrayF32FromWasm0(ptr, len) {
208
+ ptr = ptr >>> 0;
209
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
210
+ }
211
+
212
+ function getArrayF64FromWasm0(ptr, len) {
213
+ ptr = ptr >>> 0;
214
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
215
+ }
216
+
217
+ function getArrayU32FromWasm0(ptr, len) {
218
+ ptr = ptr >>> 0;
219
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
220
+ }
221
+
222
+ function getArrayU8FromWasm0(ptr, len) {
223
+ ptr = ptr >>> 0;
224
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
225
+ }
226
+
227
+ let cachedFloat32ArrayMemory0 = null;
228
+ function getFloat32ArrayMemory0() {
229
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
230
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
231
+ }
232
+ return cachedFloat32ArrayMemory0;
233
+ }
234
+
235
+ let cachedFloat64ArrayMemory0 = null;
236
+ function getFloat64ArrayMemory0() {
237
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
238
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
239
+ }
240
+ return cachedFloat64ArrayMemory0;
241
+ }
242
+
243
+ function getStringFromWasm0(ptr, len) {
244
+ return decodeText(ptr >>> 0, len);
245
+ }
246
+
247
+ let cachedUint32ArrayMemory0 = null;
248
+ function getUint32ArrayMemory0() {
249
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
250
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
251
+ }
252
+ return cachedUint32ArrayMemory0;
253
+ }
254
+
255
+ let cachedUint8ArrayMemory0 = null;
256
+ function getUint8ArrayMemory0() {
257
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
258
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
259
+ }
260
+ return cachedUint8ArrayMemory0;
261
+ }
262
+
263
+ function passArray32ToWasm0(arg, malloc) {
264
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
265
+ getUint32ArrayMemory0().set(arg, ptr / 4);
266
+ WASM_VECTOR_LEN = arg.length;
267
+ return ptr;
268
+ }
269
+
270
+ function passArray8ToWasm0(arg, malloc) {
271
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
272
+ getUint8ArrayMemory0().set(arg, ptr / 1);
273
+ WASM_VECTOR_LEN = arg.length;
274
+ return ptr;
275
+ }
276
+
277
+ function passArrayF64ToWasm0(arg, malloc) {
278
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
279
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
280
+ WASM_VECTOR_LEN = arg.length;
281
+ return ptr;
282
+ }
283
+
284
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
285
+ cachedTextDecoder.decode();
286
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
287
+ let numBytesDecoded = 0;
288
+ function decodeText(ptr, len) {
289
+ numBytesDecoded += len;
290
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
291
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
292
+ cachedTextDecoder.decode();
293
+ numBytesDecoded = len;
294
+ }
295
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
296
+ }
297
+
298
+ let WASM_VECTOR_LEN = 0;
299
+
300
+ let wasmModule, wasmInstance, wasm;
301
+ function __wbg_finalize_init(instance, module) {
302
+ wasmInstance = instance;
303
+ wasm = instance.exports;
304
+ wasmModule = module;
305
+ cachedFloat32ArrayMemory0 = null;
306
+ cachedFloat64ArrayMemory0 = null;
307
+ cachedUint32ArrayMemory0 = null;
308
+ cachedUint8ArrayMemory0 = null;
309
+ wasm.__wbindgen_start();
310
+ return wasm;
311
+ }
312
+
313
+ async function __wbg_load(module, imports) {
314
+ if (typeof Response === 'function' && module instanceof Response) {
315
+ if (!module.ok) {
316
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
317
+ }
318
+
319
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
320
+ try {
321
+ return await WebAssembly.instantiateStreaming(module, imports);
322
+ } catch (e) {
323
+ const validResponse = expectedResponseType(module.type);
324
+
325
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
326
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
327
+
328
+ } else { throw e; }
329
+ }
330
+ }
331
+
332
+ const bytes = await module.arrayBuffer();
333
+ return await WebAssembly.instantiate(bytes, imports);
334
+ } else {
335
+ const instance = await WebAssembly.instantiate(module, imports);
336
+
337
+ if (instance instanceof WebAssembly.Instance) {
338
+ return { instance, module };
339
+ } else {
340
+ return instance;
341
+ }
342
+ }
343
+
344
+ function expectedResponseType(type) {
345
+ switch (type) {
346
+ case 'basic': case 'cors': case 'default': return true;
347
+ }
348
+ return false;
349
+ }
350
+ }
351
+
352
+ function initSync(module) {
353
+ if (wasm !== undefined) return wasm;
354
+
355
+
356
+ if (module !== undefined) {
357
+ if (Object.getPrototypeOf(module) === Object.prototype) {
358
+ ({module} = module)
359
+ } else {
360
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
361
+ }
362
+ }
363
+
364
+ const imports = __wbg_get_imports();
365
+ if (!(module instanceof WebAssembly.Module)) {
366
+ module = new WebAssembly.Module(module);
367
+ }
368
+ const instance = new WebAssembly.Instance(module, imports);
369
+ return __wbg_finalize_init(instance, module);
370
+ }
371
+
372
+ async function __wbg_init(module_or_path) {
373
+ if (wasm !== undefined) return wasm;
374
+
375
+
376
+ if (module_or_path !== undefined) {
377
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
378
+ ({module_or_path} = module_or_path)
379
+ } else {
380
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
381
+ }
382
+ }
383
+
384
+ if (module_or_path === undefined) {
385
+ module_or_path = new URL('isard_tess_bg.wasm', import.meta.url);
386
+ }
387
+ const imports = __wbg_get_imports();
388
+
389
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
390
+ module_or_path = fetch(module_or_path);
391
+ }
392
+
393
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
394
+
395
+ return __wbg_finalize_init(instance, module);
396
+ }
397
+
398
+ export { initSync, __wbg_init as default };
@@ -0,0 +1,72 @@
1
+ /** A vector tile cut into geometry for the engine: the polygons of the extrusions, the fills, lines and buildings of
2
+ * `vectors()` with their style per feature, made ready for the GPU by the tessellation module */
3
+ import type { Value } from '../../basemap/mvt.ts';
4
+ import type { Priority, TileMesh, TileVectors } from '../basemap.worker.ts';
5
+ import { type Renderer } from './tiles.ts';
6
+ /**
7
+ * The polygons of a tile's features in the renderer's fill layers (each feature once, whichever layers keep it), in
8
+ * Mercator [0, 1]: a ring turning clockwise in tile units (y down) starts a polygon, the others are its holes (the
9
+ * vector tile specification)
10
+ */
11
+ export declare const polygons: (r: Renderer, z: number, x: number, y: number, id: number, priority?: Priority) => Promise<{
12
+ arrays: {
13
+ points: Float64Array<ArrayBuffer>;
14
+ ringStart: Uint32Array<ArrayBuffer>;
15
+ polygonStart: Uint32Array<ArrayBuffer>;
16
+ feature: Uint32Array<ArrayBuffer>;
17
+ };
18
+ properties: Record<string, Value>[];
19
+ } | undefined>;
20
+ /**
21
+ * A ring cut to the square [0, `extent`] (Sutherland–Hodgman), its points interleaved, unclosed: a polygon lying
22
+ * across the tile's edge keeps its part in the tile, along the edge
23
+ */
24
+ export declare const clipRing: (ring: readonly number[], extent: number) => number[];
25
+ /** A line cut to the square [0, `extent`] (Liang–Barsky per segment): its runs inside, each two points at least */
26
+ export declare const clipLine: (line: readonly number[], extent: number) => number[][];
27
+ /**
28
+ * The geometry of a feature of a tile of the source's level in the units of its tile `d` levels deeper at (`ox`, `oy`)
29
+ * among the `2^d × 2^d` it holds (overzoom); undefined if none of it lies in that tile (its points' bounds outside
30
+ * it or along its edge: nothing left once cut to it)
31
+ */
32
+ export declare const overzoomed: (geometry: readonly (readonly number[])[], extent: number, d: number, ox: number, oy: number) => number[][] | undefined;
33
+ /**
34
+ * The fills and lines of a tile's features in the renderer's layers, cut to the tile, in Mercator [0, 1], each with
35
+ * its style (color, its opacity folded in; a line's width, its gap folded in as the casing drawn by `draw`, at four
36
+ * zooms over the range the tile is drawn at); with `stylesOnly`, the styles alone. Patterns, outlines and circles are
37
+ * left to the raster path
38
+ */
39
+ export declare const vectors: (r: Renderer, { z, x, y, deepest }: {
40
+ z: number;
41
+ x: number;
42
+ y: number;
43
+ deepest?: number;
44
+ }, id: number, stylesOnly: boolean, priority?: Priority) => Promise<Float32Array<ArrayBuffer> | {
45
+ fills: {
46
+ points: Float64Array<ArrayBuffer>;
47
+ ringStart: Uint32Array<ArrayBuffer>;
48
+ polygonStart: Uint32Array<ArrayBuffer>;
49
+ feature: Uint32Array<ArrayBuffer>;
50
+ fillStart: Uint32Array<ArrayBuffer>;
51
+ };
52
+ lines: {
53
+ points: Float64Array<ArrayBuffer>;
54
+ start: Uint32Array<ArrayBuffer>;
55
+ feature: Uint32Array<ArrayBuffer>;
56
+ lineStart: Uint32Array<ArrayBuffer>;
57
+ };
58
+ styles: Float32Array<ArrayBuffer>;
59
+ tile: Float64Array<ArrayBuffer>;
60
+ properties: Record<string, Value>[];
61
+ sublayer: Uint16Array<ArrayBuffer>;
62
+ } | undefined>;
63
+ /** The tessellation module: where it is, and once loaded whether it works (false: the main thread does its work) */
64
+ export declare const tess: {
65
+ url?: string;
66
+ ready?: Promise<boolean>;
67
+ };
68
+ /** The tessellation module loaded, once; false without one or if it failed */
69
+ export declare const tessellator: () => Promise<boolean>;
70
+ /** A cut tile made ready for the GPU by the tessellation module (`raised`: per sublayer, whether its polygons are
71
+ * extruded into blocks); undefined if it fails (it is then left aside) */
72
+ export declare const tessellate: (out: TileVectors, raised: Uint8Array, prism: boolean) => TileMesh | undefined;
@@ -0,0 +1,8 @@
1
+ /** The label candidates of a tile: the texts and icons of the style's symbol layers, for the page to shape and place */
2
+ import { type LabelCandidate } from '../../basemap/vectorstyle.ts';
3
+ import type { Priority } from '../basemap.worker.ts';
4
+ import { type Renderer } from './tiles.ts';
5
+ /** Points every `spacing` along a line (tile units, x and y interleaved), the first half a spacing in (the middle of a
6
+ * shorter line): each point and the segment it lies on (x, y, x0, y0, x1, y1) */
7
+ export declare const lineAnchors: (line: readonly number[], spacing: number) => number[][];
8
+ export declare const labels: (r: Renderer, z: number, x: number, y: number, id: number, priority?: Priority, zoom?: number) => Promise<LabelCandidate[]>;
@@ -0,0 +1,10 @@
1
+ /** A vector tile drawn into an image with its style (Canvas 2D), for the raster pool */
2
+ import type { Priority } from '../basemap.worker.ts';
3
+ import { type Renderer } from './tiles.ts';
4
+ /**
5
+ * The image of a drawn canvas, its alpha straight (the engine blends straight alpha). An opaque tile (a background
6
+ * of full opacity, as a basemap's) is moved out of the canvas as it is, premultiplied and straight being the same
7
+ * there; another one is read back unpremultiplied, copied
8
+ */
9
+ export declare const tileImage: (canvas: OffscreenCanvas, g: OffscreenCanvasRenderingContext2D, opaque: boolean) => Promise<ImageBitmap>;
10
+ export declare const render: (r: Renderer, z: number, x: number, y: number, size: number, id: number, priority?: Priority) => Promise<ImageBitmap | null | undefined>;
@@ -0,0 +1,19 @@
1
+ /** The wind of a city's streets: the buildings of the vector tiles around a square, laid on its grid of cells, and
2
+ * the flow round them for a wind towards the east and one towards the north (the grid module) */
3
+ import { type StreetFlows } from '../../grid-module.ts';
4
+ import type { Priority } from '../basemap.worker.ts';
5
+ import type { Renderer } from './tiles.ts';
6
+ /** What a street flow is asked with: its square (Mercator: west, north, east, south) and grid, the tiles of level `z`
7
+ * over it (x, y pairs), the sweeps, the grid module's URL */
8
+ export interface StreetWork {
9
+ module: string;
10
+ z: number;
11
+ tiles: number[];
12
+ bounds: [x0: number, y0: number, x1: number, y1: number];
13
+ width: number;
14
+ height: number;
15
+ iterations: number;
16
+ priority?: Priority;
17
+ }
18
+ /** The streets' flows of a square: the buildings of its tiles in cells (those away from it left out), then solved */
19
+ export declare const streetFlowOf: (r: Renderer, work: StreetWork, id: number) => Promise<StreetFlows>;
@@ -0,0 +1,65 @@
1
+ /** The state a basemap worker shares among its jobs: the renderers (a style's layers over a source), the decoded vector
2
+ * tiles and raster images it keeps, the requests in progress, and the style's values as its jobs read them */
3
+ import { type TileLayer } from '../../basemap/mvt.ts';
4
+ import { type Context, type RasterSource, type StyleLayer } from '../../basemap/vectorstyle.ts';
5
+ import { Lru } from '../../util/lru.ts';
6
+ import type { Priority } from '../basemap.worker.ts';
7
+ export interface Renderer {
8
+ tiles: string;
9
+ maxzoom: number;
10
+ layers: StyleLayer[];
11
+ rasters: Record<string, RasterSource>;
12
+ sprites: Sprite[];
13
+ /** Fill patterns by icon name, cut from the sprites once */
14
+ patterns: Map<string, OffscreenCanvas | undefined>;
15
+ }
16
+ /** A sprite of the style: its images by name (`id:name` but in the default sprite) and its sheet */
17
+ export interface Sprite {
18
+ image: ImageBitmap;
19
+ icons: Record<string, {
20
+ x: number;
21
+ y: number;
22
+ width: number;
23
+ height: number;
24
+ pixelRatio?: number;
25
+ }>;
26
+ }
27
+ /** An image of the sprites and its sheet */
28
+ export declare const spriteIcon: (r: Renderer, name: string) => {
29
+ icon: {
30
+ x: number;
31
+ y: number;
32
+ width: number;
33
+ height: number;
34
+ pixelRatio?: number;
35
+ };
36
+ image: ImageBitmap;
37
+ } | undefined;
38
+ export declare const renderers: Map<string, Renderer>;
39
+ /** Decoded tiles by URL; this worker's share of them, set by the renderers */
40
+ export declare const cache: Lru<string, Promise<Map<string, TileLayer> | undefined>>;
41
+ /** The decoded tiles one worker of `workers` keeps */
42
+ export declare const cacheShare: (workers: number) => number;
43
+ /** Requests in progress, and those of them aborted (both forgotten once answered) */
44
+ export declare const active: Set<number>;
45
+ export declare const aborted: Set<number>;
46
+ /** An image of a raster source (shared by every renderer); undefined where the source has none */
47
+ export declare const image: (url: string, priority?: Priority) => Promise<ImageBitmap | undefined>;
48
+ /** A vector tile, decoded (shared by every renderer of its URL); the first request's priority fetches it */
49
+ export declare const tile: (url: string, priority?: Priority) => Promise<Map<string, TileLayer> | undefined>;
50
+ /** The vector tile to draw a raster tile from, and where the raster tile lies in it (tile units) */
51
+ export declare const source: (r: Renderer, z: number, x: number, y: number) => {
52
+ url: string;
53
+ vz: number;
54
+ vx: number;
55
+ vy: number;
56
+ part: number;
57
+ ox: number;
58
+ oy: number;
59
+ };
60
+ export declare const value: (layer: StyleLayer, group: "paint" | "layout", key: string, ctx: Context, fallback: unknown) => unknown;
61
+ /** A color with an opacity, for the canvas */
62
+ export declare const paint: (c: unknown, opacity: number) => string;
63
+ export declare const shown: (layer: StyleLayer, zoom: number) => boolean;
64
+ /** Longitude and latitude of a point of tile (z, x, y) in tile units */
65
+ export declare const lonLat: (z: number, x: number, y: number, extent: number, px: number, py: number) => [number, number];
@@ -0,0 +1,19 @@
1
+ /** The trees of a tile: points scattered over the woods of its polygons, the same each time the tile is cut */
2
+ import type { Priority } from '../basemap.worker.ts';
3
+ import { type Renderer } from './tiles.ts';
4
+ /** A number in [0, 1) from four integers, the same for the same ones: where a tree stands in its cell, its size */
5
+ export declare const treeHash: (a: number, b: number, c: number, d: number) => number;
6
+ /** Whether a point lies in rings (interleaved points, unclosed or closed), even-odd: the holes cut out */
7
+ export declare const inRings: (rings: readonly (readonly number[])[], px: number, py: number) => boolean;
8
+ /**
9
+ * Points scattered over a polygon (its rings, tile units) on a jittered grid of `cell` tile units, the grid and the
10
+ * jitter fixed by the tile (`seed`): the same trees whenever the tile is cut again, none twice across tiles (the points
11
+ * past the tile's edge left to its neighbour). Past `maxCells` cells over the polygon (a tile of a coarse level), the
12
+ * cells grow until they are no more. Each point with a number in [0, 1) for its size and heading
13
+ */
14
+ export declare const scatter: (rings: readonly (readonly number[])[], extent: number, spacing: number, seed: [number, number, number], maxCells?: number) => [x: number, y: number, k: number][];
15
+ /**
16
+ * Trees over the polygons of the renderer's layers in a tile: longitude, latitude, scale (0.75 to 1.25), heading
17
+ * (degrees) and rank (in [0, 1): the page keeps the lowest far from the view) of each, `spacing[s]` metres apart in layer `s` on a jittered grid; past `maxTrees`, thinned evenly
18
+ */
19
+ export declare const trees: (r: Renderer, z: number, x: number, y: number, id: number, spacing: number[], maxTrees: number, priority?: Priority) => Promise<Float64Array<ArrayBuffer> | undefined>;