isard 0.4.0 → 0.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 +33 -0
- package/README.md +6 -2
- package/dist/decoder.worker.js +4 -4
- package/dist/decoder.worker.js.map +7 -6
- package/dist/decoders.d.ts +3 -2
- package/dist/decoders.js +28 -5
- package/dist/decoders.js.map +1 -1
- package/dist/engine-loader.d.ts +6 -3
- package/dist/engine-loader.js +10 -3
- package/dist/engine-loader.js.map +1 -1
- package/dist/formats.d.ts +11 -0
- package/dist/formats.js +12 -0
- package/dist/formats.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -0
- 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_points_bg.wasm +0 -0
- package/dist/layers.js +2 -2
- package/dist/layers.js.map +1 -1
- package/dist/loader.d.ts +9 -3
- package/dist/loader.js +22 -3
- package/dist/loader.js.map +1 -1
- package/dist/map.d.ts +8 -0
- package/dist/map.js +10 -2
- package/dist/map.js.map +1 -1
- package/dist/pointclouds.d.ts +98 -0
- package/dist/pointclouds.js +232 -0
- package/dist/pointclouds.js.map +1 -0
- package/dist/projections.d.ts +13 -0
- package/dist/projections.js +13 -0
- package/dist/projections.js.map +1 -0
- package/dist/protocol.d.ts +17 -0
- package/dist/protocol.js.map +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/types.js.map +1 -1
- package/dist/wasm/isard.d.ts +124 -9
- package/dist/wasm/isard.js +127 -7
- package/dist/wasm/isard_points.d.ts +43 -0
- package/dist/wasm/isard_points.js +212 -0
- package/package.json +17 -1
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/* @ts-self-types="./isard_points.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The vertices (`STRIDE` bytes each, see `points`) of a COPC chunk of `count` points. `laz`: the data of the LAZ
|
|
5
|
+
* VLR; `layout`: format, record length, scale and offset of the header; `grid`: the positions of the node's square
|
|
6
|
+
* (`Grid::numbers`)
|
|
7
|
+
* @param {Uint8Array} chunk
|
|
8
|
+
* @param {Uint8Array} laz
|
|
9
|
+
* @param {Float64Array} layout
|
|
10
|
+
* @param {Float64Array} grid
|
|
11
|
+
* @param {number} count
|
|
12
|
+
* @returns {Uint8Array}
|
|
13
|
+
*/
|
|
14
|
+
export function decodeCopc(chunk, laz, layout, grid, count) {
|
|
15
|
+
const ptr0 = passArray8ToWasm0(chunk, wasm.__wbindgen_malloc);
|
|
16
|
+
const len0 = WASM_VECTOR_LEN;
|
|
17
|
+
const ptr1 = passArray8ToWasm0(laz, wasm.__wbindgen_malloc);
|
|
18
|
+
const len1 = WASM_VECTOR_LEN;
|
|
19
|
+
const ptr2 = passArrayF64ToWasm0(layout, wasm.__wbindgen_malloc);
|
|
20
|
+
const len2 = WASM_VECTOR_LEN;
|
|
21
|
+
const ptr3 = passArrayF64ToWasm0(grid, wasm.__wbindgen_malloc);
|
|
22
|
+
const len3 = WASM_VECTOR_LEN;
|
|
23
|
+
const ret = wasm.decodeCopc(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, count);
|
|
24
|
+
if (ret[3]) {
|
|
25
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
26
|
+
}
|
|
27
|
+
var v5 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
28
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
29
|
+
return v5;
|
|
30
|
+
}
|
|
31
|
+
function __wbg_get_imports() {
|
|
32
|
+
const import0 = {
|
|
33
|
+
__proto__: null,
|
|
34
|
+
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
35
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
36
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
37
|
+
return ret;
|
|
38
|
+
},
|
|
39
|
+
__wbindgen_init_externref_table: function() {
|
|
40
|
+
const table = wasm.__wbindgen_externrefs;
|
|
41
|
+
const offset = table.grow(4);
|
|
42
|
+
table.set(0, undefined);
|
|
43
|
+
table.set(offset + 0, undefined);
|
|
44
|
+
table.set(offset + 1, null);
|
|
45
|
+
table.set(offset + 2, true);
|
|
46
|
+
table.set(offset + 3, false);
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
__proto__: null,
|
|
51
|
+
"./isard_points_bg.js": import0,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
56
|
+
ptr = ptr >>> 0;
|
|
57
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let cachedFloat64ArrayMemory0 = null;
|
|
61
|
+
function getFloat64ArrayMemory0() {
|
|
62
|
+
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
63
|
+
cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
|
|
64
|
+
}
|
|
65
|
+
return cachedFloat64ArrayMemory0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function getStringFromWasm0(ptr, len) {
|
|
69
|
+
return decodeText(ptr >>> 0, len);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let cachedUint8ArrayMemory0 = null;
|
|
73
|
+
function getUint8ArrayMemory0() {
|
|
74
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
75
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
76
|
+
}
|
|
77
|
+
return cachedUint8ArrayMemory0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
81
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
82
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
83
|
+
WASM_VECTOR_LEN = arg.length;
|
|
84
|
+
return ptr;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function passArrayF64ToWasm0(arg, malloc) {
|
|
88
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
89
|
+
getFloat64ArrayMemory0().set(arg, ptr / 8);
|
|
90
|
+
WASM_VECTOR_LEN = arg.length;
|
|
91
|
+
return ptr;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function takeFromExternrefTable0(idx) {
|
|
95
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
96
|
+
wasm.__externref_table_dealloc(idx);
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
101
|
+
cachedTextDecoder.decode();
|
|
102
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
103
|
+
let numBytesDecoded = 0;
|
|
104
|
+
function decodeText(ptr, len) {
|
|
105
|
+
numBytesDecoded += len;
|
|
106
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
107
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
108
|
+
cachedTextDecoder.decode();
|
|
109
|
+
numBytesDecoded = len;
|
|
110
|
+
}
|
|
111
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
let WASM_VECTOR_LEN = 0;
|
|
115
|
+
|
|
116
|
+
let wasmModule, wasmInstance, wasm;
|
|
117
|
+
function __wbg_finalize_init(instance, module) {
|
|
118
|
+
wasmInstance = instance;
|
|
119
|
+
wasm = instance.exports;
|
|
120
|
+
wasmModule = module;
|
|
121
|
+
cachedFloat64ArrayMemory0 = null;
|
|
122
|
+
cachedUint8ArrayMemory0 = null;
|
|
123
|
+
wasm.__wbindgen_start();
|
|
124
|
+
return wasm;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async function __wbg_load(module, imports) {
|
|
128
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
129
|
+
if (!module.ok) {
|
|
130
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
134
|
+
try {
|
|
135
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
136
|
+
} catch (e) {
|
|
137
|
+
const validResponse = expectedResponseType(module.type);
|
|
138
|
+
|
|
139
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
140
|
+
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);
|
|
141
|
+
|
|
142
|
+
} else { throw e; }
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const bytes = await module.arrayBuffer();
|
|
147
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
148
|
+
} else {
|
|
149
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
150
|
+
|
|
151
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
152
|
+
return { instance, module };
|
|
153
|
+
} else {
|
|
154
|
+
return instance;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function expectedResponseType(type) {
|
|
159
|
+
switch (type) {
|
|
160
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function initSync(module) {
|
|
167
|
+
if (wasm !== undefined) return wasm;
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
if (module !== undefined) {
|
|
171
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
172
|
+
({module} = module)
|
|
173
|
+
} else {
|
|
174
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const imports = __wbg_get_imports();
|
|
179
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
180
|
+
module = new WebAssembly.Module(module);
|
|
181
|
+
}
|
|
182
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
183
|
+
return __wbg_finalize_init(instance, module);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async function __wbg_init(module_or_path) {
|
|
187
|
+
if (wasm !== undefined) return wasm;
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
if (module_or_path !== undefined) {
|
|
191
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
192
|
+
({module_or_path} = module_or_path)
|
|
193
|
+
} else {
|
|
194
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (module_or_path === undefined) {
|
|
199
|
+
module_or_path = new URL('isard_points_bg.wasm', import.meta.url);
|
|
200
|
+
}
|
|
201
|
+
const imports = __wbg_get_imports();
|
|
202
|
+
|
|
203
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
204
|
+
module_or_path = fetch(module_or_path);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
208
|
+
|
|
209
|
+
return __wbg_finalize_init(instance, module);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export { initSync, __wbg_init as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "A WebGL2 map engine for large, interactive data layers, labels and 3D Tiles over raster or vector basemaps (Rust core in WebAssembly)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Kevin Graff",
|
|
@@ -32,10 +32,26 @@
|
|
|
32
32
|
"types": "./dist/index.d.ts",
|
|
33
33
|
"default": "./dist/index.js"
|
|
34
34
|
},
|
|
35
|
+
"./formats": {
|
|
36
|
+
"isard-source": "./src/formats.ts",
|
|
37
|
+
"types": "./dist/formats.d.ts",
|
|
38
|
+
"default": "./dist/formats.js"
|
|
39
|
+
},
|
|
40
|
+
"./projections": {
|
|
41
|
+
"isard-source": "./src/projections.ts",
|
|
42
|
+
"types": "./dist/projections.d.ts",
|
|
43
|
+
"default": "./dist/projections.js"
|
|
44
|
+
},
|
|
45
|
+
"./geoplateforme": {
|
|
46
|
+
"isard-source": "./src/geoplateforme.ts",
|
|
47
|
+
"types": "./dist/geoplateforme.d.ts",
|
|
48
|
+
"default": "./dist/geoplateforme.js"
|
|
49
|
+
},
|
|
35
50
|
"./decoder.worker.js": "./dist/decoder.worker.js",
|
|
36
51
|
"./basemap.worker.js": "./dist/basemap.worker.js",
|
|
37
52
|
"./isard_bg.wasm": "./dist/isard_bg.wasm",
|
|
38
53
|
"./isard_core_bg.wasm": "./dist/isard_core_bg.wasm",
|
|
54
|
+
"./isard_points_bg.wasm": "./dist/isard_points_bg.wasm",
|
|
39
55
|
"./package.json": "./package.json"
|
|
40
56
|
},
|
|
41
57
|
"files": [
|