@loaders.gl/i3s 3.3.0-alpha.2 → 3.3.0-alpha.4

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 (66) hide show
  1. package/dist/dist.min.js +273 -203
  2. package/dist/es5/arcgis-webscene-loader.js +1 -1
  3. package/dist/es5/i3s-attribute-loader.js +2 -1
  4. package/dist/es5/i3s-attribute-loader.js.map +1 -1
  5. package/dist/es5/i3s-building-scene-layer-loader.js +1 -1
  6. package/dist/es5/i3s-content-loader.js +4 -2
  7. package/dist/es5/i3s-content-loader.js.map +1 -1
  8. package/dist/es5/i3s-loader.js +3 -2
  9. package/dist/es5/i3s-loader.js.map +1 -1
  10. package/dist/es5/i3s-node-page-loader.js +1 -1
  11. package/dist/es5/index.js.map +1 -1
  12. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +18 -12
  13. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  14. package/dist/es5/lib/utils/customizeColors.js +213 -0
  15. package/dist/es5/lib/utils/customizeColors.js.map +1 -0
  16. package/dist/es5/types.js.map +1 -1
  17. package/dist/es5/workers/i3s-content-nodejs-worker.js +10 -0
  18. package/dist/es5/workers/i3s-content-nodejs-worker.js.map +1 -0
  19. package/dist/esm/arcgis-webscene-loader.js +1 -1
  20. package/dist/esm/i3s-attribute-loader.js +2 -2
  21. package/dist/esm/i3s-attribute-loader.js.map +1 -1
  22. package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
  23. package/dist/esm/i3s-content-loader.js +3 -2
  24. package/dist/esm/i3s-content-loader.js.map +1 -1
  25. package/dist/esm/i3s-loader.js +3 -2
  26. package/dist/esm/i3s-loader.js.map +1 -1
  27. package/dist/esm/i3s-node-page-loader.js +1 -1
  28. package/dist/esm/index.js.map +1 -1
  29. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +12 -11
  30. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  31. package/dist/esm/lib/utils/customizeColors.js +108 -0
  32. package/dist/esm/lib/utils/customizeColors.js.map +1 -0
  33. package/dist/esm/types.js.map +1 -1
  34. package/dist/esm/workers/i3s-content-nodejs-worker.js +5 -0
  35. package/dist/esm/workers/i3s-content-nodejs-worker.js.map +1 -0
  36. package/dist/i3s-attribute-loader.d.ts +6 -0
  37. package/dist/i3s-attribute-loader.d.ts.map +1 -1
  38. package/dist/i3s-attribute-loader.js +2 -1
  39. package/dist/i3s-content-loader.d.ts.map +1 -1
  40. package/dist/i3s-content-loader.js +2 -1
  41. package/dist/i3s-content-nodejs-worker.js +200 -0
  42. package/dist/i3s-content-nodejs-worker.js.map +7 -0
  43. package/dist/i3s-content-worker.js +170 -23
  44. package/dist/i3s-loader.d.ts.map +1 -1
  45. package/dist/i3s-loader.js +2 -1
  46. package/dist/index.d.ts +1 -1
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
  49. package/dist/lib/parsers/parse-i3s-tile-content.js +12 -11
  50. package/dist/lib/utils/customizeColors.d.ts +14 -0
  51. package/dist/lib/utils/customizeColors.d.ts.map +1 -0
  52. package/dist/lib/utils/customizeColors.js +89 -0
  53. package/dist/types.d.ts +52 -1
  54. package/dist/types.d.ts.map +1 -1
  55. package/dist/workers/i3s-content-nodejs-worker.d.ts +2 -0
  56. package/dist/workers/i3s-content-nodejs-worker.d.ts.map +1 -0
  57. package/dist/workers/i3s-content-nodejs-worker.js +6 -0
  58. package/package.json +11 -10
  59. package/src/i3s-attribute-loader.ts +1 -1
  60. package/src/i3s-content-loader.ts +2 -1
  61. package/src/i3s-loader.ts +2 -1
  62. package/src/index.ts +3 -1
  63. package/src/lib/parsers/parse-i3s-tile-content.ts +21 -13
  64. package/src/lib/utils/customizeColors.ts +129 -0
  65. package/src/types.ts +57 -1
  66. package/src/workers/i3s-content-nodejs-worker.ts +5 -0
package/dist/dist.min.js CHANGED
@@ -9540,6 +9540,249 @@
9540
9540
  }
9541
9541
  });
9542
9542
 
9543
+ // src/lib/parsers/parse-i3s-attribute.ts
9544
+ async function parseI3STileAttribute(arrayBuffer, options) {
9545
+ const { attributeName, attributeType } = options;
9546
+ if (!attributeName) {
9547
+ return {};
9548
+ }
9549
+ return {
9550
+ [attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null
9551
+ };
9552
+ }
9553
+ function parseAttribute(attributeType, arrayBuffer) {
9554
+ switch (attributeType) {
9555
+ case STRING_ATTRIBUTE_TYPE:
9556
+ return parseStringsAttribute(arrayBuffer);
9557
+ case OBJECT_ID_ATTRIBUTE_TYPE:
9558
+ return parseShortNumberAttribute(arrayBuffer);
9559
+ case FLOAT_64_TYPE:
9560
+ return parseFloatAttribute(arrayBuffer);
9561
+ case INT_16_ATTRIBUTE_TYPE:
9562
+ return parseInt16ShortNumberAttribute(arrayBuffer);
9563
+ default:
9564
+ return parseShortNumberAttribute(arrayBuffer);
9565
+ }
9566
+ }
9567
+ function parseShortNumberAttribute(arrayBuffer) {
9568
+ const countOffset = 4;
9569
+ return new Uint32Array(arrayBuffer, countOffset);
9570
+ }
9571
+ function parseInt16ShortNumberAttribute(arrayBuffer) {
9572
+ const countOffset = 4;
9573
+ return new Int16Array(arrayBuffer, countOffset);
9574
+ }
9575
+ function parseFloatAttribute(arrayBuffer) {
9576
+ const countOffset = 8;
9577
+ return new Float64Array(arrayBuffer, countOffset);
9578
+ }
9579
+ function parseStringsAttribute(arrayBuffer) {
9580
+ const stringsCountOffset = 0;
9581
+ const dataOffset = 8;
9582
+ const bytesPerStringSize = 4;
9583
+ const stringsArray = [];
9584
+ try {
9585
+ const stringsCount = new DataView(arrayBuffer, stringsCountOffset, bytesPerStringSize).getUint32(stringsCountOffset, true);
9586
+ const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);
9587
+ let stringOffset = dataOffset + stringsCount * bytesPerStringSize;
9588
+ for (const stringByteSize of stringSizes) {
9589
+ const textDecoder = new TextDecoder("utf-8");
9590
+ const stringAttribute = new Uint8Array(arrayBuffer, stringOffset, stringByteSize);
9591
+ stringsArray.push(textDecoder.decode(stringAttribute));
9592
+ stringOffset += stringByteSize;
9593
+ }
9594
+ } catch (error) {
9595
+ console.error("Parse string attribute error: ", error.message);
9596
+ }
9597
+ return stringsArray;
9598
+ }
9599
+ var init_parse_i3s_attribute = __esm({
9600
+ "src/lib/parsers/parse-i3s-attribute.ts"() {
9601
+ init_constants2();
9602
+ }
9603
+ });
9604
+
9605
+ // src/i3s-attribute-loader.ts
9606
+ async function parse3(data, options) {
9607
+ data = parseI3STileAttribute(data, options);
9608
+ return data;
9609
+ }
9610
+ async function loadFeatureAttributes(tile, featureId, options = {}) {
9611
+ const { attributeStorageInfo, attributeUrls, tilesetFields } = getAttributesData(tile);
9612
+ if (!attributeStorageInfo || !attributeUrls || featureId < 0) {
9613
+ return null;
9614
+ }
9615
+ let attributes = [];
9616
+ const attributeLoadPromises = [];
9617
+ for (let index = 0; index < attributeStorageInfo.length; index++) {
9618
+ const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);
9619
+ const attributeName = attributeStorageInfo[index].name;
9620
+ const attributeType = getAttributeValueType(attributeStorageInfo[index]);
9621
+ const loadOptions = { ...options, attributeName, attributeType };
9622
+ const promise = load(url, I3SAttributeLoader, loadOptions);
9623
+ attributeLoadPromises.push(promise);
9624
+ }
9625
+ try {
9626
+ attributes = await Promise.allSettled(attributeLoadPromises);
9627
+ } catch (error) {
9628
+ }
9629
+ if (!attributes.length) {
9630
+ return null;
9631
+ }
9632
+ return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
9633
+ }
9634
+ function getAttributesData(tile) {
9635
+ const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;
9636
+ const attributeUrls = tile.header?.attributeUrls;
9637
+ const tilesetFields = tile.tileset?.tileset?.fields || [];
9638
+ return { attributeStorageInfo, attributeUrls, tilesetFields };
9639
+ }
9640
+ function getAttributeValueType(attribute) {
9641
+ if (attribute.hasOwnProperty("objectIds")) {
9642
+ return "Oid32";
9643
+ } else if (attribute.hasOwnProperty("attributeValues")) {
9644
+ return attribute.attributeValues.valueType;
9645
+ }
9646
+ return "";
9647
+ }
9648
+ function getFeatureIdsAttributeName(attributeStorageInfo) {
9649
+ const objectIdsAttribute = attributeStorageInfo.find((attribute) => attribute.name.includes("OBJECTID"));
9650
+ return objectIdsAttribute?.name;
9651
+ }
9652
+ function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
9653
+ const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
9654
+ const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);
9655
+ if (!objectIds) {
9656
+ return null;
9657
+ }
9658
+ const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
9659
+ if (attributeIndex < 0) {
9660
+ return null;
9661
+ }
9662
+ return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
9663
+ }
9664
+ function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
9665
+ const attributesObject = {};
9666
+ for (let index = 0; index < attributeStorageInfo.length; index++) {
9667
+ const attributeName = attributeStorageInfo[index].name;
9668
+ const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
9669
+ const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
9670
+ attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
9671
+ }
9672
+ return attributesObject;
9673
+ }
9674
+ function getAttributeCodedValues(attributeName, tilesetFields) {
9675
+ const attributeField = tilesetFields.find((field) => field.name === attributeName || field.alias === attributeName);
9676
+ return attributeField?.domain?.codedValues || [];
9677
+ }
9678
+ function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
9679
+ const attributeObject = attributes[index];
9680
+ if (attributeObject.status === REJECTED_STATUS) {
9681
+ return null;
9682
+ }
9683
+ return attributeObject.value[attributesName];
9684
+ }
9685
+ function formatAttributeValue(attribute, featureIdIndex, codedValues) {
9686
+ let value = EMPTY_VALUE;
9687
+ if (attribute && featureIdIndex in attribute) {
9688
+ value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, "").trim();
9689
+ }
9690
+ if (codedValues.length) {
9691
+ const codeValue = codedValues.find((codedValue) => codedValue.code === Number(value));
9692
+ value = codeValue?.name || EMPTY_VALUE;
9693
+ }
9694
+ return value;
9695
+ }
9696
+ var VERSION9, EMPTY_VALUE, REJECTED_STATUS, I3SAttributeLoader;
9697
+ var init_i3s_attribute_loader = __esm({
9698
+ "src/i3s-attribute-loader.ts"() {
9699
+ init_src3();
9700
+ init_parse_i3s_attribute();
9701
+ init_url_utils();
9702
+ VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
9703
+ EMPTY_VALUE = "";
9704
+ REJECTED_STATUS = "rejected";
9705
+ I3SAttributeLoader = {
9706
+ name: "I3S Attribute",
9707
+ id: "i3s-attribute",
9708
+ module: "i3s",
9709
+ version: VERSION9,
9710
+ mimeTypes: ["application/binary"],
9711
+ parse: parse3,
9712
+ extensions: ["bin"],
9713
+ options: {},
9714
+ binary: true
9715
+ };
9716
+ }
9717
+ });
9718
+
9719
+ // src/lib/utils/customizeColors.ts
9720
+ async function customizeColors(colors, featureIds, tileOptions, tilesetOptions, options) {
9721
+ if (!options?.i3s?.colorsByAttribute) {
9722
+ return colors;
9723
+ }
9724
+ const colorizeAttributeField = tilesetOptions.fields.find(({ name }) => name === options?.i3s?.colorsByAttribute?.attributeName);
9725
+ if (!colorizeAttributeField || !["esriFieldTypeDouble", "esriFieldTypeInteger", "esriFieldTypeSmallInteger"].includes(colorizeAttributeField.type)) {
9726
+ return colors;
9727
+ }
9728
+ const colorizeAttributeData = await loadFeatureAttributeData(colorizeAttributeField.name, tileOptions, tilesetOptions, options);
9729
+ if (!colorizeAttributeData) {
9730
+ return colors;
9731
+ }
9732
+ const objectIdField = tilesetOptions.fields.find(({ type }) => type === "esriFieldTypeOID");
9733
+ if (!objectIdField) {
9734
+ return colors;
9735
+ }
9736
+ const objectIdAttributeData = await loadFeatureAttributeData(objectIdField.name, tileOptions, tilesetOptions, options);
9737
+ if (!objectIdAttributeData) {
9738
+ return colors;
9739
+ }
9740
+ const attributeValuesMap = {};
9741
+ for (let i2 = 0; i2 < objectIdAttributeData[objectIdField.name].length; i2++) {
9742
+ attributeValuesMap[objectIdAttributeData[objectIdField.name][i2]] = calculateColorForAttribute(colorizeAttributeData[colorizeAttributeField.name][i2], options);
9743
+ }
9744
+ for (let i2 = 0; i2 < featureIds.value.length; i2++) {
9745
+ const color = attributeValuesMap[featureIds.value[i2]];
9746
+ if (!color) {
9747
+ continue;
9748
+ }
9749
+ colors.value.set(color, i2 * 4);
9750
+ }
9751
+ return colors;
9752
+ }
9753
+ function calculateColorForAttribute(attributeValue, options) {
9754
+ if (!options?.i3s?.colorsByAttribute) {
9755
+ return [255, 255, 255, 255];
9756
+ }
9757
+ const { minValue, maxValue, minColor, maxColor } = options.i3s.colorsByAttribute;
9758
+ const rate = (attributeValue - minValue) / (maxValue - minValue);
9759
+ const color = [255, 255, 255, 255];
9760
+ for (let i2 = 0; i2 < minColor.length; i2++) {
9761
+ color[i2] = Math.round((maxColor[i2] - minColor[i2]) * rate + minColor[i2]);
9762
+ }
9763
+ return color;
9764
+ }
9765
+ async function loadFeatureAttributeData(attributeName, { attributeUrls }, { attributeStorageInfo }, options) {
9766
+ const attributeIndex = attributeStorageInfo.findIndex(({ name }) => attributeName === name);
9767
+ if (attributeIndex === -1) {
9768
+ return null;
9769
+ }
9770
+ const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], options?.i3s?.token);
9771
+ const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);
9772
+ const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {
9773
+ attributeName,
9774
+ attributeType
9775
+ });
9776
+ return objectIdAttributeData;
9777
+ }
9778
+ var init_customizeColors = __esm({
9779
+ "src/lib/utils/customizeColors.ts"() {
9780
+ init_src3();
9781
+ init_i3s_attribute_loader();
9782
+ init_url_utils();
9783
+ }
9784
+ });
9785
+
9543
9786
  // src/lib/parsers/parse-i3s-tile-content.ts
9544
9787
  function getLoaderForTextureFormat(textureFormat) {
9545
9788
  switch (textureFormat) {
@@ -9555,7 +9798,16 @@
9555
9798
  }
9556
9799
  }
9557
9800
  async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, options, context) {
9558
- const content = defaultContent;
9801
+ const content = {
9802
+ attributes: {},
9803
+ indices: null,
9804
+ featureIds: [],
9805
+ vertexCount: 0,
9806
+ modelMatrix: new Matrix4(),
9807
+ coordinateSystem: 0,
9808
+ byteLength: 0,
9809
+ texture: null
9810
+ };
9559
9811
  if (tileOptions.textureUrl) {
9560
9812
  const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);
9561
9813
  const loader = getLoaderForTextureFormat(tileOptions.textureFormat);
@@ -9652,6 +9904,7 @@
9652
9904
  content.modelMatrix = getModelMatrix(attributes.position);
9653
9905
  content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;
9654
9906
  }
9907
+ attributes.color = await customizeColors(attributes.color, attributes.id, tileOptions, tilesetOptions, options);
9655
9908
  content.attributes = {
9656
9909
  positions: attributes.position,
9657
9910
  normals: attributes.normal,
@@ -9902,7 +10155,7 @@
9902
10155
  function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
9903
10156
  return featureIndex?.metadata?.["i3s-feature-ids"]?.intArray;
9904
10157
  }
9905
- var scratchVector5, I3S_ATTRIBUTE_TYPE, defaultContent;
10158
+ var scratchVector5, I3S_ATTRIBUTE_TYPE;
9906
10159
  var init_parse_i3s_tile_content = __esm({
9907
10160
  "src/lib/parsers/parse-i3s-tile-content.ts"() {
9908
10161
  init_src3();
@@ -9914,23 +10167,14 @@
9914
10167
  init_types();
9915
10168
  init_url_utils();
9916
10169
  init_constants2();
10170
+ init_customizeColors();
9917
10171
  scratchVector5 = new Vector3([0, 0, 0]);
9918
10172
  I3S_ATTRIBUTE_TYPE = "i3s-attribute-type";
9919
- defaultContent = {
9920
- attributes: {},
9921
- indices: null,
9922
- featureIds: [],
9923
- vertexCount: 0,
9924
- modelMatrix: new Matrix4(),
9925
- coordinateSystem: 0,
9926
- byteLength: 0,
9927
- texture: null
9928
- };
9929
10173
  }
9930
10174
  });
9931
10175
 
9932
10176
  // src/i3s-content-loader.ts
9933
- async function parse3(data, options, context) {
10177
+ async function parse4(data, options, context) {
9934
10178
  const { tile, _tileOptions, tileset, _tilesetOptions } = options?.i3s || {};
9935
10179
  const tileOptions = _tileOptions || tile;
9936
10180
  const tilesetOptions = _tilesetOptions || tileset;
@@ -9939,19 +10183,20 @@
9939
10183
  }
9940
10184
  return await parseI3STileContent(data, tileOptions, tilesetOptions, options, context);
9941
10185
  }
9942
- var VERSION9, I3SContentLoader;
10186
+ var VERSION10, I3SContentLoader;
9943
10187
  var init_i3s_content_loader = __esm({
9944
10188
  "src/i3s-content-loader.ts"() {
10189
+ init_src();
9945
10190
  init_parse_i3s_tile_content();
9946
- VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
10191
+ VERSION10 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
9947
10192
  I3SContentLoader = {
9948
10193
  name: "I3S Content (Indexed Scene Layers)",
9949
- id: "i3s-content",
10194
+ id: isBrowser2 ? "i3s-content" : "i3s-content-nodejs",
9950
10195
  module: "i3s",
9951
10196
  worker: true,
9952
- version: VERSION9,
10197
+ version: VERSION10,
9953
10198
  mimeTypes: ["application/octet-stream"],
9954
- parse: parse3,
10199
+ parse: parse4,
9955
10200
  extensions: ["bin"],
9956
10201
  options: {
9957
10202
  "i3s-content": {}
@@ -10466,21 +10711,21 @@
10466
10711
  async function parseNodePage(data) {
10467
10712
  return JSON.parse(new TextDecoder().decode(data));
10468
10713
  }
10469
- async function parse4(data) {
10714
+ async function parse5(data) {
10470
10715
  data = parseNodePage(data);
10471
10716
  return data;
10472
10717
  }
10473
- var VERSION10, I3SNodePageLoader;
10718
+ var VERSION11, I3SNodePageLoader;
10474
10719
  var init_i3s_node_page_loader = __esm({
10475
10720
  "src/i3s-node-page-loader.ts"() {
10476
- VERSION10 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
10721
+ VERSION11 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
10477
10722
  I3SNodePageLoader = {
10478
10723
  name: "I3S Node Page",
10479
10724
  id: "i3s-node-page",
10480
10725
  module: "i3s",
10481
- version: VERSION10,
10726
+ version: VERSION11,
10482
10727
  mimeTypes: ["application/json"],
10483
- parse: parse4,
10728
+ parse: parse5,
10484
10729
  extensions: ["json"],
10485
10730
  options: {}
10486
10731
  };
@@ -10799,14 +11044,14 @@
10799
11044
  }
10800
11045
  return null;
10801
11046
  }
10802
- var VERSION11, TILESET_REGEX, TILE_HEADER_REGEX, SLPK_HEX, I3SLoader;
11047
+ var VERSION12, TILESET_REGEX, TILE_HEADER_REGEX, SLPK_HEX, I3SLoader;
10803
11048
  var init_i3s_loader = __esm({
10804
11049
  "src/i3s-loader.ts"() {
10805
11050
  init_src3();
10806
11051
  init_i3s_content_loader();
10807
11052
  init_parse_i3s();
10808
11053
  init_constants2();
10809
- VERSION11 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
11054
+ VERSION12 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
10810
11055
  TILESET_REGEX = /layers\/[0-9]+$/;
10811
11056
  TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
10812
11057
  SLPK_HEX = "504b0304";
@@ -10814,7 +11059,7 @@
10814
11059
  name: "I3S (Indexed Scene Layers)",
10815
11060
  id: "i3s",
10816
11061
  module: "i3s",
10817
- version: VERSION11,
11062
+ version: VERSION12,
10818
11063
  mimeTypes: ["application/octet-stream"],
10819
11064
  parse: parseI3S,
10820
11065
  extensions: ["bin"],
@@ -10830,189 +11075,14 @@
10830
11075
  useDracoGeometry: true,
10831
11076
  useCompressedTextures: true,
10832
11077
  decodeTextures: true,
10833
- coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS
11078
+ coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS,
11079
+ colorsByAttribute: null
10834
11080
  }
10835
11081
  }
10836
11082
  };
10837
11083
  }
10838
11084
  });
10839
11085
 
10840
- // src/lib/parsers/parse-i3s-attribute.ts
10841
- async function parseI3STileAttribute(arrayBuffer, options) {
10842
- const { attributeName, attributeType } = options;
10843
- if (!attributeName) {
10844
- return {};
10845
- }
10846
- return {
10847
- [attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null
10848
- };
10849
- }
10850
- function parseAttribute(attributeType, arrayBuffer) {
10851
- switch (attributeType) {
10852
- case STRING_ATTRIBUTE_TYPE:
10853
- return parseStringsAttribute(arrayBuffer);
10854
- case OBJECT_ID_ATTRIBUTE_TYPE:
10855
- return parseShortNumberAttribute(arrayBuffer);
10856
- case FLOAT_64_TYPE:
10857
- return parseFloatAttribute(arrayBuffer);
10858
- case INT_16_ATTRIBUTE_TYPE:
10859
- return parseInt16ShortNumberAttribute(arrayBuffer);
10860
- default:
10861
- return parseShortNumberAttribute(arrayBuffer);
10862
- }
10863
- }
10864
- function parseShortNumberAttribute(arrayBuffer) {
10865
- const countOffset = 4;
10866
- return new Uint32Array(arrayBuffer, countOffset);
10867
- }
10868
- function parseInt16ShortNumberAttribute(arrayBuffer) {
10869
- const countOffset = 4;
10870
- return new Int16Array(arrayBuffer, countOffset);
10871
- }
10872
- function parseFloatAttribute(arrayBuffer) {
10873
- const countOffset = 8;
10874
- return new Float64Array(arrayBuffer, countOffset);
10875
- }
10876
- function parseStringsAttribute(arrayBuffer) {
10877
- const stringsCountOffset = 0;
10878
- const dataOffset = 8;
10879
- const bytesPerStringSize = 4;
10880
- const stringsArray = [];
10881
- try {
10882
- const stringsCount = new DataView(arrayBuffer, stringsCountOffset, bytesPerStringSize).getUint32(stringsCountOffset, true);
10883
- const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);
10884
- let stringOffset = dataOffset + stringsCount * bytesPerStringSize;
10885
- for (const stringByteSize of stringSizes) {
10886
- const textDecoder = new TextDecoder("utf-8");
10887
- const stringAttribute = new Uint8Array(arrayBuffer, stringOffset, stringByteSize);
10888
- stringsArray.push(textDecoder.decode(stringAttribute));
10889
- stringOffset += stringByteSize;
10890
- }
10891
- } catch (error) {
10892
- console.error("Parse string attribute error: ", error.message);
10893
- }
10894
- return stringsArray;
10895
- }
10896
- var init_parse_i3s_attribute = __esm({
10897
- "src/lib/parsers/parse-i3s-attribute.ts"() {
10898
- init_constants2();
10899
- }
10900
- });
10901
-
10902
- // src/i3s-attribute-loader.ts
10903
- async function parse5(data, options) {
10904
- data = parseI3STileAttribute(data, options);
10905
- return data;
10906
- }
10907
- async function loadFeatureAttributes(tile, featureId, options = {}) {
10908
- const { attributeStorageInfo, attributeUrls, tilesetFields } = getAttributesData(tile);
10909
- if (!attributeStorageInfo || !attributeUrls || featureId < 0) {
10910
- return null;
10911
- }
10912
- let attributes = [];
10913
- const attributeLoadPromises = [];
10914
- for (let index = 0; index < attributeStorageInfo.length; index++) {
10915
- const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);
10916
- const attributeName = attributeStorageInfo[index].name;
10917
- const attributeType = getAttributeValueType(attributeStorageInfo[index]);
10918
- const loadOptions = { ...options, attributeName, attributeType };
10919
- const promise = load(url, I3SAttributeLoader, loadOptions);
10920
- attributeLoadPromises.push(promise);
10921
- }
10922
- try {
10923
- attributes = await Promise.allSettled(attributeLoadPromises);
10924
- } catch (error) {
10925
- }
10926
- if (!attributes.length) {
10927
- return null;
10928
- }
10929
- return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
10930
- }
10931
- function getAttributesData(tile) {
10932
- const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;
10933
- const attributeUrls = tile.header?.attributeUrls;
10934
- const tilesetFields = tile.tileset?.tileset?.fields || [];
10935
- return { attributeStorageInfo, attributeUrls, tilesetFields };
10936
- }
10937
- function getAttributeValueType(attribute) {
10938
- if (attribute.hasOwnProperty("objectIds")) {
10939
- return "Oid32";
10940
- } else if (attribute.hasOwnProperty("attributeValues")) {
10941
- return attribute.attributeValues.valueType;
10942
- }
10943
- return "";
10944
- }
10945
- function getFeatureIdsAttributeName(attributeStorageInfo) {
10946
- const objectIdsAttribute = attributeStorageInfo.find((attribute) => attribute.name.includes("OBJECTID"));
10947
- return objectIdsAttribute?.name;
10948
- }
10949
- function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
10950
- const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
10951
- const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);
10952
- if (!objectIds) {
10953
- return null;
10954
- }
10955
- const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
10956
- if (attributeIndex < 0) {
10957
- return null;
10958
- }
10959
- return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
10960
- }
10961
- function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
10962
- const attributesObject = {};
10963
- for (let index = 0; index < attributeStorageInfo.length; index++) {
10964
- const attributeName = attributeStorageInfo[index].name;
10965
- const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
10966
- const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
10967
- attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
10968
- }
10969
- return attributesObject;
10970
- }
10971
- function getAttributeCodedValues(attributeName, tilesetFields) {
10972
- const attributeField = tilesetFields.find((field) => field.name === attributeName || field.alias === attributeName);
10973
- return attributeField?.domain?.codedValues || [];
10974
- }
10975
- function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
10976
- const attributeObject = attributes[index];
10977
- if (attributeObject.status === REJECTED_STATUS) {
10978
- return null;
10979
- }
10980
- return attributeObject.value[attributesName];
10981
- }
10982
- function formatAttributeValue(attribute, featureIdIndex, codedValues) {
10983
- let value = EMPTY_VALUE;
10984
- if (attribute && featureIdIndex in attribute) {
10985
- value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, "").trim();
10986
- }
10987
- if (codedValues.length) {
10988
- const codeValue = codedValues.find((codedValue) => codedValue.code === Number(value));
10989
- value = codeValue?.name || EMPTY_VALUE;
10990
- }
10991
- return value;
10992
- }
10993
- var VERSION12, EMPTY_VALUE, REJECTED_STATUS, I3SAttributeLoader;
10994
- var init_i3s_attribute_loader = __esm({
10995
- "src/i3s-attribute-loader.ts"() {
10996
- init_src3();
10997
- init_parse_i3s_attribute();
10998
- init_url_utils();
10999
- VERSION12 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
11000
- EMPTY_VALUE = "";
11001
- REJECTED_STATUS = "rejected";
11002
- I3SAttributeLoader = {
11003
- name: "I3S Attribute",
11004
- id: "i3s-attribute",
11005
- module: "i3s",
11006
- version: VERSION12,
11007
- mimeTypes: ["application/binary"],
11008
- parse: parse5,
11009
- extensions: ["bin"],
11010
- options: {},
11011
- binary: true
11012
- };
11013
- }
11014
- });
11015
-
11016
11086
  // src/lib/parsers/parse-i3s-building-scene-layer.ts
11017
11087
  async function parseBuildingSceneLayer(data, url) {
11018
11088
  const layer0 = JSON.parse(new TextDecoder().decode(data));
@@ -13,7 +13,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
13
13
 
14
14
  var _parseArcgisWebscene = require("./lib/parsers/parse-arcgis-webscene");
15
15
 
16
- var VERSION = typeof "3.3.0-alpha.2" !== 'undefined' ? "3.3.0-alpha.2" : 'beta';
16
+ var VERSION = typeof "3.3.0-alpha.4" !== 'undefined' ? "3.3.0-alpha.4" : 'beta';
17
17
  var ArcGisWebSceneLoader = {
18
18
  name: 'ArcGIS Web Scene Loader',
19
19
  id: 'arcgis-web-scene',
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.loadFeatureAttributes = loadFeatureAttributes;
9
+ exports.getAttributeValueType = getAttributeValueType;
9
10
  exports.I3SAttributeLoader = void 0;
10
11
 
11
12
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
@@ -24,7 +25,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
24
25
 
25
26
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
26
27
 
27
- var VERSION = typeof "3.3.0-alpha.2" !== 'undefined' ? "3.3.0-alpha.2" : 'latest';
28
+ var VERSION = typeof "3.3.0-alpha.4" !== 'undefined' ? "3.3.0-alpha.4" : 'latest';
28
29
  var EMPTY_VALUE = '';
29
30
  var REJECTED_STATUS = 'rejected';
30
31
  var I3SAttributeLoader = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/i3s-attribute-loader.ts"],"names":["VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","loadFeatureAttributes","tile","featureId","getAttributesData","attributeStorageInfo","attributeUrls","tilesetFields","attributes","attributeLoadPromises","index","length","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","generateAttributesByFeatureId","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"mappings":";;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;;;;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AACA,IAAMC,WAAW,GAAG,EAApB;AACA,IAAMC,eAAe,GAAG,UAAxB;AAIO,IAAMC,kBAAoC,GAAG;AAClDC,EAAAA,IAAI,EAAE,eAD4C;AAElDC,EAAAA,EAAE,EAAE,eAF8C;AAGlDC,EAAAA,MAAM,EAAE,KAH0C;AAIlDC,EAAAA,OAAO,EAAEP,OAJyC;AAKlDQ,EAAAA,SAAS,EAAE,CAAC,oBAAD,CALuC;AAMlDC,EAAAA,KAAK,EAALA,KANkD;AAOlDC,EAAAA,UAAU,EAAE,CAAC,KAAD,CAPsC;AAQlDC,EAAAA,OAAO,EAAE,EARyC;AASlDC,EAAAA,MAAM,EAAE;AAT0C,CAA7C;;;SAYQH,K;;;;;qEAAf,iBAAqBI,IAArB,EAA2BF,OAA3B;AAAA;AAAA;AAAA;AAAA;AACEE,YAAAA,IAAI,GAAG,8CAAsBA,IAAtB,EAA4BF,OAA5B,CAAP;AADF,6CAESE,IAFT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;SAasBC,qB;;;;;qFAAf,kBAAqCC,IAArC,EAA2CC,SAA3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAsDL,YAAAA,OAAtD,8DAAgE,EAAhE;AAAA,iCACwDM,iBAAiB,CAACF,IAAD,CADzE,EACEG,oBADF,sBACEA,oBADF,EACwBC,aADxB,sBACwBA,aADxB,EACuCC,aADvC,sBACuCA,aADvC;;AAAA,kBAGD,CAACF,oBAAD,IAAyB,CAACC,aAA1B,IAA2CH,SAAS,GAAG,CAHtD;AAAA;AAAA;AAAA;;AAAA,8CAII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7C,EAAyDE,KAAzD,EAAgEyC,cAAhE,EAAgF;AAC9E,MAAMC,eAAe,GAAG5C,UAAU,CAACE,KAAD,CAAlC;;AAEA,MAAI0C,eAAe,CAACC,MAAhB,KAA2BhE,eAA/B,EAAgD;AAC9C,WAAO,IAAP;AACD;;AAED,SAAO+D,eAAe,CAACf,KAAhB,CAAsBc,cAAtB,CAAP;AACD;;AAQD,SAASL,oBAAT,CAA8BnB,SAA9B,EAAyCc,cAAzC,EAAyDE,WAAzD,EAAsE;AACpE,MAAIN,KAAK,GAAGjD,WAAZ;;AAEA,MAAIuC,SAAS,IAAKc,cAAc,IAAId,SAApC,EAAgD;AAE9CU,IAAAA,KAAK,GAAGiB,MAAM,CAAC3B,SAAS,CAACc,cAAD,CAAV,CAAN,CAAkCc,OAAlC,CAA0C,aAA1C,EAAyD,EAAzD,EAA6DC,IAA7D,EAAR;AACD;;AAGD,MAAIb,WAAW,CAAChC,MAAhB,EAAwB;AACtB,QAAM8C,SAAS,GAAGd,WAAW,CAACV,IAAZ,CAAiB,UAAAyB,UAAU;AAAA,aAAIA,UAAU,CAACC,IAAX,KAAoBC,MAAM,CAACvB,KAAD,CAA9B;AAAA,KAA3B,CAAlB;AACAA,IAAAA,KAAK,GAAG,CAAAoB,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAElE,IAAX,KAAmBH,WAA3B;AACD;;AAED,SAAOiD,KAAP;AACD","sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\n/**\n * Load attributes based on feature id\n * @param {Object} tile\n * @param {number} featureId\n * @param {Object} options\n * @returns {Promise}\n */\n// eslint-disable-next-line complexity\nexport async function loadFeatureAttributes(tile, featureId, options = {}) {\n const {attributeStorageInfo, attributeUrls, tilesetFields} = getAttributesData(tile);\n\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n // @ts-ignore\n const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);\n const attributeName = attributeStorageInfo[index].name;\n const attributeType = getAttributeValueType(attributeStorageInfo[index]);\n const loadOptions = {...options, attributeName, attributeType};\n const promise = load(url, I3SAttributeLoader, loadOptions);\n\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\n\n/**\n * Gets attributes data from tile.\n * @param tile \n * @returns \n */\nfunction getAttributesData(tile) {\n const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;\n const attributeUrls = tile.header?.attributeUrls;\n const tilesetFields = tile.tileset?.tileset?.fields || [];\n\n return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\n\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\nfunction getAttributeValueType(attribute) {\n if (attribute.hasOwnProperty('objectIds')) {\n return 'Oid32';\n } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\n\n/**\n * Find in attributeStorageInfo attribute name responsible for feature ids list.\n * @param attributeStorageInfo \n * @returns Feature ids attribute name\n */\nfunction getFeatureIdsAttributeName(attributeStorageInfo) {\n const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));\n\n return objectIdsAttribute?.name;\n}\n\n/**\n * Generates mapping featureId to feature attributes\n * @param {Array} attributes\n * @param {Object} attributeStorageInfo\n * @param {number} featureId\n * @returns {Object}\n */\nfunction generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {\n const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);\n const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);\n\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\n\n/**\n * Generates attribute object for feature mapping by feature id\n * @param {Array} attributes\n * @param {Number} featureIdIndex\n * @param {Object} attributeStorageInfo\n * @returns {Object}\n */\nfunction getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {\n const attributesObject = {};\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const attributeName = attributeStorageInfo[index].name;\n const codedValues = getAttributeCodedValues(attributeName, tilesetFields);\n const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);\n attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);\n }\n\n return attributesObject;\n}\n\n/**\n * Get coded values list from tileset.\n * @param attributeName \n * @param tilesetFields \n */\nfunction getAttributeCodedValues(attributeName, tilesetFields) {\n const attributeField = tilesetFields\n .find(field => field.name === attributeName || field.alias === attributeName);\n\n return attributeField?.domain?.codedValues || [];\n}\n\n/**\n * Return attribute value if it presents in atrributes list\n * @param {array} attributes\n * @param {number} index\n * @param {string} attributesName\n */\nfunction getAttributeByIndexAndAttributeName(attributes, index, attributesName) {\n const attributeObject = attributes[index];\n\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n\n return attributeObject.value[attributesName];\n}\n\n/**\n * Do formatting of attribute values or return empty string.\n * @param {Array} attribute\n * @param {Number} featureIdIndex\n * @returns {String}\n */\nfunction formatAttributeValue(attribute, featureIdIndex, codedValues) {\n let value = EMPTY_VALUE;\n\n if (attribute && (featureIdIndex in attribute)) {\n // eslint-disable-next-line no-control-regex\n value = String(attribute[featureIdIndex]).replace(/\\u0000|NaN/g, '').trim();\n }\n\n // Check if coded values are existed. If so we use them.\n if (codedValues.length) {\n const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));\n value = codeValue?.name || EMPTY_VALUE;\n }\n\n return value;\n}\n"],"file":"i3s-attribute-loader.js"}
1
+ {"version":3,"sources":["../../src/i3s-attribute-loader.ts"],"names":["VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","loadFeatureAttributes","tile","featureId","getAttributesData","attributeStorageInfo","attributeUrls","tilesetFields","attributes","attributeLoadPromises","index","length","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","generateAttributesByFeatureId","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"mappings":";;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;;;;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AACA,IAAMC,WAAW,GAAG,EAApB;AACA,IAAMC,eAAe,GAAG,UAAxB;AAIO,IAAMC,kBAAoC,GAAG;AAClDC,EA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,oBAAT,CAA8BnB,SAA9B,EAAyCc,cAAzC,EAAyDE,WAAzD,EAAsE;AACpE,MAAIN,KAAK,GAAGjD,WAAZ;;AAEA,MAAIuC,SAAS,IAAKc,cAAc,IAAId,SAApC,EAAgD;AAE9CU,IAAAA,KAAK,GAAGiB,MAAM,CAAC3B,SAAS,CAACc,cAAD,CAAV,CAAN,CAAkCc,OAAlC,CAA0C,aAA1C,EAAyD,EAAzD,EAA6DC,IAA7D,EAAR;AACD;;AAGD,MAAIb,WAAW,CAAChC,MAAhB,EAAwB;AACtB,QAAM8C,SAAS,GAAGd,WAAW,CAACV,IAAZ,CAAiB,UAAAyB,UAAU;AAAA,aAAIA,UAAU,CAACC,IAAX,KAAoBC,MAAM,CAACvB,KAAD,CAA9B;AAAA,KAA3B,CAAlB;AACAA,IAAAA,KAAK,GAAG,CAAAoB,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAElE,IAAX,KAAmBH,WAA3B;AACD;;AAED,SAAOiD,KAAP;AACD","sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\n/**\n * Load attributes based on feature id\n * @param {Object} tile\n * @param {number} featureId\n * @param {Object} options\n * @returns {Promise}\n */\n// eslint-disable-next-line complexity\nexport async function loadFeatureAttributes(tile, featureId, options = {}) {\n const {attributeStorageInfo, attributeUrls, tilesetFields} = getAttributesData(tile);\n\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n // @ts-ignore\n const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);\n const attributeName = attributeStorageInfo[index].name;\n const attributeType = getAttributeValueType(attributeStorageInfo[index]);\n const loadOptions = {...options, attributeName, attributeType};\n const promise = load(url, I3SAttributeLoader, loadOptions);\n\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\n\n/**\n * Gets attributes data from tile.\n * @param tile \n * @returns \n */\nfunction getAttributesData(tile) {\n const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;\n const attributeUrls = tile.header?.attributeUrls;\n const tilesetFields = tile.tileset?.tileset?.fields || [];\n\n return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\n\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\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"],"file":"i3s-attribute-loader.js"}