@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
@@ -1 +1 @@
1
- {"version":3,"file":"load-i3s.js","names":["_core","require","_i3s","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","loadI3SContent","_ref","_asyncToGenerator2","_regenerator","mark","_callee","sourceTileset","sourceTile","tilesetLoadOptions","loadOptions","tileContent","wrap","_callee$","_context","prev","next","contentUrl","abrupt","i3s","isTileset","isTileHeader","_tileOptions","attributeUrls","textureUrl","textureFormat","textureLoaderOptions","materialDefinition","isDracoGeometry","mbs","_tilesetOptions","store","attributeStorageInfo","fields","load","I3SLoader","sent","stop","_x","_x2","_x3","exports"],"sources":["../../../../src/3d-tiles-converter/helpers/load-i3s.ts"],"sourcesContent":["import {load} from '@loaders.gl/core';\nimport {\n I3STileContent,\n I3STileHeader,\n I3STilesetHeader,\n I3SLoader,\n I3SLoaderOptions\n} from '@loaders.gl/i3s';\n\n/**\n * Load I3S node content\n * @param sourceTileset - source layer JSON\n * @param sourceTile - source I3S node metadata\n * @param tilesetLoadOptions - load options for Tiles3DLoader\n * @returns - 3DTiles tile content or null\n */\nexport const loadI3SContent = async (\n sourceTileset: I3STilesetHeader | null,\n sourceTile: I3STileHeader,\n tilesetLoadOptions: I3SLoaderOptions\n): Promise<I3STileContent | null> => {\n if (!sourceTileset || !sourceTile.contentUrl) {\n return null;\n }\n\n const loadOptions = {\n ...tilesetLoadOptions,\n i3s: {\n ...tilesetLoadOptions.i3s,\n isTileset: false,\n isTileHeader: false,\n _tileOptions: {\n attributeUrls: sourceTile.attributeUrls,\n textureUrl: sourceTile.textureUrl,\n textureFormat: sourceTile.textureFormat,\n textureLoaderOptions: sourceTile.textureLoaderOptions,\n materialDefinition: sourceTile.materialDefinition,\n isDracoGeometry: sourceTile.isDracoGeometry,\n mbs: sourceTile.mbs\n },\n _tilesetOptions: {\n store: sourceTileset.store,\n attributeStorageInfo: sourceTileset.attributeStorageInfo,\n fields: sourceTileset.fields\n }\n }\n };\n const tileContent = await load(sourceTile.contentUrl, I3SLoader, loadOptions);\n\n return tileContent;\n};\n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AAA,OAAAG,QAAA,CAAAuB,IAAA;MAAA;IAAA,GAAA/B,OAAA;EAAA,CACnB;EAAA,gBAlCYL,cAAcA,CAAAqC,EAAA,EAAAC,GAAA,EAAAC,GAAA;IAAA,OAAAtC,IAAA,CAAAf,KAAA,OAAAI,SAAA;EAAA;AAAA,GAkC1B;AAACkD,OAAA,CAAAxC,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"file":"load-i3s.js","names":["_core","require","_i3s","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","loadI3SContent","_ref","_asyncToGenerator2","_regenerator","mark","_callee","sourceTileset","sourceTile","tilesetLoadOptions","loadOptions","tileContent","wrap","_callee$","_context","prev","next","contentUrl","abrupt","i3s","isTileset","isTileHeader","_tileOptions","attributeUrls","textureUrl","textureFormat","textureLoaderOptions","materialDefinition","isDracoGeometry","mbs","_tilesetOptions","store","attributeStorageInfo","fields","load","I3SLoader","sent","stop","_x","_x2","_x3","exports"],"sources":["../../../../src/3d-tiles-converter/helpers/load-i3s.ts"],"sourcesContent":["import {load} from '@loaders.gl/core';\nimport {\n I3STileContent,\n I3STileHeader,\n I3STilesetHeader,\n I3SLoader,\n I3SLoaderOptions\n} from '@loaders.gl/i3s';\n\n/**\n * Load I3S node content\n * @param sourceTileset - source layer JSON\n * @param sourceTile - source I3S node metadata\n * @param tilesetLoadOptions - load options for Tiles3DLoader\n * @returns - 3DTiles tile content or null\n */\nexport const loadI3SContent = async (\n sourceTileset: I3STilesetHeader | null,\n sourceTile: I3STileHeader,\n tilesetLoadOptions: I3SLoaderOptions\n): Promise<I3STileContent | null> => {\n if (!sourceTileset || !sourceTile.contentUrl) {\n return null;\n }\n\n const loadOptions = {\n ...tilesetLoadOptions,\n i3s: {\n ...tilesetLoadOptions.i3s,\n isTileset: false,\n isTileHeader: false,\n _tileOptions: {\n attributeUrls: sourceTile.attributeUrls,\n textureUrl: sourceTile.textureUrl,\n textureFormat: sourceTile.textureFormat,\n textureLoaderOptions: sourceTile.textureLoaderOptions,\n materialDefinition: sourceTile.materialDefinition,\n isDracoGeometry: sourceTile.isDracoGeometry,\n mbs: sourceTile.mbs\n },\n _tilesetOptions: {\n store: sourceTileset.store,\n attributeStorageInfo: sourceTileset.attributeStorageInfo,\n fields: sourceTileset.fields\n }\n }\n };\n const tileContent = await load(sourceTile.contentUrl, I3SLoader, loadOptions);\n\n // @ts-expect-error\n return tileContent;\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAMyB,SAAAE,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,QAAAC,gBAAA,CAAAC,OAAA,EAAAR,MAAA,EAAAM,GAAA,EAAAF,MAAA,CAAAE,GAAA,SAAAhB,MAAA,CAAAmB,yBAAA,GAAAnB,MAAA,CAAAoB,gBAAA,CAA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EAAE;gBACfC,KAAK,EAAExB,aAAa,CAACwB,KAAK;gBAC1BC,oBAAoB,EAAEzB,aAAa,CAACyB,oBAAoB;gBACxDC,MAAM,EAAE1B,aAAa,CAAC0B;cACxB;YAAC;UACF;UAAAnB,QAAA,CAAAE,IAAA;UAAA,OAEuB,IAAAkB,UAAI,EAAC1B,UAAU,CAACS,UAAU,EAAEkB,cAAS,EAAEzB,WAAW,CAAC;QAAA;UAAvEC,WAAW,GAAAG,QAAA,CAAAsB,IAAA;UAAA,OAAAtB,QAAA,CAAAI,MAAA,WAGVP,WAAW;QAAA;QAAA;UAAA,OAAAG,QAAA,CAAAuB,IAAA;MAAA;IAAA,GAAA/B,OAAA;EAAA,CACnB;EAAA,gBAnCYL,cAAcA,CAAAqC,EAAA,EAAAC,GAAA,EAAAC,GAAA;IAAA,OAAAtC,IAAA,CAAAf,KAAA,OAAAI,SAAA;EAAA;AAAA,GAmC1B;AAACkD,OAAA,CAAAxC,cAAA,GAAAA,cAAA"}
@@ -16,7 +16,7 @@ var _path = require("path");
16
16
  var _workerUtils = require("@loaders.gl/worker-utils");
17
17
  var _draco = require("@loaders.gl/draco");
18
18
  var _textures = require("@loaders.gl/textures");
19
- var VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'beta';
19
+ var VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'beta';
20
20
  var PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';
21
21
  var DepsInstaller = function () {
22
22
  function DepsInstaller() {
@@ -12,32 +12,20 @@ exports.flattenPropertyTableByFeatureIds = flattenPropertyTableByFeatureIds;
12
12
  exports.getAttributeType = getAttributeType;
13
13
  exports.getFieldAttributeType = getFieldAttributeType;
14
14
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
15
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
16
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
17
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
18
- function flattenPropertyTableByFeatureIds(featureIds, propertyTable) {
15
+ function flattenPropertyTableByFeatureIds(featureIdsMap, propertyTable) {
19
16
  var resultPropertyTable = {};
20
17
  for (var propertyName in propertyTable) {
21
18
  var properties = propertyTable[propertyName];
22
- resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIds);
19
+ resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIdsMap);
23
20
  }
24
21
  return resultPropertyTable;
25
22
  }
26
- function getPropertiesByFeatureIds(properties, featureIds) {
23
+ function getPropertiesByFeatureIds(properties, featureIdsMap) {
27
24
  var resultProperties = [];
28
25
  if (properties) {
29
- var _iterator = _createForOfIteratorHelper(featureIds),
30
- _step;
31
- try {
32
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
33
- var featureId = _step.value;
34
- var property = properties[featureId] || null;
35
- resultProperties.push(property);
36
- }
37
- } catch (err) {
38
- _iterator.e(err);
39
- } finally {
40
- _iterator.f();
26
+ for (var featureIdKey in featureIdsMap) {
27
+ var property = properties[featureIdKey] || null;
28
+ resultProperties.push(property);
41
29
  }
42
30
  }
43
31
  return resultProperties;
@@ -1 +1 @@
1
- {"version":3,"file":"feature-attributes.js","names":["flattenPropertyTableByFeatureIds","featureIds","propertyTable","resultPropertyTable","propertyName","properties","getPropertiesByFeatureIds","resultProperties","_iterator","_createForOfIteratorHelper","_step","s","n","done","featureId","value","property","push","err","e","f","checkPropertiesLength","needFlatten","_i","_Object$values","Object","values","length","attribute","STRING_TYPE","SHORT_INT_TYPE","DOUBLE_TYPE","OBJECT_ID_TYPE","getAttributeType","key","_typeof2","default","Number","isInteger","createdStorageAttribute","attributeIndex","attributeType","storageAttribute","concat","name","ordering","header","valueType","attributeValues","valuesPerElement","setupIdAttribute","setupStringAttribute","setupDoubleAttribute","getFieldAttributeType","createFieldAttribute","fieldAttributeType","type","alias","createPopupInfo","title","mediaInfos","fieldInfos","popupElements","expressionInfos","fieldName","visible","isEditable","label","unshift","encoding","attributeByteCounts"],"sources":["../../../../src/i3s-converter/helpers/feature-attributes.ts"],"sourcesContent":["import type {FeatureTableJson} from '@loaders.gl/3d-tiles';\nimport {\n Attribute,\n AttributeStorageInfo,\n ESRIField,\n Field,\n FieldInfo,\n PopupInfo\n} from '@loaders.gl/i3s';\n\n/**\n * Takes attributes from property table based on featureIds.\n * If there is no property value for particular featureId (index) the property will be null.\n * Example:\n * Initial data:\n * OBJECTID: [0, 1, 5]\n * component: ['Windows', 'Frames', 'Wall', 'Roof', 'Skylight']\n * Result:\n * OBJECTID: [0, 1, 5]\n * component: ['Windows', 'Frames', 'null']\n * @param featureIds\n * @param propertyTable\n */\nexport function flattenPropertyTableByFeatureIds(\n featureIds: number[],\n propertyTable: FeatureTableJson\n): FeatureTableJson {\n const resultPropertyTable: FeatureTableJson = {};\n for (const propertyName in propertyTable) {\n const properties = propertyTable[propertyName];\n resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIds);\n }\n\n return resultPropertyTable;\n}\n\n/**\n * Getting properties by featureId index\n * @param properties\n * @param featureIds\n */\nfunction getPropertiesByFeatureIds(properties: unknown[], featureIds: number[]): unknown[] {\n const resultProperties: unknown[] = [];\n\n if (properties) {\n for (const featureId of featureIds) {\n const property = properties[featureId] || null;\n resultProperties.push(property);\n }\n }\n\n return resultProperties;\n}\n\n/**\n * Check that all attributes in propertyTable have the same length as FeatureIds.\n * If there are differencies between lengths we should flatten property table based on exiesting featureIds.\n * @param featureIds\n * @param propertyTable\n * @returns\n */\nexport function checkPropertiesLength(\n featureIds: number[],\n propertyTable: FeatureTableJson\n): boolean {\n let needFlatten = false;\n\n for (const attribute of Object.values(propertyTable)) {\n if (!featureIds || !attribute || featureIds.length !== attribute.length) {\n needFlatten = true;\n }\n }\n\n return needFlatten;\n}\n\n/** String data type name for feature attributes */\nconst STRING_TYPE = 'string';\n/** Integer data type name for feature attributes */\nconst SHORT_INT_TYPE = 'Int32';\n/** Double data type name for feature attributes */\nconst DOUBLE_TYPE = 'double';\n/** Type of attribute that is linked with feature ids */\nconst OBJECT_ID_TYPE = 'OBJECTID';\n/**\n * Get the attribute type for attributeStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param key - attribute's key\n * @param attribute - attribute's type in propertyTable\n */\nexport function getAttributeType(key: string, attribute: string): string {\n if (key === OBJECT_ID_TYPE) {\n return OBJECT_ID_TYPE;\n }\n if (typeof attribute === STRING_TYPE) {\n return STRING_TYPE;\n } else if (typeof attribute === 'number') {\n return Number.isInteger(attribute) ? SHORT_INT_TYPE : DOUBLE_TYPE;\n }\n return STRING_TYPE;\n}\n\n/**\n * Generate storage attribute for map segmentation.\n * @param attributeIndex - order index of attribute (f_0, f_1 ...).\n * @param key - attribute key from propertyTable.\n * @param attributeType - attribute type.\n * @return Updated storageAttribute.\n */\nexport function createdStorageAttribute(\n attributeIndex: number,\n key: string,\n attributeType: Attribute\n): AttributeStorageInfo {\n const storageAttribute = {\n key: `f_${attributeIndex}`,\n name: key,\n ordering: ['attributeValues'],\n header: [{property: 'count', valueType: 'UInt32'}],\n attributeValues: {valueType: 'Int32', valuesPerElement: 1}\n };\n\n switch (attributeType) {\n case OBJECT_ID_TYPE:\n setupIdAttribute(storageAttribute);\n break;\n case STRING_TYPE:\n setupStringAttribute(storageAttribute);\n break;\n case DOUBLE_TYPE:\n setupDoubleAttribute(storageAttribute);\n break;\n case SHORT_INT_TYPE:\n break;\n default:\n setupStringAttribute(storageAttribute);\n }\n\n return storageAttribute;\n}\n\n/**\n * Find and return attribute type based on key form propertyTable.\n * @param attributeType\n */\nexport function getFieldAttributeType(attributeType: Attribute): ESRIField {\n switch (attributeType) {\n case OBJECT_ID_TYPE:\n return 'esriFieldTypeOID';\n case STRING_TYPE:\n return 'esriFieldTypeString';\n case SHORT_INT_TYPE:\n return 'esriFieldTypeInteger';\n case DOUBLE_TYPE:\n return 'esriFieldTypeDouble';\n default:\n return 'esriFieldTypeString';\n }\n}\n\n/**\n * Setup field attribute for map segmentation.\n * @param key - attribute for map segmentation.\n * @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').\n */\nexport function createFieldAttribute(key: string, fieldAttributeType: ESRIField): Field {\n return {\n name: key,\n type: fieldAttributeType,\n alias: key\n };\n}\n\n/**\n * Generate popup info to show metadata on the map.\n * @param propertyTable - table data with OBJECTID.\n * @return data for correct rendering of popup.\n */\nexport function createPopupInfo(propertyTable: FeatureTableJson): PopupInfo {\n const title = '{OBJECTID}';\n const mediaInfos = [];\n const fieldInfos: FieldInfo[] = [];\n const popupElements: {\n fieldInfos: FieldInfo[];\n type: string;\n }[] = [];\n const expressionInfos = [];\n\n for (const key in propertyTable) {\n fieldInfos.push({\n fieldName: key,\n visible: true,\n isEditable: false,\n label: key\n });\n }\n popupElements.push({\n fieldInfos,\n type: 'fields'\n });\n\n return {\n title,\n mediaInfos,\n popupElements,\n fieldInfos,\n expressionInfos\n };\n}\n\n/**\n * Setup storage attribute as string.\n * @param storageAttribute - attribute for map segmentation.\n */\nfunction setupStringAttribute(storageAttribute: AttributeStorageInfo): void {\n // @ts-expect-error\n storageAttribute.ordering.unshift('attributeByteCounts');\n storageAttribute.header.push({property: 'attributeValuesByteCount', valueType: 'UInt32'});\n storageAttribute.attributeValues = {\n valueType: 'String',\n encoding: 'UTF-8',\n valuesPerElement: 1\n };\n storageAttribute.attributeByteCounts = {\n valueType: 'UInt32',\n valuesPerElement: 1\n };\n}\n\n/**\n * Setup Id attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\nfunction setupIdAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Oid32',\n valuesPerElement: 1\n };\n}\n\n/**\n * Setup double attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\nfunction setupDoubleAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Float64',\n valuesPerElement: 1\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAuBO,SAASA,gCAAgCA,CAC9CC,UAAoB,EACpBC,aAA+B,EACb;EAClB,IAAMC,mBAAqC,GAAG,CAAC,CAAC;EAChD,KAAK,IAAMC,YAAY,IAAIF,aAAa,EAAE;IACxC,IAAMG,UAAU,GAAGH,aAAa,CAACE,YAAY,CAAC;IAC9CD,mBAAmB,CAACC,YAAY,CAAC,GAAGE,yBAAyB,CAACD,UAAU,EAAEJ,UAAU,CAAC;EACvF;EAEA,OAAOE,mBAAmB;AAC5B;AAOA,SAASG,yBAAyBA,CAACD,UAAqB,EAAEJ,UAAoB,EAAa;EACzF,IAAMM,gBAA2B,GAAG,EAAE;EAEtC,IAAIF,UAAU,EAAE;IAA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EAAE,OAAO;IAClBE,gBAAgB,EAAE;EACpB,CAAC;AACH;AAMA,SAASG,oBAAoBA,CAACV,gBAAsC,EAAQ;EAC1EA,gBAAgB,CAACM,eAAe,GAAG;IACjCD,SAAS,EAAE,SAAS;IACpBE,gBAAgB,EAAE;EACpB,CAAC;AACH"}
1
+ {"version":3,"file":"feature-attributes.js","names":["flattenPropertyTableByFeatureIds","featureIdsMap","propertyTable","resultPropertyTable","propertyName","properties","getPropertiesByFeatureIds","resultProperties","featureIdKey","property","push","checkPropertiesLength","featureIds","needFlatten","_i","_Object$values","Object","values","length","attribute","STRING_TYPE","SHORT_INT_TYPE","DOUBLE_TYPE","OBJECT_ID_TYPE","getAttributeType","key","_typeof2","default","Number","isInteger","createdStorageAttribute","attributeIndex","attributeType","storageAttribute","concat","name","ordering","header","valueType","attributeValues","valuesPerElement","setupIdAttribute","setupStringAttribute","setupDoubleAttribute","getFieldAttributeType","createFieldAttribute","fieldAttributeType","type","alias","createPopupInfo","title","mediaInfos","fieldInfos","popupElements","expressionInfos","fieldName","visible","isEditable","label","unshift","encoding","attributeByteCounts"],"sources":["../../../../src/i3s-converter/helpers/feature-attributes.ts"],"sourcesContent":["import type {FeatureTableJson} from '@loaders.gl/3d-tiles';\nimport {\n Attribute,\n AttributeStorageInfo,\n ESRIField,\n Field,\n FieldInfo,\n PopupInfo\n} from '@loaders.gl/i3s';\n\n/**\n * Takes attributes from property table based on featureIdsMap.\n * If there is no property value for particular featureId (index) the property will be null.\n * Example:\n * Initial data:\n * OBJECTID: {0: 0, 3: 33, 4: 333}\n * component: ['Windows', 'Frames', 'Wall', 'Roof', 'Skylight']\n * Result:\n * OBJECTID: [0, 33, 333]\n * component: ['Windows', 'Roof', 'Skylight']\n * @param featureIdsMap\n * @param propertyTable\n */\nexport function flattenPropertyTableByFeatureIds(\n featureIdsMap: Record<string, number>,\n propertyTable: FeatureTableJson\n): FeatureTableJson {\n const resultPropertyTable: FeatureTableJson = {};\n for (const propertyName in propertyTable) {\n const properties = propertyTable[propertyName];\n resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIdsMap);\n }\n\n return resultPropertyTable;\n}\n\n/**\n * Getting properties by featureId index\n * @param properties\n * @param featureIdsMap\n */\nfunction getPropertiesByFeatureIds(\n properties: unknown[],\n featureIdsMap: Record<string, number>\n): unknown[] {\n const resultProperties: unknown[] = [];\n\n if (properties) {\n for (const featureIdKey in featureIdsMap) {\n const property = properties[featureIdKey] || null;\n resultProperties.push(property);\n }\n }\n\n return resultProperties;\n}\n\n/**\n * Check that all attributes in propertyTable have the same length as FeatureIds.\n * If there are differencies between lengths we should flatten property table based on exiesting featureIds.\n * @param featureIds\n * @param propertyTable\n * @returns\n */\nexport function checkPropertiesLength(\n featureIds: number[],\n propertyTable: FeatureTableJson\n): boolean {\n let needFlatten = false;\n\n for (const attribute of Object.values(propertyTable)) {\n if (!featureIds || !attribute || featureIds.length !== attribute.length) {\n needFlatten = true;\n }\n }\n\n return needFlatten;\n}\n\n/** String data type name for feature attributes */\nconst STRING_TYPE = 'string';\n/** Integer data type name for feature attributes */\nconst SHORT_INT_TYPE = 'Int32';\n/** Double data type name for feature attributes */\nconst DOUBLE_TYPE = 'double';\n/** Type of attribute that is linked with feature ids */\nconst OBJECT_ID_TYPE = 'OBJECTID';\n/**\n * Get the attribute type for attributeStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param key - attribute's key\n * @param attribute - attribute's type in propertyTable\n */\nexport function getAttributeType(key: string, attribute: string): string {\n if (key === OBJECT_ID_TYPE) {\n return OBJECT_ID_TYPE;\n }\n if (typeof attribute === STRING_TYPE) {\n return STRING_TYPE;\n } else if (typeof attribute === 'number') {\n return Number.isInteger(attribute) ? SHORT_INT_TYPE : DOUBLE_TYPE;\n }\n return STRING_TYPE;\n}\n\n/**\n * Generate storage attribute for map segmentation.\n * @param attributeIndex - order index of attribute (f_0, f_1 ...).\n * @param key - attribute key from propertyTable.\n * @param attributeType - attribute type.\n * @return Updated storageAttribute.\n */\nexport function createdStorageAttribute(\n attributeIndex: number,\n key: string,\n attributeType: Attribute\n): AttributeStorageInfo {\n const storageAttribute = {\n key: `f_${attributeIndex}`,\n name: key,\n ordering: ['attributeValues'],\n header: [{property: 'count', valueType: 'UInt32'}],\n attributeValues: {valueType: 'Int32', valuesPerElement: 1}\n };\n\n switch (attributeType) {\n case OBJECT_ID_TYPE:\n setupIdAttribute(storageAttribute);\n break;\n case STRING_TYPE:\n setupStringAttribute(storageAttribute);\n break;\n case DOUBLE_TYPE:\n setupDoubleAttribute(storageAttribute);\n break;\n case SHORT_INT_TYPE:\n break;\n default:\n setupStringAttribute(storageAttribute);\n }\n\n return storageAttribute;\n}\n\n/**\n * Find and return attribute type based on key form propertyTable.\n * @param attributeType\n */\nexport function getFieldAttributeType(attributeType: Attribute): ESRIField {\n switch (attributeType) {\n case OBJECT_ID_TYPE:\n return 'esriFieldTypeOID';\n case STRING_TYPE:\n return 'esriFieldTypeString';\n case SHORT_INT_TYPE:\n return 'esriFieldTypeInteger';\n case DOUBLE_TYPE:\n return 'esriFieldTypeDouble';\n default:\n return 'esriFieldTypeString';\n }\n}\n\n/**\n * Setup field attribute for map segmentation.\n * @param key - attribute for map segmentation.\n * @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').\n */\nexport function createFieldAttribute(key: string, fieldAttributeType: ESRIField): Field {\n return {\n name: key,\n type: fieldAttributeType,\n alias: key\n };\n}\n\n/**\n * Generate popup info to show metadata on the map.\n * @param propertyTable - table data with OBJECTID.\n * @return data for correct rendering of popup.\n */\nexport function createPopupInfo(propertyTable: FeatureTableJson): PopupInfo {\n const title = '{OBJECTID}';\n const mediaInfos = [];\n const fieldInfos: FieldInfo[] = [];\n const popupElements: {\n fieldInfos: FieldInfo[];\n type: string;\n }[] = [];\n const expressionInfos = [];\n\n for (const key in propertyTable) {\n fieldInfos.push({\n fieldName: key,\n visible: true,\n isEditable: false,\n label: key\n });\n }\n popupElements.push({\n fieldInfos,\n type: 'fields'\n });\n\n return {\n title,\n mediaInfos,\n popupElements,\n fieldInfos,\n expressionInfos\n };\n}\n\n/**\n * Setup storage attribute as string.\n * @param storageAttribute - attribute for map segmentation.\n */\nfunction setupStringAttribute(storageAttribute: AttributeStorageInfo): void {\n // @ts-expect-error\n storageAttribute.ordering.unshift('attributeByteCounts');\n storageAttribute.header.push({property: 'attributeValuesByteCount', valueType: 'UInt32'});\n storageAttribute.attributeValues = {\n valueType: 'String',\n encoding: 'UTF-8',\n valuesPerElement: 1\n };\n storageAttribute.attributeByteCounts = {\n valueType: 'UInt32',\n valuesPerElement: 1\n };\n}\n\n/**\n * Setup Id attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\nfunction setupIdAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Oid32',\n valuesPerElement: 1\n };\n}\n\n/**\n * Setup double attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\nfunction setupDoubleAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Float64',\n valuesPerElement: 1\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAuBO,SAASA,gCAAgCA,CAC9CC,aAAqC,EACrCC,aAA+B,EACb;EAClB,IAAMC,mBAAqC,GAAG,CAAC,CAAC;EAChD,KAAK,IAAMC,YAAY,IAAIF,aAAa,EAAE;IACxC,IAAMG,UAAU,GAAGH,aAAa,CAACE,YAAY,CAAC;IAC9CD,mBAAmB,CAACC,YAAY,CAAC,GAAGE,yBAAyB,CAACD,UAAU,EAAEJ,aAAa,CAAC;EAC1F;EAEA,OAAOE,mBAAmB;AAC5B;AAOA,SAASG,yBAAyBA,CAChCD,UAAqB,EACrBJ,aAAqC,EAC1B;EACX,IAAMM,gBAA2B,GAAG,EAAE;EAEtC,IAAIF,UAAU,EAAE;IACd,KAAK,IAAMG,YAAY,IAAIP,aAAa,EAAE;MACx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IAAI,CAAC;MACd6C,SAAS,EAAE9B,GAAG;MACd+B,OAAO,EAAE,IAAI;MACbC,UAAU,EAAE,KAAK;MACjBC,KAAK,EAAEjC;IACT,CAAC,CAAC;EACJ;EACA4B,aAAa,CAAC3C,IAAI,CAAC;IACjB0C,UAAU,EAAVA,UAAU;IACVL,IAAI,EAAE;EACR,CAAC,CAAC;EAEF,OAAO;IACLG,KAAK,EAALA,KAAK;IACLC,UAAU,EAAVA,UAAU;IACVE,aAAa,EAAbA,aAAa;IACbD,UAAU,EAAVA,UAAU;IACVE,eAAe,EAAfA;EACF,CAAC;AACH;AAMA,SAASZ,oBAAoBA,CAACT,gBAAsC,EAAQ;EAE1EA,gBAAgB,CAACG,QAAQ,CAACuB,OAAO,CAAC,qBAAqB,CAAC;EACxD1B,gBAAgB,CAACI,MAAM,CAAC3B,IAAI,CAAC;IAACD,QAAQ,EAAE,0BAA0B;IAAE6B,SAAS,EAAE;EAAQ,CAAC,CAAC;EACzFL,gBAAgB,CAACM,eAAe,GAAG;IACjCD,SAAS,EAAE,QAAQ;IACnBsB,QAAQ,EAAE,OAAO;IACjBpB,gBAAgB,EAAE;EACpB,CAAC;EACDP,gBAAgB,CAAC4B,mBAAmB,GAAG;IACrCvB,SAAS,EAAE,QAAQ;IACnBE,gBAAgB,EAAE;EACpB,CAAC;AACH;AAMA,SAASC,gBAAgBA,CAACR,gBAAsC,EAAQ;EACtEA,gBAAgB,CAACM,eAAe,GAAG;IACjCD,SAAS,EAAE,OAAO;IAClBE,gBAAgB,EAAE;EACpB,CAAC;AACH;AAMA,SAASG,oBAAoBA,CAACV,gBAAsC,EAAQ;EAC1EA,gBAAgB,CAACM,eAAe,GAAG;IACjCD,SAAS,EAAE,SAAS;IACpBE,gBAAgB,EAAE;EACpB,CAAC;AACH"}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.generateAttributes = generateAttributes;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
8
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
10
  var _loaderUtils = require("@loaders.gl/loader-utils");
10
11
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
@@ -107,6 +108,11 @@ function makeAttributeObjects(attributes) {
107
108
  var colorsList = new Uint8Array(colors);
108
109
  var texCoordsList = new Float32Array(texCoords);
109
110
  var uvRegionsList = new Uint16Array(uvRegions);
111
+ var positionsOffset = 0;
112
+ var normalsOffset = 0;
113
+ var colorsOffset = 0;
114
+ var uvRegionsOffset = 0;
115
+ var texCoordsOffset = 0;
110
116
  for (var index = 0; index < featureIds.length; index++) {
111
117
  var startIndex = faceRange[index * 2];
112
118
  var endIndex = faceRange[index * 2 + 1];
@@ -117,21 +123,19 @@ function makeAttributeObjects(attributes) {
117
123
  var texCoordsCount = getSliceAttributeCount('texCoords', startIndex, endIndex);
118
124
  groupedData.push({
119
125
  featureId: featureIds[index],
120
- positions: positionsList.slice(0, positionsCount),
121
- normals: normalsList.slice(0, normalsCount),
122
- colors: colorsList.slice(0, colorsCount),
123
- uvRegions: uvRegionsList.slice(0, uvRegionsCount),
124
- texCoords: texCoordsList.slice(0, texCoordsCount)
126
+ positions: positionsList.subarray(positionsOffset, positionsOffset + positionsCount),
127
+ normals: normalsList.subarray(normalsOffset, normalsOffset + normalsCount),
128
+ colors: colorsList.subarray(colorsOffset, colorsOffset + colorsCount),
129
+ uvRegions: uvRegionsList.subarray(uvRegionsOffset, uvRegionsOffset + uvRegionsCount),
130
+ texCoords: texCoordsList.subarray(texCoordsOffset, texCoordsOffset + texCoordsCount)
125
131
  });
126
- positionsList = positionsList.slice(positionsCount);
127
- normalsList = normalsList.slice(normalsCount);
128
- colorsList = colorsList.slice(colorsCount);
129
- uvRegionsList = uvRegionsList.slice(uvRegionsCount);
130
- texCoordsList = texCoordsList.slice(texCoordsCount);
132
+ positionsOffset += positionsCount;
133
+ normalsOffset += normalsCount;
134
+ colorsOffset += colorsCount;
135
+ uvRegionsOffset += uvRegionsCount;
136
+ texCoordsOffset += texCoordsCount;
131
137
  }
132
- return groupedData.sort(function (first, second) {
133
- return first.featureId - second.featureId;
134
- });
138
+ return groupedData;
135
139
  }
136
140
  function getSliceAttributeCount(attributeName, startIndex, endIndex) {
137
141
  var itemsPerVertex4 = 4;
@@ -152,63 +156,98 @@ function getSliceAttributeCount(attributeName, startIndex, endIndex) {
152
156
  }
153
157
  }
154
158
  function unifyObjectsByFeatureId(sortedData) {
155
- var uniqueObjects = [];
156
- var _loop = function _loop() {
157
- var currentObject = sortedData[index];
158
- var existingObject = uniqueObjects.find(function (obj) {
159
- return obj.featureId === currentObject.featureId;
160
- });
161
- if (existingObject) {
162
- existingObject.positions = (0, _loaderUtils.concatenateTypedArrays)(existingObject.positions, currentObject.positions);
163
- existingObject.normals = (0, _loaderUtils.concatenateTypedArrays)(existingObject.normals, currentObject.normals);
164
- existingObject.colors = (0, _loaderUtils.concatenateTypedArrays)(existingObject.colors, currentObject.colors);
165
- existingObject.texCoords = (0, _loaderUtils.concatenateTypedArrays)(existingObject.texCoords, currentObject.texCoords);
166
- existingObject.uvRegions = (0, _loaderUtils.concatenateTypedArrays)(existingObject.uvRegions, currentObject.uvRegions);
167
- } else {
168
- uniqueObjects.push(currentObject);
159
+ var groupedMetadata = [];
160
+ var _iterator2 = _createForOfIteratorHelper(sortedData),
161
+ _step2;
162
+ try {
163
+ var _loop = function _loop() {
164
+ var data = _step2.value;
165
+ var existingObject = groupedMetadata.find(function (obj) {
166
+ return obj.featureId === data.featureId;
167
+ });
168
+ if (existingObject) {
169
+ existingObject.attributes.push(data);
170
+ } else {
171
+ groupedMetadata.push({
172
+ featureId: data.featureId,
173
+ attributes: [data]
174
+ });
175
+ }
176
+ };
177
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
178
+ _loop();
169
179
  }
170
- };
171
- for (var index = 0; index < sortedData.length; index++) {
172
- _loop();
180
+ } catch (err) {
181
+ _iterator2.e(err);
182
+ } finally {
183
+ _iterator2.f();
184
+ }
185
+ var uniqueObjects = [];
186
+ for (var _i = 0, _groupedMetadata = groupedMetadata; _i < _groupedMetadata.length; _i++) {
187
+ var metatada = _groupedMetadata[_i];
188
+ var attributes = concatenateAttributes(metatada.attributes);
189
+ uniqueObjects.push(_objectSpread({
190
+ featureId: metatada.featureId
191
+ }, attributes));
173
192
  }
174
193
  return uniqueObjects;
175
194
  }
176
195
  function groupAttributesAndRangesByFeatureId(unifiedObjects, featureCount) {
177
196
  var firstAttributeObject = unifiedObjects[0];
178
197
  var featureIds = [firstAttributeObject.featureId || 0];
179
- var positions = new Float32Array(firstAttributeObject.positions);
180
- var normals = new Float32Array(firstAttributeObject.normals);
181
- var colors = new Uint8Array(firstAttributeObject.colors);
182
- var uvRegions = new Uint16Array(firstAttributeObject.uvRegions);
183
- var texCoords = new Float32Array(firstAttributeObject.texCoords);
184
198
  var range = [0];
185
199
  var objIndex = 0;
186
200
  var sum = 0;
187
201
  for (var index = 1; index < unifiedObjects.length; index++) {
188
202
  var currentAttributesObject = unifiedObjects[index];
189
203
  featureIds.push(currentAttributesObject.featureId || 0);
190
- positions = (0, _loaderUtils.concatenateTypedArrays)(positions, currentAttributesObject.positions);
191
- normals = (0, _loaderUtils.concatenateTypedArrays)(normals, currentAttributesObject.normals);
192
- colors = (0, _loaderUtils.concatenateTypedArrays)(colors, currentAttributesObject.colors);
193
- uvRegions = (0, _loaderUtils.concatenateTypedArrays)(uvRegions, currentAttributesObject.uvRegions);
194
- texCoords = (0, _loaderUtils.concatenateTypedArrays)(texCoords, currentAttributesObject.texCoords);
195
204
  var groupedObject = unifiedObjects[objIndex];
196
205
  range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1 + sum);
197
206
  range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE + sum);
198
207
  sum += groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;
199
208
  objIndex += 1;
200
209
  }
201
- range.push(positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);
210
+ var attributes = concatenateAttributes(unifiedObjects);
211
+ range.push(attributes.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);
202
212
  var faceRange = new Uint32Array(range);
203
- return {
213
+ return _objectSpread({
204
214
  faceRange: faceRange,
205
215
  featureIds: featureIds,
216
+ featureCount: featureCount
217
+ }, attributes);
218
+ }
219
+ function concatenateAttributes(attributes) {
220
+ var positionGroups = attributes.map(function (_ref) {
221
+ var positions = _ref.positions;
222
+ return positions;
223
+ });
224
+ var positions = positionGroups.length > 1 ? _loaderUtils.concatenateTypedArrays.apply(void 0, (0, _toConsumableArray2.default)(positionGroups)) : positionGroups[0];
225
+ var normalGroups = attributes.map(function (_ref2) {
226
+ var normals = _ref2.normals;
227
+ return normals;
228
+ });
229
+ var normals = normalGroups.length > 1 ? _loaderUtils.concatenateTypedArrays.apply(void 0, (0, _toConsumableArray2.default)(normalGroups)) : normalGroups[0];
230
+ var colorGroups = attributes.map(function (_ref3) {
231
+ var colors = _ref3.colors;
232
+ return colors;
233
+ });
234
+ var colors = colorGroups.length > 1 ? _loaderUtils.concatenateTypedArrays.apply(void 0, (0, _toConsumableArray2.default)(colorGroups)) : colorGroups[0];
235
+ var texCoordGroups = attributes.map(function (_ref4) {
236
+ var texCoords = _ref4.texCoords;
237
+ return texCoords;
238
+ });
239
+ var texCoords = texCoordGroups.length > 1 ? _loaderUtils.concatenateTypedArrays.apply(void 0, (0, _toConsumableArray2.default)(texCoordGroups)) : texCoordGroups[0];
240
+ var uvRegionGroups = attributes.map(function (_ref5) {
241
+ var uvRegions = _ref5.uvRegions;
242
+ return uvRegions;
243
+ });
244
+ var uvRegions = uvRegionGroups.length > 1 ? _loaderUtils.concatenateTypedArrays.apply(void 0, (0, _toConsumableArray2.default)(uvRegionGroups)) : uvRegionGroups[0];
245
+ return {
206
246
  positions: positions,
207
247
  normals: normals,
208
248
  colors: colors,
209
- uvRegions: uvRegions,
210
249
  texCoords: texCoords,
211
- featureCount: featureCount
250
+ uvRegions: uvRegions
212
251
  };
213
252
  }
214
253
  //# sourceMappingURL=geometry-attributes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"geometry-attributes.js","names":["_loaderUtils","require","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","arguments","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","VALUES_PER_VERTEX","POSITIONS_AND_NORMALS_PER_TRIANGLE","generateAttributes","attributes","positions","normals","texCoords","colors","uvRegions","featureIndices","triangleCount","faceRange","Uint32Array","featureIds","featureCount","data","calculateFaceRangesAndFeaturesCount","attributeObjects","makeAttributeObjects","unifiedAttributeObjectsByFeatureIds","unifyObjectsByFeatureId","groupedAttributes","groupAttributesAndRangesByFeatureId","rangeIndex","featureIndex","currentFeatureId","getFrequentValue","faceRangeList","uniqueFeatureIds","index","newFeatureId","includes","values","map","mostFrequentValue","maxCount","_iterator","_step","_attributes$faceRange","groupedData","positionsList","Float32Array","normalsList","colorsList","Uint8Array","texCoordsList","uvRegionsList","Uint16Array","startIndex","endIndex","positionsCount","getSliceAttributeCount","normalsCount","colorsCount","uvRegionsCount","texCoordsCount","featureId","sort","first","second","attributeName","itemsPerVertex4","texCoordsPerVertex","trianglesCount","vertexCount","sortedData","uniqueObjects","_loop","currentObject","existingObject","find","obj","concatenateTypedArrays","unifiedObjects","firstAttributeObject","range","objIndex","sum","currentAttributesObject","groupedObject"],"sources":["../../../../src/i3s-converter/helpers/geometry-attributes.ts"],"sourcesContent":["import type {GeometryAttributes, ConvertedAttributes, GroupedByFeatureIdAttributes} from '../types';\nimport {concatenateTypedArrays} from '@loaders.gl/loader-utils';\n\nconst VALUES_PER_VERTEX = 3;\nconst POSITIONS_AND_NORMALS_PER_TRIANGLE = 9;\n\n/**\n * Generate geometry attributes with faceRange and featureCount\n * @param attributes\n * @returns attirbutes with featureCount, featureIds and changed faceRange.\n */\nexport function generateAttributes(attributes: ConvertedAttributes): GeometryAttributes {\n const {positions, normals, texCoords, colors, uvRegions, featureIndices} = attributes;\n const triangleCount = positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;\n\n if (!featureIndices.length) {\n return {\n faceRange: new Uint32Array([0, triangleCount - 1]),\n featureIds: [0],\n featureCount: 1,\n positions,\n normals,\n texCoords,\n colors,\n uvRegions\n };\n }\n\n const data = calculateFaceRangesAndFeaturesCount(featureIndices);\n const attributeObjects = makeAttributeObjects({...data, ...attributes});\n const unifiedAttributeObjectsByFeatureIds = unifyObjectsByFeatureId(attributeObjects);\n const groupedAttributes = groupAttributesAndRangesByFeatureId(\n unifiedAttributeObjectsByFeatureIds,\n data.featureCount\n );\n return groupedAttributes;\n}\n\n/**\n * Calculates face Ranges and feature count based on featureIndices.\n * @param featureIndices\n * @returns Object with featureCount, reordered attributes and changed faceRange.\n */\nfunction calculateFaceRangesAndFeaturesCount(featureIndices: number[]): {\n faceRange: Uint32Array;\n featureCount: number;\n featureIds: number[];\n} {\n let rangeIndex = 1;\n let featureIndex = 1;\n let currentFeatureId = getFrequentValue(featureIndices.slice(0, VALUES_PER_VERTEX));\n const faceRangeList: any[] = [];\n const featureIds: any[] = [];\n const uniqueFeatureIds = [currentFeatureId];\n\n faceRangeList[0] = 0;\n featureIds[0] = currentFeatureId;\n\n for (let index = VALUES_PER_VERTEX; index < featureIndices.length; index += VALUES_PER_VERTEX) {\n const newFeatureId = getFrequentValue(featureIndices.slice(index, index + VALUES_PER_VERTEX));\n if (currentFeatureId !== newFeatureId) {\n faceRangeList[rangeIndex] = index / VALUES_PER_VERTEX - 1;\n faceRangeList[rangeIndex + 1] = index / VALUES_PER_VERTEX;\n featureIds[featureIndex] = newFeatureId;\n\n if (!uniqueFeatureIds.includes(newFeatureId)) {\n uniqueFeatureIds.push(newFeatureId);\n }\n\n rangeIndex += 2;\n featureIndex += 1;\n }\n currentFeatureId = newFeatureId;\n }\n\n faceRangeList[rangeIndex] = featureIndices.length / VALUES_PER_VERTEX - 1;\n\n const faceRange = new Uint32Array(faceRangeList);\n const featureCount = uniqueFeatureIds.length;\n\n return {faceRange, featureCount, featureIds};\n}\n\n/**\n * Find most frequent value to avoid situation where one vertex can be part of multiple features (objects).\n * @param values\n */\nfunction getFrequentValue(values: number[]): number {\n const map: {[key: number]: number} = {};\n\n let mostFrequentValue = values[0];\n let maxCount = 1;\n\n for (const value of values) {\n // Save item and it's frequency count to the map.\n map[value] = (map[value] || 0) + 1;\n // Find max count of frequency.\n maxCount = maxCount > map[value] ? maxCount : map[value];\n // Find the most frequent value.\n mostFrequentValue = maxCount > map[value] ? mostFrequentValue : value;\n }\n\n return mostFrequentValue;\n}\n\n/**\n * Generate list of attribute object grouped by feature ids.\n * @param attributes\n * @returns sorted list of attribute objects.\n */\nfunction makeAttributeObjects(attributes: GeometryAttributes): GroupedByFeatureIdAttributes[] {\n const {\n featureIds,\n positions,\n normals,\n colors,\n uvRegions,\n texCoords,\n faceRange = new Uint32Array(0)\n } = attributes;\n const groupedData: GroupedByFeatureIdAttributes[] = [];\n\n let positionsList = new Float32Array(positions);\n let normalsList = new Float32Array(normals);\n let colorsList = new Uint8Array(colors);\n let texCoordsList = new Float32Array(texCoords);\n let uvRegionsList = new Uint16Array(uvRegions);\n\n for (let index = 0; index < featureIds.length; index++) {\n const startIndex = faceRange[index * 2];\n const endIndex = faceRange[index * 2 + 1];\n\n const positionsCount = getSliceAttributeCount('positions', startIndex, endIndex);\n const normalsCount = getSliceAttributeCount('normals', startIndex, endIndex);\n const colorsCount = getSliceAttributeCount('colors', startIndex, endIndex);\n const uvRegionsCount = getSliceAttributeCount('uvRegions', startIndex, endIndex);\n const texCoordsCount = getSliceAttributeCount('texCoords', startIndex, endIndex);\n\n groupedData.push({\n featureId: featureIds[index],\n positions: positionsList.slice(0, positionsCount),\n normals: normalsList.slice(0, normalsCount),\n colors: colorsList.slice(0, colorsCount),\n uvRegions: uvRegionsList.slice(0, uvRegionsCount),\n texCoords: texCoordsList.slice(0, texCoordsCount)\n });\n\n positionsList = positionsList.slice(positionsCount);\n normalsList = normalsList.slice(normalsCount);\n colorsList = colorsList.slice(colorsCount);\n uvRegionsList = uvRegionsList.slice(uvRegionsCount);\n texCoordsList = texCoordsList.slice(texCoordsCount);\n }\n\n return groupedData.sort((first, second) => first.featureId - second.featureId);\n}\n\n/**\n * Generate sliced count for generating attribute objects depends on attribute name and range.\n * @param attributeName\n * @param startIndex\n * @param endIndex\n * @returns sliced count\n */\nfunction getSliceAttributeCount(\n attributeName: string,\n startIndex: number,\n endIndex: number\n): number {\n const itemsPerVertex4 = 4;\n const texCoordsPerVertex = 2;\n\n const trianglesCount = endIndex - startIndex + 1;\n const vertexCount = trianglesCount * 3;\n\n switch (attributeName) {\n case 'positions':\n case 'normals':\n return trianglesCount * POSITIONS_AND_NORMALS_PER_TRIANGLE;\n case 'colors':\n case 'uvRegions':\n return vertexCount * itemsPerVertex4;\n case 'texCoords':\n return vertexCount * texCoordsPerVertex;\n default:\n return 0;\n }\n}\n\n/**\n * Generates unique object list depends on feature ids and concantenate their attributes.\n * @param sortedData\n * @returns unique list of objects\n */\nfunction unifyObjectsByFeatureId(\n sortedData: GroupedByFeatureIdAttributes[]\n): GroupedByFeatureIdAttributes[] {\n const uniqueObjects: GroupedByFeatureIdAttributes[] = [];\n\n for (let index = 0; index < sortedData.length; index++) {\n const currentObject = sortedData[index];\n const existingObject = uniqueObjects.find((obj) => obj.featureId === currentObject.featureId);\n\n if (existingObject) {\n existingObject.positions = concatenateTypedArrays(\n existingObject.positions,\n currentObject.positions\n );\n existingObject.normals = concatenateTypedArrays(\n existingObject.normals,\n currentObject.normals\n );\n existingObject.colors = concatenateTypedArrays(existingObject.colors, currentObject.colors);\n existingObject.texCoords = concatenateTypedArrays(\n existingObject.texCoords,\n currentObject.texCoords\n );\n existingObject.uvRegions = concatenateTypedArrays(\n existingObject.uvRegions,\n currentObject.uvRegions\n );\n } else {\n uniqueObjects.push(currentObject);\n }\n }\n\n return uniqueObjects;\n}\n\n/**\n * Generates attribute objects with new faceRange and reordered attributes.\n * @param unifiedObjects\n * @returns generated attributes with new faceRange.\n */\nfunction groupAttributesAndRangesByFeatureId(\n unifiedObjects: GroupedByFeatureIdAttributes[],\n featureCount: number\n): GeometryAttributes {\n const firstAttributeObject = unifiedObjects[0];\n const featureIds = [firstAttributeObject.featureId || 0];\n\n let positions = new Float32Array(firstAttributeObject.positions);\n let normals = new Float32Array(firstAttributeObject.normals);\n let colors = new Uint8Array(firstAttributeObject.colors);\n let uvRegions = new Uint16Array(firstAttributeObject.uvRegions);\n let texCoords = new Float32Array(firstAttributeObject.texCoords);\n const range = [0];\n\n let objIndex = 0;\n let sum = 0;\n\n for (let index = 1; index < unifiedObjects.length; index++) {\n const currentAttributesObject = unifiedObjects[index];\n featureIds.push(currentAttributesObject.featureId || 0);\n\n positions = concatenateTypedArrays(positions, currentAttributesObject.positions);\n normals = concatenateTypedArrays(normals, currentAttributesObject.normals);\n colors = concatenateTypedArrays(colors, currentAttributesObject.colors);\n uvRegions = concatenateTypedArrays(uvRegions, currentAttributesObject.uvRegions);\n texCoords = concatenateTypedArrays(texCoords, currentAttributesObject.texCoords);\n\n const groupedObject = unifiedObjects[objIndex];\n range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1 + sum);\n range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE + sum);\n\n sum += groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;\n objIndex += 1;\n }\n\n range.push(positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);\n\n const faceRange = new Uint32Array(range);\n return {faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount};\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAgE,SAAAC,2BAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,EAAA,QAAAG,KAAA,CAAAC,OAAA,CAAAN,CAAA,MAAAE,EAAA,GAAAK,2BAAA,CAAAP,CAAA,MAAAC,cAAA,IAAAD,CAAA,WAAAA,CAAA,CAAAQ,MAAA,qBAAAN,EAAA,EAAAF,CAAA,GAAAE,EAAA,MAAAO,CAAA,UAAAC,CAAA,YAAAA,EAAA,eAAAC,CAAA,EAAAD,CAAA,EAAAE,CAAA,WAAAA,EAAA,QAAAH,CAAA,IAAAT,CAAA,CAAAQ,MAAA,WAAAK,IAAA,mBAAAA,IAAA,SAAAC,KAAA,EAAAd,CAAA,CAAAS,CAAA,UAAAM,CAAA,WAAAA,EAAAC,EAAA,UAAAA,EAAA,KAAAC,CAAA,EAAAP,CAAA,gBAAAQ,SAAA,iJAAAC,gBAAA,SA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MAAM,GAAGwD,kCAAkC,GAAG4E,GAAG,CAAC;IAErFA,GAAG,IAAIE,aAAa,CAAC3E,SAAS,CAAC3D,MAAM,GAAGwD,kCAAkC;IAC1E2E,QAAQ,IAAI,CAAC;EACf;EAEAD,KAAK,CAACxF,IAAI,CAACiB,SAAS,CAAC3D,MAAM,GAAGwD,kCAAkC,GAAG,CAAC,CAAC;EAErE,IAAMU,SAAS,GAAG,IAAIC,WAAW,CAAC+D,KAAK,CAAC;EACxC,OAAO;IAAChE,SAAS,EAATA,SAAS;IAAEE,UAAU,EAAVA,UAAU;IAAET,SAAS,EAATA,SAAS;IAAEC,OAAO,EAAPA,OAAO;IAAEE,MAAM,EAANA,MAAM;IAAEC,SAAS,EAATA,SAAS;IAAEF,SAAS,EAATA,SAAS;IAAEQ,YAAY,EAAZA;EAAY,CAAC;AAChG"}
1
+ {"version":3,"file":"geometry-attributes.js","names":["_loaderUtils","require","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","arguments","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","VALUES_PER_VERTEX","POSITIONS_AND_NORMALS_PER_TRIANGLE","generateAttributes","attributes","positions","normals","texCoords","colors","uvRegions","featureIndices","triangleCount","faceRange","Uint32Array","featureIds","featureCount","data","calculateFaceRangesAndFeaturesCount","attributeObjects","makeAttributeObjects","unifiedAttributeObjectsByFeatureIds","unifyObjectsByFeatureId","groupedAttributes","groupAttributesAndRangesByFeatureId","rangeIndex","featureIndex","currentFeatureId","getFrequentValue","faceRangeList","uniqueFeatureIds","index","newFeatureId","includes","values","map","mostFrequentValue","maxCount","_iterator","_step","_attributes$faceRange","groupedData","positionsList","Float32Array","normalsList","colorsList","Uint8Array","texCoordsList","uvRegionsList","Uint16Array","positionsOffset","normalsOffset","colorsOffset","uvRegionsOffset","texCoordsOffset","startIndex","endIndex","positionsCount","getSliceAttributeCount","normalsCount","colorsCount","uvRegionsCount","texCoordsCount","featureId","subarray","attributeName","itemsPerVertex4","texCoordsPerVertex","trianglesCount","vertexCount","sortedData","groupedMetadata","_iterator2","_step2","_loop","existingObject","find","obj","uniqueObjects","_i","_groupedMetadata","metatada","concatenateAttributes","unifiedObjects","firstAttributeObject","range","objIndex","sum","currentAttributesObject","groupedObject","positionGroups","_ref","concatenateTypedArrays","_toConsumableArray2","normalGroups","_ref2","colorGroups","_ref3","texCoordGroups","_ref4","uvRegionGroups","_ref5"],"sources":["../../../../src/i3s-converter/helpers/geometry-attributes.ts"],"sourcesContent":["import type {\n GeometryAttributes,\n ConvertedAttributes,\n GroupedByFeatureIdAttributes,\n GroupedAttributes\n} from '../types';\nimport {concatenateTypedArrays} from '@loaders.gl/loader-utils';\n\nconst VALUES_PER_VERTEX = 3;\nconst POSITIONS_AND_NORMALS_PER_TRIANGLE = 9;\n\n/**\n * Generate geometry attributes with faceRange and featureCount\n * @param attributes\n * @returns attirbutes with featureCount, featureIds and changed faceRange.\n */\nexport function generateAttributes(attributes: ConvertedAttributes): GeometryAttributes {\n const {positions, normals, texCoords, colors, uvRegions, featureIndices} = attributes;\n const triangleCount = positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;\n\n if (!featureIndices.length) {\n return {\n faceRange: new Uint32Array([0, triangleCount - 1]),\n featureIds: [0],\n featureCount: 1,\n positions,\n normals,\n texCoords,\n colors,\n uvRegions\n };\n }\n\n const data = calculateFaceRangesAndFeaturesCount(featureIndices);\n const attributeObjects = makeAttributeObjects({...data, ...attributes});\n const unifiedAttributeObjectsByFeatureIds = unifyObjectsByFeatureId(attributeObjects);\n const groupedAttributes = groupAttributesAndRangesByFeatureId(\n unifiedAttributeObjectsByFeatureIds,\n data.featureCount\n );\n return groupedAttributes;\n}\n\n/**\n * Calculates face Ranges and feature count based on featureIndices.\n * @param featureIndices\n * @returns Object with featureCount, reordered attributes and changed faceRange.\n */\nfunction calculateFaceRangesAndFeaturesCount(featureIndices: number[]): {\n faceRange: Uint32Array;\n featureCount: number;\n featureIds: number[];\n} {\n let rangeIndex = 1;\n let featureIndex = 1;\n let currentFeatureId = getFrequentValue(featureIndices.slice(0, VALUES_PER_VERTEX));\n const faceRangeList: any[] = [];\n const featureIds: any[] = [];\n const uniqueFeatureIds = [currentFeatureId];\n\n faceRangeList[0] = 0;\n featureIds[0] = currentFeatureId;\n\n for (let index = VALUES_PER_VERTEX; index < featureIndices.length; index += VALUES_PER_VERTEX) {\n const newFeatureId = getFrequentValue(featureIndices.slice(index, index + VALUES_PER_VERTEX));\n if (currentFeatureId !== newFeatureId) {\n faceRangeList[rangeIndex] = index / VALUES_PER_VERTEX - 1;\n faceRangeList[rangeIndex + 1] = index / VALUES_PER_VERTEX;\n featureIds[featureIndex] = newFeatureId;\n\n if (!uniqueFeatureIds.includes(newFeatureId)) {\n uniqueFeatureIds.push(newFeatureId);\n }\n\n rangeIndex += 2;\n featureIndex += 1;\n }\n currentFeatureId = newFeatureId;\n }\n\n faceRangeList[rangeIndex] = featureIndices.length / VALUES_PER_VERTEX - 1;\n\n const faceRange = new Uint32Array(faceRangeList);\n const featureCount = uniqueFeatureIds.length;\n\n return {faceRange, featureCount, featureIds};\n}\n\n/**\n * Find most frequent value to avoid situation where one vertex can be part of multiple features (objects).\n * @param values\n */\nfunction getFrequentValue(values: number[]): number {\n const map: {[key: number]: number} = {};\n\n let mostFrequentValue = values[0];\n let maxCount = 1;\n\n for (const value of values) {\n // Save item and it's frequency count to the map.\n map[value] = (map[value] || 0) + 1;\n // Find max count of frequency.\n maxCount = maxCount > map[value] ? maxCount : map[value];\n // Find the most frequent value.\n mostFrequentValue = maxCount > map[value] ? mostFrequentValue : value;\n }\n\n return mostFrequentValue;\n}\n\n/**\n * Generate list of attribute object grouped by feature ids.\n * @param attributes\n * @returns sorted list of attribute objects.\n */\nfunction makeAttributeObjects(attributes: GeometryAttributes): GroupedByFeatureIdAttributes[] {\n const {\n featureIds,\n positions,\n normals,\n colors,\n uvRegions,\n texCoords,\n faceRange = new Uint32Array(0)\n } = attributes;\n const groupedData: GroupedByFeatureIdAttributes[] = [];\n\n let positionsList = new Float32Array(positions);\n let normalsList = new Float32Array(normals);\n let colorsList = new Uint8Array(colors);\n let texCoordsList = new Float32Array(texCoords);\n let uvRegionsList = new Uint16Array(uvRegions);\n let positionsOffset = 0;\n let normalsOffset = 0;\n let colorsOffset = 0;\n let uvRegionsOffset = 0;\n let texCoordsOffset = 0;\n\n for (let index = 0; index < featureIds.length; index++) {\n const startIndex = faceRange[index * 2];\n const endIndex = faceRange[index * 2 + 1];\n\n const positionsCount = getSliceAttributeCount('positions', startIndex, endIndex);\n const normalsCount = getSliceAttributeCount('normals', startIndex, endIndex);\n const colorsCount = getSliceAttributeCount('colors', startIndex, endIndex);\n const uvRegionsCount = getSliceAttributeCount('uvRegions', startIndex, endIndex);\n const texCoordsCount = getSliceAttributeCount('texCoords', startIndex, endIndex);\n\n groupedData.push({\n featureId: featureIds[index],\n positions: positionsList.subarray(positionsOffset, positionsOffset + positionsCount),\n normals: normalsList.subarray(normalsOffset, normalsOffset + normalsCount),\n colors: colorsList.subarray(colorsOffset, colorsOffset + colorsCount),\n uvRegions: uvRegionsList.subarray(uvRegionsOffset, uvRegionsOffset + uvRegionsCount),\n texCoords: texCoordsList.subarray(texCoordsOffset, texCoordsOffset + texCoordsCount)\n });\n\n positionsOffset += positionsCount;\n normalsOffset += normalsCount;\n colorsOffset += colorsCount;\n uvRegionsOffset += uvRegionsCount;\n texCoordsOffset += texCoordsCount;\n }\n\n return groupedData;\n}\n\n/**\n * Generate sliced count for generating attribute objects depends on attribute name and range.\n * @param attributeName\n * @param startIndex\n * @param endIndex\n * @returns sliced count\n */\nfunction getSliceAttributeCount(\n attributeName: string,\n startIndex: number,\n endIndex: number\n): number {\n const itemsPerVertex4 = 4;\n const texCoordsPerVertex = 2;\n\n const trianglesCount = endIndex - startIndex + 1;\n const vertexCount = trianglesCount * 3;\n\n switch (attributeName) {\n case 'positions':\n case 'normals':\n return trianglesCount * POSITIONS_AND_NORMALS_PER_TRIANGLE;\n case 'colors':\n case 'uvRegions':\n return vertexCount * itemsPerVertex4;\n case 'texCoords':\n return vertexCount * texCoordsPerVertex;\n default:\n return 0;\n }\n}\n\n/**\n * Generates unique object list depends on feature ids and concantenate their attributes.\n * @param sortedData\n * @returns unique list of objects\n */\nfunction unifyObjectsByFeatureId(\n sortedData: GroupedByFeatureIdAttributes[]\n): GroupedByFeatureIdAttributes[] {\n const groupedMetadata: {\n featureId: number;\n attributes: GroupedByFeatureIdAttributes[];\n }[] = [];\n for (const data of sortedData) {\n const existingObject = groupedMetadata.find((obj) => obj.featureId === data.featureId);\n if (existingObject) {\n existingObject.attributes.push(data);\n } else {\n groupedMetadata.push({\n featureId: data.featureId,\n attributes: [data]\n });\n }\n }\n\n const uniqueObjects: GroupedByFeatureIdAttributes[] = [];\n for (const metatada of groupedMetadata) {\n const attributes = concatenateAttributes(metatada.attributes);\n\n uniqueObjects.push({\n featureId: metatada.featureId,\n ...attributes\n });\n }\n\n return uniqueObjects;\n}\n\n/**\n * Generates attribute objects with new faceRange and reordered attributes.\n * @param unifiedObjects\n * @returns generated attributes with new faceRange.\n */\nfunction groupAttributesAndRangesByFeatureId(\n unifiedObjects: GroupedByFeatureIdAttributes[],\n featureCount: number\n): GeometryAttributes {\n const firstAttributeObject = unifiedObjects[0];\n const featureIds = [firstAttributeObject.featureId || 0];\n const range = [0];\n\n let objIndex = 0;\n let sum = 0;\n\n for (let index = 1; index < unifiedObjects.length; index++) {\n const currentAttributesObject = unifiedObjects[index];\n featureIds.push(currentAttributesObject.featureId || 0);\n\n const groupedObject = unifiedObjects[objIndex];\n range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1 + sum);\n range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE + sum);\n\n sum += groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;\n objIndex += 1;\n }\n\n const attributes = concatenateAttributes(unifiedObjects);\n\n range.push(attributes.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);\n\n const faceRange = new Uint32Array(range);\n return {faceRange, featureIds, featureCount, ...attributes};\n}\n\n/**\n * Concatenate attributes typed arrays\n * @param attributes - grouped by featureId typed arrays\n * @returns - concatenated typed array list\n */\nfunction concatenateAttributes(attributes: GroupedByFeatureIdAttributes[]): GroupedAttributes {\n const positionGroups = attributes.map(({positions}) => positions);\n const positions =\n positionGroups.length > 1 ? concatenateTypedArrays(...positionGroups) : positionGroups[0];\n\n const normalGroups = attributes.map(({normals}) => normals);\n const normals =\n normalGroups.length > 1 ? concatenateTypedArrays(...normalGroups) : normalGroups[0];\n\n const colorGroups = attributes.map(({colors}) => colors);\n const colors = colorGroups.length > 1 ? concatenateTypedArrays(...colorGroups) : colorGroups[0];\n\n const texCoordGroups = attributes.map(({texCoords}) => texCoords);\n const texCoords =\n texCoordGroups.length > 1 ? concatenateTypedArrays(...texCoordGroups) : texCoordGroups[0];\n\n const uvRegionGroups = attributes.map(({uvRegions}) => uvRegions);\n const uvRegions =\n uvRegionGroups.length > 1 ? concatenateTypedArrays(...uvRegionGroups) : uvRegionGroups[0];\n return {\n positions,\n normals,\n colors,\n texCoords,\n uvRegions\n };\n}\n"],"mappings":";;;;;;;;;AAMA,IAAAA,YAAA,GAAAC,OAAA;AAAgE,SAAAC,2BAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,EAAA,QAAAG,KAAA,CAAAC,OAAA,CAAAN,CAAA,MAAAE,EAAA,GAAAK,2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IAAA,IAAE3F,SAAS,GAAA2F,KAAA,CAAT3F,SAAS;IAAA,OAAMA,SAAS;EAAA,EAAC;EACjE,IAAMA,SAAS,GACb0F,cAAc,CAACvJ,MAAM,GAAG,CAAC,GAAGiJ,mCAAsB,CAAAtG,KAAA,aAAAuG,mBAAA,CAAA/F,OAAA,EAAIoG,cAAc,EAAC,GAAGA,cAAc,CAAC,CAAC,CAAC;EAE3F,IAAME,cAAc,GAAG/F,UAAU,CAAC8B,GAAG,CAAC,UAAAkE,KAAA;IAAA,IAAE3F,SAAS,GAAA2F,KAAA,CAAT3F,SAAS;IAAA,OAAMA,SAAS;EAAA,EAAC;EACjE,IAAMA,SAAS,GACb0F,cAAc,CAACzJ,MAAM,GAAG,CAAC,GAAGiJ,mCAAsB,CAAAtG,KAAA,aAAAuG,mBAAA,CAAA/F,OAAA,EAAIsG,cAAc,EAAC,GAAGA,cAAc,CAAC,CAAC,CAAC;EAC3F,OAAO;IACL9F,SAAS,EAATA,SAAS;IACTC,OAAO,EAAPA,OAAO;IACPE,MAAM,EAANA,MAAM;IACND,SAAS,EAATA,SAAS;IACTE,SAAS,EAATA;EACF,CAAC;AACH"}
@@ -173,7 +173,7 @@ function _makeNodeResources(_x14) {
173
173
  function _makeNodeResources2() {
174
174
  _makeNodeResources2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(_ref) {
175
175
  var _tileContent$gltf5;
176
- var convertedAttributes, material, texture, tileContent, nodeId, featuresHashArray, propertyTable, attributeStorageInfo, draco, libraries, boundingVolumes, vertexCount, _generateAttributes, faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount, header, typedFeatureIds, fileBuffer, compressedGeometry, attributes;
176
+ var convertedAttributes, material, texture, tileContent, nodeId, featuresHashArray, propertyTable, attributeStorageInfo, draco, libraries, boundingVolumes, vertexCount, _generateAttributes, faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount, featureIdsMap, header, typedFeatureIds, fileBuffer, compressedGeometry, attributes;
177
177
  return _regenerator.default.wrap(function _callee2$(_context2) {
178
178
  while (1) switch (_context2.prev = _context2.next) {
179
179
  case 0:
@@ -181,8 +181,9 @@ function _makeNodeResources2() {
181
181
  boundingVolumes = convertedAttributes.boundingVolumes;
182
182
  vertexCount = convertedAttributes.positions.length / VALUES_PER_VERTEX;
183
183
  _generateAttributes = (0, _geometryAttributes.generateAttributes)(convertedAttributes), faceRange = _generateAttributes.faceRange, featureIds = _generateAttributes.featureIds, positions = _generateAttributes.positions, normals = _generateAttributes.normals, colors = _generateAttributes.colors, uvRegions = _generateAttributes.uvRegions, texCoords = _generateAttributes.texCoords, featureCount = _generateAttributes.featureCount;
184
- if (tileContent.batchTableJson) {
185
- makeFeatureIdsUnique(featureIds, convertedAttributes.featureIndices, featuresHashArray, tileContent.batchTableJson);
184
+ featureIdsMap = {};
185
+ if (propertyTable) {
186
+ featureIdsMap = makeFeatureIdsUnique(featureIds, convertedAttributes.featureIndices, featuresHashArray, propertyTable);
186
187
  }
187
188
  header = new Uint32Array(2);
188
189
  typedFeatureIds = generateBigUint64Array(featureIds);
@@ -199,7 +200,7 @@ function _makeNodeResources2() {
199
200
  }, libraries) : null;
200
201
  attributes = [];
201
202
  if (attributeStorageInfo && propertyTable) {
202
- attributes = convertPropertyTableToAttributeBuffers(featureIds, propertyTable, attributeStorageInfo);
203
+ attributes = convertPropertyTableToAttributeBuffers(featureIds, featureIdsMap, propertyTable, attributeStorageInfo);
203
204
  }
204
205
  return _context2.abrupt("return", {
205
206
  nodeId: nodeId,
@@ -214,7 +215,7 @@ function _makeNodeResources2() {
214
215
  featureCount: featureCount,
215
216
  boundingVolumes: boundingVolumes
216
217
  });
217
- case 13:
218
+ case 14:
218
219
  case "end":
219
220
  return _context2.stop();
220
221
  }
@@ -935,6 +936,7 @@ function makeFeatureIdsUnique(featureIds, featureIndices, featuresHashArray, bat
935
936
  var replaceMap = getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray);
936
937
  replaceIndicesByUnique(featureIndices, replaceMap);
937
938
  replaceIndicesByUnique(featureIds, replaceMap);
939
+ return replaceMap;
938
940
  }
939
941
  function getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray) {
940
942
  var featureMap = {};
@@ -965,10 +967,10 @@ function replaceIndicesByUnique(indicesArray, featureMap) {
965
967
  indicesArray[index] = featureMap[indicesArray[index]];
966
968
  }
967
969
  }
968
- function convertPropertyTableToAttributeBuffers(featureIds, propertyTable, attributeStorageInfo) {
970
+ function convertPropertyTableToAttributeBuffers(featureIds, featureIdsMap, propertyTable, attributeStorageInfo) {
969
971
  var attributeBuffers = [];
970
972
  var needFlattenPropertyTable = (0, _featureAttributes.checkPropertiesLength)(featureIds, propertyTable);
971
- var properties = needFlattenPropertyTable ? (0, _featureAttributes.flattenPropertyTableByFeatureIds)(featureIds, propertyTable) : propertyTable;
973
+ var properties = needFlattenPropertyTable ? (0, _featureAttributes.flattenPropertyTableByFeatureIds)(featureIdsMap, propertyTable) : propertyTable;
972
974
  var propertyTableWithObjectIds = _objectSpread({
973
975
  OBJECTID: featureIds
974
976
  }, properties);