isard 1.3.0 → 1.5.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.
- package/CHANGELOG.md +90 -0
- package/README.md +23 -6
- package/dist/basemap/basemaps.js +1 -0
- package/dist/basemap/basemaps.js.map +1 -1
- package/dist/basemap/vectortiles/context.d.ts +43 -0
- package/dist/basemap/vectortiles/context.js +6 -0
- package/dist/basemap/vectortiles/context.js.map +1 -0
- package/dist/basemap/vectortiles/extrusions.d.ts +11 -0
- package/dist/basemap/vectortiles/extrusions.js +46 -0
- package/dist/basemap/vectortiles/extrusions.js.map +1 -0
- package/dist/basemap/vectortiles/labels.d.ts +22 -0
- package/dist/basemap/vectortiles/labels.js +225 -0
- package/dist/basemap/vectortiles/labels.js.map +1 -0
- package/dist/basemap/vectortiles/requests.d.ts +24 -0
- package/dist/basemap/vectortiles/requests.js +61 -0
- package/dist/basemap/vectortiles/requests.js.map +1 -0
- package/dist/basemap/vectortiles/street-wind.d.ts +19 -0
- package/dist/basemap/vectortiles/street-wind.js +133 -0
- package/dist/basemap/vectortiles/street-wind.js.map +1 -0
- package/dist/basemap/vectortiles/style.d.ts +47 -0
- package/dist/basemap/vectortiles/style.js +141 -0
- package/dist/basemap/vectortiles/style.js.map +1 -0
- package/dist/basemap/vectortiles/tiles.d.ts +34 -0
- package/dist/basemap/vectortiles/tiles.js +62 -0
- package/dist/basemap/vectortiles/tiles.js.map +1 -0
- package/dist/basemap/vectortiles/trees.d.ts +19 -0
- package/dist/basemap/vectortiles/trees.js +93 -0
- package/dist/basemap/vectortiles/trees.js.map +1 -0
- package/dist/basemap/vectortiles/vectors.d.ts +20 -0
- package/dist/basemap/vectortiles/vectors.js +167 -0
- package/dist/basemap/vectortiles/vectors.js.map +1 -0
- package/dist/basemap/vectortiles.d.ts +34 -75
- package/dist/basemap/vectortiles.js +70 -654
- package/dist/basemap/vectortiles.js.map +1 -1
- package/dist/basemap/workerpool.js +33 -5
- package/dist/basemap/workerpool.js.map +1 -1
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +8 -5
- package/dist/bind/layers.js +10 -0
- package/dist/bind/layers.js.map +1 -1
- package/dist/decoder.worker.js +5 -4
- package/dist/decoder.worker.js.map +8 -6
- package/dist/engine/decoders.d.ts +4 -8
- package/dist/engine/decoders.js +29 -2
- package/dist/engine/decoders.js.map +1 -1
- package/dist/engine-loader.d.ts +4 -1
- package/dist/engine-loader.js +9 -0
- package/dist/engine-loader.js.map +1 -1
- package/dist/grid-module.d.ts +44 -0
- package/dist/grid-module.js +63 -0
- package/dist/grid-module.js.map +1 -0
- package/dist/grids.d.ts +51 -0
- package/dist/grids.js +88 -0
- package/dist/grids.js.map +1 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
- package/dist/isard_grid_bg.wasm +0 -0
- package/dist/layers/flow.d.ts +118 -0
- package/dist/layers/flow.js +263 -0
- package/dist/layers/flow.js.map +1 -0
- package/dist/layers/panoramas.d.ts +2 -0
- package/dist/layers/panoramas.js +27 -6
- package/dist/layers/panoramas.js.map +1 -1
- package/dist/layers/symbols.d.ts +2 -0
- package/dist/layers/symbols.js +2 -1
- package/dist/layers/symbols.js.map +1 -1
- package/dist/map/layer-spec.d.ts +4 -1
- package/dist/map/layer-spec.js +2 -0
- package/dist/map/layer-spec.js.map +1 -1
- package/dist/map/workers.d.ts +4 -0
- package/dist/map/workers.js +38 -0
- package/dist/map/workers.js.map +1 -1
- package/dist/map.d.ts +14 -0
- package/dist/map.js +19 -1
- package/dist/map.js.map +1 -1
- package/dist/react/Layer.d.ts +2 -0
- package/dist/react/Layer.js.map +1 -1
- package/dist/types.d.ts +7 -3
- package/dist/types.js.map +1 -1
- package/dist/util/read.d.ts +4 -0
- package/dist/util/read.js +28 -0
- package/dist/util/read.js.map +1 -0
- package/dist/wasm/isard.d.ts +55 -0
- package/dist/wasm/isard.js +112 -1
- package/dist/wasm/isard_core.d.ts +55 -0
- package/dist/wasm/isard_core.js +112 -1
- package/dist/wasm/isard_grid.d.ts +101 -0
- package/dist/wasm/isard_grid.js +375 -0
- package/dist/workers/basemap/street.d.ts +19 -0
- package/dist/workers/basemap.worker.d.ts +21 -0
- package/dist/workers/basemap.worker.js +23 -4
- package/dist/workers/basemap.worker.js.map +1 -1
- package/package.json +2 -1
- package/vite.js +3 -2
package/dist/wasm/isard_core.js
CHANGED
|
@@ -97,6 +97,25 @@ export class Engine {
|
|
|
97
97
|
}
|
|
98
98
|
return ret[0] >>> 0;
|
|
99
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* A flow layer of `particles` particles (rounded up to a multiple of 4096) with trails of `trail` positions; its
|
|
102
|
+
* field comes with `setFlowField`
|
|
103
|
+
*
|
|
104
|
+
* # Errors
|
|
105
|
+
*
|
|
106
|
+
* Throws (to JavaScript) when a WebGL object cannot be created, a shader fails to compile or the trails need a
|
|
107
|
+
* table texture past the GPU's `MAX_TEXTURE_SIZE`
|
|
108
|
+
* @param {number} particles
|
|
109
|
+
* @param {number} trail
|
|
110
|
+
* @returns {number}
|
|
111
|
+
*/
|
|
112
|
+
addFlow(particles, trail) {
|
|
113
|
+
const ret = wasm.engine_addFlow(this.__wbg_ptr, particles, trail);
|
|
114
|
+
if (ret[2]) {
|
|
115
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
116
|
+
}
|
|
117
|
+
return ret[0] >>> 0;
|
|
118
|
+
}
|
|
100
119
|
/**
|
|
101
120
|
* Ground layer running `code` (GLSL ES 3.0 defining `vec4 ground(vec2 offset)`, see `render::ground`) over the
|
|
102
121
|
* ground; `anchor`: Mercator point the offsets are taken from; bounds: Mercator box it shows in. Compilation errors
|
|
@@ -450,6 +469,14 @@ export class Engine {
|
|
|
450
469
|
const ret = wasm.engine_project(this.__wbg_ptr, lon, lat, !isLikeNone(height), isLikeNone(height) ? 0 : height);
|
|
451
470
|
return ret;
|
|
452
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* A flow layer's second field becomes its field (the model's next hour reached): only the hour after it is then
|
|
474
|
+
* sent (`setFlowNext`)
|
|
475
|
+
* @param {number} id
|
|
476
|
+
*/
|
|
477
|
+
promoteFlowNext(id) {
|
|
478
|
+
wasm.engine_promoteFlowNext(this.__wbg_ptr, id);
|
|
479
|
+
}
|
|
453
480
|
/**
|
|
454
481
|
* Removes batch `key` of an extrusion layer (nothing if there is none)
|
|
455
482
|
* @param {number} id
|
|
@@ -728,6 +755,79 @@ export class Engine {
|
|
|
728
755
|
setFirstPerson(lon, lat, height, bearing, pitch, fov) {
|
|
729
756
|
wasm.engine_setFirstPerson(this.__wbg_ptr, lon, lat, height, bearing, pitch, fov);
|
|
730
757
|
}
|
|
758
|
+
/**
|
|
759
|
+
* How far a flow layer's field has gone towards its next one, 0 to 1 (the time between the model's two hours)
|
|
760
|
+
* @param {number} id
|
|
761
|
+
* @param {number} blend
|
|
762
|
+
*/
|
|
763
|
+
setFlowBlend(id, blend) {
|
|
764
|
+
wasm.engine_setFlowBlend(this.__wbg_ptr, id, blend);
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* The field of a flow layer: `width` × `height` points over `bounds` (west, south, east, north, degrees: the
|
|
768
|
+
* longitudes and latitudes of the corner points; a last column one step short of 360° round the world), their
|
|
769
|
+
* east and north components (m/s, row after row from the north; not a number: none there). On the grid of the
|
|
770
|
+
* field before, the particles go on (its next field and blend kept); on another one, they start again
|
|
771
|
+
* @param {number} id
|
|
772
|
+
* @param {number} width
|
|
773
|
+
* @param {number} height
|
|
774
|
+
* @param {Float32Array} u
|
|
775
|
+
* @param {Float32Array} v
|
|
776
|
+
* @param {Float64Array} bounds
|
|
777
|
+
*/
|
|
778
|
+
setFlowField(id, width, height, u, v, bounds) {
|
|
779
|
+
const ptr0 = passArrayF32ToWasm0(u, wasm.__wbindgen_malloc);
|
|
780
|
+
const len0 = WASM_VECTOR_LEN;
|
|
781
|
+
const ptr1 = passArrayF32ToWasm0(v, wasm.__wbindgen_malloc);
|
|
782
|
+
const len1 = WASM_VECTOR_LEN;
|
|
783
|
+
const ptr2 = passArrayF64ToWasm0(bounds, wasm.__wbindgen_malloc);
|
|
784
|
+
const len2 = WASM_VECTOR_LEN;
|
|
785
|
+
wasm.engine_setFlowField(this.__wbg_ptr, id, width, height, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* A flow layer's second field, on its grid (the model's next hour, or the flow of a wind towards the north: east
|
|
789
|
+
* and north components, row after row; empty: none), mixed in by `setFlowBlend` or `setFlowWeights`
|
|
790
|
+
* @param {number} id
|
|
791
|
+
* @param {Float32Array} u
|
|
792
|
+
* @param {Float32Array} v
|
|
793
|
+
*/
|
|
794
|
+
setFlowNext(id, u, v) {
|
|
795
|
+
const ptr0 = passArrayF32ToWasm0(u, wasm.__wbindgen_malloc);
|
|
796
|
+
const len0 = WASM_VECTOR_LEN;
|
|
797
|
+
const ptr1 = passArrayF32ToWasm0(v, wasm.__wbindgen_malloc);
|
|
798
|
+
const len1 = WASM_VECTOR_LEN;
|
|
799
|
+
wasm.engine_setFlowNext(this.__wbg_ptr, id, ptr0, len0, ptr1, len1);
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* The look of a flow layer's trails: speeds (m/s) and their colors (RGBA 0-1, four numbers each), up to 8;
|
|
803
|
+
* width (CSS pixels), opacity, height over the ground (metres), speed on screen (pixels a second for 10 m/s),
|
|
804
|
+
* particles moving for each 100 × 100 CSS pixels of the view (at most the layer's)
|
|
805
|
+
* @param {number} id
|
|
806
|
+
* @param {Float32Array} speeds
|
|
807
|
+
* @param {Float32Array} colors
|
|
808
|
+
* @param {number} width
|
|
809
|
+
* @param {number} opacity
|
|
810
|
+
* @param {number} height
|
|
811
|
+
* @param {number} speed
|
|
812
|
+
* @param {number} density
|
|
813
|
+
*/
|
|
814
|
+
setFlowStyle(id, speeds, colors, width, opacity, height, speed, density) {
|
|
815
|
+
const ptr0 = passArrayF32ToWasm0(speeds, wasm.__wbindgen_malloc);
|
|
816
|
+
const len0 = WASM_VECTOR_LEN;
|
|
817
|
+
const ptr1 = passArrayF32ToWasm0(colors, wasm.__wbindgen_malloc);
|
|
818
|
+
const len1 = WASM_VECTOR_LEN;
|
|
819
|
+
wasm.engine_setFlowStyle(this.__wbg_ptr, id, ptr0, len0, ptr1, len1, width, opacity, height, speed, density);
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* A flow layer's velocity as `a` times its field plus `b` times its second one (a wind of `a` m/s towards the east
|
|
823
|
+
* and `b` towards the north, from the flows of 1 m/s each way): nothing sent again but two numbers
|
|
824
|
+
* @param {number} id
|
|
825
|
+
* @param {number} a
|
|
826
|
+
* @param {number} b
|
|
827
|
+
*/
|
|
828
|
+
setFlowWeights(id, a, b) {
|
|
829
|
+
wasm.engine_setFlowWeights(this.__wbg_ptr, id, a, b);
|
|
830
|
+
}
|
|
731
831
|
/**
|
|
732
832
|
* Color of the globe under the tiles (polar caps)
|
|
733
833
|
* @param {number} r
|
|
@@ -1310,6 +1410,17 @@ export class Engine {
|
|
|
1310
1410
|
const ret = wasm.engine_stats(this.__wbg_ptr);
|
|
1311
1411
|
return ret;
|
|
1312
1412
|
}
|
|
1413
|
+
/**
|
|
1414
|
+
* Moves a flow layer's particles by `seconds` of the page's time (one animation frame), in the current view;
|
|
1415
|
+
* whether they moved (none in view, or no field: the map need not be drawn again)
|
|
1416
|
+
* @param {number} id
|
|
1417
|
+
* @param {number} seconds
|
|
1418
|
+
* @returns {boolean}
|
|
1419
|
+
*/
|
|
1420
|
+
stepFlow(id, seconds) {
|
|
1421
|
+
const ret = wasm.engine_stepFlow(this.__wbg_ptr, id, seconds);
|
|
1422
|
+
return ret !== 0;
|
|
1423
|
+
}
|
|
1313
1424
|
/**
|
|
1314
1425
|
* The height above the relief (metres) of the top of what stands at a position (degrees): a roof, a mesh, 0 on
|
|
1315
1426
|
* the bare ground; undefined where nothing of the last frame is there. The scene is drawn from above into a single
|
|
@@ -2439,7 +2550,7 @@ function __wbg_get_imports() {
|
|
|
2439
2550
|
return ret;
|
|
2440
2551
|
},
|
|
2441
2552
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
2442
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2553
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 110, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2443
2554
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_);
|
|
2444
2555
|
return ret;
|
|
2445
2556
|
},
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The grids of a file
|
|
6
|
+
*/
|
|
7
|
+
export class GridSet {
|
|
8
|
+
private constructor();
|
|
9
|
+
free(): void;
|
|
10
|
+
/**
|
|
11
|
+
* How many grids
|
|
12
|
+
*/
|
|
13
|
+
count(): number;
|
|
14
|
+
/**
|
|
15
|
+
* Grid `i`'s description: name, standard name, units, level, time, width, height, bounds (JSON)
|
|
16
|
+
*/
|
|
17
|
+
meta(i: number): string;
|
|
18
|
+
/**
|
|
19
|
+
* Grid `i`'s values, row after row from the north
|
|
20
|
+
*/
|
|
21
|
+
values(i: number): Float32Array;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The flows of a city's streets for a wind of 1 m/s from the west and one from the south (see `street`): the east and
|
|
26
|
+
* north velocities of each, `width` × `height` cells each
|
|
27
|
+
*/
|
|
28
|
+
export class StreetFlow {
|
|
29
|
+
private constructor();
|
|
30
|
+
free(): void;
|
|
31
|
+
/**
|
|
32
|
+
* The flow of a wind towards the east: its east velocities, then its north ones
|
|
33
|
+
*/
|
|
34
|
+
eastU(): Float32Array;
|
|
35
|
+
eastV(): Float32Array;
|
|
36
|
+
/**
|
|
37
|
+
* The flow of a wind towards the north: its east velocities, then its north ones
|
|
38
|
+
*/
|
|
39
|
+
northU(): Float32Array;
|
|
40
|
+
northV(): Float32Array;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The grids of a GRIB2 or classic NetCDF file
|
|
45
|
+
*
|
|
46
|
+
* # Errors
|
|
47
|
+
*
|
|
48
|
+
* Throws (to JavaScript) when the file is of neither kind, malformed, or packed in a way not read
|
|
49
|
+
*/
|
|
50
|
+
export function readGrids(bytes: Uint8Array): GridSet;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The flows of the streets of a grid of `width` × `height` cells round the buildings of `points` (their rings in
|
|
54
|
+
* cells, from the north-west corner, interleaved; `ring_start` the first point of each ring and the end,
|
|
55
|
+
* `polygon_start` the first ring of each polygon and the end), after `iterations` sweeps
|
|
56
|
+
*/
|
|
57
|
+
export function streetFlow(points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, width: number, height: number, iterations: number): StreetFlow;
|
|
58
|
+
|
|
59
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
60
|
+
|
|
61
|
+
export interface InitOutput {
|
|
62
|
+
readonly memory: WebAssembly.Memory;
|
|
63
|
+
readonly __wbg_gridset_free: (a: number, b: number) => void;
|
|
64
|
+
readonly __wbg_streetflow_free: (a: number, b: number) => void;
|
|
65
|
+
readonly gridset_count: (a: number) => number;
|
|
66
|
+
readonly gridset_meta: (a: number, b: number) => [number, number];
|
|
67
|
+
readonly gridset_values: (a: number, b: number) => any;
|
|
68
|
+
readonly readGrids: (a: number, b: number) => [number, number, number];
|
|
69
|
+
readonly streetFlow: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
70
|
+
readonly streetflow_eastU: (a: number) => any;
|
|
71
|
+
readonly streetflow_eastV: (a: number) => any;
|
|
72
|
+
readonly streetflow_northU: (a: number) => any;
|
|
73
|
+
readonly streetflow_northV: (a: number) => any;
|
|
74
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
75
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
76
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
77
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
78
|
+
readonly __wbindgen_start: () => void;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
85
|
+
* a precompiled `WebAssembly.Module`.
|
|
86
|
+
*
|
|
87
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
88
|
+
*
|
|
89
|
+
* @returns {InitOutput}
|
|
90
|
+
*/
|
|
91
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
95
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
96
|
+
*
|
|
97
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
98
|
+
*
|
|
99
|
+
* @returns {Promise<InitOutput>}
|
|
100
|
+
*/
|
|
101
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
/* @ts-self-types="./isard_grid.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The grids of a file
|
|
5
|
+
*/
|
|
6
|
+
export class GridSet {
|
|
7
|
+
static __wrap(ptr) {
|
|
8
|
+
const obj = Object.create(GridSet.prototype);
|
|
9
|
+
obj.__wbg_ptr = ptr;
|
|
10
|
+
GridSetFinalization.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
|
+
GridSetFinalization.unregister(this);
|
|
17
|
+
return ptr;
|
|
18
|
+
}
|
|
19
|
+
free() {
|
|
20
|
+
const ptr = this.__destroy_into_raw();
|
|
21
|
+
wasm.__wbg_gridset_free(ptr, 0);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* How many grids
|
|
25
|
+
* @returns {number}
|
|
26
|
+
*/
|
|
27
|
+
count() {
|
|
28
|
+
const ret = wasm.gridset_count(this.__wbg_ptr);
|
|
29
|
+
return ret >>> 0;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Grid `i`'s description: name, standard name, units, level, time, width, height, bounds (JSON)
|
|
33
|
+
* @param {number} i
|
|
34
|
+
* @returns {string}
|
|
35
|
+
*/
|
|
36
|
+
meta(i) {
|
|
37
|
+
let deferred1_0;
|
|
38
|
+
let deferred1_1;
|
|
39
|
+
try {
|
|
40
|
+
const ret = wasm.gridset_meta(this.__wbg_ptr, i);
|
|
41
|
+
deferred1_0 = ret[0];
|
|
42
|
+
deferred1_1 = ret[1];
|
|
43
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
44
|
+
} finally {
|
|
45
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Grid `i`'s values, row after row from the north
|
|
50
|
+
* @param {number} i
|
|
51
|
+
* @returns {Float32Array}
|
|
52
|
+
*/
|
|
53
|
+
values(i) {
|
|
54
|
+
const ret = wasm.gridset_values(this.__wbg_ptr, i);
|
|
55
|
+
return ret;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (Symbol.dispose) GridSet.prototype[Symbol.dispose] = GridSet.prototype.free;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The flows of a city's streets for a wind of 1 m/s from the west and one from the south (see `street`): the east and
|
|
62
|
+
* north velocities of each, `width` × `height` cells each
|
|
63
|
+
*/
|
|
64
|
+
export class StreetFlow {
|
|
65
|
+
static __wrap(ptr) {
|
|
66
|
+
const obj = Object.create(StreetFlow.prototype);
|
|
67
|
+
obj.__wbg_ptr = ptr;
|
|
68
|
+
StreetFlowFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
69
|
+
return obj;
|
|
70
|
+
}
|
|
71
|
+
__destroy_into_raw() {
|
|
72
|
+
const ptr = this.__wbg_ptr;
|
|
73
|
+
this.__wbg_ptr = 0;
|
|
74
|
+
StreetFlowFinalization.unregister(this);
|
|
75
|
+
return ptr;
|
|
76
|
+
}
|
|
77
|
+
free() {
|
|
78
|
+
const ptr = this.__destroy_into_raw();
|
|
79
|
+
wasm.__wbg_streetflow_free(ptr, 0);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The flow of a wind towards the east: its east velocities, then its north ones
|
|
83
|
+
* @returns {Float32Array}
|
|
84
|
+
*/
|
|
85
|
+
eastU() {
|
|
86
|
+
const ret = wasm.streetflow_eastU(this.__wbg_ptr);
|
|
87
|
+
return ret;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @returns {Float32Array}
|
|
91
|
+
*/
|
|
92
|
+
eastV() {
|
|
93
|
+
const ret = wasm.streetflow_eastV(this.__wbg_ptr);
|
|
94
|
+
return ret;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The flow of a wind towards the north: its east velocities, then its north ones
|
|
98
|
+
* @returns {Float32Array}
|
|
99
|
+
*/
|
|
100
|
+
northU() {
|
|
101
|
+
const ret = wasm.streetflow_northU(this.__wbg_ptr);
|
|
102
|
+
return ret;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @returns {Float32Array}
|
|
106
|
+
*/
|
|
107
|
+
northV() {
|
|
108
|
+
const ret = wasm.streetflow_northV(this.__wbg_ptr);
|
|
109
|
+
return ret;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (Symbol.dispose) StreetFlow.prototype[Symbol.dispose] = StreetFlow.prototype.free;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The grids of a GRIB2 or classic NetCDF file
|
|
116
|
+
*
|
|
117
|
+
* # Errors
|
|
118
|
+
*
|
|
119
|
+
* Throws (to JavaScript) when the file is of neither kind, malformed, or packed in a way not read
|
|
120
|
+
* @param {Uint8Array} bytes
|
|
121
|
+
* @returns {GridSet}
|
|
122
|
+
*/
|
|
123
|
+
export function readGrids(bytes) {
|
|
124
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
125
|
+
const len0 = WASM_VECTOR_LEN;
|
|
126
|
+
const ret = wasm.readGrids(ptr0, len0);
|
|
127
|
+
if (ret[2]) {
|
|
128
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
129
|
+
}
|
|
130
|
+
return GridSet.__wrap(ret[0]);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The flows of the streets of a grid of `width` × `height` cells round the buildings of `points` (their rings in
|
|
135
|
+
* cells, from the north-west corner, interleaved; `ring_start` the first point of each ring and the end,
|
|
136
|
+
* `polygon_start` the first ring of each polygon and the end), after `iterations` sweeps
|
|
137
|
+
* @param {Float64Array} points
|
|
138
|
+
* @param {Uint32Array} ring_start
|
|
139
|
+
* @param {Uint32Array} polygon_start
|
|
140
|
+
* @param {number} width
|
|
141
|
+
* @param {number} height
|
|
142
|
+
* @param {number} iterations
|
|
143
|
+
* @returns {StreetFlow}
|
|
144
|
+
*/
|
|
145
|
+
export function streetFlow(points, ring_start, polygon_start, width, height, iterations) {
|
|
146
|
+
const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
147
|
+
const len0 = WASM_VECTOR_LEN;
|
|
148
|
+
const ptr1 = passArray32ToWasm0(ring_start, wasm.__wbindgen_malloc);
|
|
149
|
+
const len1 = WASM_VECTOR_LEN;
|
|
150
|
+
const ptr2 = passArray32ToWasm0(polygon_start, wasm.__wbindgen_malloc);
|
|
151
|
+
const len2 = WASM_VECTOR_LEN;
|
|
152
|
+
const ret = wasm.streetFlow(ptr0, len0, ptr1, len1, ptr2, len2, width, height, iterations);
|
|
153
|
+
return StreetFlow.__wrap(ret);
|
|
154
|
+
}
|
|
155
|
+
function __wbg_get_imports() {
|
|
156
|
+
const import0 = {
|
|
157
|
+
__proto__: null,
|
|
158
|
+
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
159
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
160
|
+
},
|
|
161
|
+
__wbg_new_from_slice_ca6ad97db1f4779a: function(arg0, arg1) {
|
|
162
|
+
const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
|
|
163
|
+
return ret;
|
|
164
|
+
},
|
|
165
|
+
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
166
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
167
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
168
|
+
return ret;
|
|
169
|
+
},
|
|
170
|
+
__wbindgen_init_externref_table: function() {
|
|
171
|
+
const table = wasm.__wbindgen_externrefs;
|
|
172
|
+
const offset = table.grow(4);
|
|
173
|
+
table.set(0, undefined);
|
|
174
|
+
table.set(offset + 0, undefined);
|
|
175
|
+
table.set(offset + 1, null);
|
|
176
|
+
table.set(offset + 2, true);
|
|
177
|
+
table.set(offset + 3, false);
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
return {
|
|
181
|
+
__proto__: null,
|
|
182
|
+
"./isard_grid_bg.js": import0,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const GridSetFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
187
|
+
? { register: () => {}, unregister: () => {} }
|
|
188
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_gridset_free(ptr, 1));
|
|
189
|
+
const StreetFlowFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
190
|
+
? { register: () => {}, unregister: () => {} }
|
|
191
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_streetflow_free(ptr, 1));
|
|
192
|
+
|
|
193
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
194
|
+
ptr = ptr >>> 0;
|
|
195
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
199
|
+
function getFloat32ArrayMemory0() {
|
|
200
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
201
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
202
|
+
}
|
|
203
|
+
return cachedFloat32ArrayMemory0;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
let cachedFloat64ArrayMemory0 = null;
|
|
207
|
+
function getFloat64ArrayMemory0() {
|
|
208
|
+
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
209
|
+
cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
|
|
210
|
+
}
|
|
211
|
+
return cachedFloat64ArrayMemory0;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function getStringFromWasm0(ptr, len) {
|
|
215
|
+
return decodeText(ptr >>> 0, len);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
let cachedUint32ArrayMemory0 = null;
|
|
219
|
+
function getUint32ArrayMemory0() {
|
|
220
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
221
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
222
|
+
}
|
|
223
|
+
return cachedUint32ArrayMemory0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
let cachedUint8ArrayMemory0 = null;
|
|
227
|
+
function getUint8ArrayMemory0() {
|
|
228
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
229
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
230
|
+
}
|
|
231
|
+
return cachedUint8ArrayMemory0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
235
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
236
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
237
|
+
WASM_VECTOR_LEN = arg.length;
|
|
238
|
+
return ptr;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
242
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
243
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
244
|
+
WASM_VECTOR_LEN = arg.length;
|
|
245
|
+
return ptr;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function passArrayF64ToWasm0(arg, malloc) {
|
|
249
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
250
|
+
getFloat64ArrayMemory0().set(arg, ptr / 8);
|
|
251
|
+
WASM_VECTOR_LEN = arg.length;
|
|
252
|
+
return ptr;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function takeFromExternrefTable0(idx) {
|
|
256
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
257
|
+
wasm.__externref_table_dealloc(idx);
|
|
258
|
+
return value;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
262
|
+
cachedTextDecoder.decode();
|
|
263
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
264
|
+
let numBytesDecoded = 0;
|
|
265
|
+
function decodeText(ptr, len) {
|
|
266
|
+
numBytesDecoded += len;
|
|
267
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
268
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
269
|
+
cachedTextDecoder.decode();
|
|
270
|
+
numBytesDecoded = len;
|
|
271
|
+
}
|
|
272
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
let WASM_VECTOR_LEN = 0;
|
|
276
|
+
|
|
277
|
+
let wasmModule, wasmInstance, wasm;
|
|
278
|
+
function __wbg_finalize_init(instance, module) {
|
|
279
|
+
wasmInstance = instance;
|
|
280
|
+
wasm = instance.exports;
|
|
281
|
+
wasmModule = module;
|
|
282
|
+
cachedFloat32ArrayMemory0 = null;
|
|
283
|
+
cachedFloat64ArrayMemory0 = null;
|
|
284
|
+
cachedUint32ArrayMemory0 = null;
|
|
285
|
+
cachedUint8ArrayMemory0 = null;
|
|
286
|
+
wasm.__wbindgen_start();
|
|
287
|
+
return wasm;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
async function __wbg_load(module, imports) {
|
|
291
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
292
|
+
if (!module.ok) {
|
|
293
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
297
|
+
try {
|
|
298
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
299
|
+
} catch (e) {
|
|
300
|
+
const validResponse = expectedResponseType(module.type);
|
|
301
|
+
|
|
302
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
303
|
+
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);
|
|
304
|
+
|
|
305
|
+
} else { throw e; }
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const bytes = await module.arrayBuffer();
|
|
310
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
311
|
+
} else {
|
|
312
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
313
|
+
|
|
314
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
315
|
+
return { instance, module };
|
|
316
|
+
} else {
|
|
317
|
+
return instance;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function expectedResponseType(type) {
|
|
322
|
+
switch (type) {
|
|
323
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
324
|
+
}
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function initSync(module) {
|
|
330
|
+
if (wasm !== undefined) return wasm;
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
if (module !== undefined) {
|
|
334
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
335
|
+
({module} = module)
|
|
336
|
+
} else {
|
|
337
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const imports = __wbg_get_imports();
|
|
342
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
343
|
+
module = new WebAssembly.Module(module);
|
|
344
|
+
}
|
|
345
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
346
|
+
return __wbg_finalize_init(instance, module);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
async function __wbg_init(module_or_path) {
|
|
350
|
+
if (wasm !== undefined) return wasm;
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
if (module_or_path !== undefined) {
|
|
354
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
355
|
+
({module_or_path} = module_or_path)
|
|
356
|
+
} else {
|
|
357
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (module_or_path === undefined) {
|
|
362
|
+
module_or_path = new URL('isard_grid_bg.wasm', import.meta.url);
|
|
363
|
+
}
|
|
364
|
+
const imports = __wbg_get_imports();
|
|
365
|
+
|
|
366
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
367
|
+
module_or_path = fetch(module_or_path);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
371
|
+
|
|
372
|
+
return __wbg_finalize_init(instance, module);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export { initSync, __wbg_init as default };
|
|
@@ -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>;
|
|
@@ -19,6 +19,8 @@ import { type Job } from '../basemap/resample.ts';
|
|
|
19
19
|
import { type PngEncoding } from '../basemap/terrain.ts';
|
|
20
20
|
import { type LabelCandidate, type RasterSource, type StyleLayer } from '../basemap/vectorstyle.ts';
|
|
21
21
|
import { type HeaderRules } from '../engine/requests.ts';
|
|
22
|
+
import { type GridDescription, type StreetFlows } from '../grid-module.ts';
|
|
23
|
+
import { type StreetWork } from './basemap/street.ts';
|
|
22
24
|
import { type Sprite } from './basemap/tiles.ts';
|
|
23
25
|
export type { LabelCandidate, RasterSource, Sprite };
|
|
24
26
|
/** Fetch priority of a request (`fetch`'s `priority`, a hint to the browser) */
|
|
@@ -85,6 +87,18 @@ export type BasemapWork = {
|
|
|
85
87
|
url: string;
|
|
86
88
|
encoding: PngEncoding;
|
|
87
89
|
floor?: number;
|
|
90
|
+
}
|
|
91
|
+
/** The wind of a city's streets round the buildings of the renderer's layers (see `StreetWork`) */
|
|
92
|
+
| ({
|
|
93
|
+
type: 'street';
|
|
94
|
+
key: string;
|
|
95
|
+
} & StreetWork)
|
|
96
|
+
/** A GRIB2 or NetCDF file (fetched from `url`, or its `bytes`) read into grids by the grid module (`module`) */
|
|
97
|
+
| {
|
|
98
|
+
type: 'grids';
|
|
99
|
+
module: string;
|
|
100
|
+
url?: string;
|
|
101
|
+
bytes?: ArrayBuffer;
|
|
88
102
|
} | {
|
|
89
103
|
type: 'reproject';
|
|
90
104
|
job: Job;
|
|
@@ -151,6 +165,13 @@ export type BasemapResponse = {
|
|
|
151
165
|
} | {
|
|
152
166
|
id: number;
|
|
153
167
|
heights: Float32Array;
|
|
168
|
+
} | {
|
|
169
|
+
id: number;
|
|
170
|
+
grids: GridDescription[];
|
|
171
|
+
values: Float32Array[];
|
|
172
|
+
} | {
|
|
173
|
+
id: number;
|
|
174
|
+
street: StreetFlows;
|
|
154
175
|
};
|
|
155
176
|
/** The polygons of a tile in Mercator [0, 1], as the extrusions take them (`PolygonArrays`), and their properties */
|
|
156
177
|
export interface TilePolygons {
|