@loaders.gl/i3s 4.2.0-alpha.5 → 4.2.0-alpha.6

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.
@@ -106,7 +106,7 @@
106
106
  );
107
107
  globalThis._loadersgl_.version = NPM_TAG;
108
108
  } else {
109
- globalThis._loadersgl_.version = "4.2.0-alpha.4";
109
+ globalThis._loadersgl_.version = "4.2.0-alpha.5";
110
110
  }
111
111
  }
112
112
  return globalThis._loadersgl_.version;
@@ -627,7 +627,9 @@
627
627
  }
628
628
  getParentPort().then((parentPort2) => {
629
629
  if (parentPort2) {
630
- parentPort2.on("message", handleMessage);
630
+ parentPort2.on("message", (message) => {
631
+ handleMessage(message);
632
+ });
631
633
  parentPort2.on("exit", () => console.debug("Node worker closing"));
632
634
  } else {
633
635
  globalThis.onmessage = handleMessage;
@@ -1442,7 +1444,7 @@
1442
1444
  var navigator_ = globalThis.navigator || {};
1443
1445
 
1444
1446
  // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
1445
- var VERSION2 = true ? "4.2.0-alpha.4" : "untranspiled source";
1447
+ var VERSION2 = true ? "4.2.0-alpha.5" : "untranspiled source";
1446
1448
  var isBrowser4 = isBrowser3();
1447
1449
 
1448
1450
  // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
@@ -5312,7 +5314,7 @@
5312
5314
  _defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
5313
5315
 
5314
5316
  // ../images/src/lib/utils/version.ts
5315
- var VERSION3 = true ? "4.2.0-alpha.4" : "latest";
5317
+ var VERSION3 = true ? "4.2.0-alpha.5" : "latest";
5316
5318
 
5317
5319
  // ../images/src/lib/category-api/image-type.ts
5318
5320
  var parseImageNode = globalThis.loaders?.parseImageNode;
@@ -5718,7 +5720,7 @@
5718
5720
  };
5719
5721
 
5720
5722
  // ../draco/src/lib/utils/version.ts
5721
- var VERSION4 = true ? "4.2.0-alpha.4" : "latest";
5723
+ var VERSION4 = true ? "4.2.0-alpha.5" : "latest";
5722
5724
 
5723
5725
  // ../draco/src/draco-loader.ts
5724
5726
  var DracoLoader = {
@@ -6321,7 +6323,7 @@
6321
6323
  }
6322
6324
 
6323
6325
  // ../textures/src/lib/utils/version.ts
6324
- var VERSION5 = true ? "4.2.0-alpha.4" : "latest";
6326
+ var VERSION5 = true ? "4.2.0-alpha.5" : "latest";
6325
6327
 
6326
6328
  // ../textures/src/lib/parsers/basis-module-loader.ts
6327
6329
  var BASIS_EXTERNAL_LIBRARIES = {
@@ -7483,11 +7485,7 @@
7483
7485
  texture: null
7484
7486
  };
7485
7487
  if (tileOptions.textureUrl) {
7486
- const url = getUrlWithToken(
7487
- getInternalPathFromUrl(tileOptions.textureUrl),
7488
- // @ts-expect-error options is not properly typed
7489
- options?.i3s?.token
7490
- );
7488
+ const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);
7491
7489
  const loader = getLoaderForTextureFormat(tileOptions.textureFormat);
7492
7490
  const fetchFunc = context?.fetch || fetch;
7493
7491
  const response = await fetchFunc(url);
@@ -7525,18 +7523,6 @@
7525
7523
  }
7526
7524
  return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);
7527
7525
  }
7528
- function getInternalPathFromUrl(url) {
7529
- const slpkUrlParts = url.split(".slpk");
7530
- let filename2;
7531
- if (slpkUrlParts.length === 1) {
7532
- filename2 = url;
7533
- } else if (slpkUrlParts.length === 2) {
7534
- filename2 = slpkUrlParts[1].slice(1);
7535
- } else {
7536
- filename2 = url;
7537
- }
7538
- return filename2;
7539
- }
7540
7526
  async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options) {
7541
7527
  const contentByteLength = arrayBuffer.byteLength;
7542
7528
  let attributes;
@@ -7664,11 +7650,11 @@
7664
7650
  for (const { property, type } of options.store.defaultGeometrySchema.header) {
7665
7651
  const TypedArrayTypeHeader = getConstructorForDataFormat(type);
7666
7652
  switch (property) {
7667
- case "vertexCount" /* vertexCount */:
7653
+ case "vertexCount" /* vertexCount */.toString():
7668
7654
  vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];
7669
7655
  byteOffset += sizeOf(type);
7670
7656
  break;
7671
- case "featureCount" /* featureCount */:
7657
+ case "featureCount" /* featureCount */.toString():
7672
7658
  featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];
7673
7659
  byteOffset += sizeOf(type);
7674
7660
  break;
@@ -7866,7 +7852,7 @@
7866
7852
  }
7867
7853
 
7868
7854
  // src/i3s-content-loader.ts
7869
- var VERSION6 = true ? "4.2.0-alpha.4" : "latest";
7855
+ var VERSION6 = true ? "4.2.0-alpha.5" : "latest";
7870
7856
  var I3SContentLoader = {
7871
7857
  name: "I3S Content (Indexed Scene Layers)",
7872
7858
  id: "i3s-content",
@@ -1 +1 @@
1
- {"version":3,"file":"i3s-loader.d.ts","sourceRoot":"","sources":["../src/i3s-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE9E,OAAO,KAAK,EAAC,gBAAgB,EAAC,mBAAgB;AAI9C,OAAO,EAAC,eAAe,EAAC,mBAAgB;AAYxC,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE,eAAe,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,gBAAgB,EAAE,KAAK,EAAE,aAAa,CAuB9E,CAAC"}
1
+ {"version":3,"file":"i3s-loader.d.ts","sourceRoot":"","sources":["../src/i3s-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE9E,OAAO,KAAK,EAAC,gBAAgB,EAAC,mBAAgB;AAI9C,OAAO,EAAC,eAAe,EAAC,mBAAgB;AAaxC,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE,eAAe,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,gBAAgB,EAAE,KAAK,EAAE,aAAa,CAuB9E,CAAC"}
@@ -5,8 +5,9 @@ import { COORDINATE_SYSTEM } from "./lib/parsers/constants.js";
5
5
  import { getUrlWithoutParams } from "./lib/utils/url-utils.js";
6
6
  // __VERSION__ is injected by babel-plugin-version-inline
7
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
- const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
8
+ const VERSION = typeof "4.2.0-alpha.5" !== 'undefined' ? "4.2.0-alpha.5" : 'latest';
9
9
  const TILESET_REGEX = /layers\/[0-9]+$/;
10
+ const LOCAL_SLPK_REGEX = /\.slpk$/;
10
11
  const TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
11
12
  const SLPK_HEX = '504b0304';
12
13
  const POINT_CLOUD = 'PointCloud';
@@ -49,7 +50,7 @@ async function parseI3S(data, options = {}, context) {
49
50
  // auto detect file type based on url
50
51
  let isTileset;
51
52
  if (options.i3s.isTileset === 'auto') {
52
- isTileset = TILESET_REGEX.test(urlWithoutParams);
53
+ isTileset = TILESET_REGEX.test(urlWithoutParams) || LOCAL_SLPK_REGEX.test(urlWithoutParams);
53
54
  }
54
55
  else {
55
56
  isTileset = options.i3s.isTileset;
@@ -1,6 +1,6 @@
1
1
  // __VERSION__ is injected by babel-plugin-version-inline
2
2
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
3
- const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
3
+ const VERSION = typeof "4.2.0-alpha.5" !== 'undefined' ? "4.2.0-alpha.5" : 'latest';
4
4
  /**
5
5
  * Loader for I3S node pages
6
6
  */
@@ -2,7 +2,7 @@ import { DataViewFile } from '@loaders.gl/loader-utils';
2
2
  import { parseSLPKArchive } from "./lib/parsers/parse-slpk/parse-slpk.js";
3
3
  // __VERSION__ is injected by babel-plugin-version-inline
4
4
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
5
- const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
5
+ const VERSION = typeof "4.2.0-alpha.5" !== 'undefined' ? "4.2.0-alpha.5" : 'latest';
6
6
  /**
7
7
  * Loader for SLPK - Scene Layer Package (Archive I3S format)
8
8
  * @todo - this reloads the entire archive for every tile, should be optimized
package/dist/index.cjs CHANGED
@@ -173,11 +173,7 @@ async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, opt
173
173
  texture: null
174
174
  };
175
175
  if (tileOptions.textureUrl) {
176
- const url = getUrlWithToken(
177
- getInternalPathFromUrl(tileOptions.textureUrl),
178
- // @ts-expect-error options is not properly typed
179
- (_a = options == null ? void 0 : options.i3s) == null ? void 0 : _a.token
180
- );
176
+ const url = getUrlWithToken(tileOptions.textureUrl, (_a = options == null ? void 0 : options.i3s) == null ? void 0 : _a.token);
181
177
  const loader = getLoaderForTextureFormat(tileOptions.textureFormat);
182
178
  const fetchFunc = (context == null ? void 0 : context.fetch) || fetch;
183
179
  const response = await fetchFunc(url);
@@ -215,18 +211,6 @@ async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, opt
215
211
  }
216
212
  return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);
217
213
  }
218
- function getInternalPathFromUrl(url) {
219
- const slpkUrlParts = url.split(".slpk");
220
- let filename;
221
- if (slpkUrlParts.length === 1) {
222
- filename = url;
223
- } else if (slpkUrlParts.length === 2) {
224
- filename = slpkUrlParts[1].slice(1);
225
- } else {
226
- filename = url;
227
- }
228
- return filename;
229
- }
230
214
  async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options) {
231
215
  var _a, _b;
232
216
  const contentByteLength = arrayBuffer.byteLength;
@@ -331,11 +315,11 @@ function parseHeaders(arrayBuffer, options) {
331
315
  for (const { property, type } of options.store.defaultGeometrySchema.header) {
332
316
  const TypedArrayTypeHeader = getConstructorForDataFormat(type);
333
317
  switch (property) {
334
- case HeaderAttributeProperty.vertexCount:
318
+ case HeaderAttributeProperty.vertexCount.toString():
335
319
  vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];
336
320
  byteOffset += sizeOf(type);
337
321
  break;
338
- case HeaderAttributeProperty.featureCount:
322
+ case HeaderAttributeProperty.featureCount.toString():
339
323
  featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];
340
324
  byteOffset += sizeOf(type);
341
325
  break;
@@ -533,7 +517,7 @@ function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
533
517
  }
534
518
 
535
519
  // dist/i3s-content-loader.js
536
- var VERSION = true ? "4.2.0-alpha.4" : "latest";
520
+ var VERSION = true ? "4.2.0-alpha.5" : "latest";
537
521
  var I3SContentLoader = {
538
522
  name: "I3S Content (Indexed Scene Layers)",
539
523
  id: "i3s-content",
@@ -568,7 +552,7 @@ var import_core3 = require("@loaders.gl/core");
568
552
  var import_textures2 = require("@loaders.gl/textures");
569
553
 
570
554
  // dist/i3s-node-page-loader.js
571
- var VERSION2 = true ? "4.2.0-alpha.4" : "latest";
555
+ var VERSION2 = true ? "4.2.0-alpha.5" : "latest";
572
556
  var I3SNodePageLoader = {
573
557
  name: "I3S Node Page",
574
558
  id: "i3s-node-page",
@@ -587,6 +571,16 @@ async function parseNodePage(data, options) {
587
571
 
588
572
  // dist/lib/helpers/i3s-nodepages-tiles.js
589
573
  var I3SNodePagesTiles = class {
574
+ tileset;
575
+ nodePages = [];
576
+ pendingNodePages = [];
577
+ nodesPerPage;
578
+ options;
579
+ lodSelectionMetricType;
580
+ textureDefinitionsSelectedFormats = [];
581
+ nodesInNodePages;
582
+ url;
583
+ textureLoaderOptions = {};
590
584
  /**
591
585
  * @constructs
592
586
  * Create a I3SNodePagesTiles instance.
@@ -596,10 +590,6 @@ var I3SNodePagesTiles = class {
596
590
  */
597
591
  constructor(tileset, url = "", options) {
598
592
  var _a, _b;
599
- this.nodePages = [];
600
- this.pendingNodePages = [];
601
- this.textureDefinitionsSelectedFormats = [];
602
- this.textureLoaderOptions = {};
603
593
  this.tileset = { ...tileset };
604
594
  this.url = url;
605
595
  this.nodesPerPage = ((_a = tileset.nodePages) == null ? void 0 : _a.nodesPerPage) || 64;
@@ -617,7 +607,7 @@ var I3SNodePagesTiles = class {
617
607
  const pageIndex = Math.floor(id / this.nodesPerPage);
618
608
  if (!this.nodePages[pageIndex] && !this.pendingNodePages[pageIndex]) {
619
609
  const nodePageUrl = getUrlWithToken(
620
- this.url.indexOf(".slpk") !== -1 ? `nodepages/${pageIndex}` : `${this.url}/nodepages/${pageIndex}`,
610
+ `${this.url}/nodepages/${pageIndex}`,
621
611
  // @ts-expect-error this.options is not properly typed
622
612
  (_a = this.options.i3s) == null ? void 0 : _a.token
623
613
  );
@@ -906,8 +896,9 @@ async function normalizeTilesetData(tileset, options, context) {
906
896
  }
907
897
 
908
898
  // dist/i3s-loader.js
909
- var VERSION3 = true ? "4.2.0-alpha.4" : "latest";
899
+ var VERSION3 = true ? "4.2.0-alpha.5" : "latest";
910
900
  var TILESET_REGEX = /layers\/[0-9]+$/;
901
+ var LOCAL_SLPK_REGEX = /\.slpk$/;
911
902
  var TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
912
903
  var SLPK_HEX = "504b0304";
913
904
  var POINT_CLOUD = "PointCloud";
@@ -945,7 +936,7 @@ async function parseI3S(data, options = {}, context) {
945
936
  const urlWithoutParams = getUrlWithoutParams(url);
946
937
  let isTileset;
947
938
  if (options.i3s.isTileset === "auto") {
948
- isTileset = TILESET_REGEX.test(urlWithoutParams);
939
+ isTileset = TILESET_REGEX.test(urlWithoutParams) || LOCAL_SLPK_REGEX.test(urlWithoutParams);
949
940
  } else {
950
941
  isTileset = options.i3s.isTileset;
951
942
  }
@@ -1031,6 +1022,11 @@ var PATH_DESCRIPTIONS = [
1031
1022
  }
1032
1023
  ];
1033
1024
  var SLPKArchive = class extends import_zip.IndexedArchive {
1025
+ // Maps hex-encoded md5 filename hashes to bigint offsets into the archive
1026
+ hashTable;
1027
+ _textEncoder = new TextEncoder();
1028
+ _textDecoder = new TextDecoder();
1029
+ _md5Hash = new import_crypto.MD5Hash();
1034
1030
  /**
1035
1031
  * Constructor
1036
1032
  * @param fileProvider - instance of a binary data reader
@@ -1039,9 +1035,6 @@ var SLPKArchive = class extends import_zip.IndexedArchive {
1039
1035
  */
1040
1036
  constructor(fileProvider, hashTable, fileName) {
1041
1037
  super(fileProvider, hashTable, fileName);
1042
- this._textEncoder = new TextEncoder();
1043
- this._textDecoder = new TextDecoder();
1044
- this._md5Hash = new import_crypto.MD5Hash();
1045
1038
  this.hashTable = hashTable;
1046
1039
  }
1047
1040
  /**
@@ -1150,7 +1143,7 @@ async function parseSLPKArchive(fileProvider, cb, fileName) {
1150
1143
  }
1151
1144
 
1152
1145
  // dist/i3s-slpk-loader.js
1153
- var VERSION4 = true ? "4.2.0-alpha.4" : "latest";
1146
+ var VERSION4 = true ? "4.2.0-alpha.5" : "latest";
1154
1147
  var SLPKLoader = {
1155
1148
  name: "I3S SLPK (Scene Layer Package)",
1156
1149
  id: "slpk",
@@ -1227,7 +1220,7 @@ function parseStringsAttribute(arrayBuffer) {
1227
1220
  }
1228
1221
 
1229
1222
  // dist/i3s-attribute-loader.js
1230
- var VERSION5 = true ? "4.2.0-alpha.4" : "latest";
1223
+ var VERSION5 = true ? "4.2.0-alpha.5" : "latest";
1231
1224
  var EMPTY_VALUE = "";
1232
1225
  var REJECTED_STATUS = "rejected";
1233
1226
  var I3SAttributeLoader = {
@@ -1365,7 +1358,7 @@ function parseSublayersTree(sublayers, url) {
1365
1358
  }
1366
1359
 
1367
1360
  // dist/i3s-building-scene-layer-loader.js
1368
- var VERSION6 = true ? "4.2.0-alpha.4" : "latest";
1361
+ var VERSION6 = true ? "4.2.0-alpha.5" : "latest";
1369
1362
  var I3SBuildingSceneLayerLoader = {
1370
1363
  name: "I3S Building Scene Layer",
1371
1364
  id: "i3s-building-scene-layer",
@@ -1399,6 +1392,7 @@ var SUPPORTED_LAYERS_TYPES = [
1399
1392
  var NO_AVAILABLE_SUPPORTED_LAYERS_ERROR = "NO_AVAILABLE_SUPPORTED_LAYERS_ERROR";
1400
1393
  var NOT_SUPPORTED_CRS_ERROR = "NOT_SUPPORTED_CRS_ERROR";
1401
1394
  var LayerError = class extends Error {
1395
+ details;
1402
1396
  constructor(message, details) {
1403
1397
  super(message);
1404
1398
  this.details = details;
@@ -1456,7 +1450,7 @@ async function checkSupportedIndexCRS(layer) {
1456
1450
  }
1457
1451
 
1458
1452
  // dist/arcgis-webscene-loader.js
1459
- var VERSION7 = true ? "4.2.0-alpha.4" : "latest";
1453
+ var VERSION7 = true ? "4.2.0-alpha.5" : "latest";
1460
1454
  var ArcGISWebSceneLoader = {
1461
1455
  name: "ArcGIS Web Scene Loader",
1462
1456
  id: "arcgis-web-scene",