@loaders.gl/i3s 3.1.8 → 3.2.0-alpha.3
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/dist/dist.min.js +130 -64
- package/dist/es5/i3s-attribute-loader.js +1 -1
- package/dist/es5/i3s-attribute-loader.js.map +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/es5/i3s-content-loader.js +1 -1
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +1 -1
- package/dist/es5/i3s-loader.js.map +1 -1
- package/dist/es5/i3s-node-page-loader.js +1 -1
- package/dist/es5/i3s-node-page-loader.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +43 -52
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +56 -51
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s.js +8 -12
- package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/esm/i3s-attribute-loader.js +1 -1
- package/dist/esm/i3s-attribute-loader.js.map +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/esm/i3s-content-loader.js +1 -1
- package/dist/esm/i3s-content-loader.js.map +1 -1
- package/dist/esm/i3s-loader.js +1 -1
- package/dist/esm/i3s-loader.js.map +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -1
- package/dist/esm/i3s-node-page-loader.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +8 -2
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js +35 -30
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s.js +1 -1
- package/dist/esm/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s-content-loader.js +1 -1
- package/dist/i3s-content-worker.js +154 -71
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js +7 -3
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +35 -30
- package/dist/lib/parsers/parse-i3s.js +1 -1
- package/dist/types.d.ts +100 -34
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/i3s-building-scene-layer-loader.ts +1 -1
- package/src/i3s-content-loader.ts +1 -1
- package/src/index.ts +4 -1
- package/src/lib/helpers/i3s-nodepages-tiles.ts +8 -3
- package/src/lib/parsers/parse-i3s-tile-content.ts +39 -33
- package/src/lib/parsers/parse-i3s.ts +1 -1
- package/src/types.ts +97 -34
package/dist/dist.min.js
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
var DEFAULT_VERSION, VERSION;
|
|
65
65
|
var init_version = __esm({
|
|
66
66
|
"../worker-utils/src/lib/env-utils/version.ts"() {
|
|
67
|
-
DEFAULT_VERSION = "
|
|
67
|
+
DEFAULT_VERSION = "beta";
|
|
68
68
|
VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : DEFAULT_VERSION;
|
|
69
69
|
if (typeof __VERSION__ === "undefined") {
|
|
70
70
|
console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
@@ -112,13 +112,13 @@
|
|
|
112
112
|
init_assert2();
|
|
113
113
|
WorkerJob = class {
|
|
114
114
|
constructor(jobName, workerThread) {
|
|
115
|
-
this.name = jobName;
|
|
116
|
-
this.workerThread = workerThread;
|
|
117
115
|
this.isRunning = true;
|
|
118
116
|
this._resolve = () => {
|
|
119
117
|
};
|
|
120
118
|
this._reject = () => {
|
|
121
119
|
};
|
|
120
|
+
this.name = jobName;
|
|
121
|
+
this.workerThread = workerThread;
|
|
122
122
|
this.result = new Promise((resolve, reject) => {
|
|
123
123
|
this._resolve = resolve;
|
|
124
124
|
this._reject = reject;
|
|
@@ -145,6 +145,21 @@
|
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
+
// ../worker-utils/src/lib/node/worker_threads-browser.js
|
|
149
|
+
var Worker2;
|
|
150
|
+
var init_worker_threads_browser = __esm({
|
|
151
|
+
"../worker-utils/src/lib/node/worker_threads-browser.js"() {
|
|
152
|
+
Worker2 = class {
|
|
153
|
+
on(message, cb) {
|
|
154
|
+
}
|
|
155
|
+
postMessage(...args) {
|
|
156
|
+
}
|
|
157
|
+
terminate() {
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
148
163
|
// ../worker-utils/src/lib/worker-utils/get-loadable-worker-url.ts
|
|
149
164
|
function getLoadableWorkerURL(props) {
|
|
150
165
|
assert2(props.source && !props.url || !props.source && props.url);
|
|
@@ -232,6 +247,8 @@
|
|
|
232
247
|
var NOOP, WorkerThread;
|
|
233
248
|
var init_worker_thread = __esm({
|
|
234
249
|
"../worker-utils/src/lib/worker-farm/worker-thread.ts"() {
|
|
250
|
+
init_worker_threads_browser();
|
|
251
|
+
init_globals2();
|
|
235
252
|
init_assert2();
|
|
236
253
|
init_get_loadable_worker_url();
|
|
237
254
|
init_get_transfer_list();
|
|
@@ -248,10 +265,10 @@
|
|
|
248
265
|
this.url = url;
|
|
249
266
|
this.onMessage = NOOP;
|
|
250
267
|
this.onError = (error) => console.log(error);
|
|
251
|
-
this.worker = this._createBrowserWorker();
|
|
268
|
+
this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
|
|
252
269
|
}
|
|
253
270
|
static isSupported() {
|
|
254
|
-
return typeof Worker !== "undefined";
|
|
271
|
+
return typeof Worker !== "undefined" && isBrowser2 || typeof Worker2 !== void 0;
|
|
255
272
|
}
|
|
256
273
|
destroy() {
|
|
257
274
|
this.onMessage = NOOP;
|
|
@@ -294,6 +311,27 @@
|
|
|
294
311
|
worker.onmessageerror = (event) => console.error(event);
|
|
295
312
|
return worker;
|
|
296
313
|
}
|
|
314
|
+
_createNodeWorker() {
|
|
315
|
+
let worker;
|
|
316
|
+
if (this.url) {
|
|
317
|
+
const absolute = this.url.includes(":/") || this.url.startsWith("/");
|
|
318
|
+
const url = absolute ? this.url : `./${this.url}`;
|
|
319
|
+
worker = new Worker2(url, { eval: false });
|
|
320
|
+
} else if (this.source) {
|
|
321
|
+
worker = new Worker2(this.source, { eval: true });
|
|
322
|
+
} else {
|
|
323
|
+
throw new Error("no worker");
|
|
324
|
+
}
|
|
325
|
+
worker.on("message", (data) => {
|
|
326
|
+
this.onMessage(data);
|
|
327
|
+
});
|
|
328
|
+
worker.on("error", (error) => {
|
|
329
|
+
this.onError(error);
|
|
330
|
+
});
|
|
331
|
+
worker.on("exit", (code) => {
|
|
332
|
+
});
|
|
333
|
+
return worker;
|
|
334
|
+
}
|
|
297
335
|
};
|
|
298
336
|
}
|
|
299
337
|
});
|
|
@@ -322,6 +360,9 @@
|
|
|
322
360
|
this.url = props.url;
|
|
323
361
|
this.setProps(props);
|
|
324
362
|
}
|
|
363
|
+
static isSupported() {
|
|
364
|
+
return WorkerThread.isSupported();
|
|
365
|
+
}
|
|
325
366
|
destroy() {
|
|
326
367
|
this.idleQueue.forEach((worker) => worker.destroy());
|
|
327
368
|
this.isDestroyed = true;
|
|
@@ -418,9 +459,9 @@
|
|
|
418
459
|
DEFAULT_PROPS = {
|
|
419
460
|
maxConcurrency: 3,
|
|
420
461
|
maxMobileConcurrency: 1,
|
|
462
|
+
reuseWorkers: true,
|
|
421
463
|
onDebug: () => {
|
|
422
|
-
}
|
|
423
|
-
reuseWorkers: true
|
|
464
|
+
}
|
|
424
465
|
};
|
|
425
466
|
WorkerFarm = class {
|
|
426
467
|
constructor(props) {
|
|
@@ -441,6 +482,7 @@
|
|
|
441
482
|
for (const workerPool of this.workerPools.values()) {
|
|
442
483
|
workerPool.destroy();
|
|
443
484
|
}
|
|
485
|
+
this.workerPools = new Map();
|
|
444
486
|
}
|
|
445
487
|
setProps(props) {
|
|
446
488
|
this.props = { ...this.props, ...props };
|
|
@@ -500,7 +542,7 @@
|
|
|
500
542
|
var init_get_worker_url = __esm({
|
|
501
543
|
"../worker-utils/src/lib/worker-api/get-worker-url.ts"() {
|
|
502
544
|
init_assert2();
|
|
503
|
-
NPM_TAG = "
|
|
545
|
+
NPM_TAG = "beta";
|
|
504
546
|
}
|
|
505
547
|
});
|
|
506
548
|
|
|
@@ -598,7 +640,7 @@
|
|
|
598
640
|
node = __toModule(require_require_utils());
|
|
599
641
|
init_assert2();
|
|
600
642
|
init_version();
|
|
601
|
-
LATEST = "
|
|
643
|
+
LATEST = "beta";
|
|
602
644
|
VERSION2 = typeof VERSION !== "undefined" ? VERSION : LATEST;
|
|
603
645
|
loadLibraryPromises = {};
|
|
604
646
|
}
|
|
@@ -608,6 +650,7 @@
|
|
|
608
650
|
var init_src = __esm({
|
|
609
651
|
"../worker-utils/src/index.ts"() {
|
|
610
652
|
init_assert2();
|
|
653
|
+
init_globals2();
|
|
611
654
|
init_worker_farm();
|
|
612
655
|
init_get_worker_url();
|
|
613
656
|
init_validate_worker_version();
|
|
@@ -620,6 +663,9 @@
|
|
|
620
663
|
if (!WorkerFarm.isSupported()) {
|
|
621
664
|
return false;
|
|
622
665
|
}
|
|
666
|
+
if (!isBrowser2 && !options?._nodeWorkers) {
|
|
667
|
+
return false;
|
|
668
|
+
}
|
|
623
669
|
return loader.worker && options?.worker;
|
|
624
670
|
}
|
|
625
671
|
async function parseWithWorker(loader, data, options, context, parseOnMainThread) {
|
|
@@ -628,10 +674,12 @@
|
|
|
628
674
|
const workerFarm = WorkerFarm.getWorkerFarm(options);
|
|
629
675
|
const workerPool = workerFarm.getWorkerPool({ name, url });
|
|
630
676
|
options = JSON.parse(JSON.stringify(options));
|
|
677
|
+
context = JSON.parse(JSON.stringify(context || {}));
|
|
631
678
|
const job = await workerPool.startJob("process-on-worker", onMessage.bind(null, parseOnMainThread));
|
|
632
679
|
job.postMessage("process", {
|
|
633
680
|
input: data,
|
|
634
|
-
options
|
|
681
|
+
options,
|
|
682
|
+
context
|
|
635
683
|
});
|
|
636
684
|
const result = await job.result;
|
|
637
685
|
return await result.result;
|
|
@@ -661,6 +709,7 @@
|
|
|
661
709
|
var init_parse_with_worker = __esm({
|
|
662
710
|
"../loader-utils/src/lib/worker-loader-utils/parse-with-worker.ts"() {
|
|
663
711
|
init_src();
|
|
712
|
+
init_src();
|
|
664
713
|
}
|
|
665
714
|
});
|
|
666
715
|
|
|
@@ -974,7 +1023,7 @@
|
|
|
974
1023
|
text += ` ${await response.text()}`;
|
|
975
1024
|
}
|
|
976
1025
|
message += text;
|
|
977
|
-
message = message.length > 60 ? `${message.slice(60)}...` : message;
|
|
1026
|
+
message = message.length > 60 ? `${message.slice(0, 60)}...` : message;
|
|
978
1027
|
} catch (error) {
|
|
979
1028
|
}
|
|
980
1029
|
return message;
|
|
@@ -1611,29 +1660,29 @@
|
|
|
1611
1660
|
}
|
|
1612
1661
|
});
|
|
1613
1662
|
|
|
1614
|
-
// ../../node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js
|
|
1663
|
+
// ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js
|
|
1615
1664
|
var init_hi_res_timestamp2 = __esm({
|
|
1616
|
-
"../../node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js"() {
|
|
1665
|
+
"../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js"() {
|
|
1617
1666
|
}
|
|
1618
1667
|
});
|
|
1619
1668
|
|
|
1620
|
-
// ../../node_modules/@probe.gl/stats/dist/esm/lib/stat.js
|
|
1669
|
+
// ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stat.js
|
|
1621
1670
|
var init_stat = __esm({
|
|
1622
|
-
"../../node_modules/@probe.gl/stats/dist/esm/lib/stat.js"() {
|
|
1671
|
+
"../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stat.js"() {
|
|
1623
1672
|
init_hi_res_timestamp2();
|
|
1624
1673
|
}
|
|
1625
1674
|
});
|
|
1626
1675
|
|
|
1627
|
-
// ../../node_modules/@probe.gl/stats/dist/esm/lib/stats.js
|
|
1676
|
+
// ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stats.js
|
|
1628
1677
|
var init_stats = __esm({
|
|
1629
|
-
"../../node_modules/@probe.gl/stats/dist/esm/lib/stats.js"() {
|
|
1678
|
+
"../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stats.js"() {
|
|
1630
1679
|
init_stat();
|
|
1631
1680
|
}
|
|
1632
1681
|
});
|
|
1633
1682
|
|
|
1634
|
-
// ../../node_modules/@probe.gl/stats/dist/esm/index.js
|
|
1683
|
+
// ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/index.js
|
|
1635
1684
|
var init_esm = __esm({
|
|
1636
|
-
"../../node_modules/@probe.gl/stats/dist/esm/index.js"() {
|
|
1685
|
+
"../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/index.js"() {
|
|
1637
1686
|
init_stats();
|
|
1638
1687
|
init_stat();
|
|
1639
1688
|
init_hi_res_timestamp2();
|
|
@@ -1701,6 +1750,7 @@
|
|
|
1701
1750
|
var DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS;
|
|
1702
1751
|
var init_option_defaults = __esm({
|
|
1703
1752
|
"../core/src/lib/loader-utils/option-defaults.ts"() {
|
|
1753
|
+
init_src2();
|
|
1704
1754
|
init_loggers();
|
|
1705
1755
|
DEFAULT_LOADER_OPTIONS = {
|
|
1706
1756
|
fetch: null,
|
|
@@ -1711,7 +1761,8 @@
|
|
|
1711
1761
|
worker: true,
|
|
1712
1762
|
maxConcurrency: 3,
|
|
1713
1763
|
maxMobileConcurrency: 1,
|
|
1714
|
-
reuseWorkers:
|
|
1764
|
+
reuseWorkers: isBrowser,
|
|
1765
|
+
_nodeWorkers: false,
|
|
1715
1766
|
_workerType: "",
|
|
1716
1767
|
limit: 0,
|
|
1717
1768
|
_limitMB: 0,
|
|
@@ -2975,6 +3026,12 @@
|
|
|
2975
3026
|
}
|
|
2976
3027
|
async function parseWithLoader(loader, data, options, context) {
|
|
2977
3028
|
validateWorkerVersion(loader);
|
|
3029
|
+
if (isResponse(data)) {
|
|
3030
|
+
const response = data;
|
|
3031
|
+
const { ok, redirected, status, statusText, type, url } = response;
|
|
3032
|
+
const headers = Object.fromEntries(response.headers.entries());
|
|
3033
|
+
context.response = { headers, ok, redirected, status, statusText, type, url };
|
|
3034
|
+
}
|
|
2978
3035
|
data = await getArrayBufferOrStringFromData(data, loader, options);
|
|
2979
3036
|
if (loader.parseTextSync && typeof data === "string") {
|
|
2980
3037
|
options.dataType = "text";
|
|
@@ -2997,6 +3054,7 @@
|
|
|
2997
3054
|
init_src();
|
|
2998
3055
|
init_src2();
|
|
2999
3056
|
init_normalize_loader();
|
|
3057
|
+
init_is_type();
|
|
3000
3058
|
init_option_utils();
|
|
3001
3059
|
init_get_data();
|
|
3002
3060
|
init_loader_context();
|
|
@@ -7721,7 +7779,7 @@
|
|
|
7721
7779
|
var VERSION7;
|
|
7722
7780
|
var init_version4 = __esm({
|
|
7723
7781
|
"../textures/src/lib/utils/version.ts"() {
|
|
7724
|
-
VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "
|
|
7782
|
+
VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
|
|
7725
7783
|
}
|
|
7726
7784
|
});
|
|
7727
7785
|
|
|
@@ -7792,7 +7850,7 @@
|
|
|
7792
7850
|
var init_basis_module_loader = __esm({
|
|
7793
7851
|
"../textures/src/lib/parsers/basis-module-loader.ts"() {
|
|
7794
7852
|
init_src();
|
|
7795
|
-
VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "
|
|
7853
|
+
VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
|
|
7796
7854
|
BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION8}/dist/libs/basis_encoder.wasm`;
|
|
7797
7855
|
BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION8}/dist/libs/basis_encoder.js`;
|
|
7798
7856
|
}
|
|
@@ -8193,7 +8251,7 @@
|
|
|
8193
8251
|
const basisFile = new BasisFile(new Uint8Array(data));
|
|
8194
8252
|
try {
|
|
8195
8253
|
if (!basisFile.startTranscoding()) {
|
|
8196
|
-
|
|
8254
|
+
throw new Error("Failed to start basis transcoding");
|
|
8197
8255
|
}
|
|
8198
8256
|
const imageCount = basisFile.getNumImages();
|
|
8199
8257
|
const images = [];
|
|
@@ -8219,22 +8277,22 @@
|
|
|
8219
8277
|
const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);
|
|
8220
8278
|
const decodedData = new Uint8Array(decodedSize);
|
|
8221
8279
|
if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {
|
|
8222
|
-
|
|
8280
|
+
throw new Error("failed to start Basis transcoding");
|
|
8223
8281
|
}
|
|
8224
8282
|
return {
|
|
8225
8283
|
width,
|
|
8226
8284
|
height,
|
|
8227
8285
|
data: decodedData,
|
|
8228
8286
|
compressed,
|
|
8229
|
-
|
|
8230
|
-
|
|
8287
|
+
format,
|
|
8288
|
+
hasAlpha
|
|
8231
8289
|
};
|
|
8232
8290
|
}
|
|
8233
8291
|
function parseKTX2File(KTX2File, data, options) {
|
|
8234
8292
|
const ktx2File = new KTX2File(new Uint8Array(data));
|
|
8235
8293
|
try {
|
|
8236
8294
|
if (!ktx2File.startTranscoding()) {
|
|
8237
|
-
|
|
8295
|
+
throw new Error("failed to start KTX2 transcoding");
|
|
8238
8296
|
}
|
|
8239
8297
|
const levelsCount = ktx2File.getLevels();
|
|
8240
8298
|
const levels = [];
|
|
@@ -8242,7 +8300,7 @@
|
|
|
8242
8300
|
levels.push(transcodeKTX2Image(ktx2File, levelIndex, options));
|
|
8243
8301
|
break;
|
|
8244
8302
|
}
|
|
8245
|
-
return levels;
|
|
8303
|
+
return [levels];
|
|
8246
8304
|
} finally {
|
|
8247
8305
|
ktx2File.close();
|
|
8248
8306
|
ktx2File.delete();
|
|
@@ -8254,14 +8312,14 @@
|
|
|
8254
8312
|
const decodedSize = ktx2File.getImageTranscodedSizeInBytes(levelIndex, 0, 0, basisFormat);
|
|
8255
8313
|
const decodedData = new Uint8Array(decodedSize);
|
|
8256
8314
|
if (!ktx2File.transcodeImage(decodedData, levelIndex, 0, 0, basisFormat, 0, -1, -1)) {
|
|
8257
|
-
|
|
8315
|
+
throw new Error("Failed to transcode KTX2 image");
|
|
8258
8316
|
}
|
|
8259
8317
|
return {
|
|
8260
8318
|
width,
|
|
8261
8319
|
height,
|
|
8262
8320
|
data: decodedData,
|
|
8263
8321
|
compressed,
|
|
8264
|
-
alphaFlag,
|
|
8322
|
+
hasAlpha: alphaFlag,
|
|
8265
8323
|
format
|
|
8266
8324
|
};
|
|
8267
8325
|
}
|
|
@@ -8734,7 +8792,7 @@
|
|
|
8734
8792
|
containerFormat: "ktx2",
|
|
8735
8793
|
module: "encoder"
|
|
8736
8794
|
};
|
|
8737
|
-
return await parseBasis(arrayBuffer, options);
|
|
8795
|
+
return (await parseBasis(arrayBuffer, options))[0];
|
|
8738
8796
|
}
|
|
8739
8797
|
return parseCompressedTexture(arrayBuffer);
|
|
8740
8798
|
}
|
|
@@ -9518,7 +9576,10 @@
|
|
|
9518
9576
|
tile.content.texture = await parse(arrayBuffer2, loader, options2);
|
|
9519
9577
|
}
|
|
9520
9578
|
} else if (loader === CompressedTextureLoader || loader === BasisLoader) {
|
|
9521
|
-
|
|
9579
|
+
let texture = await load(arrayBuffer2, loader, tile.textureLoaderOptions);
|
|
9580
|
+
if (loader === BasisLoader) {
|
|
9581
|
+
texture = texture[0];
|
|
9582
|
+
}
|
|
9522
9583
|
tile.content.texture = {
|
|
9523
9584
|
compressed: true,
|
|
9524
9585
|
mipmaps: false,
|
|
@@ -9542,6 +9603,7 @@
|
|
|
9542
9603
|
return tile;
|
|
9543
9604
|
}
|
|
9544
9605
|
const content = tile.content;
|
|
9606
|
+
const contentByteLength = arrayBuffer.byteLength;
|
|
9545
9607
|
let attributes;
|
|
9546
9608
|
let vertexCount;
|
|
9547
9609
|
let byteOffset = 0;
|
|
@@ -9617,7 +9679,7 @@
|
|
|
9617
9679
|
}
|
|
9618
9680
|
}
|
|
9619
9681
|
content.vertexCount = vertexCount;
|
|
9620
|
-
content.byteLength =
|
|
9682
|
+
content.byteLength = contentByteLength;
|
|
9621
9683
|
return tile;
|
|
9622
9684
|
}
|
|
9623
9685
|
function updateAttributesMetadata(attributes, decompressedGeometry) {
|
|
@@ -9670,38 +9732,38 @@
|
|
|
9670
9732
|
byteOffset
|
|
9671
9733
|
};
|
|
9672
9734
|
}
|
|
9673
|
-
function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes,
|
|
9735
|
+
function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, attributeCount, attributesOrder) {
|
|
9674
9736
|
const attributes = {};
|
|
9675
9737
|
for (const attribute of attributesOrder) {
|
|
9676
9738
|
if (vertexAttributes[attribute]) {
|
|
9677
9739
|
const { valueType, valuesPerElement } = vertexAttributes[attribute];
|
|
9678
|
-
|
|
9679
|
-
|
|
9740
|
+
if (byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <= arrayBuffer.byteLength) {
|
|
9741
|
+
const buffer = arrayBuffer.slice(byteOffset);
|
|
9742
|
+
let value;
|
|
9743
|
+
if (valueType === "UInt64") {
|
|
9744
|
+
value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));
|
|
9745
|
+
} else {
|
|
9746
|
+
const TypedArrayType = getConstructorForDataFormat(valueType);
|
|
9747
|
+
value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);
|
|
9748
|
+
}
|
|
9749
|
+
attributes[attribute] = {
|
|
9750
|
+
value,
|
|
9751
|
+
type: GL_TYPE_MAP[valueType],
|
|
9752
|
+
size: valuesPerElement
|
|
9753
|
+
};
|
|
9754
|
+
switch (attribute) {
|
|
9755
|
+
case "color":
|
|
9756
|
+
attributes.color.normalized = true;
|
|
9757
|
+
break;
|
|
9758
|
+
case "position":
|
|
9759
|
+
case "region":
|
|
9760
|
+
case "normal":
|
|
9761
|
+
default:
|
|
9762
|
+
}
|
|
9763
|
+
byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);
|
|
9764
|
+
} else if (attribute !== "uv0") {
|
|
9680
9765
|
break;
|
|
9681
9766
|
}
|
|
9682
|
-
const buffer = arrayBuffer.slice(byteOffset);
|
|
9683
|
-
let value;
|
|
9684
|
-
if (valueType === "UInt64") {
|
|
9685
|
-
value = parseUint64Values(buffer, count * valuesPerElement, sizeOf(valueType));
|
|
9686
|
-
} else {
|
|
9687
|
-
const TypedArrayType = getConstructorForDataFormat(valueType);
|
|
9688
|
-
value = new TypedArrayType(buffer, 0, count * valuesPerElement);
|
|
9689
|
-
}
|
|
9690
|
-
attributes[attribute] = {
|
|
9691
|
-
value,
|
|
9692
|
-
type: GL_TYPE_MAP[valueType],
|
|
9693
|
-
size: valuesPerElement
|
|
9694
|
-
};
|
|
9695
|
-
switch (attribute) {
|
|
9696
|
-
case "color":
|
|
9697
|
-
attributes.color.normalized = true;
|
|
9698
|
-
break;
|
|
9699
|
-
case "position":
|
|
9700
|
-
case "region":
|
|
9701
|
-
case "normal":
|
|
9702
|
-
default:
|
|
9703
|
-
}
|
|
9704
|
-
byteOffset = byteOffset + count * valuesPerElement * sizeOf(valueType);
|
|
9705
9767
|
}
|
|
9706
9768
|
}
|
|
9707
9769
|
return { attributes, byteOffset };
|
|
@@ -9877,7 +9939,7 @@
|
|
|
9877
9939
|
var init_i3s_content_loader = __esm({
|
|
9878
9940
|
"src/i3s-content-loader.ts"() {
|
|
9879
9941
|
init_parse_i3s_tile_content();
|
|
9880
|
-
VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "
|
|
9942
|
+
VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
|
|
9881
9943
|
I3SContentLoader = {
|
|
9882
9944
|
name: "I3S Content (Indexed Scene Layers)",
|
|
9883
9945
|
id: "i3s-content",
|
|
@@ -10462,10 +10524,14 @@
|
|
|
10462
10524
|
async formTileFromNodePages(id) {
|
|
10463
10525
|
const node2 = await this.getNodeById(id);
|
|
10464
10526
|
const children = [];
|
|
10527
|
+
const childNodesPromises = [];
|
|
10465
10528
|
for (const child of node2.children || []) {
|
|
10466
|
-
|
|
10529
|
+
childNodesPromises.push(this.getNodeById(child));
|
|
10530
|
+
}
|
|
10531
|
+
const childNodes = await Promise.all(childNodesPromises);
|
|
10532
|
+
for (const childNode of childNodes) {
|
|
10467
10533
|
children.push({
|
|
10468
|
-
id:
|
|
10534
|
+
id: childNode.index.toString(),
|
|
10469
10535
|
obb: childNode.obb
|
|
10470
10536
|
});
|
|
10471
10537
|
}
|
|
@@ -10650,7 +10716,7 @@
|
|
|
10650
10716
|
tileset.url = context.url;
|
|
10651
10717
|
if (tileset.nodePages) {
|
|
10652
10718
|
tileset.nodePagesTile = new I3SNodePagesTiles(tileset, options);
|
|
10653
|
-
tileset.root =
|
|
10719
|
+
tileset.root = tileset.nodePagesTile.formTileFromNodePages(0);
|
|
10654
10720
|
} else {
|
|
10655
10721
|
const rootNodeUrl = getUrlWithToken(`${tileset.url}/nodes/root`, options.i3s?.token);
|
|
10656
10722
|
tileset.root = await load(rootNodeUrl, tileset.loader, {
|
|
@@ -10992,7 +11058,7 @@
|
|
|
10992
11058
|
var init_i3s_building_scene_layer_loader = __esm({
|
|
10993
11059
|
"src/i3s-building-scene-layer-loader.ts"() {
|
|
10994
11060
|
init_parse_i3s_building_scene_layer();
|
|
10995
|
-
VERSION13 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "
|
|
11061
|
+
VERSION13 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
|
|
10996
11062
|
I3SBuildingSceneLayerLoader = {
|
|
10997
11063
|
name: "I3S Building Scene Layer",
|
|
10998
11064
|
id: "i3s-building-scene-layer",
|
|
@@ -24,7 +24,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
24
24
|
|
|
25
25
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
26
26
|
|
|
27
|
-
var VERSION = typeof "3.
|
|
27
|
+
var VERSION = typeof "3.2.0-alpha.3" !== 'undefined' ? "3.2.0-alpha.3" : 'latest';
|
|
28
28
|
var EMPTY_VALUE = '';
|
|
29
29
|
var REJECTED_STATUS = 'rejected';
|
|
30
30
|
var I3SAttributeLoader = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i3s-attribute-loader.ts"],"names":["VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","loadFeatureAttributes","tile","featureId","getAttributesData","attributeStorageInfo","attributeUrls","tilesetFields","attributes","attributeLoadPromises","index","length","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","generateAttributesByFeatureId","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"mappings":";;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;;;;;AAIA,IAAMA,OAAO,GAAG,mBAAuB,WAAvB,aAAmD,QAAnE;AACA,IAAMC,WAAW,GAAG,EAApB;AACA,IAAMC,eAAe,GAAG,UAAxB;AAIO,IAAMC,kBAAoC,GAAG;AAClDC,EAAAA,IAAI,EAAE,eAD4C;AAElDC,EAAAA,EAAE,EAAE,eAF8C;AAGlDC,EAAAA,MAAM,EAAE,KAH0C;AAIlDC,EAAAA,OAAO,EAAEP,OAJyC;AAKlDQ,EAAAA,SAAS,EAAE,CAAC,oBAAD,CALuC;AAMlDC,EAAAA,KAAK,EAALA,KANkD;AAOlDC,EAAAA,UAAU,EAAE,CAAC,KAAD,CAPsC;AAQlDC,EAAAA,OAAO,EAAE,EARyC;AASlDC,EAAAA,MAAM,EAAE;AAT0C,CAA7C;;;SAYQH,K;;;;;qEAAf,iBAAqBI,IAArB,EAA2BF,OAA3B;AAAA;AAAA;AAAA;AAAA;AACEE,YAAAA,IAAI,GAAG,8CAAsBA,IAAtB,EAA4BF,OAA5B,CAAP;AADF,6CAESE,IAFT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;SAasBC,qB;;;;;qFAAf,kBAAqCC,IAArC,EAA2CC,SAA3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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ils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\n/**\n * Load attributes based on feature id\n * @param {Object} tile\n * @param {number} featureId\n * @param {Object} options\n * @returns {Promise}\n */\n// eslint-disable-next-line complexity\nexport async function loadFeatureAttributes(tile, featureId, options = {}) {\n const {attributeStorageInfo, attributeUrls, tilesetFields} = getAttributesData(tile);\n\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n // @ts-ignore\n const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);\n const attributeName = attributeStorageInfo[index].name;\n const attributeType = getAttributeValueType(attributeStorageInfo[index]);\n const loadOptions = {...options, attributeName, attributeType};\n const promise = load(url, I3SAttributeLoader, loadOptions);\n\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\n\n/**\n * Gets attributes data from tile.\n * @param tile \n * @returns \n */\nfunction getAttributesData(tile) {\n const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;\n const attributeUrls = tile.header?.attributeUrls;\n const tilesetFields = tile.tileset?.tileset?.fields || [];\n\n return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\n\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\nfunction getAttributeValueType(attribute) {\n if (attribute.hasOwnProperty('objectIds')) {\n return 'Oid32';\n } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\n\n/**\n * Find in attributeStorageInfo attribute name responsible for feature ids list.\n * @param attributeStorageInfo \n * @returns Feature ids attribute name\n */\nfunction getFeatureIdsAttributeName(attributeStorageInfo) {\n const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));\n\n return objectIdsAttribute?.name;\n}\n\n/**\n * Generates mapping featureId to feature attributes\n * @param {Array} attributes\n * @param {Object} attributeStorageInfo\n * @param {number} featureId\n * @returns {Object}\n */\nfunction generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {\n const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);\n const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);\n\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\n\n/**\n * Generates attribute object for feature mapping by feature id\n * @param {Array} attributes\n * @param {Number} featureIdIndex\n * @param {Object} attributeStorageInfo\n * @returns {Object}\n */\nfunction getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {\n const attributesObject = {};\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const attributeName = attributeStorageInfo[index].name;\n const codedValues = getAttributeCodedValues(attributeName, tilesetFields);\n const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);\n attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);\n }\n\n return attributesObject;\n}\n\n/**\n * Get coded values list from tileset.\n * @param attributeName \n * @param tilesetFields \n */\nfunction getAttributeCodedValues(attributeName, tilesetFields) {\n const attributeField = tilesetFields\n .find(field => field.name === attributeName || field.alias === attributeName);\n\n return attributeField?.domain?.codedValues || [];\n}\n\n/**\n * Return attribute value if it presents in atrributes list\n * @param {array} attributes\n * @param {number} index\n * @param {string} attributesName\n */\nfunction getAttributeByIndexAndAttributeName(attributes, index, attributesName) {\n const attributeObject = attributes[index];\n\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n\n return attributeObject.value[attributesName];\n}\n\n/**\n * Do formatting of attribute values or return empty string.\n * @param {Array} attribute\n * @param {Number} featureIdIndex\n * @returns {String}\n */\nfunction formatAttributeValue(attribute, featureIdIndex, codedValues) {\n let value = EMPTY_VALUE;\n\n if (attribute && (featureIdIndex in attribute)) {\n // eslint-disable-next-line no-control-regex\n value = String(attribute[featureIdIndex]).replace(/\\u0000|NaN/g, '').trim();\n }\n\n // Check if coded values are existed. If so we use them.\n if (codedValues.length) {\n const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));\n value = codeValue?.name || EMPTY_VALUE;\n }\n\n return value;\n}\n"],"file":"i3s-attribute-loader.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/i3s-attribute-loader.ts"],"names":["VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","loadFeatureAttributes","tile","featureId","getAttributesData","attributeStorageInfo","attributeUrls","tilesetFields","attributes","attributeLoadPromises","index","length","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","generateAttributesByFeatureId","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"mappings":";;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;;;;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AACA,IAAMC,WAAW,GAAG,EAApB;AACA,IAAMC,eAAe,GAAG,UAAxB;AAIO,IAAMC,kBAAoC,GAAG;AAClDC,EAAAA,IAAI,EAAE,eAD4C;AAElDC,EAAAA,EAAE,EAAE,eAF8C;AAGlDC,EAAAA,MAAM,EAAE,KAH0C;AAIlDC,EAAAA,OAAO,EAAEP,OAJyC;AAKlDQ,EAAAA,SAAS,EAAE,CAAC,oBAAD,CALuC;AAMlDC,EAAAA,KAAK,EAALA,KANkD;AAOlDC,EAAAA,UAAU,EAAE,CAAC,KAAD,CAPsC;AAQlDC,EAAAA,OAAO,EAAE,EARyC;AASlDC,EAAAA,MAAM,EAAE;AAT0C,CAA7C;;;SAYQH,K;;;;;qEAAf,iBAAqBI,IAArB,EAA2BF,OAA3B;AAAA;AAAA;AAAA;AAAA;AACEE,YAAAA,IAAI,GAAG,8CAAsBA,IAAtB,EAA4BF,OAA5B,CAAP;AADF,6CAESE,IAFT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;SAasBC,qB;;;;;qFAAf,kBAAqCC,IAArC,EAA2CC,SAA3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAsDL,YAAAA,OAAtD,8DAAgE,EAAhE;AAAA,iCACwDM,iBAAiB,CAACF,IAAD,CADzE,EACEG,oBADF,sBACEA,oBADF,EACwBC,aADxB,sBACwBA,aADxB,EACuCC,aADvC,sBACuCA,aADvC;;AAAA,kBAGD,CAACF,oBAAD,IAAyB,CAACC,aAA1B,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AxB,KAAuC,EAA9C;AACD;;AAQD,SAASE,mCAAT,CAA6CrC,UAA7C,EAAyDE,KAAzD,EAAgEyC,cAAhE,EAAgF;AAC9E,MAAMC,eAAe,GAAG5C,UAAU,CAACE,KAAD,CAAlC;;AAEA,MAAI0C,eAAe,CAACC,MAAhB,KAA2BhE,eAA/B,EAAgD;AAC9C,WAAO,IAAP;AACD;;AAED,SAAO+D,eAAe,CAACf,KAAhB,CAAsBc,cAAtB,CAAP;AACD;;AAQD,SAASL,oBAAT,CAA8BnB,SAA9B,EAAyCc,cAAzC,EAAyDE,WAAzD,EAAsE;AACpE,MAAIN,KAAK,GAAGjD,WAAZ;;AAEA,MAAIuC,SAAS,IAAKc,cAAc,IAAId,SAApC,EAAgD;AAE9CU,IAAAA,KAAK,GAAGiB,MAAM,CAAC3B,SAAS,CAACc,cAAD,CAAV,CAAN,CAAkCc,OAAlC,CAA0C,aAA1C,EAAyD,EAAzD,EAA6DC,IAA7D,EAAR;AACD;;AAGD,MAAIb,WAAW,CAAChC,MAAhB,EAAwB;AACtB,QAAM8C,SAAS,GAAGd,WAAW,CAACV,IAAZ,CAAiB,UAAAyB,UAAU;AAAA,aAAIA,UAAU,CAACC,IAAX,KAAoBC,MAAM,CAACvB,KAAD,CAA9B;AAAA,KAA3B,CAAlB;AACAA,IAAAA,KAAK,GAAG,CAAAoB,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAElE,IAAX,KAAmBH,WAA3B;AACD;;AAED,SAAOiD,KAAP;AACD","sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\n/**\n * Load attributes based on feature id\n * @param {Object} tile\n * @param {number} featureId\n * @param {Object} options\n * @returns {Promise}\n */\n// eslint-disable-next-line complexity\nexport async function loadFeatureAttributes(tile, featureId, options = {}) {\n const {attributeStorageInfo, attributeUrls, tilesetFields} = getAttributesData(tile);\n\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n // @ts-ignore\n const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);\n const attributeName = attributeStorageInfo[index].name;\n const attributeType = getAttributeValueType(attributeStorageInfo[index]);\n const loadOptions = {...options, attributeName, attributeType};\n const promise = load(url, I3SAttributeLoader, loadOptions);\n\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\n\n/**\n * Gets attributes data from tile.\n * @param tile \n * @returns \n */\nfunction getAttributesData(tile) {\n const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;\n const attributeUrls = tile.header?.attributeUrls;\n const tilesetFields = tile.tileset?.tileset?.fields || [];\n\n return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\n\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\nfunction getAttributeValueType(attribute) {\n if (attribute.hasOwnProperty('objectIds')) {\n return 'Oid32';\n } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\n\n/**\n * Find in attributeStorageInfo attribute name responsible for feature ids list.\n * @param attributeStorageInfo \n * @returns Feature ids attribute name\n */\nfunction getFeatureIdsAttributeName(attributeStorageInfo) {\n const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));\n\n return objectIdsAttribute?.name;\n}\n\n/**\n * Generates mapping featureId to feature attributes\n * @param {Array} attributes\n * @param {Object} attributeStorageInfo\n * @param {number} featureId\n * @returns {Object}\n */\nfunction generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {\n const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);\n const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);\n\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\n\n/**\n * Generates attribute object for feature mapping by feature id\n * @param {Array} attributes\n * @param {Number} featureIdIndex\n * @param {Object} attributeStorageInfo\n * @returns {Object}\n */\nfunction getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {\n const attributesObject = {};\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const attributeName = attributeStorageInfo[index].name;\n const codedValues = getAttributeCodedValues(attributeName, tilesetFields);\n const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);\n attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);\n }\n\n return attributesObject;\n}\n\n/**\n * Get coded values list from tileset.\n * @param attributeName \n * @param tilesetFields \n */\nfunction getAttributeCodedValues(attributeName, tilesetFields) {\n const attributeField = tilesetFields\n .find(field => field.name === attributeName || field.alias === attributeName);\n\n return attributeField?.domain?.codedValues || [];\n}\n\n/**\n * Return attribute value if it presents in atrributes list\n * @param {array} attributes\n * @param {number} index\n * @param {string} attributesName\n */\nfunction getAttributeByIndexAndAttributeName(attributes, index, attributesName) {\n const attributeObject = attributes[index];\n\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n\n return attributeObject.value[attributesName];\n}\n\n/**\n * Do formatting of attribute values or return empty string.\n * @param {Array} attribute\n * @param {Number} featureIdIndex\n * @returns {String}\n */\nfunction formatAttributeValue(attribute, featureIdIndex, codedValues) {\n let value = EMPTY_VALUE;\n\n if (attribute && (featureIdIndex in attribute)) {\n // eslint-disable-next-line no-control-regex\n value = String(attribute[featureIdIndex]).replace(/\\u0000|NaN/g, '').trim();\n }\n\n // Check if coded values are existed. If so we use them.\n if (codedValues.length) {\n const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));\n value = codeValue?.name || EMPTY_VALUE;\n }\n\n return value;\n}\n"],"file":"i3s-attribute-loader.js"}
|
|
@@ -13,7 +13,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
13
13
|
|
|
14
14
|
var _parseI3sBuildingSceneLayer = require("./lib/parsers/parse-i3s-building-scene-layer");
|
|
15
15
|
|
|
16
|
-
var VERSION = typeof "3.
|
|
16
|
+
var VERSION = typeof "3.2.0-alpha.3" !== 'undefined' ? "3.2.0-alpha.3" : 'beta';
|
|
17
17
|
var I3SBuildingSceneLayerLoader = {
|
|
18
18
|
name: 'I3S Building Scene Layer',
|
|
19
19
|
id: 'i3s-building-scene-layer',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i3s-building-scene-layer-loader.ts"],"names":["VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","context","url","Error"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA,IAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../src/i3s-building-scene-layer-loader.ts"],"names":["VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","context","url","Error"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,MAAnE;AAIO,IAAMC,2BAA6C,GAAG;AAC3DC,EAAAA,IAAI,EAAE,0BADqD;AAE3DC,EAAAA,EAAE,EAAE,0BAFuD;AAG3DC,EAAAA,MAAM,EAAE,KAHmD;AAI3DC,EAAAA,OAAO,EAAEL,OAJkD;AAK3DM,EAAAA,SAAS,EAAE,CAAC,kBAAD,CALgD;AAM3DC,EAAAA,KAAK,EAALA,KAN2D;AAO3DC,EAAAA,UAAU,EAAE,CAAC,MAAD,CAP+C;AAQ3DC,EAAAA,OAAO,EAAE;AARkD,CAAtD;;;SAWQF,K;;;;;qEAAf,iBACEG,IADF,EAEED,OAFF,EAGEE,OAHF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAKOA,OALP,aAKOA,OALP,eAKOA,OAAO,CAAEC,GALhB;AAAA;AAAA;AAAA;;AAAA,kBAMU,IAAIC,KAAJ,CAAU,qBAAV,CANV;;AAAA;AAAA,6CASS,yDAAwBH,IAAxB,EAA8BC,OAAO,CAACC,GAAtC,CATT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {BuildingSceneLayerTileset} from './types';\n\nimport {parseBuildingSceneLayer} from './lib/parsers/parse-i3s-building-scene-layer';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n/**\n * Loader for I3S - Building Scene Layer\n */\nexport const I3SBuildingSceneLayerLoader: LoaderWithParser = {\n name: 'I3S Building Scene Layer',\n id: 'i3s-building-scene-layer',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\nasync function parse(\n data: ArrayBuffer,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<BuildingSceneLayerTileset> {\n if (!context?.url) {\n throw new Error('Url is not provided');\n }\n\n return parseBuildingSceneLayer(data, context.url);\n}\n"],"file":"i3s-building-scene-layer-loader.js"}
|
|
@@ -13,7 +13,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
13
13
|
|
|
14
14
|
var _parseI3sTileContent = require("./lib/parsers/parse-i3s-tile-content");
|
|
15
15
|
|
|
16
|
-
var VERSION = typeof "3.
|
|
16
|
+
var VERSION = typeof "3.2.0-alpha.3" !== 'undefined' ? "3.2.0-alpha.3" : 'beta';
|
|
17
17
|
var I3SContentLoader = {
|
|
18
18
|
name: 'I3S Content (Indexed Scene Layers)',
|
|
19
19
|
id: 'i3s-content',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i3s-content-loader.ts"],"names":["VERSION","I3SContentLoader","name","id","module","worker","version","mimeTypes","parse","extensions","options","data","context","i3s","tile","tileset","content"],"mappings":";;;;;;;;;;;;;AACA;;AAKA,IAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../src/i3s-content-loader.ts"],"names":["VERSION","I3SContentLoader","name","id","module","worker","version","mimeTypes","parse","extensions","options","data","context","i3s","tile","tileset","content"],"mappings":";;;;;;;;;;;;;AACA;;AAKA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,MAAnE;AAIO,IAAMC,gBAAkC,GAAG;AAChDC,EAAAA,IAAI,EAAE,oCAD0C;AAEhDC,EAAAA,EAAE,EAAE,aAF4C;AAGhDC,EAAAA,MAAM,EAAE,KAHwC;AAIhDC,EAAAA,MAAM,EAAE,IAJwC;AAKhDC,EAAAA,OAAO,EAAEN,OALuC;AAMhDO,EAAAA,SAAS,EAAE,CAAC,0BAAD,CANqC;AAOhDC,EAAAA,KAAK,EAALA,KAPgD;AAQhDC,EAAAA,UAAU,EAAE,CAAC,KAAD,CARoC;AAShDC,EAAAA,OAAO,EAAE;AACP,mBAAe;AADR;AATuC,CAA3C;;;SAcQF,K;;;;;qEAAf,iBAAqBG,IAArB,EAA2BD,OAA3B,EAAoDE,OAApD;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,mBAC0B,CAAAF,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEG,GAAT,KAAgB,EAD1C,EACSC,IADT,QACSA,IADT,EACeC,OADf,QACeA,OADf;AAAA;AAAA,mBAEQ,8CAAoBJ,IAApB,EAA0BG,IAA1B,EAAgCC,OAAhC,EAAyCL,OAAzC,EAAkDE,OAAlD,CAFR;;AAAA;AAAA,6CAGSE,IAAI,CAACE,OAHd;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader: LoaderWithParser = {\n name: 'I3S Content (Indexed Scene Layers)',\n id: 'i3s-content',\n module: 'i3s',\n worker: true,\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse,\n extensions: ['bin'],\n options: {\n 'i3s-content': {}\n }\n};\n\nasync function parse(data, options?: LoaderOptions, context?: LoaderContext) {\n const {tile, tileset} = options?.i3s || {};\n await parseI3STileContent(data, tile, tileset, options, context);\n return tile.content;\n}\n"],"file":"i3s-content-loader.js"}
|
package/dist/es5/i3s-loader.js
CHANGED
|
@@ -21,7 +21,7 @@ var _parseI3s = require("./lib/parsers/parse-i3s");
|
|
|
21
21
|
|
|
22
22
|
var _constants = require("./lib/parsers/constants");
|
|
23
23
|
|
|
24
|
-
var VERSION = typeof "3.
|
|
24
|
+
var VERSION = typeof "3.2.0-alpha.3" !== 'undefined' ? "3.2.0-alpha.3" : 'latest';
|
|
25
25
|
var TILESET_REGEX = /layers\/[0-9]+$/;
|
|
26
26
|
var TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
27
27
|
var SLPK_HEX = '504b0304';
|