@loaders.gl/i3s 4.1.0-alpha.1 → 4.1.0-alpha.11
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/arcgis-webscene-loader.js +1 -1
- package/dist/arcgis-webscene-loader.js.map +1 -1
- package/dist/dist.dev.js +177 -22
- package/dist/i3s-attribute-loader.js +1 -1
- package/dist/i3s-attribute-loader.js.map +1 -1
- package/dist/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/i3s-content-loader.js +1 -1
- package/dist/i3s-content-loader.js.map +1 -1
- package/dist/i3s-content-worker-node.js +34 -34
- package/dist/i3s-content-worker-node.js.map +3 -3
- package/dist/i3s-content-worker.js +15 -8
- package/dist/i3s-loader.js +1 -1
- package/dist/i3s-loader.js.map +1 -1
- package/dist/i3s-node-page-loader.js +1 -1
- package/dist/i3s-node-page-loader.js.map +1 -1
- package/dist/i3s-slpk-loader.js +1 -1
- package/dist/i3s-slpk-loader.js.map +1 -1
- package/dist/index.cjs +9 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/parsers/constants.d.ts.map +1 -1
- package/dist/lib/parsers/constants.js.map +1 -1
- package/dist/lib/parsers/parse-arcgis-webscene.d.ts +10 -0
- package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -1
- package/dist/lib/parsers/parse-arcgis-webscene.js +8 -1
- package/dist/lib/parsers/parse-arcgis-webscene.js.map +1 -1
- package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/package.json +12 -12
- package/src/index.ts +3 -1
- package/src/lib/parsers/constants.ts +2 -1
- package/src/lib/parsers/parse-arcgis-webscene.ts +17 -1
- package/src/lib/parsers/parse-i3s-attribute.ts +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseWebscene } from "./lib/parsers/parse-arcgis-webscene.js";
|
|
2
|
-
const VERSION = typeof
|
|
2
|
+
const VERSION = typeof "4.1.0-alpha.11" !== 'undefined' ? "4.1.0-alpha.11" : 'latest';
|
|
3
3
|
export const ArcGISWebSceneLoader = {
|
|
4
4
|
name: 'ArcGIS Web Scene Loader',
|
|
5
5
|
id: 'arcgis-web-scene',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arcgis-webscene-loader.js","names":["parseWebscene","VERSION","
|
|
1
|
+
{"version":3,"file":"arcgis-webscene-loader.js","names":["parseWebscene","VERSION","ArcGISWebSceneLoader","name","id","module","version","mimeTypes","parse","extensions","options","data"],"sources":["../src/arcgis-webscene-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArcGISWebSceneData} from './types';\n\nimport {parseWebscene} from './lib/parsers/parse-arcgis-webscene';\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';\n\nexport type ArcGISWebSceneLoaderOptions = LoaderOptions & {};\n\n/**\n * Loader for ArcGIS WebScene\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport const ArcGISWebSceneLoader: LoaderWithParser<\n ArcGISWebSceneData,\n never,\n ArcGISWebSceneLoaderOptions\n> = {\n name: 'ArcGIS Web Scene Loader',\n id: 'arcgis-web-scene',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\n/**\n * Parse ArcGIS webscene\n * @param data\n */\nasync function parse(data: ArrayBuffer): Promise<ArcGISWebSceneData> {\n return parseWebscene(data);\n}\n"],"mappings":"SAGQA,aAAa;AAIrB,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAQ3E,OAAO,MAAMC,oBAIZ,GAAG;EACFC,IAAI,EAAE,yBAAyB;EAC/BC,EAAE,EAAE,kBAAkB;EACtBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,KAAK;EACLC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;AAMD,eAAeF,KAAKA,CAACG,IAAiB,EAA+B;EACnE,OAAOX,aAAa,CAACW,IAAI,CAAC;AAC5B"}
|
package/dist/dist.dev.js
CHANGED
|
@@ -4269,6 +4269,7 @@ var __exports__ = (() => {
|
|
|
4269
4269
|
I3SContentLoader: () => I3SContentLoader,
|
|
4270
4270
|
I3SLoader: () => I3SLoader,
|
|
4271
4271
|
I3SNodePageLoader: () => I3SNodePageLoader,
|
|
4272
|
+
LayerError: () => LayerError,
|
|
4272
4273
|
SLPKLoader: () => SLPKLoader,
|
|
4273
4274
|
customizeColors: () => customizeColors,
|
|
4274
4275
|
loadFeatureAttributes: () => loadFeatureAttributes,
|
|
@@ -4328,15 +4329,14 @@ var __exports__ = (() => {
|
|
|
4328
4329
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
4329
4330
|
|
|
4330
4331
|
// ../worker-utils/src/lib/env-utils/version.ts
|
|
4331
|
-
var NPM_TAG = "latest";
|
|
4332
4332
|
function getVersion() {
|
|
4333
4333
|
if (!globalThis._loadersgl_?.version) {
|
|
4334
4334
|
globalThis._loadersgl_ = globalThis._loadersgl_ || {};
|
|
4335
|
-
if (
|
|
4335
|
+
if (false) {
|
|
4336
4336
|
console.warn("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
4337
4337
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
4338
4338
|
} else {
|
|
4339
|
-
globalThis._loadersgl_.version =
|
|
4339
|
+
globalThis._loadersgl_.version = "4.1.0-alpha.11";
|
|
4340
4340
|
}
|
|
4341
4341
|
}
|
|
4342
4342
|
return globalThis._loadersgl_.version;
|
|
@@ -4465,6 +4465,9 @@ var __exports__ = (() => {
|
|
|
4465
4465
|
return true;
|
|
4466
4466
|
}
|
|
4467
4467
|
function concatenateArrayBuffers(...sources) {
|
|
4468
|
+
return concatenateArrayBuffersFromArray(sources);
|
|
4469
|
+
}
|
|
4470
|
+
function concatenateArrayBuffersFromArray(sources) {
|
|
4468
4471
|
const sourceArrays = sources.map((source2) => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2);
|
|
4469
4472
|
const byteLength = sourceArrays.reduce((length4, typedArray) => length4 + typedArray.byteLength, 0);
|
|
4470
4473
|
const result = new Uint8Array(byteLength);
|
|
@@ -9109,7 +9112,7 @@ var __exports__ = (() => {
|
|
|
9109
9112
|
_defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
|
|
9110
9113
|
|
|
9111
9114
|
// ../images/src/lib/utils/version.ts
|
|
9112
|
-
var VERSION2 =
|
|
9115
|
+
var VERSION2 = true ? "4.1.0-alpha.11" : "latest";
|
|
9113
9116
|
|
|
9114
9117
|
// ../images/src/lib/category-api/image-type.ts
|
|
9115
9118
|
var parseImageNode = globalThis.loaders?.parseImageNode;
|
|
@@ -9498,7 +9501,7 @@ var __exports__ = (() => {
|
|
|
9498
9501
|
};
|
|
9499
9502
|
|
|
9500
9503
|
// ../draco/src/lib/utils/version.ts
|
|
9501
|
-
var VERSION3 =
|
|
9504
|
+
var VERSION3 = true ? "4.1.0-alpha.11" : "latest";
|
|
9502
9505
|
|
|
9503
9506
|
// ../draco/src/draco-loader.ts
|
|
9504
9507
|
var DracoLoader = {
|
|
@@ -10073,7 +10076,7 @@ var __exports__ = (() => {
|
|
|
10073
10076
|
}
|
|
10074
10077
|
|
|
10075
10078
|
// ../textures/src/lib/utils/version.ts
|
|
10076
|
-
var VERSION4 =
|
|
10079
|
+
var VERSION4 = true ? "4.1.0-alpha.11" : "latest";
|
|
10077
10080
|
|
|
10078
10081
|
// ../textures/src/lib/parsers/basis-module-loader.ts
|
|
10079
10082
|
var BASIS_EXTERNAL_LIBRARIES = {
|
|
@@ -11477,7 +11480,7 @@ var __exports__ = (() => {
|
|
|
11477
11480
|
}
|
|
11478
11481
|
|
|
11479
11482
|
// src/i3s-content-loader.ts
|
|
11480
|
-
var VERSION5 =
|
|
11483
|
+
var VERSION5 = true ? "4.1.0-alpha.11" : "latest";
|
|
11481
11484
|
var I3SContentLoader = {
|
|
11482
11485
|
name: "I3S Content (Indexed Scene Layers)",
|
|
11483
11486
|
id: "i3s-content",
|
|
@@ -11987,7 +11990,7 @@ var __exports__ = (() => {
|
|
|
11987
11990
|
var import_core16 = __toESM(require_core(), 1);
|
|
11988
11991
|
|
|
11989
11992
|
// src/i3s-node-page-loader.ts
|
|
11990
|
-
var VERSION6 =
|
|
11993
|
+
var VERSION6 = true ? "4.1.0-alpha.11" : "latest";
|
|
11991
11994
|
var I3SNodePageLoader = {
|
|
11992
11995
|
name: "I3S Node Page",
|
|
11993
11996
|
id: "i3s-node-page",
|
|
@@ -12277,7 +12280,7 @@ var __exports__ = (() => {
|
|
|
12277
12280
|
}
|
|
12278
12281
|
|
|
12279
12282
|
// src/i3s-loader.ts
|
|
12280
|
-
var VERSION7 =
|
|
12283
|
+
var VERSION7 = true ? "4.1.0-alpha.11" : "latest";
|
|
12281
12284
|
var TILESET_REGEX = /layers\/[0-9]+$/;
|
|
12282
12285
|
var TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
12283
12286
|
var SLPK_HEX = "504b0304";
|
|
@@ -12387,25 +12390,121 @@ var __exports__ = (() => {
|
|
|
12387
12390
|
const zipEoCDOffset = await searchFromTheEnd(file, eoCDSignature);
|
|
12388
12391
|
let cdRecordsNumber = BigInt(await file.getUint16(zipEoCDOffset + CD_RECORDS_NUMBER_OFFSET));
|
|
12389
12392
|
let cdStartOffset = BigInt(await file.getUint32(zipEoCDOffset + CD_START_OFFSET_OFFSET));
|
|
12390
|
-
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
}
|
|
12396
|
-
const zip64EoCDOffset = await file.getBigUint64(zip64EoCDLocatorOffset + ZIP64_EOCD_START_OFFSET_OFFSET);
|
|
12393
|
+
let zip64EoCDLocatorOffset = zipEoCDOffset - 20n;
|
|
12394
|
+
let zip64EoCDOffset = 0n;
|
|
12395
|
+
const magicBytes = await file.slice(zip64EoCDLocatorOffset, zip64EoCDLocatorOffset + 4n);
|
|
12396
|
+
if (compareArrayBuffers(magicBytes, zip64EoCDLocatorSignature)) {
|
|
12397
|
+
zip64EoCDOffset = await file.getBigUint64(zip64EoCDLocatorOffset + ZIP64_EOCD_START_OFFSET_OFFSET);
|
|
12397
12398
|
const endOfCDMagicBytes = await file.slice(zip64EoCDOffset, zip64EoCDOffset + 4n);
|
|
12398
12399
|
if (!compareArrayBuffers(endOfCDMagicBytes, zip64EoCDSignature.buffer)) {
|
|
12399
12400
|
throw new Error("zip64 EoCD not found");
|
|
12400
12401
|
}
|
|
12401
12402
|
cdRecordsNumber = await file.getBigUint64(zip64EoCDOffset + ZIP64_CD_RECORDS_NUMBER_OFFSET);
|
|
12402
12403
|
cdStartOffset = await file.getBigUint64(zip64EoCDOffset + ZIP64_CD_START_OFFSET_OFFSET);
|
|
12404
|
+
} else {
|
|
12405
|
+
zip64EoCDLocatorOffset = 0n;
|
|
12403
12406
|
}
|
|
12404
12407
|
return {
|
|
12405
12408
|
cdRecordsNumber,
|
|
12406
|
-
cdStartOffset
|
|
12409
|
+
cdStartOffset,
|
|
12410
|
+
offsets: {
|
|
12411
|
+
zip64EoCDOffset,
|
|
12412
|
+
zip64EoCDLocatorOffset,
|
|
12413
|
+
zipEoCDOffset
|
|
12414
|
+
}
|
|
12407
12415
|
};
|
|
12408
12416
|
};
|
|
12417
|
+
var EOCD_FIELDS = [{
|
|
12418
|
+
offset: 0,
|
|
12419
|
+
size: 4,
|
|
12420
|
+
default: new DataView(eoCDSignature.buffer).getUint32(0, true)
|
|
12421
|
+
}, {
|
|
12422
|
+
offset: 4,
|
|
12423
|
+
size: 2,
|
|
12424
|
+
default: 0
|
|
12425
|
+
}, {
|
|
12426
|
+
offset: 6,
|
|
12427
|
+
size: 2,
|
|
12428
|
+
default: 0
|
|
12429
|
+
}, {
|
|
12430
|
+
offset: 8,
|
|
12431
|
+
size: 2,
|
|
12432
|
+
name: "recordsNumber"
|
|
12433
|
+
}, {
|
|
12434
|
+
offset: 10,
|
|
12435
|
+
size: 2,
|
|
12436
|
+
name: "recordsNumber"
|
|
12437
|
+
}, {
|
|
12438
|
+
offset: 12,
|
|
12439
|
+
size: 4,
|
|
12440
|
+
name: "cdSize"
|
|
12441
|
+
}, {
|
|
12442
|
+
offset: 16,
|
|
12443
|
+
size: 4,
|
|
12444
|
+
name: "cdOffset"
|
|
12445
|
+
}, {
|
|
12446
|
+
offset: 20,
|
|
12447
|
+
size: 2,
|
|
12448
|
+
default: 0
|
|
12449
|
+
}];
|
|
12450
|
+
var ZIP64_EOCD_LOCATOR_FIELDS = [{
|
|
12451
|
+
offset: 0,
|
|
12452
|
+
size: 4,
|
|
12453
|
+
default: new DataView(zip64EoCDLocatorSignature.buffer).getUint32(0, true)
|
|
12454
|
+
}, {
|
|
12455
|
+
offset: 4,
|
|
12456
|
+
size: 4,
|
|
12457
|
+
default: 0
|
|
12458
|
+
}, {
|
|
12459
|
+
offset: 8,
|
|
12460
|
+
size: 8,
|
|
12461
|
+
name: "eoCDStart"
|
|
12462
|
+
}, {
|
|
12463
|
+
offset: 16,
|
|
12464
|
+
size: 4,
|
|
12465
|
+
default: 1
|
|
12466
|
+
}];
|
|
12467
|
+
var ZIP64_EOCD_FIELDS = [{
|
|
12468
|
+
offset: 0,
|
|
12469
|
+
size: 4,
|
|
12470
|
+
default: new DataView(zip64EoCDSignature.buffer).getUint32(0, true)
|
|
12471
|
+
}, {
|
|
12472
|
+
offset: 4,
|
|
12473
|
+
size: 8,
|
|
12474
|
+
default: 44
|
|
12475
|
+
}, {
|
|
12476
|
+
offset: 12,
|
|
12477
|
+
size: 2,
|
|
12478
|
+
default: 45
|
|
12479
|
+
}, {
|
|
12480
|
+
offset: 14,
|
|
12481
|
+
size: 2,
|
|
12482
|
+
default: 45
|
|
12483
|
+
}, {
|
|
12484
|
+
offset: 16,
|
|
12485
|
+
size: 4,
|
|
12486
|
+
default: 0
|
|
12487
|
+
}, {
|
|
12488
|
+
offset: 20,
|
|
12489
|
+
size: 4,
|
|
12490
|
+
default: 0
|
|
12491
|
+
}, {
|
|
12492
|
+
offset: 24,
|
|
12493
|
+
size: 8,
|
|
12494
|
+
name: "recordsNumber"
|
|
12495
|
+
}, {
|
|
12496
|
+
offset: 32,
|
|
12497
|
+
size: 8,
|
|
12498
|
+
name: "recordsNumber"
|
|
12499
|
+
}, {
|
|
12500
|
+
offset: 40,
|
|
12501
|
+
size: 8,
|
|
12502
|
+
name: "cdSize"
|
|
12503
|
+
}, {
|
|
12504
|
+
offset: 48,
|
|
12505
|
+
size: 8,
|
|
12506
|
+
name: "cdOffset"
|
|
12507
|
+
}];
|
|
12409
12508
|
|
|
12410
12509
|
// ../zip/src/parse-zip/cd-file-header.ts
|
|
12411
12510
|
var CD_COMPRESSED_SIZE_OFFSET = 20n;
|
|
@@ -12617,6 +12716,52 @@ var __exports__ = (() => {
|
|
|
12617
12716
|
compressionMethod
|
|
12618
12717
|
};
|
|
12619
12718
|
};
|
|
12719
|
+
var ZIP_HEADER_FIELDS2 = [{
|
|
12720
|
+
offset: 0,
|
|
12721
|
+
size: 4,
|
|
12722
|
+
default: new DataView(signature2.buffer).getUint32(0, true)
|
|
12723
|
+
}, {
|
|
12724
|
+
offset: 4,
|
|
12725
|
+
size: 2,
|
|
12726
|
+
default: 45
|
|
12727
|
+
}, {
|
|
12728
|
+
offset: 6,
|
|
12729
|
+
size: 2,
|
|
12730
|
+
default: 0
|
|
12731
|
+
}, {
|
|
12732
|
+
offset: 8,
|
|
12733
|
+
size: 2,
|
|
12734
|
+
default: 0
|
|
12735
|
+
}, {
|
|
12736
|
+
offset: 10,
|
|
12737
|
+
size: 2,
|
|
12738
|
+
default: 0
|
|
12739
|
+
}, {
|
|
12740
|
+
offset: 12,
|
|
12741
|
+
size: 2,
|
|
12742
|
+
default: 0
|
|
12743
|
+
}, {
|
|
12744
|
+
offset: 14,
|
|
12745
|
+
size: 4,
|
|
12746
|
+
name: "crc32"
|
|
12747
|
+
}, {
|
|
12748
|
+
offset: 18,
|
|
12749
|
+
size: 4,
|
|
12750
|
+
name: "length"
|
|
12751
|
+
}, {
|
|
12752
|
+
offset: 22,
|
|
12753
|
+
size: 4,
|
|
12754
|
+
name: "length"
|
|
12755
|
+
}, {
|
|
12756
|
+
offset: 26,
|
|
12757
|
+
size: 2,
|
|
12758
|
+
name: "fnlength"
|
|
12759
|
+
}, {
|
|
12760
|
+
offset: 28,
|
|
12761
|
+
size: 2,
|
|
12762
|
+
default: 0,
|
|
12763
|
+
name: "extraLength"
|
|
12764
|
+
}];
|
|
12620
12765
|
|
|
12621
12766
|
// ../crypto/src/lib/hash.ts
|
|
12622
12767
|
var Hash = class {
|
|
@@ -13152,6 +13297,9 @@ var __exports__ = (() => {
|
|
|
13152
13297
|
}
|
|
13153
13298
|
async function makeHashTableFromZipHeaders(fileProvider) {
|
|
13154
13299
|
const zipCDIterator = makeZipCDHeaderIterator(fileProvider);
|
|
13300
|
+
return getHashTable(zipCDIterator);
|
|
13301
|
+
}
|
|
13302
|
+
async function getHashTable(zipCDIterator) {
|
|
13155
13303
|
const md5Hash = new MD5Hash();
|
|
13156
13304
|
const textEncoder = new TextEncoder();
|
|
13157
13305
|
const hashTable = {};
|
|
@@ -13442,7 +13590,7 @@ var __exports__ = (() => {
|
|
|
13442
13590
|
}
|
|
13443
13591
|
|
|
13444
13592
|
// src/i3s-slpk-loader.ts
|
|
13445
|
-
var VERSION8 =
|
|
13593
|
+
var VERSION8 = true ? "4.1.0-alpha.11" : "latest";
|
|
13446
13594
|
var SLPKLoader = {
|
|
13447
13595
|
name: "I3S SLPK (Scene Layer Package)",
|
|
13448
13596
|
id: "slpk",
|
|
@@ -13521,7 +13669,7 @@ var __exports__ = (() => {
|
|
|
13521
13669
|
}
|
|
13522
13670
|
|
|
13523
13671
|
// src/i3s-attribute-loader.ts
|
|
13524
|
-
var VERSION9 =
|
|
13672
|
+
var VERSION9 = true ? "4.1.0-alpha.11" : "latest";
|
|
13525
13673
|
var EMPTY_VALUE = "";
|
|
13526
13674
|
var REJECTED_STATUS = "rejected";
|
|
13527
13675
|
var I3SAttributeLoader = {
|
|
@@ -13674,7 +13822,7 @@ var __exports__ = (() => {
|
|
|
13674
13822
|
}
|
|
13675
13823
|
|
|
13676
13824
|
// src/i3s-building-scene-layer-loader.ts
|
|
13677
|
-
var VERSION10 =
|
|
13825
|
+
var VERSION10 = true ? "4.1.0-alpha.11" : "latest";
|
|
13678
13826
|
var I3SBuildingSceneLayerLoader = {
|
|
13679
13827
|
name: "I3S Building Scene Layer",
|
|
13680
13828
|
id: "i3s-building-scene-layer",
|
|
@@ -13702,6 +13850,13 @@ var __exports__ = (() => {
|
|
|
13702
13850
|
var SUPPORTED_LAYERS_TYPES = [ARCGIS_SCENE_SERVER_LAYER_TYPE, INTEGRATED_MESH_LAYER, BUILDING_SCENE_LAYER, GROUP_LAYER];
|
|
13703
13851
|
var NO_AVAILABLE_SUPPORTED_LAYERS_ERROR = "NO_AVAILABLE_SUPPORTED_LAYERS_ERROR";
|
|
13704
13852
|
var NOT_SUPPORTED_CRS_ERROR = "NOT_SUPPORTED_CRS_ERROR";
|
|
13853
|
+
var LayerError = class extends Error {
|
|
13854
|
+
constructor(message, details) {
|
|
13855
|
+
super(message);
|
|
13856
|
+
this.details = details;
|
|
13857
|
+
this.name = "LayerError";
|
|
13858
|
+
}
|
|
13859
|
+
};
|
|
13705
13860
|
async function parseWebscene(data) {
|
|
13706
13861
|
const layer0 = JSON.parse(new TextDecoder().decode(data));
|
|
13707
13862
|
const {
|
|
@@ -13712,7 +13867,7 @@ var __exports__ = (() => {
|
|
|
13712
13867
|
unsupportedLayers
|
|
13713
13868
|
} = await parseOperationalLayers(operationalLayers, true);
|
|
13714
13869
|
if (!layers.length) {
|
|
13715
|
-
throw new
|
|
13870
|
+
throw new LayerError(NO_AVAILABLE_SUPPORTED_LAYERS_ERROR, unsupportedLayers);
|
|
13716
13871
|
}
|
|
13717
13872
|
return {
|
|
13718
13873
|
header: layer0,
|
|
@@ -13762,7 +13917,7 @@ var __exports__ = (() => {
|
|
|
13762
13917
|
}
|
|
13763
13918
|
|
|
13764
13919
|
// src/arcgis-webscene-loader.ts
|
|
13765
|
-
var VERSION11 =
|
|
13920
|
+
var VERSION11 = true ? "4.1.0-alpha.11" : "latest";
|
|
13766
13921
|
var ArcGISWebSceneLoader = {
|
|
13767
13922
|
name: "ArcGIS Web Scene Loader",
|
|
13768
13923
|
id: "arcgis-web-scene",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { load } from '@loaders.gl/core';
|
|
2
2
|
import { parseI3STileAttribute } from "./lib/parsers/parse-i3s-attribute.js";
|
|
3
3
|
import { getUrlWithToken } from "./lib/utils/url-utils.js";
|
|
4
|
-
const VERSION = typeof
|
|
4
|
+
const VERSION = typeof "4.1.0-alpha.11" !== 'undefined' ? "4.1.0-alpha.11" : 'latest';
|
|
5
5
|
const EMPTY_VALUE = '';
|
|
6
6
|
const REJECTED_STATUS = 'rejected';
|
|
7
7
|
export const I3SAttributeLoader = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-attribute-loader.js","names":["load","parseI3STileAttribute","getUrlWithToken","VERSION","__VERSION__","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","arrayBuffer","options","extensions","binary","loadFeatureAttributes","tile","featureId","arguments","length","undefined","attributeStorageInfo","attributeUrls","tilesetFields","getAttributesData","attributes","attributeLoadPromises","index","_options$i3s","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","error","generateAttributesByFeatureId","_tile$tileset","_tile$tileset$tileset","_tile$header","_tile$tileset2","_tile$tileset2$tilese","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","_attributeField$domai","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"sources":["../src/i3s-attribute-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport type {I3STileAttributes} from './lib/parsers/parse-i3s-attribute';\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/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser<I3STileAttributes, never, I3SLoaderOptions> = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse: async (arrayBuffer: ArrayBuffer, options?: LoaderOptions) => parseI3STileAttribute(arrayBuffer, options),\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\n\n// TODO - these seem to use the loader rather than being part of the loader. Move to different file...\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 */\nexport function 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"],"mappings":"AACA,SAAQA,IAAI,QAAO,kBAAkB;AAAC,SAG9BC,qBAAqB;AAAA,SACrBC,eAAe;AAIvB,MAAMC,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAC3E,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,eAAe,GAAG,UAAU;AAKlC,OAAO,MAAMC,kBAAgF,GAAG;EAC9FC,IAAI,EAAE,eAAe;EACrBC,EAAE,EAAE,eAAe;EACnBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAER,OAAO;EAChBS,SAAS,EAAE,CAAC,oBAAoB,CAAC;EACjCC,KAAK,EAAE,MAAAA,CAAOC,WAAwB,EAAEC,OAAuB,KAAKd,qBAAqB,CAACa,WAAW,EAAEC,OAAO,CAAC;EAC/GC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBD,OAAO,EAAE,CAAC,CAAC;EACXE,MAAM,EAAE;AACV,CAAC;AAaD,OAAO,eAAeC,qBAAqBA,CAACC,IAAI,EAAEC,SAAS,EAAgB;EAAA,IAAdL,OAAO,GAAAM,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACvE,MAAM;IAACG,oBAAoB;IAAEC,aAAa;IAAEC;EAAa,CAAC,GAAGC,iBAAiB,CAACR,IAAI,CAAC;EAEpF,IAAI,CAACK,oBAAoB,IAAI,CAACC,aAAa,IAAIL,SAAS,GAAG,CAAC,EAAE;IAC5D,OAAO,IAAI;EACb;EAEA,IAAIQ,UAAoB,GAAG,EAAE;EAC7B,MAAMC,qBAAwC,GAAG,EAAE;E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CAACE,KAAK,CAAC;EAEzC,IAAIiD,eAAe,CAACC,MAAM,KAAK1E,eAAe,EAAE;IAC9C,OAAO,IAAI;EACb;EAEA,OAAOyE,eAAe,CAAChB,KAAK,CAACe,cAAc,CAAC;AAC9C;AAQA,SAASN,oBAAoBA,CAACnB,SAAS,EAAEc,cAAc,EAAEE,WAAW,EAAE;EACpE,IAAIN,KAAK,GAAG1D,WAAW;EAEvB,IAAIgD,SAAS,IAAKc,cAAc,IAAId,SAAU,EAAE;IAE9CU,KAAK,GAAGkB,MAAM,CAAC5B,SAAS,CAACc,cAAc,CAAC,CAAC,CAACe,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAACC,IAAI,CAAC,CAAC;EAC7E;EAGA,IAAId,WAAW,CAAC/C,MAAM,EAAE;IACtB,MAAM8D,SAAS,GAAGf,WAAW,CAACV,IAAI,CAAC0B,UAAU,IAAIA,UAAU,CAACC,IAAI,KAAKC,MAAM,CAACxB,KAAK,CAAC,CAAC;IACnFA,KAAK,GAAG,CAAAqB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAE5E,IAAI,KAAIH,WAAW;EACxC;EAEA,OAAO0D,KAAK;AACd"}
|
|
1
|
+
{"version":3,"file":"i3s-attribute-loader.js","names":["load","parseI3STileAttribute","getUrlWithToken","VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","arrayBuffer","options","extensions","binary","loadFeatureAttributes","tile","featureId","arguments","length","undefined","attributeStorageInfo","attributeUrls","tilesetFields","getAttributesData","attributes","attributeLoadPromises","index","_options$i3s","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","error","generateAttributesByFeatureId","_tile$tileset","_tile$tileset$tileset","_tile$header","_tile$tileset2","_tile$tileset2$tilese","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","_attributeField$domai","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"sources":["../src/i3s-attribute-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport type {I3STileAttributes} from './lib/parsers/parse-i3s-attribute';\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/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser<I3STileAttributes, never, I3SLoaderOptions> = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse: async (arrayBuffer: ArrayBuffer, options?: LoaderOptions) => parseI3STileAttribute(arrayBuffer, options),\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\n\n// TODO - these seem to use the loader rather than being part of the loader. Move to different file...\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 */\nexport function 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"],"mappings":"AACA,SAAQA,IAAI,QAAO,kBAAkB;AAAC,SAG9BC,qBAAqB;A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AAKc,cAAc,IAAId,SAAU,EAAE;IAE9CU,KAAK,GAAGkB,MAAM,CAAC5B,SAAS,CAACc,cAAc,CAAC,CAAC,CAACe,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAACC,IAAI,CAAC,CAAC;EAC7E;EAGA,IAAId,WAAW,CAAC/C,MAAM,EAAE;IACtB,MAAM8D,SAAS,GAAGf,WAAW,CAACV,IAAI,CAAC0B,UAAU,IAAIA,UAAU,CAACC,IAAI,KAAKC,MAAM,CAACxB,KAAK,CAAC,CAAC;IACnFA,KAAK,GAAG,CAAAqB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAE5E,IAAI,KAAIH,WAAW;EACxC;EAEA,OAAO0D,KAAK;AACd"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseBuildingSceneLayer } from "./lib/parsers/parse-i3s-building-scene-layer.js";
|
|
2
|
-
const VERSION = typeof
|
|
2
|
+
const VERSION = typeof "4.1.0-alpha.11" !== 'undefined' ? "4.1.0-alpha.11" : 'latest';
|
|
3
3
|
export const I3SBuildingSceneLayerLoader = {
|
|
4
4
|
name: 'I3S Building Scene Layer',
|
|
5
5
|
id: 'i3s-building-scene-layer',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-building-scene-layer-loader.js","names":["parseBuildingSceneLayer","VERSION","
|
|
1
|
+
{"version":3,"file":"i3s-building-scene-layer-loader.js","names":["parseBuildingSceneLayer","VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","context","url","Error"],"sources":["../src/i3s-building-scene-layer-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\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__ : 'latest';\n/**\n * Loader for I3S - Building Scene Layer\n */\nexport const I3SBuildingSceneLayerLoader: LoaderWithParser<\n BuildingSceneLayerTileset,\n never,\n I3SLoaderOptions\n> = {\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"],"mappings":"SAIQA,uBAAuB;AAK/B,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAI3E,OAAO,MAAMC,2BAIZ,GAAG;EACFC,IAAI,EAAE,0BAA0B;EAChCC,EAAE,EAAE,0BAA0B;EAC9BC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,KAAK;EACLC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,eAAeF,KAAKA,CAClBG,IAAiB,EACjBD,OAAuB,EACvBE,OAAuB,EACa;EACpC,IAAI,EAACA,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEC,GAAG,GAAE;IACjB,MAAM,IAAIC,KAAK,CAAC,qBAAqB,CAAC;EACxC;EAEA,OAAOd,uBAAuB,CAACW,IAAI,EAAEC,OAAO,CAACC,GAAG,CAAC;AACnD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseI3STileContent } from "./lib/parsers/parse-i3s-tile-content.js";
|
|
2
|
-
const VERSION = typeof
|
|
2
|
+
const VERSION = typeof "4.1.0-alpha.11" !== 'undefined' ? "4.1.0-alpha.11" : 'latest';
|
|
3
3
|
export const I3SContentLoader = {
|
|
4
4
|
name: 'I3S Content (Indexed Scene Layers)',
|
|
5
5
|
id: 'i3s-content',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-content-loader.js","names":["parseI3STileContent","VERSION","
|
|
1
|
+
{"version":3,"file":"i3s-content-loader.js","names":["parseI3STileContent","VERSION","I3SContentLoader","name","id","module","worker","version","mimeTypes","parse","extensions","options","data","context","tile","_tileOptions","tileset","_tilesetOptions","i3s","tileOptions","tilesetOptions"],"sources":["../src/i3s-content-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';\nimport {I3STileContent, I3STileOptions, I3STilesetOptions} from './types';\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__ : 'latest';\n\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader: LoaderWithParser<I3STileContent | null, never, I3SLoaderOptions> = {\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?: I3SLoaderOptions, context?: LoaderContext) {\n const {tile, _tileOptions, tileset, _tilesetOptions} = options?.i3s || {};\n const tileOptions = _tileOptions || tile;\n const tilesetOptions = _tilesetOptions || tileset;\n if (!tileOptions || !tilesetOptions) {\n return null;\n }\n return await parseI3STileContent(\n data,\n tileOptions as I3STileOptions,\n tilesetOptions as I3STilesetOptions,\n options,\n context\n );\n}\n"],"mappings":"SAEQA,mBAAmB;AAM3B,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAK3E,OAAO,MAAMC,gBAAkF,GAAG;EAChGC,IAAI,EAAE,oCAAoC;EAC1CC,EAAE,EAAE,aAAa;EACjBC,MAAM,EAAE,KAAK;EACbC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAEN,OAAO;EAChBO,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,KAAK;EACLC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE;IACP,aAAa,EAAE,CAAC;EAClB;AACF,CAAC;AAED,eAAeF,KAAKA,CAACG,IAAI,EAAED,OAA0B,EAAEE,OAAuB,EAAE;EAC9E,MAAM;IAACC,IAAI;IAAEC,YAAY;IAAEC,OAAO;IAAEC;EAAe,CAAC,GAAG,CAAAN,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,GAAG,KAAI,CAAC,CAAC;EACzE,MAAMC,WAAW,GAAGJ,YAAY,IAAID,IAAI;EACxC,MAAMM,cAAc,GAAGH,eAAe,IAAID,OAAO;EACjD,IAAI,CAACG,WAAW,IAAI,CAACC,cAAc,EAAE;IACnC,OAAO,IAAI;EACb;EACA,OAAO,MAAMpB,mBAAmB,CAC9BY,IAAI,EACJO,WAAW,EACXC,cAAc,EACdT,OAAO,EACPE,OACF,CAAC;AACH"}
|