@loaders.gl/tile-converter 4.0.0-alpha.23 → 4.0.0-alpha.24

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.
Files changed (92) hide show
  1. package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -1
  2. package/dist/converter.min.js +97 -97
  3. package/dist/dist.min.js +237 -182
  4. package/dist/es5/3d-tiles-converter/helpers/load-i3s.js.map +1 -1
  5. package/dist/es5/deps-installer/deps-installer.js +1 -1
  6. package/dist/es5/i3s-converter/helpers/feature-attributes.js +6 -18
  7. package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
  8. package/dist/es5/i3s-converter/helpers/geometry-attributes.js +83 -44
  9. package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  10. package/dist/es5/i3s-converter/helpers/geometry-converter.js +9 -7
  11. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  12. package/dist/es5/i3s-converter/types.js.map +1 -1
  13. package/dist/es5/pgm-loader.js +11 -3
  14. package/dist/es5/pgm-loader.js.map +1 -1
  15. package/dist/esm/3d-tiles-converter/helpers/load-i3s.js.map +1 -1
  16. package/dist/esm/deps-installer/deps-installer.js +1 -1
  17. package/dist/esm/i3s-converter/helpers/feature-attributes.js +5 -5
  18. package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -1
  19. package/dist/esm/i3s-converter/helpers/geometry-attributes.js +76 -34
  20. package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  21. package/dist/esm/i3s-converter/helpers/geometry-converter.js +7 -5
  22. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  23. package/dist/esm/i3s-converter/types.js.map +1 -1
  24. package/dist/esm/pgm-loader.js +7 -4
  25. package/dist/esm/pgm-loader.js.map +1 -1
  26. package/dist/i3s-converter/helpers/feature-attributes.d.ts +6 -6
  27. package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
  28. package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
  29. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  30. package/dist/i3s-converter/types.d.ts +7 -4
  31. package/dist/i3s-converter/types.d.ts.map +1 -1
  32. package/dist/pgm-loader.d.ts +9 -2
  33. package/dist/pgm-loader.d.ts.map +1 -1
  34. package/package.json +14 -14
  35. package/src/3d-tiles-converter/helpers/load-i3s.ts +1 -0
  36. package/src/i3s-converter/helpers/feature-attributes.ts +14 -11
  37. package/src/i3s-converter/helpers/geometry-attributes.ts +80 -50
  38. package/src/i3s-converter/helpers/geometry-converter.ts +18 -9
  39. package/src/i3s-converter/types.ts +8 -4
  40. package/src/pgm-loader.ts +15 -7
  41. package/dist/3d-tiles-converter/3d-tiles-converter.js +0 -279
  42. package/dist/3d-tiles-converter/helpers/b3dm-converter.js +0 -271
  43. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -23
  44. package/dist/3d-tiles-converter/helpers/load-i3s.js +0 -42
  45. package/dist/3d-tiles-converter/helpers/texture-atlas.js +0 -54
  46. package/dist/3d-tiles-converter/json-templates/tileset.js +0 -43
  47. package/dist/bundle.js +0 -5
  48. package/dist/constants.js +0 -4
  49. package/dist/converter-cli.js +0 -222
  50. package/dist/deps-installer/deps-installer.js +0 -89
  51. package/dist/i3s-converter/helpers/batch-ids-extensions.js +0 -179
  52. package/dist/i3s-converter/helpers/coordinate-converter.js +0 -122
  53. package/dist/i3s-converter/helpers/create-scene-server-path.js +0 -28
  54. package/dist/i3s-converter/helpers/feature-attributes.js +0 -218
  55. package/dist/i3s-converter/helpers/geometry-attributes.js +0 -203
  56. package/dist/i3s-converter/helpers/geometry-converter.js +0 -1321
  57. package/dist/i3s-converter/helpers/gltf-attributes.js +0 -129
  58. package/dist/i3s-converter/helpers/load-3d-tiles.js +0 -99
  59. package/dist/i3s-converter/helpers/node-debug.js +0 -120
  60. package/dist/i3s-converter/helpers/node-index-document.js +0 -271
  61. package/dist/i3s-converter/helpers/node-pages.js +0 -316
  62. package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +0 -100
  63. package/dist/i3s-converter/helpers/tileset-traversal.js +0 -29
  64. package/dist/i3s-converter/i3s-converter.js +0 -964
  65. package/dist/i3s-converter/json-templates/geometry-definitions.js +0 -87
  66. package/dist/i3s-converter/json-templates/layers.js +0 -139
  67. package/dist/i3s-converter/json-templates/metadata.js +0 -25
  68. package/dist/i3s-converter/json-templates/node.js +0 -89
  69. package/dist/i3s-converter/json-templates/scene-server.js +0 -31
  70. package/dist/i3s-converter/json-templates/shared-resources.js +0 -129
  71. package/dist/i3s-converter/json-templates/store.js +0 -103
  72. package/dist/i3s-converter/types.js +0 -17
  73. package/dist/i3s-server/app.js +0 -29
  74. package/dist/i3s-server/bin/www.js +0 -37
  75. package/dist/i3s-server/controllers/index-controller.js +0 -31
  76. package/dist/i3s-server/controllers/slpk-controller.js +0 -33
  77. package/dist/i3s-server/routes/index.js +0 -20
  78. package/dist/i3s-server/routes/slpk-router.js +0 -34
  79. package/dist/i3s-server/utils/create-scene-server.js +0 -22
  80. package/dist/i3s-server/utils/server-utils.js +0 -66
  81. package/dist/index.js +0 -10
  82. package/dist/lib/utils/cli-utils.js +0 -82
  83. package/dist/lib/utils/compress-util.js +0 -257
  84. package/dist/lib/utils/file-utils.js +0 -139
  85. package/dist/lib/utils/geometry-utils.js +0 -18
  86. package/dist/lib/utils/lod-conversion-utils.js +0 -76
  87. package/dist/lib/utils/queue.js +0 -18
  88. package/dist/lib/utils/statistic-utills.js +0 -64
  89. package/dist/lib/utils/write-queue.js +0 -80
  90. package/dist/pgm-loader.js +0 -24
  91. package/dist/slpk-extractor/slpk-extractor.js +0 -75
  92. package/dist/slpk-extractor-cli.js +0 -102
package/dist/dist.min.js CHANGED
@@ -45517,9 +45517,9 @@ var require_geoid = __commonJS({
45517
45517
  var stencilsize_ = 12;
45518
45518
  var nterms_ = (3 + 1) * (3 + 2) / 2;
45519
45519
  var PIXEL_SIZE = 2;
45520
- var Geoid = function() {
45521
- function Geoid2(options) {
45522
- (0, _classCallCheck2.default)(this, Geoid2);
45520
+ var Geoid2 = function() {
45521
+ function Geoid3(options) {
45522
+ (0, _classCallCheck2.default)(this, Geoid3);
45523
45523
  (0, _defineProperty2.default)(this, "_v00", 0);
45524
45524
  (0, _defineProperty2.default)(this, "_v01", 0);
45525
45525
  (0, _defineProperty2.default)(this, "_v10", 0);
@@ -45532,7 +45532,7 @@ var require_geoid = __commonJS({
45532
45532
  this._ix = this.options._width;
45533
45533
  this._iy = this.options._height;
45534
45534
  }
45535
- (0, _createClass2.default)(Geoid2, [{
45535
+ (0, _createClass2.default)(Geoid3, [{
45536
45536
  key: "getHeight",
45537
45537
  value: function getHeight(lat, lon) {
45538
45538
  lat = Math.abs(lat) > 90 ? NaN : lat;
@@ -45625,9 +45625,9 @@ var require_geoid = __commonJS({
45625
45625
  return r;
45626
45626
  }
45627
45627
  }]);
45628
- return Geoid2;
45628
+ return Geoid3;
45629
45629
  }();
45630
- exports.default = Geoid;
45630
+ exports.default = Geoid2;
45631
45631
  function remainder(x, y) {
45632
45632
  y = Math.abs(y);
45633
45633
  var z = fmod(x, y);
@@ -47861,37 +47861,20 @@ __export(fs_exports, {
47861
47861
  writeFileSync: () => writeFileSync
47862
47862
  });
47863
47863
  var import_fs2 = __toModule(require("fs"));
47864
- var readdir;
47865
- var stat;
47866
- var statSync;
47867
- var readFile;
47868
- var readFileSync;
47869
- var writeFile;
47870
- var writeFileSync;
47871
- var open;
47872
- var close;
47873
- var read;
47874
- var fstat;
47875
- var createReadStream;
47876
- var createWriteStream;
47864
+ var readdir = promisify2(import_fs2.default.readdir);
47865
+ var stat = promisify2(import_fs2.default.stat);
47866
+ var statSync = import_fs2.default.statSync;
47867
+ var readFile = import_fs2.default.readFile;
47868
+ var readFileSync = import_fs2.default.readFileSync;
47869
+ var writeFile = promisify3(import_fs2.default.writeFile);
47870
+ var writeFileSync = import_fs2.default.writeFileSync;
47871
+ var open = import_fs2.default.open;
47872
+ var close = (fd) => new Promise((resolve2, reject) => import_fs2.default.close(fd, (err) => err ? reject(err) : resolve2()));
47873
+ var read = import_fs2.default.read;
47874
+ var fstat = import_fs2.default.fstat;
47875
+ var createReadStream = import_fs2.default.createReadStream;
47876
+ var createWriteStream = import_fs2.default.createWriteStream;
47877
47877
  var isSupported = Boolean(import_fs2.default);
47878
- try {
47879
- readdir = promisify2(import_fs2.default.readdir);
47880
- stat = promisify2(import_fs2.default.stat);
47881
- statSync = import_fs2.default.statSync;
47882
- readFile = import_fs2.default.readFile;
47883
- readFileSync = import_fs2.default.readFileSync;
47884
- writeFile = promisify3(import_fs2.default.writeFile);
47885
- writeFileSync = import_fs2.default.writeFileSync;
47886
- open = import_fs2.default.open;
47887
- close = (fd) => new Promise((resolve2, reject) => import_fs2.default.close(fd, (err) => err ? reject(err) : resolve2()));
47888
- read = import_fs2.default.read;
47889
- fstat = import_fs2.default.fstat;
47890
- createReadStream = import_fs2.default.createReadStream;
47891
- createWriteStream = import_fs2.default.createWriteStream;
47892
- isSupported = Boolean(import_fs2.default);
47893
- } catch {
47894
- }
47895
47878
  async function _readToArrayBuffer(fd, start, length) {
47896
47879
  const buffer = Buffer.alloc(length);
47897
47880
  const { bytesRead } = await read(fd, buffer, 0, length, start);
@@ -50121,7 +50104,7 @@ function getUint32Array(dracoArray) {
50121
50104
  }
50122
50105
 
50123
50106
  // ../draco/src/lib/draco-module-loader.ts
50124
- var DRACO_DECODER_VERSION = "1.5.5";
50107
+ var DRACO_DECODER_VERSION = "1.5.6";
50125
50108
  var DRACO_ENCODER_VERSION = "1.4.1";
50126
50109
  var STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
50127
50110
  var DRACO_EXTERNAL_LIBRARIES = {
@@ -52340,7 +52323,7 @@ var GLTFScenegraph = class {
52340
52323
  }
52341
52324
  };
52342
52325
 
52343
- // ../gltf/src/lib/extensions/data-processing.ts
52326
+ // ../gltf/src/lib/extensions/utils/3d-tiles-utils.ts
52344
52327
  var ATTRIBUTE_TYPE_TO_COMPONENTS2 = {
52345
52328
  SCALAR: 1,
52346
52329
  VEC2: 2,
@@ -52380,13 +52363,31 @@ var ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE2 = {
52380
52363
  function getArrayElementByteSize(attributeType, componentType) {
52381
52364
  return ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE2[componentType] * ATTRIBUTE_TYPE_TO_COMPONENTS2[attributeType];
52382
52365
  }
52383
- function convertRawBufferToMetadataArray(typedArray, attributeType, componentType, elementCount = 1) {
52366
+ function getOffsetsForProperty(scenegraph, bufferViewIndex, offsetType, numberOfElements) {
52367
+ if (offsetType !== "UINT8" && offsetType !== "UINT16" && offsetType !== "UINT32" && offsetType !== "UINT64") {
52368
+ return null;
52369
+ }
52370
+ const arrayOffsetsBytes = scenegraph.getTypedArrayForBufferView(bufferViewIndex);
52371
+ const arrayOffsets = convertRawBufferToMetadataArray(arrayOffsetsBytes, "SCALAR", offsetType, numberOfElements + 1);
52372
+ if (arrayOffsets instanceof BigInt64Array || arrayOffsets instanceof BigUint64Array) {
52373
+ return null;
52374
+ }
52375
+ return arrayOffsets;
52376
+ }
52377
+ function convertRawBufferToMetadataArray(data, attributeType, componentType, elementCount = 1) {
52384
52378
  const numberOfComponents = ATTRIBUTE_TYPE_TO_COMPONENTS2[attributeType];
52385
52379
  const ArrayType = ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY2[componentType];
52386
- const length = elementCount * numberOfComponents;
52387
52380
  const size = ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE2[componentType];
52388
- const offset = typedArray.byteOffset % size ? Math.ceil(typedArray.byteOffset / size) * size : typedArray.byteOffset;
52389
- return new ArrayType(typedArray.buffer, offset, length);
52381
+ const length = elementCount * numberOfComponents;
52382
+ const byteLength = length * size;
52383
+ let buffer = data.buffer;
52384
+ let offset = data.byteOffset;
52385
+ if (offset % size !== 0) {
52386
+ const bufferArray = new Uint8Array(buffer);
52387
+ buffer = bufferArray.slice(offset, offset + byteLength).buffer;
52388
+ offset = 0;
52389
+ }
52390
+ return new ArrayType(buffer, offset, length);
52390
52391
  }
52391
52392
  function getPrimitiveTextureData(scenegraph, textureInfo, primitive) {
52392
52393
  const json = scenegraph.gltf.json;
@@ -52521,6 +52522,15 @@ function decodeExtStructuralMetadata(scenegraph, options) {
52521
52522
  }
52522
52523
  }
52523
52524
  }
52525
+ function findPropertyTableByClass(propertyTables, schemaClassName) {
52526
+ for (let i = 0, len = propertyTables.length; i < len; i++) {
52527
+ const propertyTable = propertyTables[i];
52528
+ if (propertyTable.class === schemaClassName) {
52529
+ return propertyTable;
52530
+ }
52531
+ }
52532
+ return null;
52533
+ }
52524
52534
  function processPrimitivePropertyTextures(scenegraph, propertyTextures, primitive, extension) {
52525
52535
  if (!propertyTextures) {
52526
52536
  return;
@@ -52581,14 +52591,8 @@ function getPropertyDataFromBinarySource(scenegraph, schema, classProperty, numb
52581
52591
  let data = [];
52582
52592
  const valuesBufferView = propertyTableProperty.values;
52583
52593
  const valuesDataBytes = scenegraph.getTypedArrayForBufferView(valuesBufferView);
52584
- let arrayOffsets = null;
52585
- if (classProperty.array && typeof classProperty.count === "undefined" && typeof propertyTableProperty.arrayOffsets !== "undefined" && typeof propertyTableProperty.arrayOffsetType !== "undefined") {
52586
- arrayOffsets = getOffsetArray(scenegraph, propertyTableProperty.arrayOffsets, propertyTableProperty.arrayOffsetType, numberOfElements);
52587
- }
52588
- let stringOffsets = null;
52589
- if (typeof propertyTableProperty.stringOffsets !== "undefined" && typeof propertyTableProperty.stringOffsetType !== "undefined") {
52590
- stringOffsets = getOffsetArray(scenegraph, propertyTableProperty.stringOffsets, propertyTableProperty.stringOffsetType, numberOfElements);
52591
- }
52594
+ const arrayOffsets = getArrayOffsetsForProperty(scenegraph, classProperty, propertyTableProperty, numberOfElements);
52595
+ const stringOffsets = getStringOffsetsForProperty(scenegraph, propertyTableProperty, numberOfElements);
52592
52596
  switch (classProperty.type) {
52593
52597
  case "SCALAR":
52594
52598
  case "VEC2":
@@ -52616,11 +52620,17 @@ function getPropertyDataFromBinarySource(scenegraph, schema, classProperty, numb
52616
52620
  }
52617
52621
  return data;
52618
52622
  }
52619
- function getOffsetArray(scenegraph, offsets, offsetType, numberOfElements) {
52620
- const arrayOffsetsBufferView = offsets;
52621
- const arrayOffsetsBytes = scenegraph.getTypedArrayForBufferView(arrayOffsetsBufferView);
52622
- const arrayOffsets = convertRawBufferToMetadataArray(arrayOffsetsBytes, "SCALAR", offsetType, numberOfElements + 1);
52623
- return arrayOffsets;
52623
+ function getArrayOffsetsForProperty(scenegraph, classProperty, propertyTableProperty, numberOfElements) {
52624
+ if (classProperty.array && typeof classProperty.count === "undefined" && typeof propertyTableProperty.arrayOffsets !== "undefined" && typeof propertyTableProperty.arrayOffsetType !== "undefined") {
52625
+ return getOffsetsForProperty(scenegraph, propertyTableProperty.arrayOffsets, propertyTableProperty.arrayOffsetType, numberOfElements);
52626
+ }
52627
+ return null;
52628
+ }
52629
+ function getStringOffsetsForProperty(scenegraph, propertyTableProperty, numberOfElements) {
52630
+ if (typeof propertyTableProperty.stringOffsets !== "undefined" && typeof propertyTableProperty.stringOffsetType !== "undefined") {
52631
+ return getOffsetsForProperty(scenegraph, propertyTableProperty.stringOffsets, propertyTableProperty.stringOffsetType, numberOfElements);
52632
+ }
52633
+ return null;
52624
52634
  }
52625
52635
  function getPropertyDataNumeric(classProperty, numberOfElements, valuesDataBytes, arrayOffsets) {
52626
52636
  const isArray = classProperty.array;
@@ -52630,52 +52640,42 @@ function getPropertyDataNumeric(classProperty, numberOfElements, valuesDataBytes
52630
52640
  let valuesData;
52631
52641
  if (classProperty.componentType) {
52632
52642
  valuesData = convertRawBufferToMetadataArray(valuesDataBytes, classProperty.type, classProperty.componentType, elementCount);
52643
+ if (!valuesData) {
52644
+ valuesData = valuesDataBytes;
52645
+ }
52633
52646
  } else {
52634
52647
  valuesData = valuesDataBytes;
52635
52648
  }
52636
52649
  if (isArray) {
52637
52650
  if (arrayOffsets) {
52638
- return handleVariableLengthArrayNumeric(valuesData, numberOfElements, arrayOffsets, valuesDataBytes.length, elementSize);
52651
+ return parseVariableLengthArrayNumeric(valuesData, numberOfElements, arrayOffsets, valuesDataBytes.length, elementSize);
52639
52652
  }
52640
52653
  if (arrayCount) {
52641
- return handleFixedLengthArrayNumeric(valuesData, numberOfElements, arrayCount);
52654
+ return parseFixedLengthArrayNumeric(valuesData, numberOfElements, arrayCount);
52642
52655
  }
52643
52656
  return [];
52644
52657
  }
52645
- const attributeValueArray = [];
52646
- for (let index = 0; index < numberOfElements; index++) {
52647
- const value = valuesData[index];
52648
- attributeValueArray.push(value);
52649
- }
52650
- return attributeValueArray;
52658
+ return valuesData;
52651
52659
  }
52652
- function handleVariableLengthArrayNumeric(valuesData, numberOfElements, arrayOffsets, valuesDataBytesLength, elementSize) {
52660
+ function parseVariableLengthArrayNumeric(valuesData, numberOfElements, arrayOffsets, valuesDataBytesLength, valueSize) {
52653
52661
  const attributeValueArray = [];
52654
52662
  for (let index = 0; index < numberOfElements; index++) {
52655
- const array = [];
52656
52663
  const arrayOffset = arrayOffsets[index];
52657
52664
  const arrayByteSize = arrayOffsets[index + 1] - arrayOffsets[index];
52658
- if (arrayByteSize + arrayOffset <= valuesDataBytesLength) {
52659
- const typedArrayOffset = arrayOffset / elementSize;
52660
- const elementCount = arrayByteSize / elementSize;
52661
- for (let i = 0; i < elementCount; i++) {
52662
- const value = valuesData[typedArrayOffset + i];
52663
- array.push(value);
52664
- }
52665
+ if (arrayByteSize + arrayOffset > valuesDataBytesLength) {
52666
+ break;
52665
52667
  }
52666
- attributeValueArray.push(array);
52668
+ const typedArrayOffset = arrayOffset / valueSize;
52669
+ const elementCount = arrayByteSize / valueSize;
52670
+ attributeValueArray.push(valuesData.slice(typedArrayOffset, typedArrayOffset + elementCount));
52667
52671
  }
52668
52672
  return attributeValueArray;
52669
52673
  }
52670
- function handleFixedLengthArrayNumeric(valuesData, numberOfElements, arrayCount) {
52674
+ function parseFixedLengthArrayNumeric(valuesData, numberOfElements, arrayCount) {
52671
52675
  const attributeValueArray = [];
52672
52676
  for (let index = 0; index < numberOfElements; index++) {
52673
- const array = [];
52674
- for (let i = 0; i < arrayCount; i++) {
52675
- const value = valuesData[i];
52676
- array.push(value);
52677
- }
52678
- attributeValueArray.push(array);
52677
+ const elementOffset = index * arrayCount;
52678
+ attributeValueArray.push(valuesData.slice(elementOffset, elementOffset + arrayCount));
52679
52679
  }
52680
52680
  return attributeValueArray;
52681
52681
  }
@@ -52701,9 +52701,6 @@ function getPropertyDataString(classProperty, numberOfElements, valuesDataBytes,
52701
52701
  return [];
52702
52702
  }
52703
52703
  function getPropertyDataENUM(schema, classProperty, numberOfElements, valuesDataBytes, arrayOffsets) {
52704
- const data = [];
52705
- const isArray = classProperty.array;
52706
- const arrayCount = classProperty.count;
52707
52704
  const enumType = classProperty.enumType;
52708
52705
  if (!enumType) {
52709
52706
  throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");
@@ -52715,69 +52712,77 @@ function getPropertyDataENUM(schema, classProperty, numberOfElements, valuesData
52715
52712
  const enumValueType = enumEntry.valueType || "UINT16";
52716
52713
  const elementSize = getArrayElementByteSize(classProperty.type, enumValueType);
52717
52714
  const elementCount = valuesDataBytes.byteLength / elementSize;
52718
- const valuesData = convertRawBufferToMetadataArray(valuesDataBytes, classProperty.type, enumValueType, elementCount);
52719
- if (isArray) {
52715
+ let valuesData = convertRawBufferToMetadataArray(valuesDataBytes, classProperty.type, enumValueType, elementCount);
52716
+ if (!valuesData) {
52717
+ valuesData = valuesDataBytes;
52718
+ }
52719
+ if (classProperty.array) {
52720
52720
  if (arrayOffsets) {
52721
- return handleVariableLengthArrayENUM(valuesData, numberOfElements, arrayOffsets, valuesDataBytes.length, elementSize, enumEntry);
52721
+ return parseVariableLengthArrayENUM({
52722
+ valuesData,
52723
+ numberOfElements,
52724
+ arrayOffsets,
52725
+ valuesDataBytesLength: valuesDataBytes.length,
52726
+ elementSize,
52727
+ enumEntry
52728
+ });
52722
52729
  }
52730
+ const arrayCount = classProperty.count;
52723
52731
  if (arrayCount) {
52724
- return handleFixedLengthArrayENUM(valuesData, numberOfElements, arrayCount, enumEntry);
52732
+ return parseFixedLengthArrayENUM(valuesData, numberOfElements, arrayCount, enumEntry);
52725
52733
  }
52726
52734
  return [];
52727
52735
  }
52728
- for (let index = 0; index < numberOfElements; index++) {
52729
- const enumValue = valuesData[index];
52730
- const enumObject = getEnumByValue(enumEntry, enumValue);
52731
- if (enumObject) {
52732
- data.push(enumObject.name);
52733
- }
52734
- }
52735
- return data;
52736
+ return getEnumsArray(valuesData, 0, numberOfElements, enumEntry);
52736
52737
  }
52737
- function handleVariableLengthArrayENUM(valuesData, numberOfElements, arrayOffsets, valuesDataBytesLength, elementSize, enumEntry) {
52738
+ function parseVariableLengthArrayENUM(params) {
52739
+ const {
52740
+ valuesData,
52741
+ numberOfElements,
52742
+ arrayOffsets,
52743
+ valuesDataBytesLength,
52744
+ elementSize,
52745
+ enumEntry
52746
+ } = params;
52738
52747
  const attributeValueArray = [];
52739
52748
  for (let index = 0; index < numberOfElements; index++) {
52740
- const array = [];
52741
52749
  const arrayOffset = arrayOffsets[index];
52742
52750
  const arrayByteSize = arrayOffsets[index + 1] - arrayOffsets[index];
52743
- if (arrayByteSize + arrayOffset <= valuesDataBytesLength) {
52744
- const typedArrayOffset = arrayOffset / elementSize;
52745
- const elementCount = arrayByteSize / elementSize;
52746
- for (let i = 0; i < elementCount; i++) {
52747
- const value = valuesData[typedArrayOffset + i];
52748
- const enumObject = getEnumByValue(enumEntry, value);
52749
- if (enumObject) {
52750
- array.push(enumObject.name);
52751
- }
52752
- }
52751
+ if (arrayByteSize + arrayOffset > valuesDataBytesLength) {
52752
+ break;
52753
52753
  }
52754
+ const typedArrayOffset = arrayOffset / elementSize;
52755
+ const elementCount = arrayByteSize / elementSize;
52756
+ const array = getEnumsArray(valuesData, typedArrayOffset, elementCount, enumEntry);
52754
52757
  attributeValueArray.push(array);
52755
52758
  }
52756
52759
  return attributeValueArray;
52757
52760
  }
52758
- function handleFixedLengthArrayENUM(valuesData, numberOfElements, arrayCount, enumEntry) {
52761
+ function parseFixedLengthArrayENUM(valuesData, numberOfElements, arrayCount, enumEntry) {
52759
52762
  const attributeValueArray = [];
52760
52763
  for (let index = 0; index < numberOfElements; index++) {
52761
- const array = [];
52762
- for (let i = 0; i < arrayCount; i++) {
52763
- const value = valuesData[i];
52764
- const enumObject = getEnumByValue(enumEntry, value);
52765
- if (enumObject) {
52766
- array.push(enumObject.name);
52767
- }
52768
- }
52764
+ const elementOffset = arrayCount * index;
52765
+ const array = getEnumsArray(valuesData, elementOffset, arrayCount, enumEntry);
52769
52766
  attributeValueArray.push(array);
52770
52767
  }
52771
52768
  return attributeValueArray;
52772
52769
  }
52773
- function findPropertyTableByClass(propertyTables, schemaClassName) {
52774
- for (let i = 0, len = propertyTables.length; i < len; i++) {
52775
- const propertyTable = propertyTables[i];
52776
- if (propertyTable.class === schemaClassName) {
52777
- return propertyTable;
52770
+ function getEnumsArray(valuesData, offset, count, enumEntry) {
52771
+ const array = [];
52772
+ for (let i = 0; i < count; i++) {
52773
+ if (valuesData instanceof BigInt64Array || valuesData instanceof BigUint64Array) {
52774
+ array.push("");
52775
+ } else {
52776
+ const value = valuesData[offset + i];
52777
+ const enumObject = getEnumByValue(enumEntry, value);
52778
+ if (enumObject) {
52779
+ array.push(enumObject.name);
52780
+ } else {
52781
+ array.push("");
52782
+ }
52778
52783
  }
52779
52784
  }
52780
- return null;
52785
+ return array;
52781
52786
  }
52782
52787
  function getEnumByValue(enumEntry, value) {
52783
52788
  for (const enumValue of enumEntry.values) {
@@ -52903,16 +52908,43 @@ function handleFeatureTextureProperties(scenegraph, featureTexture, schemaClass)
52903
52908
  function getPropertyDataFromBinarySource2(scenegraph, schemaProperty, numberOfFeatures, featureTableProperty) {
52904
52909
  const bufferView = featureTableProperty.bufferView;
52905
52910
  const dataArray = scenegraph.getTypedArrayForBufferView(bufferView);
52906
- switch (schemaProperty.type) {
52907
- case "STRING": {
52908
- const stringOffsetBufferView = featureTableProperty.stringOffsetBufferView;
52909
- const offsetsData = scenegraph.getTypedArrayForBufferView(stringOffsetBufferView);
52910
- return getStringAttributes(dataArray, offsetsData, numberOfFeatures);
52911
+ if (schemaProperty.type === "STRING") {
52912
+ const offsetsData = getStringOffsets(scenegraph, featureTableProperty, numberOfFeatures);
52913
+ if (!offsetsData) {
52914
+ return [];
52911
52915
  }
52912
- default:
52916
+ return getStringAttributes(dataArray, offsetsData, numberOfFeatures);
52917
+ } else if (isNumericProperty(schemaProperty.type)) {
52918
+ return getNumericAttributes(dataArray, schemaProperty.type, numberOfFeatures);
52913
52919
  }
52914
52920
  return dataArray;
52915
52921
  }
52922
+ function isNumericProperty(schemaPropertyType) {
52923
+ return [
52924
+ "UINT8",
52925
+ "INT16",
52926
+ "UINT16",
52927
+ "INT32",
52928
+ "UINT32",
52929
+ "INT64",
52930
+ "UINT64",
52931
+ "FLOAT32",
52932
+ "FLOAT64"
52933
+ ].includes(schemaPropertyType);
52934
+ }
52935
+ function getStringOffsets(scenegraph, featureTableProperty, numberOfElements) {
52936
+ if (typeof featureTableProperty.stringOffsetBufferView !== "undefined") {
52937
+ return getOffsetsForProperty(scenegraph, featureTableProperty.stringOffsetBufferView, featureTableProperty.offsetType || "UINT32", numberOfElements);
52938
+ }
52939
+ return null;
52940
+ }
52941
+ function getNumericAttributes(valuesDataBytes, propertyType, elementCount) {
52942
+ let valuesData = convertRawBufferToMetadataArray(valuesDataBytes, "SCALAR", propertyType, elementCount);
52943
+ if (!valuesData) {
52944
+ valuesData = valuesDataBytes;
52945
+ }
52946
+ return valuesData;
52947
+ }
52916
52948
  function getPropertyDataFromTexture(scenegraph, featureTextureProperty, attributeName) {
52917
52949
  const json = scenegraph.gltf.json;
52918
52950
  if (!json.meshes) {
@@ -53030,14 +53062,10 @@ function findFeatureTextureByName(featureTextures, schemaClassName) {
53030
53062
  function getStringAttributes(data, offsetsData, stringsCount) {
53031
53063
  const stringsArray = [];
53032
53064
  const textDecoder = new TextDecoder("utf8");
53033
- let stringOffset = 0;
53034
- const bytesPerStringSize = 4;
53035
53065
  for (let index = 0; index < stringsCount; index++) {
53036
- const stringByteSize = offsetsData[(index + 1) * bytesPerStringSize] - offsetsData[index * bytesPerStringSize];
53037
- const stringData = data.subarray(stringOffset, stringByteSize + stringOffset);
53066
+ const stringData = data.slice(offsetsData[index], offsetsData[index + 1]);
53038
53067
  const stringAttribute = textDecoder.decode(stringData);
53039
53068
  stringsArray.push(stringAttribute);
53040
- stringOffset += stringByteSize;
53041
53069
  }
53042
53070
  return stringsArray;
53043
53071
  }
@@ -59433,6 +59461,11 @@ function makeAttributeObjects(attributes) {
59433
59461
  let colorsList = new Uint8Array(colors);
59434
59462
  let texCoordsList = new Float32Array(texCoords);
59435
59463
  let uvRegionsList = new Uint16Array(uvRegions);
59464
+ let positionsOffset = 0;
59465
+ let normalsOffset = 0;
59466
+ let colorsOffset = 0;
59467
+ let uvRegionsOffset = 0;
59468
+ let texCoordsOffset = 0;
59436
59469
  for (let index = 0; index < featureIds.length; index++) {
59437
59470
  const startIndex = faceRange[index * 2];
59438
59471
  const endIndex = faceRange[index * 2 + 1];
@@ -59443,19 +59476,19 @@ function makeAttributeObjects(attributes) {
59443
59476
  const texCoordsCount = getSliceAttributeCount("texCoords", startIndex, endIndex);
59444
59477
  groupedData.push({
59445
59478
  featureId: featureIds[index],
59446
- positions: positionsList.slice(0, positionsCount),
59447
- normals: normalsList.slice(0, normalsCount),
59448
- colors: colorsList.slice(0, colorsCount),
59449
- uvRegions: uvRegionsList.slice(0, uvRegionsCount),
59450
- texCoords: texCoordsList.slice(0, texCoordsCount)
59479
+ positions: positionsList.subarray(positionsOffset, positionsOffset + positionsCount),
59480
+ normals: normalsList.subarray(normalsOffset, normalsOffset + normalsCount),
59481
+ colors: colorsList.subarray(colorsOffset, colorsOffset + colorsCount),
59482
+ uvRegions: uvRegionsList.subarray(uvRegionsOffset, uvRegionsOffset + uvRegionsCount),
59483
+ texCoords: texCoordsList.subarray(texCoordsOffset, texCoordsOffset + texCoordsCount)
59451
59484
  });
59452
- positionsList = positionsList.slice(positionsCount);
59453
- normalsList = normalsList.slice(normalsCount);
59454
- colorsList = colorsList.slice(colorsCount);
59455
- uvRegionsList = uvRegionsList.slice(uvRegionsCount);
59456
- texCoordsList = texCoordsList.slice(texCoordsCount);
59485
+ positionsOffset += positionsCount;
59486
+ normalsOffset += normalsCount;
59487
+ colorsOffset += colorsCount;
59488
+ uvRegionsOffset += uvRegionsCount;
59489
+ texCoordsOffset += texCoordsCount;
59457
59490
  }
59458
- return groupedData.sort((first, second) => first.featureId - second.featureId);
59491
+ return groupedData;
59459
59492
  }
59460
59493
  function getSliceAttributeCount(attributeName, startIndex, endIndex) {
59461
59494
  const itemsPerVertex4 = 4;
@@ -59476,50 +59509,66 @@ function getSliceAttributeCount(attributeName, startIndex, endIndex) {
59476
59509
  }
59477
59510
  }
59478
59511
  function unifyObjectsByFeatureId(sortedData) {
59479
- const uniqueObjects = [];
59480
- for (let index = 0; index < sortedData.length; index++) {
59481
- const currentObject = sortedData[index];
59482
- const existingObject = uniqueObjects.find((obj) => obj.featureId === currentObject.featureId);
59512
+ const groupedMetadata = [];
59513
+ for (const data of sortedData) {
59514
+ const existingObject = groupedMetadata.find((obj) => obj.featureId === data.featureId);
59483
59515
  if (existingObject) {
59484
- existingObject.positions = concatenateTypedArrays(existingObject.positions, currentObject.positions);
59485
- existingObject.normals = concatenateTypedArrays(existingObject.normals, currentObject.normals);
59486
- existingObject.colors = concatenateTypedArrays(existingObject.colors, currentObject.colors);
59487
- existingObject.texCoords = concatenateTypedArrays(existingObject.texCoords, currentObject.texCoords);
59488
- existingObject.uvRegions = concatenateTypedArrays(existingObject.uvRegions, currentObject.uvRegions);
59516
+ existingObject.attributes.push(data);
59489
59517
  } else {
59490
- uniqueObjects.push(currentObject);
59518
+ groupedMetadata.push({
59519
+ featureId: data.featureId,
59520
+ attributes: [data]
59521
+ });
59491
59522
  }
59492
59523
  }
59524
+ const uniqueObjects = [];
59525
+ for (const metatada of groupedMetadata) {
59526
+ const attributes = concatenateAttributes(metatada.attributes);
59527
+ uniqueObjects.push({
59528
+ featureId: metatada.featureId,
59529
+ ...attributes
59530
+ });
59531
+ }
59493
59532
  return uniqueObjects;
59494
59533
  }
59495
59534
  function groupAttributesAndRangesByFeatureId(unifiedObjects, featureCount) {
59496
59535
  const firstAttributeObject = unifiedObjects[0];
59497
59536
  const featureIds = [firstAttributeObject.featureId || 0];
59498
- let positions = new Float32Array(firstAttributeObject.positions);
59499
- let normals = new Float32Array(firstAttributeObject.normals);
59500
- let colors = new Uint8Array(firstAttributeObject.colors);
59501
- let uvRegions = new Uint16Array(firstAttributeObject.uvRegions);
59502
- let texCoords = new Float32Array(firstAttributeObject.texCoords);
59503
59537
  const range = [0];
59504
59538
  let objIndex = 0;
59505
59539
  let sum = 0;
59506
59540
  for (let index = 1; index < unifiedObjects.length; index++) {
59507
59541
  const currentAttributesObject = unifiedObjects[index];
59508
59542
  featureIds.push(currentAttributesObject.featureId || 0);
59509
- positions = concatenateTypedArrays(positions, currentAttributesObject.positions);
59510
- normals = concatenateTypedArrays(normals, currentAttributesObject.normals);
59511
- colors = concatenateTypedArrays(colors, currentAttributesObject.colors);
59512
- uvRegions = concatenateTypedArrays(uvRegions, currentAttributesObject.uvRegions);
59513
- texCoords = concatenateTypedArrays(texCoords, currentAttributesObject.texCoords);
59514
59543
  const groupedObject = unifiedObjects[objIndex];
59515
59544
  range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1 + sum);
59516
59545
  range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE + sum);
59517
59546
  sum += groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;
59518
59547
  objIndex += 1;
59519
59548
  }
59520
- range.push(positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);
59549
+ const attributes = concatenateAttributes(unifiedObjects);
59550
+ range.push(attributes.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);
59521
59551
  const faceRange = new Uint32Array(range);
59522
- return { faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount };
59552
+ return { faceRange, featureIds, featureCount, ...attributes };
59553
+ }
59554
+ function concatenateAttributes(attributes) {
59555
+ const positionGroups = attributes.map(({ positions: positions2 }) => positions2);
59556
+ const positions = positionGroups.length > 1 ? concatenateTypedArrays(...positionGroups) : positionGroups[0];
59557
+ const normalGroups = attributes.map(({ normals: normals2 }) => normals2);
59558
+ const normals = normalGroups.length > 1 ? concatenateTypedArrays(...normalGroups) : normalGroups[0];
59559
+ const colorGroups = attributes.map(({ colors: colors2 }) => colors2);
59560
+ const colors = colorGroups.length > 1 ? concatenateTypedArrays(...colorGroups) : colorGroups[0];
59561
+ const texCoordGroups = attributes.map(({ texCoords: texCoords2 }) => texCoords2);
59562
+ const texCoords = texCoordGroups.length > 1 ? concatenateTypedArrays(...texCoordGroups) : texCoordGroups[0];
59563
+ const uvRegionGroups = attributes.map(({ uvRegions: uvRegions2 }) => uvRegions2);
59564
+ const uvRegions = uvRegionGroups.length > 1 ? concatenateTypedArrays(...uvRegionGroups) : uvRegionGroups[0];
59565
+ return {
59566
+ positions,
59567
+ normals,
59568
+ colors,
59569
+ texCoords,
59570
+ uvRegions
59571
+ };
59523
59572
  }
59524
59573
 
59525
59574
  // src/i3s-converter/helpers/coordinate-converter.ts
@@ -59818,19 +59867,19 @@ function generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, image
59818
59867
  }
59819
59868
 
59820
59869
  // src/i3s-converter/helpers/feature-attributes.ts
59821
- function flattenPropertyTableByFeatureIds(featureIds, propertyTable) {
59870
+ function flattenPropertyTableByFeatureIds(featureIdsMap, propertyTable) {
59822
59871
  const resultPropertyTable = {};
59823
59872
  for (const propertyName in propertyTable) {
59824
59873
  const properties = propertyTable[propertyName];
59825
- resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIds);
59874
+ resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIdsMap);
59826
59875
  }
59827
59876
  return resultPropertyTable;
59828
59877
  }
59829
- function getPropertiesByFeatureIds(properties, featureIds) {
59878
+ function getPropertiesByFeatureIds(properties, featureIdsMap) {
59830
59879
  const resultProperties = [];
59831
59880
  if (properties) {
59832
- for (const featureId of featureIds) {
59833
- const property = properties[featureId] || null;
59881
+ for (const featureIdKey in featureIdsMap) {
59882
+ const property = properties[featureIdKey] || null;
59834
59883
  resultProperties.push(property);
59835
59884
  }
59836
59885
  }
@@ -60047,8 +60096,9 @@ async function _makeNodeResources({
60047
60096
  const boundingVolumes = convertedAttributes.boundingVolumes;
60048
60097
  const vertexCount = convertedAttributes.positions.length / VALUES_PER_VERTEX2;
60049
60098
  const { faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount } = generateAttributes(convertedAttributes);
60050
- if (tileContent.batchTableJson) {
60051
- makeFeatureIdsUnique(featureIds, convertedAttributes.featureIndices, featuresHashArray, tileContent.batchTableJson);
60099
+ let featureIdsMap = {};
60100
+ if (propertyTable) {
60101
+ featureIdsMap = makeFeatureIdsUnique(featureIds, convertedAttributes.featureIndices, featuresHashArray, propertyTable);
60052
60102
  }
60053
60103
  const header = new Uint32Array(2);
60054
60104
  const typedFeatureIds = generateBigUint64Array(featureIds);
@@ -60065,7 +60115,7 @@ async function _makeNodeResources({
60065
60115
  }, libraries) : null;
60066
60116
  let attributes = [];
60067
60117
  if (attributeStorageInfo && propertyTable) {
60068
- attributes = convertPropertyTableToAttributeBuffers(featureIds, propertyTable, attributeStorageInfo);
60118
+ attributes = convertPropertyTableToAttributeBuffers(featureIds, featureIdsMap, propertyTable, attributeStorageInfo);
60069
60119
  }
60070
60120
  return {
60071
60121
  nodeId,
@@ -60529,6 +60579,7 @@ function makeFeatureIdsUnique(featureIds, featureIndices, featuresHashArray, bat
60529
60579
  const replaceMap = getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray);
60530
60580
  replaceIndicesByUnique(featureIndices, replaceMap);
60531
60581
  replaceIndicesByUnique(featureIds, replaceMap);
60582
+ return replaceMap;
60532
60583
  }
60533
60584
  function getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray) {
60534
60585
  const featureMap = {};
@@ -60559,10 +60610,10 @@ function replaceIndicesByUnique(indicesArray, featureMap) {
60559
60610
  indicesArray[index] = featureMap[indicesArray[index]];
60560
60611
  }
60561
60612
  }
60562
- function convertPropertyTableToAttributeBuffers(featureIds, propertyTable, attributeStorageInfo) {
60613
+ function convertPropertyTableToAttributeBuffers(featureIds, featureIdsMap, propertyTable, attributeStorageInfo) {
60563
60614
  const attributeBuffers = [];
60564
60615
  const needFlattenPropertyTable = checkPropertiesLength(featureIds, propertyTable);
60565
- const properties = needFlattenPropertyTable ? flattenPropertyTableByFeatureIds(featureIds, propertyTable) : propertyTable;
60616
+ const properties = needFlattenPropertyTable ? flattenPropertyTableByFeatureIds(featureIdsMap, propertyTable) : propertyTable;
60566
60617
  const propertyTableWithObjectIds = {
60567
60618
  OBJECTID: featureIds,
60568
60619
  ...properties
@@ -60906,10 +60957,12 @@ var PGMLoader = {
60906
60957
  module: "tile-converter",
60907
60958
  version: VERSION12,
60908
60959
  mimeTypes: ["image/x-portable-graymap"],
60909
- parse: async (arrayBuffer, options) => (0, import_geoid.parsePGM)(new Uint8Array(arrayBuffer), options),
60960
+ parse: async (arrayBuffer, options) => (0, import_geoid.parsePGM)(new Uint8Array(arrayBuffer), options?.pgm || {}),
60910
60961
  extensions: ["pgm"],
60911
60962
  options: {
60912
- cubic: false
60963
+ pgm: {
60964
+ cubic: false
60965
+ }
60913
60966
  }
60914
60967
  };
60915
60968
 
@@ -63342,9 +63395,6 @@ var import_geospatial9 = __toModule(require_es52());
63342
63395
 
63343
63396
  // ../i3s/src/i3s-node-page-loader.ts
63344
63397
  var VERSION15 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
63345
- async function parseNodePage(data, options) {
63346
- return JSON.parse(new TextDecoder().decode(data));
63347
- }
63348
63398
  var I3SNodePageLoader = {
63349
63399
  name: "I3S Node Page",
63350
63400
  id: "i3s-node-page",
@@ -63353,8 +63403,13 @@ var I3SNodePageLoader = {
63353
63403
  mimeTypes: ["application/json"],
63354
63404
  parse: parseNodePage,
63355
63405
  extensions: ["json"],
63356
- options: {}
63406
+ options: {
63407
+ i3s: {}
63408
+ }
63357
63409
  };
63410
+ async function parseNodePage(data, options) {
63411
+ return JSON.parse(new TextDecoder().decode(data));
63412
+ }
63358
63413
 
63359
63414
  // ../i3s/src/lib/helpers/i3s-nodepages-tiles.ts
63360
63415
  var I3SNodePagesTiles = class {