@loaders.gl/raster 5.0.0-alpha.13 → 5.0.0-alpha.14
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/LICENSE +52 -0
- package/dist/geotiff/advanced.cjs +4 -4
- package/dist/geotiff/geotiff-loader-types.js +1 -1
- package/dist/geotiff/geotiff-raster-loader-types.js +1 -1
- package/dist/geotiff/geotiff-source-loader.js +1 -1
- package/dist/geotiff/loaders.js +1 -1
- package/dist/geotiff/ometiff-source-loader.js +1 -1
- package/dist/index.cjs +4 -4
- package/dist/lerc/lerc-loader-types.js +1 -1
- package/dist/quantized-mesh-worker.js +59 -15
- package/dist/terrain/index.cjs +1 -1
- package/dist/terrain/lib/utils/version.js +1 -1
- package/dist/terrain-worker.js +60 -16
- package/package.json +5 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
loaders.gl is licensed under the MIT license
|
|
2
|
+
|
|
3
|
+
Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2015 Uber Technologies, Inc.
|
|
26
|
+
|
|
27
|
+
Portions of modules/images/src/lib/category-api/binary-image-api.ts are based on
|
|
28
|
+
binary-gltf-utils (https://github.com/Qantas94Heavy/binary-gltf-utils) under the
|
|
29
|
+
MIT License reproduced above.
|
|
30
|
+
|
|
31
|
+
Copyright (c) 2016-17 Karl Cheng
|
|
32
|
+
|
|
33
|
+
Portions of modules/core/src/schema-utils/lib/utils/async-queue.ts are adapted from
|
|
34
|
+
async-iter-demo (https://github.com/rauschma/async-iter-demo) under the MIT
|
|
35
|
+
License reproduced above.
|
|
36
|
+
|
|
37
|
+
Copyright (c) 2016 Axel Rauschmayer
|
|
38
|
+
|
|
39
|
+
loaders.gl includes certain files from Cesium (https://github.com/CesiumGS/cesium)
|
|
40
|
+
under the Apache 2.0 License, including files in modules/3d-tiles.
|
|
41
|
+
|
|
42
|
+
Copyright 2011-2018 CesiumJS Contributors
|
|
43
|
+
|
|
44
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
45
|
+
you may not use this file except in compliance with the License.
|
|
46
|
+
You may obtain a copy of the License at
|
|
47
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
48
|
+
|
|
49
|
+
Unless required by applicable law or agreed to in writing, software
|
|
50
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
51
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
52
|
+
See the License for the specific language governing permissions and limitations under the License.
|
|
@@ -65,7 +65,7 @@ var OMETiffFormat = {
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
// dist/geotiff/geotiff-loader-types.js
|
|
68
|
-
var VERSION = true ? "5.0.0-alpha.
|
|
68
|
+
var VERSION = true ? "5.0.0-alpha.14" : "latest";
|
|
69
69
|
async function preload() {
|
|
70
70
|
const { GeoTIFFLoaderWithParser } = await import("@loaders.gl/raster/geotiff/geotiff-loader");
|
|
71
71
|
return GeoTIFFLoaderWithParser;
|
|
@@ -131,7 +131,7 @@ async function openGeoTIFFSourceDecoder(source, signal) {
|
|
|
131
131
|
|
|
132
132
|
// dist/geotiff/geotiff-source-loader.js
|
|
133
133
|
var import_loader_utils = require("@loaders.gl/core/loader-utils");
|
|
134
|
-
var VERSION2 = true ? "5.0.0-alpha.
|
|
134
|
+
var VERSION2 = true ? "5.0.0-alpha.14" : "latest";
|
|
135
135
|
var GEOTIFF_RASTER_QUERY_CAPABILITIES = Object.freeze({
|
|
136
136
|
bounds: "pushdown",
|
|
137
137
|
level: "pushdown",
|
|
@@ -1629,7 +1629,7 @@ async function loadOmeTiff(tiff, firstImage) {
|
|
|
1629
1629
|
}
|
|
1630
1630
|
|
|
1631
1631
|
// dist/geotiff/ometiff-source-loader.js
|
|
1632
|
-
var VERSION3 = true ? "5.0.0-alpha.
|
|
1632
|
+
var VERSION3 = true ? "5.0.0-alpha.14" : "latest";
|
|
1633
1633
|
var OMETiffSourceLoader = {
|
|
1634
1634
|
dataType: null,
|
|
1635
1635
|
batchType: null,
|
|
@@ -1866,7 +1866,7 @@ async function loadGeoTiff(source, opts = {}) {
|
|
|
1866
1866
|
}
|
|
1867
1867
|
|
|
1868
1868
|
// dist/geotiff/geotiff-raster-loader-types.js
|
|
1869
|
-
var VERSION4 = true ? "5.0.0-alpha.
|
|
1869
|
+
var VERSION4 = true ? "5.0.0-alpha.14" : "latest";
|
|
1870
1870
|
async function preload2() {
|
|
1871
1871
|
const { GeoTIFFRasterLoaderWithParser } = await import("@loaders.gl/raster/geotiff/geotiff-raster-loader");
|
|
1872
1872
|
return GeoTIFFRasterLoaderWithParser;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { GeoTIFFFormat } from "./geotiff-format.js";
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "5.0.0-alpha.
|
|
7
|
+
const VERSION = typeof "5.0.0-alpha.14" !== 'undefined' ? "5.0.0-alpha.14" : 'latest';
|
|
8
8
|
/** Preloads the parser-bearing GeoTIFF loader implementation. */
|
|
9
9
|
async function preload() {
|
|
10
10
|
const { GeoTIFFLoaderWithParser } = await import('@loaders.gl/raster/geotiff/geotiff-loader');
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { GeoTIFFFormat } from "./geotiff-format.js";
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "5.0.0-alpha.
|
|
7
|
+
const VERSION = typeof "5.0.0-alpha.14" !== 'undefined' ? "5.0.0-alpha.14" : 'latest';
|
|
8
8
|
/** Loads the optional numeric TIFF parser on first use by an asynchronous core API. */
|
|
9
9
|
async function preload() {
|
|
10
10
|
const { GeoTIFFRasterLoaderWithParser } = await import('@loaders.gl/raster/geotiff/geotiff-raster-loader');
|
|
@@ -6,7 +6,7 @@ import { createTileGrid, createTileGridMatrix, DataSource, getRasterViewportBoun
|
|
|
6
6
|
import { GeoTIFFFormat } from "./geotiff-format.js";
|
|
7
7
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
8
8
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
9
|
-
const VERSION = typeof "5.0.0-alpha.
|
|
9
|
+
const VERSION = typeof "5.0.0-alpha.14" !== 'undefined' ? "5.0.0-alpha.14" : 'latest';
|
|
10
10
|
/** Common raster-query capabilities of GeoTIFF and COG sources. */
|
|
11
11
|
export const GEOTIFF_RASTER_QUERY_CAPABILITIES = Object.freeze({
|
|
12
12
|
bounds: 'pushdown',
|
package/dist/geotiff/loaders.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { fromArrayBuffer } from 'geotiff';
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "5.0.0-alpha.
|
|
7
|
+
const VERSION = typeof "5.0.0-alpha.14" !== 'undefined' ? "5.0.0-alpha.14" : 'latest';
|
|
8
8
|
/**
|
|
9
9
|
* Loads a GeoTIFF file containing a RGB image.
|
|
10
10
|
*/
|
|
@@ -8,7 +8,7 @@ import { ensureArray, getImageSize, intToRgba } from "./lib/utils/tiff-utils.js"
|
|
|
8
8
|
import { OMETiffFormat } from "./geotiff-format.js";
|
|
9
9
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
10
10
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
11
|
-
const VERSION = typeof "5.0.0-alpha.
|
|
11
|
+
const VERSION = typeof "5.0.0-alpha.14" !== 'undefined' ? "5.0.0-alpha.14" : 'latest';
|
|
12
12
|
/**
|
|
13
13
|
* Source factory for non-geospatial OME-TIFF plane data.
|
|
14
14
|
*/
|
package/dist/index.cjs
CHANGED
|
@@ -68,7 +68,7 @@ var OMETiffFormat = {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
// dist/geotiff/geotiff-loader-types.js
|
|
71
|
-
var VERSION = true ? "5.0.0-alpha.
|
|
71
|
+
var VERSION = true ? "5.0.0-alpha.14" : "latest";
|
|
72
72
|
async function preload() {
|
|
73
73
|
const { GeoTIFFLoaderWithParser } = await import("@loaders.gl/raster/geotiff/geotiff-loader");
|
|
74
74
|
return GeoTIFFLoaderWithParser;
|
|
@@ -87,7 +87,7 @@ var GeoTIFFLoader = {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
// dist/geotiff/geotiff-raster-loader-types.js
|
|
90
|
-
var VERSION2 = true ? "5.0.0-alpha.
|
|
90
|
+
var VERSION2 = true ? "5.0.0-alpha.14" : "latest";
|
|
91
91
|
async function preload2() {
|
|
92
92
|
const { GeoTIFFRasterLoaderWithParser } = await import("@loaders.gl/raster/geotiff/geotiff-raster-loader");
|
|
93
93
|
return GeoTIFFRasterLoaderWithParser;
|
|
@@ -116,7 +116,7 @@ var LERCFormat = {
|
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
// dist/lerc/lerc-loader-types.js
|
|
119
|
-
var VERSION3 = true ? "5.0.0-alpha.
|
|
119
|
+
var VERSION3 = true ? "5.0.0-alpha.14" : "latest";
|
|
120
120
|
async function preload3() {
|
|
121
121
|
const { LERCLoaderWithParser } = await import("@loaders.gl/raster/lerc/lerc-loader");
|
|
122
122
|
return LERCLoaderWithParser;
|
|
@@ -140,7 +140,7 @@ var LERCLoader = {
|
|
|
140
140
|
};
|
|
141
141
|
|
|
142
142
|
// dist/terrain/lib/utils/version.js
|
|
143
|
-
var VERSION4 = true ? "5.0.0-alpha.
|
|
143
|
+
var VERSION4 = true ? "5.0.0-alpha.14" : "latest";
|
|
144
144
|
|
|
145
145
|
// dist/terrain/terrain-format.js
|
|
146
146
|
var TerrainFormat = {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { LERCFormat } from "./lerc-format.js";
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "5.0.0-alpha.
|
|
7
|
+
const VERSION = typeof "5.0.0-alpha.14" !== 'undefined' ? "5.0.0-alpha.14" : 'latest';
|
|
8
8
|
/** Preloads the parser-bearing LERC loader implementation. */
|
|
9
9
|
async function preload() {
|
|
10
10
|
const { LERCLoaderWithParser } = await import('@loaders.gl/raster/lerc/lerc-loader');
|
|
@@ -243,6 +243,8 @@
|
|
|
243
243
|
process: processOnMainThread
|
|
244
244
|
};
|
|
245
245
|
WorkerBody.onmessage = async (type, payload) => {
|
|
246
|
+
const reporter = type === "process" || type === "process-in-batches" ? createProgressReporter() : void 0;
|
|
247
|
+
const jobContext = { ...context, reportProgress: reporter?.report };
|
|
246
248
|
try {
|
|
247
249
|
switch (type) {
|
|
248
250
|
case "preload":
|
|
@@ -255,9 +257,10 @@
|
|
|
255
257
|
const result = await process(
|
|
256
258
|
payload.input,
|
|
257
259
|
payload.options || {},
|
|
258
|
-
|
|
260
|
+
jobContext,
|
|
259
261
|
payload.context || {}
|
|
260
262
|
);
|
|
263
|
+
reporter?.finish();
|
|
261
264
|
WorkerBody.postMessage("done", { result });
|
|
262
265
|
break;
|
|
263
266
|
case "process-in-batches":
|
|
@@ -272,13 +275,14 @@
|
|
|
272
275
|
const resultIterator = processInBatches(
|
|
273
276
|
createDemandDrivenIterator(inputBatches),
|
|
274
277
|
payload.options || {},
|
|
275
|
-
|
|
278
|
+
jobContext,
|
|
276
279
|
payload.context || {}
|
|
277
280
|
);
|
|
278
281
|
for await (const batch of resultIterator) {
|
|
279
282
|
await WorkerBody.postMessage("output-batch", { result: batch });
|
|
280
283
|
await outputAcknowledgements.next();
|
|
281
284
|
}
|
|
285
|
+
reporter?.finish();
|
|
282
286
|
await WorkerBody.postMessage("done", {});
|
|
283
287
|
} finally {
|
|
284
288
|
activeInputBatches = null;
|
|
@@ -306,6 +310,7 @@
|
|
|
306
310
|
default:
|
|
307
311
|
}
|
|
308
312
|
} catch (error) {
|
|
313
|
+
reporter?.finish();
|
|
309
314
|
const message = error instanceof Error ? error.message : "";
|
|
310
315
|
WorkerBody.postMessage("error", { error: message });
|
|
311
316
|
}
|
|
@@ -345,6 +350,35 @@
|
|
|
345
350
|
WorkerBody.postMessage("process", payload);
|
|
346
351
|
});
|
|
347
352
|
}
|
|
353
|
+
function createProgressReporter() {
|
|
354
|
+
let pending;
|
|
355
|
+
let finished = false;
|
|
356
|
+
let scheduled = false;
|
|
357
|
+
const flush = () => {
|
|
358
|
+
scheduled = false;
|
|
359
|
+
if (pending) {
|
|
360
|
+
WorkerBody.postMessage("progress", { progress: pending });
|
|
361
|
+
pending = void 0;
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
return {
|
|
365
|
+
/** Records progress while retaining phase transitions. */
|
|
366
|
+
report(progress) {
|
|
367
|
+
if (finished) return;
|
|
368
|
+
if (pending && pending.phase !== progress.phase) flush();
|
|
369
|
+
pending = { ...progress };
|
|
370
|
+
if (!scheduled) {
|
|
371
|
+
scheduled = true;
|
|
372
|
+
setTimeout(flush, 0);
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
376
|
+
finish() {
|
|
377
|
+
flush();
|
|
378
|
+
finished = true;
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
}
|
|
348
382
|
var requestId, activeInputBatches, activeOutputAcknowledgements;
|
|
349
383
|
var init_create_worker = __esm({
|
|
350
384
|
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
@@ -391,6 +425,7 @@
|
|
|
391
425
|
options,
|
|
392
426
|
context: {
|
|
393
427
|
...loaderContext,
|
|
428
|
+
reportProgress: workerContext?.reportProgress,
|
|
394
429
|
coreApi: createWorkerCoreApi(),
|
|
395
430
|
_parse: createParseOnMainThread(workerContext?.process)
|
|
396
431
|
}
|
|
@@ -401,8 +436,10 @@
|
|
|
401
436
|
if (!loader.parseInBatches) {
|
|
402
437
|
throw new Error(`${loader.id} loader does not support batched parsing`);
|
|
403
438
|
}
|
|
404
|
-
const
|
|
439
|
+
const parserOptions = getWorkerLoaderOptions(loader, options);
|
|
440
|
+
const resultIterator = loader.parseInBatches(inputIterator, parserOptions, {
|
|
405
441
|
...loaderContext,
|
|
442
|
+
reportProgress: workerContext?.reportProgress,
|
|
406
443
|
coreApi: createWorkerCoreApi(),
|
|
407
444
|
_parse: createParseOnMainThread(workerContext?.process)
|
|
408
445
|
});
|
|
@@ -458,7 +495,17 @@
|
|
|
458
495
|
if (!context) {
|
|
459
496
|
return void 0;
|
|
460
497
|
}
|
|
461
|
-
const {
|
|
498
|
+
const {
|
|
499
|
+
fetch: fetch2,
|
|
500
|
+
loaders,
|
|
501
|
+
coreApi,
|
|
502
|
+
signal,
|
|
503
|
+
reportProgress,
|
|
504
|
+
_parse,
|
|
505
|
+
_parseSync,
|
|
506
|
+
_parseInBatches,
|
|
507
|
+
...serializableContext
|
|
508
|
+
} = context;
|
|
462
509
|
return JSON.parse(JSON.stringify(serializableContext));
|
|
463
510
|
}
|
|
464
511
|
async function parseData({
|
|
@@ -479,18 +526,15 @@
|
|
|
479
526
|
} else {
|
|
480
527
|
throw new Error(`Could not load data with ${loader.name} loader`);
|
|
481
528
|
}
|
|
482
|
-
options =
|
|
529
|
+
options = getWorkerLoaderOptions(loader, options);
|
|
530
|
+
return await parser(data, { ...options }, context, loader);
|
|
531
|
+
}
|
|
532
|
+
function getWorkerLoaderOptions(loader, options) {
|
|
533
|
+
return {
|
|
483
534
|
...options,
|
|
484
|
-
modules: {
|
|
485
|
-
|
|
486
|
-
...options.modules || {}
|
|
487
|
-
},
|
|
488
|
-
core: {
|
|
489
|
-
...options.core,
|
|
490
|
-
worker: false
|
|
491
|
-
}
|
|
535
|
+
modules: { ...loader.options?.modules, ...options.modules },
|
|
536
|
+
core: { ...options.core, worker: false }
|
|
492
537
|
};
|
|
493
|
-
return await parser(data, { ...options }, context, loader);
|
|
494
538
|
}
|
|
495
539
|
var init_create_loader_worker = __esm({
|
|
496
540
|
"../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts"() {
|
|
@@ -17180,7 +17224,7 @@ return true;`);
|
|
|
17180
17224
|
var init_version = __esm({
|
|
17181
17225
|
"src/terrain/lib/utils/version.ts"() {
|
|
17182
17226
|
"use strict";
|
|
17183
|
-
VERSION = true ? "5.0.0-alpha.
|
|
17227
|
+
VERSION = true ? "5.0.0-alpha.14" : "latest";
|
|
17184
17228
|
}
|
|
17185
17229
|
});
|
|
17186
17230
|
|
package/dist/terrain/index.cjs
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
export const VERSION = typeof "5.0.0-alpha.
|
|
7
|
+
export const VERSION = typeof "5.0.0-alpha.14" !== 'undefined' ? "5.0.0-alpha.14" : 'latest';
|
|
8
8
|
//# sourceMappingURL=version.js.map
|
package/dist/terrain-worker.js
CHANGED
|
@@ -287,6 +287,8 @@
|
|
|
287
287
|
process: processOnMainThread
|
|
288
288
|
};
|
|
289
289
|
WorkerBody.onmessage = async (type, payload) => {
|
|
290
|
+
const reporter = type === "process" || type === "process-in-batches" ? createProgressReporter() : void 0;
|
|
291
|
+
const jobContext = { ...context, reportProgress: reporter?.report };
|
|
290
292
|
try {
|
|
291
293
|
switch (type) {
|
|
292
294
|
case "preload":
|
|
@@ -299,9 +301,10 @@
|
|
|
299
301
|
const result = await process2(
|
|
300
302
|
payload.input,
|
|
301
303
|
payload.options || {},
|
|
302
|
-
|
|
304
|
+
jobContext,
|
|
303
305
|
payload.context || {}
|
|
304
306
|
);
|
|
307
|
+
reporter?.finish();
|
|
305
308
|
WorkerBody.postMessage("done", { result });
|
|
306
309
|
break;
|
|
307
310
|
case "process-in-batches":
|
|
@@ -316,13 +319,14 @@
|
|
|
316
319
|
const resultIterator = processInBatches(
|
|
317
320
|
createDemandDrivenIterator(inputBatches),
|
|
318
321
|
payload.options || {},
|
|
319
|
-
|
|
322
|
+
jobContext,
|
|
320
323
|
payload.context || {}
|
|
321
324
|
);
|
|
322
325
|
for await (const batch of resultIterator) {
|
|
323
326
|
await WorkerBody.postMessage("output-batch", { result: batch });
|
|
324
327
|
await outputAcknowledgements.next();
|
|
325
328
|
}
|
|
329
|
+
reporter?.finish();
|
|
326
330
|
await WorkerBody.postMessage("done", {});
|
|
327
331
|
} finally {
|
|
328
332
|
activeInputBatches = null;
|
|
@@ -350,6 +354,7 @@
|
|
|
350
354
|
default:
|
|
351
355
|
}
|
|
352
356
|
} catch (error) {
|
|
357
|
+
reporter?.finish();
|
|
353
358
|
const message = error instanceof Error ? error.message : "";
|
|
354
359
|
WorkerBody.postMessage("error", { error: message });
|
|
355
360
|
}
|
|
@@ -389,6 +394,35 @@
|
|
|
389
394
|
WorkerBody.postMessage("process", payload);
|
|
390
395
|
});
|
|
391
396
|
}
|
|
397
|
+
function createProgressReporter() {
|
|
398
|
+
let pending;
|
|
399
|
+
let finished = false;
|
|
400
|
+
let scheduled = false;
|
|
401
|
+
const flush = () => {
|
|
402
|
+
scheduled = false;
|
|
403
|
+
if (pending) {
|
|
404
|
+
WorkerBody.postMessage("progress", { progress: pending });
|
|
405
|
+
pending = void 0;
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
return {
|
|
409
|
+
/** Records progress while retaining phase transitions. */
|
|
410
|
+
report(progress) {
|
|
411
|
+
if (finished) return;
|
|
412
|
+
if (pending && pending.phase !== progress.phase) flush();
|
|
413
|
+
pending = { ...progress };
|
|
414
|
+
if (!scheduled) {
|
|
415
|
+
scheduled = true;
|
|
416
|
+
setTimeout(flush, 0);
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
420
|
+
finish() {
|
|
421
|
+
flush();
|
|
422
|
+
finished = true;
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
}
|
|
392
426
|
var requestId, activeInputBatches, activeOutputAcknowledgements;
|
|
393
427
|
var init_create_worker = __esm({
|
|
394
428
|
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
@@ -435,6 +469,7 @@
|
|
|
435
469
|
options,
|
|
436
470
|
context: {
|
|
437
471
|
...loaderContext,
|
|
472
|
+
reportProgress: workerContext?.reportProgress,
|
|
438
473
|
coreApi: createWorkerCoreApi(),
|
|
439
474
|
_parse: createParseOnMainThread(workerContext?.process)
|
|
440
475
|
}
|
|
@@ -445,8 +480,10 @@
|
|
|
445
480
|
if (!loader.parseInBatches) {
|
|
446
481
|
throw new Error(`${loader.id} loader does not support batched parsing`);
|
|
447
482
|
}
|
|
448
|
-
const
|
|
483
|
+
const parserOptions = getWorkerLoaderOptions(loader, options);
|
|
484
|
+
const resultIterator = loader.parseInBatches(inputIterator, parserOptions, {
|
|
449
485
|
...loaderContext,
|
|
486
|
+
reportProgress: workerContext?.reportProgress,
|
|
450
487
|
coreApi: createWorkerCoreApi(),
|
|
451
488
|
_parse: createParseOnMainThread(workerContext?.process)
|
|
452
489
|
});
|
|
@@ -502,7 +539,17 @@
|
|
|
502
539
|
if (!context) {
|
|
503
540
|
return void 0;
|
|
504
541
|
}
|
|
505
|
-
const {
|
|
542
|
+
const {
|
|
543
|
+
fetch: fetch2,
|
|
544
|
+
loaders,
|
|
545
|
+
coreApi,
|
|
546
|
+
signal,
|
|
547
|
+
reportProgress,
|
|
548
|
+
_parse,
|
|
549
|
+
_parseSync,
|
|
550
|
+
_parseInBatches,
|
|
551
|
+
...serializableContext
|
|
552
|
+
} = context;
|
|
506
553
|
return JSON.parse(JSON.stringify(serializableContext));
|
|
507
554
|
}
|
|
508
555
|
async function parseData({
|
|
@@ -523,18 +570,15 @@
|
|
|
523
570
|
} else {
|
|
524
571
|
throw new Error(`Could not load data with ${loader.name} loader`);
|
|
525
572
|
}
|
|
526
|
-
options =
|
|
573
|
+
options = getWorkerLoaderOptions(loader, options);
|
|
574
|
+
return await parser(data, { ...options }, context, loader);
|
|
575
|
+
}
|
|
576
|
+
function getWorkerLoaderOptions(loader, options) {
|
|
577
|
+
return {
|
|
527
578
|
...options,
|
|
528
|
-
modules: {
|
|
529
|
-
|
|
530
|
-
...options.modules || {}
|
|
531
|
-
},
|
|
532
|
-
core: {
|
|
533
|
-
...options.core,
|
|
534
|
-
worker: false
|
|
535
|
-
}
|
|
579
|
+
modules: { ...loader.options?.modules, ...options.modules },
|
|
580
|
+
core: { ...options.core, worker: false }
|
|
536
581
|
};
|
|
537
|
-
return await parser(data, { ...options }, context, loader);
|
|
538
582
|
}
|
|
539
583
|
var init_create_loader_worker = __esm({
|
|
540
584
|
"../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts"() {
|
|
@@ -16996,7 +17040,7 @@ return true;`);
|
|
|
16996
17040
|
var init_version = __esm({
|
|
16997
17041
|
"../images/src/lib/utils/version.ts"() {
|
|
16998
17042
|
"use strict";
|
|
16999
|
-
VERSION = true ? "5.0.0-alpha.
|
|
17043
|
+
VERSION = true ? "5.0.0-alpha.14" : "latest";
|
|
17000
17044
|
}
|
|
17001
17045
|
});
|
|
17002
17046
|
|
|
@@ -18117,7 +18161,7 @@ return true;`);
|
|
|
18117
18161
|
var init_version2 = __esm({
|
|
18118
18162
|
"src/terrain/lib/utils/version.ts"() {
|
|
18119
18163
|
"use strict";
|
|
18120
|
-
VERSION2 = true ? "5.0.0-alpha.
|
|
18164
|
+
VERSION2 = true ? "5.0.0-alpha.14" : "latest";
|
|
18121
18165
|
}
|
|
18122
18166
|
});
|
|
18123
18167
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/raster",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.14",
|
|
4
4
|
"description": "GeoTIFF, LERC and terrain loaders with lazy format entry points",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -321,8 +321,8 @@
|
|
|
321
321
|
"pre-build": "npm run copy-libs && node ./build-cjs.mjs && npm run build-worker-terrain && npm run build-worker-quantized-mesh"
|
|
322
322
|
},
|
|
323
323
|
"dependencies": {
|
|
324
|
-
"@loaders.gl/images": "5.0.0-alpha.
|
|
325
|
-
"@math.gl/geospatial": "5.0.0-alpha.
|
|
324
|
+
"@loaders.gl/images": "5.0.0-alpha.14",
|
|
325
|
+
"@math.gl/geospatial": "5.0.0-alpha.20",
|
|
326
326
|
"fast-xml-parser": "^5.3.6"
|
|
327
327
|
},
|
|
328
328
|
"peerDependencies": {
|
|
@@ -342,5 +342,6 @@
|
|
|
342
342
|
"@mapbox/martini": "0.2.0",
|
|
343
343
|
"geotiff": "^2.1.0",
|
|
344
344
|
"lerc": "^4.2.0"
|
|
345
|
-
}
|
|
345
|
+
},
|
|
346
|
+
"gitHead": "226b7bca7ecb3684b7386487ee76565ca240d7d9"
|
|
346
347
|
}
|