@loaders.gl/tile-converter 4.1.0-alpha.9 → 4.2.0-alpha.1

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 (68) hide show
  1. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
  2. package/dist/3d-tiles-converter/3d-tiles-converter.js +4 -4
  3. package/dist/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  4. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
  5. package/dist/3d-tiles-converter/helpers/b3dm-converter.js +8 -0
  6. package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  7. package/dist/3d-tiles-converter/json-templates/tileset.d.ts.map +1 -1
  8. package/dist/3d-tiles-converter/json-templates/tileset.js +3 -0
  9. package/dist/3d-tiles-converter/json-templates/tileset.js.map +1 -1
  10. package/dist/constants.d.ts +1 -0
  11. package/dist/constants.d.ts.map +1 -1
  12. package/dist/constants.js +1 -0
  13. package/dist/constants.js.map +1 -1
  14. package/dist/converter-cli.js +3 -3
  15. package/dist/converter-cli.js.map +1 -1
  16. package/dist/converter.min.cjs +131 -220
  17. package/dist/deps-installer/deps-installer.js +1 -1
  18. package/dist/i3s-converter/helpers/attribute-metadata-info.d.ts +10 -0
  19. package/dist/i3s-converter/helpers/attribute-metadata-info.d.ts.map +1 -1
  20. package/dist/i3s-converter/helpers/attribute-metadata-info.js +5 -0
  21. package/dist/i3s-converter/helpers/attribute-metadata-info.js.map +1 -1
  22. package/dist/i3s-converter/helpers/node-index-document.d.ts +2 -1
  23. package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
  24. package/dist/i3s-converter/helpers/node-index-document.js +6 -8
  25. package/dist/i3s-converter/helpers/node-index-document.js.map +1 -1
  26. package/dist/i3s-converter/helpers/progress.js +1 -1
  27. package/dist/i3s-converter/helpers/progress.js.map +1 -1
  28. package/dist/i3s-converter/i3s-converter.d.ts +32 -0
  29. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  30. package/dist/i3s-converter/i3s-converter.js +195 -47
  31. package/dist/i3s-converter/i3s-converter.js.map +1 -1
  32. package/dist/i3s-converter/types.d.ts +7 -0
  33. package/dist/i3s-converter/types.d.ts.map +1 -1
  34. package/dist/i3s-converter/types.js +8 -0
  35. package/dist/i3s-converter/types.js.map +1 -1
  36. package/dist/i3s-server/bin/i3s-server.min.cjs +76 -76
  37. package/dist/index.cjs +638 -139
  38. package/dist/lib/utils/compress-util.d.ts +0 -37
  39. package/dist/lib/utils/compress-util.d.ts.map +1 -1
  40. package/dist/lib/utils/compress-util.js +1 -149
  41. package/dist/lib/utils/compress-util.js.map +1 -1
  42. package/dist/lib/utils/conversion-dump.d.ts +131 -0
  43. package/dist/lib/utils/conversion-dump.d.ts.map +1 -0
  44. package/dist/lib/utils/conversion-dump.js +191 -0
  45. package/dist/lib/utils/conversion-dump.js.map +1 -0
  46. package/dist/lib/utils/statistic-utills.js +1 -1
  47. package/dist/lib/utils/statistic-utills.js.map +1 -1
  48. package/dist/lib/utils/write-queue.d.ts +6 -1
  49. package/dist/lib/utils/write-queue.d.ts.map +1 -1
  50. package/dist/lib/utils/write-queue.js +15 -3
  51. package/dist/lib/utils/write-queue.js.map +1 -1
  52. package/dist/pgm-loader.js +1 -1
  53. package/dist/slpk-extractor.min.cjs +31 -31
  54. package/package.json +16 -16
  55. package/src/3d-tiles-converter/3d-tiles-converter.ts +5 -4
  56. package/src/3d-tiles-converter/helpers/b3dm-converter.ts +19 -0
  57. package/src/3d-tiles-converter/json-templates/tileset.ts +3 -0
  58. package/src/constants.ts +1 -0
  59. package/src/converter-cli.ts +3 -3
  60. package/src/i3s-converter/helpers/attribute-metadata-info.ts +16 -0
  61. package/src/i3s-converter/helpers/node-index-document.ts +18 -8
  62. package/src/i3s-converter/helpers/progress.ts +1 -1
  63. package/src/i3s-converter/i3s-converter.ts +385 -93
  64. package/src/i3s-converter/types.ts +8 -0
  65. package/src/lib/utils/compress-util.ts +1 -264
  66. package/src/lib/utils/conversion-dump.ts +325 -0
  67. package/src/lib/utils/statistic-utills.ts +1 -1
  68. package/src/lib/utils/write-queue.ts +15 -2
@@ -5,7 +5,7 @@ import { join, dirname } from 'path';
5
5
  import { ChildProcessProxy } from '@loaders.gl/worker-utils';
6
6
  import { DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS } from '@loaders.gl/draco';
7
7
  import { BASIS_EXTERNAL_LIBRARIES } from '@loaders.gl/textures';
8
- const VERSION = typeof "4.1.0-alpha.9" !== 'undefined' ? "4.1.0-alpha.9" : 'latest';
8
+ const VERSION = typeof "4.2.0-alpha.1" !== 'undefined' ? "4.2.0-alpha.1" : 'latest';
9
9
  const PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';
10
10
  export class DepsInstaller {
11
11
  async install() {
@@ -1,4 +1,9 @@
1
1
  import type { Attribute, AttributeStorageInfo, Field, PopupInfo } from '@loaders.gl/i3s';
2
+ export type AttributeMetadataInfoObject = {
3
+ attributeStorageInfo: AttributeStorageInfo[];
4
+ fields: Field[];
5
+ popupInfo: PopupInfo | undefined;
6
+ };
2
7
  export declare class AttributeMetadataInfo {
3
8
  private _attributeStorageInfo;
4
9
  private _fields;
@@ -30,6 +35,11 @@ export declare class AttributeMetadataInfo {
30
35
  * The method creates and stores objects for opt_uint64, opt_float32 attributes.
31
36
  */
32
37
  addMetadataInfo(attributeTypesMap: Record<string, Attribute>): void;
38
+ /**
39
+ * Set AttributeMetadataInfo from object
40
+ * @param object - object with AttributeMetadataInfo props
41
+ */
42
+ fromObject(object: AttributeMetadataInfoObject): void;
33
43
  /**
34
44
  * Generates storage attribute for map segmentation.
35
45
  * @param attributeIndex - order index of attribute (f_0, f_1 ...).
@@ -1 +1 @@
1
- {"version":3,"file":"attribute-metadata-info.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/attribute-metadata-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,oBAAoB,EAEpB,KAAK,EAEL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAIzB,qBAAa,qBAAqB;IAChC,OAAO,CAAC,qBAAqB,CAAyB;IACtD,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,UAAU,CAAwB;;IAO1C,IAAI,oBAAoB,IAAI,oBAAoB,EAAE,CAEjD;IAED,IAAI,MAAM,IAAI,KAAK,EAAE,CAEpB;IAED,IAAI,SAAS,IAAI,SAAS,GAAG,SAAS,CAErC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,eAAe,CAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI;IA0CnE;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;IAgC9B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAe7B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAO5B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAQ5B;;;;OAIG;IACH,OAAO,CAAC,eAAe;CA+BxB"}
1
+ {"version":3,"file":"attribute-metadata-info.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/attribute-metadata-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,oBAAoB,EAEpB,KAAK,EAEL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAIzB,MAAM,MAAM,2BAA2B,GAAG;IACxC,oBAAoB,EAAE,oBAAoB,EAAE,CAAC;IAC7C,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,qBAAa,qBAAqB;IAChC,OAAO,CAAC,qBAAqB,CAAyB;IACtD,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,UAAU,CAAwB;;IAO1C,IAAI,oBAAoB,IAAI,oBAAoB,EAAE,CAEjD;IAED,IAAI,MAAM,IAAI,KAAK,EAAE,CAEpB;IAED,IAAI,SAAS,IAAI,SAAS,GAAG,SAAS,CAErC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,eAAe,CAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI;IA0CnE;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,2BAA2B;IAM9C;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;IAgC9B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAe7B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAO5B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAQ5B;;;;OAIG;IACH,OAAO,CAAC,eAAe;CA+BxB"}
@@ -47,6 +47,11 @@ export class AttributeMetadataInfo {
47
47
  this._popupInfo = this.createPopupInfo(attributeNames);
48
48
  }
49
49
  }
50
+ fromObject(object) {
51
+ this._attributeStorageInfo = object.attributeStorageInfo;
52
+ this._fields = object.fields;
53
+ this._popupInfo = object.popupInfo;
54
+ }
50
55
  createStorageAttribute(attributeIndex, key, attributeType) {
51
56
  const storageAttribute = {
52
57
  key: `f_${attributeIndex}`,
@@ -1 +1 @@
1
- {"version":3,"file":"attribute-metadata-info.js","names":["AttributeType","AttributeMetadataInfo","constructor","_attributeStorageInfo","_fields","_popupInfo","attributeStorageInfo","fields","popupInfo","addMetadataInfo","attributeTypesMap","Object","keys","length","attributeTypes","OBJECTID","OBJECT_ID_TYPE","isUpdated","attributeIndex","key","elementFound","find","element","name","attributeType","storageAttribute","createStorageAttribute","fieldAttributeType","getFieldAttributeType","fieldAttribute","createFieldAttribute","push","attributeNames","info","createPopupInfo","ordering","header","property","valueType","attributeValues","valuesPerElement","setupIdAttribute","STRING_TYPE","setupStringAttribute","DOUBLE_TYPE","setupDoubleAttribute","SHORT_INT_TYPE","unshift","encoding","attributeByteCounts","type","alias","propertyNames","title","mediaInfos","fieldInfos","popupElements","expressionInfos","propertyName","fieldName","visible","isEditable","label"],"sources":["../../../src/i3s-converter/helpers/attribute-metadata-info.ts"],"sourcesContent":["import type {\n Attribute,\n AttributeStorageInfo,\n ESRIField,\n Field,\n FieldInfo,\n PopupInfo\n} from '@loaders.gl/i3s';\n\nimport {AttributeType} from '../types';\n\nexport class AttributeMetadataInfo {\n private _attributeStorageInfo: AttributeStorageInfo[];\n private _fields: Field[];\n private _popupInfo: PopupInfo | undefined;\n\n constructor() {\n this._attributeStorageInfo = [];\n this._fields = [];\n }\n\n get attributeStorageInfo(): AttributeStorageInfo[] {\n return this._attributeStorageInfo;\n }\n\n get fields(): Field[] {\n return this._fields;\n }\n\n get popupInfo(): PopupInfo | undefined {\n return this._popupInfo;\n }\n\n /**\n * Creates and stores Attribute Storage Info, Fields and PopupInfo objects based on attribute's types.\n * Appends objects that have not been stored yet.\n * @param attributeTypesMap - set of attribute's types\n * @example AttributeStorageInfo, Fields and PopupInfo already contain objects for the following attributes:\n * {\n * color: 'string',\n * name: 'string',\n * opt_uint8: 'Int32'\n * }\n * Then, we call the addMetadataInfo method with the following attributeTypesMap:\n * {\n * // The same attributes\n * color: 'string',\n * name: 'string',\n * opt_uint8: 'Int32',\n * // New attributes\n * opt_uint64: 'string',\n * opt_float32: 'double',\n * }\n * The method creates and stores objects for opt_uint64, opt_float32 attributes.\n */\n addMetadataInfo(attributeTypesMap: Record<string, Attribute>): void {\n if (!Object.keys(attributeTypesMap).length) {\n return;\n }\n const attributeTypes: Record<string, Attribute> = {\n OBJECTID: AttributeType.OBJECT_ID_TYPE,\n ...attributeTypesMap\n };\n\n let isUpdated = false;\n let attributeIndex = this._attributeStorageInfo.length;\n for (const key in attributeTypes) {\n /*\n We will append a new attribute only in case it has not been added to the attribute storage info yet.\n */\n const elementFound = this._attributeStorageInfo.find((element) => element.name === key);\n if (!elementFound) {\n const attributeType = attributeTypes[key];\n\n const storageAttribute = this.createStorageAttribute(attributeIndex, key, attributeType);\n const fieldAttributeType = this.getFieldAttributeType(attributeType);\n const fieldAttribute = this.createFieldAttribute(key, fieldAttributeType);\n\n this._attributeStorageInfo.push(storageAttribute);\n this._fields.push(fieldAttribute);\n attributeIndex += 1;\n isUpdated = true;\n }\n }\n if (isUpdated) {\n /*\n The attributeStorageInfo is updated. So, popupInfo should be recreated.\n Use attributeStorageInfo as a source of attribute names to create the popupInfo.\n */\n const attributeNames: string[] = [];\n for (let info of this._attributeStorageInfo) {\n attributeNames.push(info.name);\n }\n this._popupInfo = this.createPopupInfo(attributeNames);\n }\n }\n\n /**\n * Generates 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 */\n private createStorageAttribute(\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 AttributeType.OBJECT_ID_TYPE:\n this.setupIdAttribute(storageAttribute);\n break;\n case AttributeType.STRING_TYPE:\n this.setupStringAttribute(storageAttribute);\n break;\n case AttributeType.DOUBLE_TYPE:\n this.setupDoubleAttribute(storageAttribute);\n break;\n case AttributeType.SHORT_INT_TYPE:\n break;\n default:\n this.setupStringAttribute(storageAttribute);\n }\n\n return storageAttribute;\n }\n\n /**\n * Finds and returns attribute type based on key form propertyTable.\n * @param attributeType\n */\n private getFieldAttributeType(attributeType: Attribute): ESRIField {\n switch (attributeType) {\n case AttributeType.OBJECT_ID_TYPE:\n return 'esriFieldTypeOID';\n case AttributeType.STRING_TYPE:\n return 'esriFieldTypeString';\n case AttributeType.SHORT_INT_TYPE:\n return 'esriFieldTypeInteger';\n case AttributeType.DOUBLE_TYPE:\n return 'esriFieldTypeDouble';\n default:\n return 'esriFieldTypeString';\n }\n }\n\n /**\n * Sets up Id attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\n private setupIdAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Oid32',\n valuesPerElement: 1\n };\n }\n\n /**\n * Sets up storage attribute as string.\n * @param storageAttribute - attribute for map segmentation.\n */\n private 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 * Sets up double attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\n private setupDoubleAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Float64',\n valuesPerElement: 1\n };\n }\n\n /**\n * Sets up field attribute for map segmentation.\n * @param key - attribute for map segmentation.\n * @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').\n */\n private createFieldAttribute(key: string, fieldAttributeType: ESRIField): Field {\n return {\n name: key,\n type: fieldAttributeType,\n alias: key\n };\n }\n\n /**\n * Generates popup info to show metadata on the map.\n * @param propertyNames - array of property names including OBJECTID.\n * @return data for correct rendering of popup.\n */\n private createPopupInfo(propertyNames: string[]): 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 propertyName of propertyNames) {\n fieldInfos.push({\n fieldName: propertyName,\n visible: true,\n isEditable: false,\n label: propertyName\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"],"mappings":"SASQA,aAAa;AAErB,OAAO,MAAMC,qBAAqB,CAAC;EAKjCC,WAAWA,CAAA,EAAG;IAAA,KAJNC,qBAAqB;IAAA,KACrBC,OAAO;IAAA,KACPC,UAAU;IAGhB,IAAI,CAACF,qBAAqB,GAAG,EAAE;IAC/B,IAAI,CAACC,OAAO,GAAG,EAAE;EACnB;EAEA,IAAIE,oBAAoBA,CAAA,EAA2B;IACjD,OAAO,IAAI,CAACH,qBAAqB;EACnC;EAEA,IAAII,MAAMA,CAAA,EAAY;IACpB,OAAO,IAAI,CAACH,OAAO;EACrB;EAEA,IAAII,SAASA,CAAA,EAA0B;IACrC,OAAO,IAAI,CAACH,UAAU;EACxB;EAwBAI,eAAeA,CAACC,iBAA4C,EAAQ;IAClE,IAAI,CAACC,MAAM,CAACC,IAAI,CAACF,iBAAiB,CAAC,CAACG,MAAM,EAAE;MAC1C;IACF;IACA,MAAMC,cAAyC,GAAG;MAChDC,QAAQ,EAAEf,aAAa,CAACgB,cAAc;MACtC,GAAGN;IACL,CAAC;IAED,IAAIO,SAAS,GAAG,KAAK;IACrB,IAAIC,cAAc,GAAG,IAAI,CAACf,qBAAqB,CAACU,MAAM;IACtD,KAAK,MAAMM,GAAG,IAAIL,cAAc,EAAE;MAIhC,MAAMM,YAAY,GAAG,IAAI,CAACjB,qBAAqB,CAACkB,IAAI,CAAEC,OAAO,IAAKA,OAAO,CAACC,IAAI,KAAKJ,GAAG,CAAC;MACvF,IAAI,CAACC,YAAY,EAAE;QACjB,MAAMI,aAAa,GAAGV,cAAc,CAACK,GAAG,CAAC;QAEzC,MAAMM,gBAAgB,GAAG,IAAI,CAACC,sBAAsB,CAACR,cAAc,EAAEC,GAAG,EAAEK,aAAa,CAAC;QACxF,MAAMG,kBAAkB,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IAAI,EAAEJ,GAAG;MACT+B,IAAI,EAAEvB,kBAAkB;MACxBwB,KAAK,EAAEhC;IACT,CAAC;EACH;EAOQe,eAAeA,CAACkB,aAAuB,EAAa;IAC1D,MAAMC,KAAK,GAAG,YAAY;IAC1B,MAAMC,UAAU,GAAG,EAAE;IACrB,MAAMC,UAAuB,GAAG,EAAE;IAClC,MAAMC,aAGH,GAAG,EAAE;IACR,MAAMC,eAAe,GAAG,EAAE;IAE1B,KAAK,MAAMC,YAAY,IAAIN,aAAa,EAAE;MACxCG,UAAU,CAACxB,IAAI,CAAC;QACd4B,SAAS,EAAED,YAAY;QACvBE,OAAO,EAAE,IAAI;QACbC,UAAU,EAAE,KAAK;QACjBC,KAAK,EAAEJ;MACT,CAAC,CAAC;IACJ;IACAF,aAAa,CAACzB,IAAI,CAAC;MACjBwB,UAAU;MACVL,IAAI,EAAE;IACR,CAAC,CAAC;IAEF,OAAO;MACLG,KAAK;MACLC,UAAU;MACVE,aAAa;MACbD,UAAU;MACVE;IACF,CAAC;EACH;AACF"}
1
+ {"version":3,"file":"attribute-metadata-info.js","names":["AttributeType","AttributeMetadataInfo","constructor","_attributeStorageInfo","_fields","_popupInfo","attributeStorageInfo","fields","popupInfo","addMetadataInfo","attributeTypesMap","Object","keys","length","attributeTypes","OBJECTID","OBJECT_ID_TYPE","isUpdated","attributeIndex","key","elementFound","find","element","name","attributeType","storageAttribute","createStorageAttribute","fieldAttributeType","getFieldAttributeType","fieldAttribute","createFieldAttribute","push","attributeNames","info","createPopupInfo","fromObject","object","ordering","header","property","valueType","attributeValues","valuesPerElement","setupIdAttribute","STRING_TYPE","setupStringAttribute","DOUBLE_TYPE","setupDoubleAttribute","SHORT_INT_TYPE","unshift","encoding","attributeByteCounts","type","alias","propertyNames","title","mediaInfos","fieldInfos","popupElements","expressionInfos","propertyName","fieldName","visible","isEditable","label"],"sources":["../../../src/i3s-converter/helpers/attribute-metadata-info.ts"],"sourcesContent":["import type {\n Attribute,\n AttributeStorageInfo,\n ESRIField,\n Field,\n FieldInfo,\n PopupInfo\n} from '@loaders.gl/i3s';\n\nimport {AttributeType} from '../types';\n\nexport type AttributeMetadataInfoObject = {\n attributeStorageInfo: AttributeStorageInfo[];\n fields: Field[];\n popupInfo: PopupInfo | undefined;\n};\n\nexport class AttributeMetadataInfo {\n private _attributeStorageInfo: AttributeStorageInfo[];\n private _fields: Field[];\n private _popupInfo: PopupInfo | undefined;\n\n constructor() {\n this._attributeStorageInfo = [];\n this._fields = [];\n }\n\n get attributeStorageInfo(): AttributeStorageInfo[] {\n return this._attributeStorageInfo;\n }\n\n get fields(): Field[] {\n return this._fields;\n }\n\n get popupInfo(): PopupInfo | undefined {\n return this._popupInfo;\n }\n\n /**\n * Creates and stores Attribute Storage Info, Fields and PopupInfo objects based on attribute's types.\n * Appends objects that have not been stored yet.\n * @param attributeTypesMap - set of attribute's types\n * @example AttributeStorageInfo, Fields and PopupInfo already contain objects for the following attributes:\n * {\n * color: 'string',\n * name: 'string',\n * opt_uint8: 'Int32'\n * }\n * Then, we call the addMetadataInfo method with the following attributeTypesMap:\n * {\n * // The same attributes\n * color: 'string',\n * name: 'string',\n * opt_uint8: 'Int32',\n * // New attributes\n * opt_uint64: 'string',\n * opt_float32: 'double',\n * }\n * The method creates and stores objects for opt_uint64, opt_float32 attributes.\n */\n addMetadataInfo(attributeTypesMap: Record<string, Attribute>): void {\n if (!Object.keys(attributeTypesMap).length) {\n return;\n }\n const attributeTypes: Record<string, Attribute> = {\n OBJECTID: AttributeType.OBJECT_ID_TYPE,\n ...attributeTypesMap\n };\n\n let isUpdated = false;\n let attributeIndex = this._attributeStorageInfo.length;\n for (const key in attributeTypes) {\n /*\n We will append a new attribute only in case it has not been added to the attribute storage info yet.\n */\n const elementFound = this._attributeStorageInfo.find((element) => element.name === key);\n if (!elementFound) {\n const attributeType = attributeTypes[key];\n\n const storageAttribute = this.createStorageAttribute(attributeIndex, key, attributeType);\n const fieldAttributeType = this.getFieldAttributeType(attributeType);\n const fieldAttribute = this.createFieldAttribute(key, fieldAttributeType);\n\n this._attributeStorageInfo.push(storageAttribute);\n this._fields.push(fieldAttribute);\n attributeIndex += 1;\n isUpdated = true;\n }\n }\n if (isUpdated) {\n /*\n The attributeStorageInfo is updated. So, popupInfo should be recreated.\n Use attributeStorageInfo as a source of attribute names to create the popupInfo.\n */\n const attributeNames: string[] = [];\n for (let info of this._attributeStorageInfo) {\n attributeNames.push(info.name);\n }\n this._popupInfo = this.createPopupInfo(attributeNames);\n }\n }\n\n /**\n * Set AttributeMetadataInfo from object\n * @param object - object with AttributeMetadataInfo props\n */\n fromObject(object: AttributeMetadataInfoObject) {\n this._attributeStorageInfo = object.attributeStorageInfo;\n this._fields = object.fields;\n this._popupInfo = object.popupInfo;\n }\n\n /**\n * Generates 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 */\n private createStorageAttribute(\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 AttributeType.OBJECT_ID_TYPE:\n this.setupIdAttribute(storageAttribute);\n break;\n case AttributeType.STRING_TYPE:\n this.setupStringAttribute(storageAttribute);\n break;\n case AttributeType.DOUBLE_TYPE:\n this.setupDoubleAttribute(storageAttribute);\n break;\n case AttributeType.SHORT_INT_TYPE:\n break;\n default:\n this.setupStringAttribute(storageAttribute);\n }\n\n return storageAttribute;\n }\n\n /**\n * Finds and returns attribute type based on key form propertyTable.\n * @param attributeType\n */\n private getFieldAttributeType(attributeType: Attribute): ESRIField {\n switch (attributeType) {\n case AttributeType.OBJECT_ID_TYPE:\n return 'esriFieldTypeOID';\n case AttributeType.STRING_TYPE:\n return 'esriFieldTypeString';\n case AttributeType.SHORT_INT_TYPE:\n return 'esriFieldTypeInteger';\n case AttributeType.DOUBLE_TYPE:\n return 'esriFieldTypeDouble';\n default:\n return 'esriFieldTypeString';\n }\n }\n\n /**\n * Sets up Id attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\n private setupIdAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Oid32',\n valuesPerElement: 1\n };\n }\n\n /**\n * Sets up storage attribute as string.\n * @param storageAttribute - attribute for map segmentation.\n */\n private 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 * Sets up double attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\n private setupDoubleAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Float64',\n valuesPerElement: 1\n };\n }\n\n /**\n * Sets up field attribute for map segmentation.\n * @param key - attribute for map segmentation.\n * @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').\n */\n private createFieldAttribute(key: string, fieldAttributeType: ESRIField): Field {\n return {\n name: key,\n type: fieldAttributeType,\n alias: key\n };\n }\n\n /**\n * Generates popup info to show metadata on the map.\n * @param propertyNames - array of property names including OBJECTID.\n * @return data for correct rendering of popup.\n */\n private createPopupInfo(propertyNames: string[]): 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 propertyName of propertyNames) {\n fieldInfos.push({\n fieldName: propertyName,\n visible: true,\n isEditable: false,\n label: propertyName\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"],"mappings":"SASQA,aAAa;AAQrB,OAAO,MAAMC,qBAAqB,CAAC;EAKjCC,WAAWA,CAAA,EAAG;IAAA,KAJNC,qBAAqB;IAAA,KACrBC,OAAO;IAAA,KACPC,UAAU;IAGhB,IAAI,CAACF,qBAAqB,GAAG,EAAE;IAC/B,IAAI,CAACC,OAAO,GAAG,EAAE;EACnB;EAEA,IAAIE,oBAAoBA,CAAA,EAA2B;IACjD,OAAO,IAAI,CAACH,qBAAqB;EACnC;EAEA,IAAII,MAAMA,CAAA,EAAY;IACpB,OAAO,IAAI,CAACH,OAAO;EACrB;EAEA,IAAII,SAASA,CAAA,EAA0B;IACrC,OAAO,IAAI,CAACH,UAAU;EACxB;EAwBAI,eAAeA,CAACC,iBAA4C,EAAQ;IAClE,IAAI,CAACC,MAAM,CAACC,IAAI,CAACF,iBAAiB,CAAC,CAACG,MAAM,EAAE;MAC1C;IACF;IACA,MAAMC,cAAyC,GAAG;MAChDC,QAAQ,EAAEf,aAAa,CAACgB,cAAc;MACtC,GAAGN;IACL,CAAC;IAED,IAAIO,SAAS,GAAG,KAAK;IACrB,IAAIC,cAAc,GAAG,IAAI,CAACf,qBAAqB,CAACU,MAAM;IACtD,KAAK,MAAMM,GAAG,IAAIL,cAAc,EAAE;MAIhC,MAAMM,YAAY,GAAG,IAAI,CAACjB,qBAAqB,CAACkB,IAAI,CAAEC,OAAO,IAAKA,OAAO,CAACC,IAAI,KAAKJ,GAAG,CAAC;MACvF,IAAI,CAACC,YAAY,EAAE;QACjB,MAAMI,aAAa,GAAGV,cAAc,CAACK,GAAG,CAAC;QAEzC,MAAMM,gBAAgB,GAAG,IAAI,CAACC,sBAAsB,CAACR,cAAc,EAAEC,GAAG,EAAEK,aAAa,CAAC;QACxF,MAAMG,kBAAkB,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ACH;EAMQK,oBAAoBA,CAACtB,gBAAsC,EAAQ;IACzEA,gBAAgB,CAACgB,eAAe,GAAG;MACjCD,SAAS,EAAE,SAAS;MACpBE,gBAAgB,EAAE;IACpB,CAAC;EACH;EAOQZ,oBAAoBA,CAACX,GAAW,EAAEQ,kBAA6B,EAAS;IAC9E,OAAO;MACLJ,IAAI,EAAEJ,GAAG;MACTiC,IAAI,EAAEzB,kBAAkB;MACxB0B,KAAK,EAAElC;IACT,CAAC;EACH;EAOQe,eAAeA,CAACoB,aAAuB,EAAa;IAC1D,MAAMC,KAAK,GAAG,YAAY;IAC1B,MAAMC,UAAU,GAAG,EAAE;IACrB,MAAMC,UAAuB,GAAG,EAAE;IAClC,MAAMC,aAGH,GAAG,EAAE;IACR,MAAMC,eAAe,GAAG,EAAE;IAE1B,KAAK,MAAMC,YAAY,IAAIN,aAAa,EAAE;MACxCG,UAAU,CAAC1B,IAAI,CAAC;QACd8B,SAAS,EAAED,YAAY;QACvBE,OAAO,EAAE,IAAI;QACbC,UAAU,EAAE,KAAK;QACjBC,KAAK,EAAEJ;MACT,CAAC,CAAC;IACJ;IACAF,aAAa,CAAC3B,IAAI,CAAC;MACjB0B,UAAU;MACVL,IAAI,EAAE;IACR,CAAC,CAAC;IAEF,OAAO;MACLG,KAAK;MACLC,UAAU;MACVE,aAAa;MACbD,UAAU;MACVE;IACF,CAAC;EACH;AACF"}
@@ -1,6 +1,7 @@
1
1
  import { BoundingVolumes, LodSelection, Node3DIndexDocument, NodeInPage } from '@loaders.gl/i3s';
2
2
  import I3SConverter from '../i3s-converter';
3
3
  import { I3SConvertedResources } from '../types';
4
+ import { DumpMetadata } from '../../lib/utils/conversion-dump';
4
5
  /**
5
6
  * Wrapper for https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md data
6
7
  * The class allows working with 3DNodeIndexDocument in 2 modes:
@@ -98,6 +99,6 @@ export declare class NodeIndexDocument {
98
99
  * @param resources.attributes - feature attributes
99
100
  * @return 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object
100
101
  */
101
- static createNodeIndexDocument(parentNode: NodeIndexDocument, boundingVolumes: BoundingVolumes, lodSelection: LodSelection[], nodeInPage: NodeInPage, resources: I3SConvertedResources): Promise<Node3DIndexDocument>;
102
+ static createNodeIndexDocument(parentNode: NodeIndexDocument, boundingVolumes: BoundingVolumes, lodSelection: LodSelection[], nodeInPage: NodeInPage, resources: I3SConvertedResources | DumpMetadata): Promise<Node3DIndexDocument>;
102
103
  }
103
104
  //# sourceMappingURL=node-index-document.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node-index-document.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-index-document.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,UAAU,EAEX,MAAM,iBAAiB,CAAC;AAIzB,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAC,qBAAqB,EAAC,MAAM,UAAU,CAAC;AAE/C;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B,cAAc;IACP,EAAE,EAAE,MAAM,CAAC;IAClB,uBAAuB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACxB,+BAA+B;IACxB,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAAQ;IAC/C,eAAe;IACR,QAAQ,EAAE,iBAAiB,EAAE,CAAM;IAC1C,yBAAyB;IACzB,OAAO,CAAC,SAAS,CAAe;IAEhC;;;OAGG;IACH,OAAO,CAAC,UAAU,CAAkB;IACpC,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;;;OAIG;gBACS,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY;IAM/C;;;;OAIG;IACU,OAAO,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAS3E;;;OAGG;IACU,WAAW,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BxE;;OAEG;IACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAmC1C,+CAA+C;IAClC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAMlC,wBAAwB;IACxB,OAAO,CAAC,QAAQ;IAOhB;;;OAGG;YACW,KAAK;IAyBnB;;;OAGG;YACW,IAAI;IAalB;;OAEG;IACH,OAAO,CAAC,KAAK;IAIb;;;;;OAKG;WACU,cAAc,CACzB,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,iBAAiB,CAAC;IAM7B;;;;;;;;;OASG;WACU,UAAU,CACrB,UAAU,EAAE,iBAAiB,EAC7B,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAAE,EAC5B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,qBAAqB,EAChC,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,iBAAiB,CAAC;IAY7B;;;;OAIG;IACH,MAAM,CAAC,2BAA2B,CAAC,eAAe,EAAE,eAAe,GAAG,mBAAmB;IAqBzF;;;;;;;;;;OAUG;WACU,uBAAuB,CAClC,UAAU,EAAE,iBAAiB,EAC7B,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAAE,EAC5B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,qBAAqB,GAC/B,OAAO,CAAC,mBAAmB,CAAC;CAgDhC"}
1
+ {"version":3,"file":"node-index-document.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-index-document.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,UAAU,EAEX,MAAM,iBAAiB,CAAC;AAIzB,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAC,qBAAqB,EAAC,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,iCAAiC,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AAC,eAAe,EAAE,eAAe,GAAG,mBAAmB;IAqBzF;;;;;;;;;;OAUG;WACU,uBAAuB,CAClC,UAAU,EAAE,iBAAiB,EAC7B,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAAE,EAC5B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,qBAAqB,GAAG,YAAY,GAC9C,OAAO,CAAC,mBAAmB,CAAC;CAyDhC"}
@@ -147,10 +147,6 @@ export class NodeIndexDocument {
147
147
  return transform(root0data, nodeTemplate());
148
148
  }
149
149
  static async createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources) {
150
- const {
151
- texture,
152
- attributes
153
- } = resources;
154
150
  const nodeId = nodeInPage.index;
155
151
  const parentNodeData = await parentNode.load();
156
152
  const nodeData = {
@@ -170,23 +166,25 @@ export class NodeIndexDocument {
170
166
  };
171
167
  const node = transform(nodeData, nodeTemplate());
172
168
  if (nodeInPage.mesh) {
173
- var _parentNode$converter, _parentNode$converter2;
169
+ var _parentNode$converter, _parentNode$converter2, _parentNode$converter3, _parentNode$converter4;
174
170
  node.geometryData = [{
175
171
  href: './geometries/0'
176
172
  }];
177
173
  node.sharedResource = {
178
174
  href: './shared'
179
175
  };
180
- if (texture) {
176
+ if ('texture' in resources && resources.texture || 'texelCountHint' in resources && resources.texelCountHint) {
181
177
  node.textureData = [{
182
178
  href: './textures/0'
183
179
  }, {
184
180
  href: './textures/1'
185
181
  }];
186
182
  }
187
- if (attributes && attributes.length && (_parentNode$converter = parentNode.converter.layers0) !== null && _parentNode$converter !== void 0 && (_parentNode$converter2 = _parentNode$converter.attributeStorageInfo) !== null && _parentNode$converter2 !== void 0 && _parentNode$converter2.length) {
183
+ if ('attributes' in resources && resources.attributes && resources.attributes.length && (_parentNode$converter = parentNode.converter.layers0) !== null && _parentNode$converter !== void 0 && (_parentNode$converter2 = _parentNode$converter.attributeStorageInfo) !== null && _parentNode$converter2 !== void 0 && _parentNode$converter2.length || 'attributesCount' in resources && resources.attributesCount && (_parentNode$converter3 = parentNode.converter.layers0) !== null && _parentNode$converter3 !== void 0 && (_parentNode$converter4 = _parentNode$converter3.attributeStorageInfo) !== null && _parentNode$converter4 !== void 0 && _parentNode$converter4.length) {
184
+ var _resources$attributes;
185
+ const attributesLength = ('attributes' in resources ? (_resources$attributes = resources.attributes) === null || _resources$attributes === void 0 ? void 0 : _resources$attributes.length : resources.attributesCount) || 0;
188
186
  node.attributeData = [];
189
- const minimumLength = attributes.length < parentNode.converter.layers0.attributeStorageInfo.length ? attributes.length : parentNode.converter.layers0.attributeStorageInfo.length;
187
+ const minimumLength = attributesLength < parentNode.converter.layers0.attributeStorageInfo.length ? attributesLength : parentNode.converter.layers0.attributeStorageInfo.length;
190
188
  for (let index = 0; index < minimumLength; index++) {
191
189
  const folderName = parentNode.converter.layers0.attributeStorageInfo[index].key;
192
190
  node.attributeData.push({
@@ -1 +1 @@
1
- {"version":3,"file":"node-index-document.js","names":["join","transform","v4","uuidv4","openJson","writeFile","writeFileForSlpk","NODE","nodeTemplate","NodeIndexDocument","finalized","_finalized","constructor","id","converter","inPageId","data","children","toString","addData","options","instantNodeWriting","write","addChildren","childNodes","newChildren","node","nodeData","load","push","href","obb","mbs","concat","_data$children","addNeighbors","childNode","_childNodeData$neighb","_nodeData$children","childNodeData","neighbors","Number","length","neighbor","console","warn","save","finalize","child","flush","path","layers0Path","slpk","writeQueue","enqueue","archiveKey","writePromise","JSON","stringify","compressList","parentNodePath","parentNodeFileName","createRootNode","boundingVolumes","rootData","createRootNodeIndexDocument","rootNode","createNode","parentNode","lodSelection","nodeInPage","resources","createNodeIndexDocument","index","root0data","version","toUpperCase","level","metricType","maxError","texture","attributes","nodeId","parentNodeData","mesh","_parentNode$converter","_parentNode$converter2","geometryData","sharedResource","textureData","layers0","attributeStorageInfo","attributeData","minimumLength","folderName","key"],"sources":["../../../src/i3s-converter/helpers/node-index-document.ts"],"sourcesContent":["import {join} from 'path';\nimport {\n BoundingVolumes,\n LodSelection,\n Node3DIndexDocument,\n NodeInPage,\n NodeReference\n} from '@loaders.gl/i3s';\nimport transform from 'json-map-transform';\nimport {v4 as uuidv4} from 'uuid';\nimport {openJson, writeFile, writeFileForSlpk} from '../../lib/utils/file-utils';\nimport I3SConverter from '../i3s-converter';\nimport {NODE as nodeTemplate} from '../json-templates/node';\nimport {I3SConvertedResources} from '../types';\n\n/**\n * Wrapper for https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md data\n * The class allows working with 3DNodeIndexDocument in 2 modes:\n * in memory: the data is stored in `data` field\n * on disk: the data is written on disk in a file. The file can be rewritten when new childrend or neighbors have to be added\n */\nexport class NodeIndexDocument {\n /** Node id */\n public id: string;\n /** Id in node pages */\n public inPageId: number;\n /** 3DNodeIndexDocument data */\n public data: Node3DIndexDocument | null = null;\n /** children */\n public children: NodeIndexDocument[] = [];\n /** converter instance */\n private converter: I3SConverter;\n\n /**\n * Finalized property. It means that all child nodes are saved and their data\n * is unloaded\n */\n private _finalized: boolean = false;\n get finalized(): boolean {\n return this._finalized;\n }\n\n /**\n * Constructor\n * @param id - id of the node in node pages\n * @param converter - converter instance\n */\n constructor(id: number, converter: I3SConverter) {\n this.inPageId = id;\n this.id = id === 0 ? 'root' : id.toString();\n this.converter = converter;\n }\n\n /**\n * Add Node3DIndexDocument data to the node\n * @param data Node3DIndexDocument data\n * @returns this NodeIndexDocument instance (to recurring with constructor)\n */\n public async addData(data: Node3DIndexDocument): Promise<NodeIndexDocument> {\n if (this.converter.options.instantNodeWriting) {\n await this.write(data);\n } else {\n this.data = data;\n }\n return this;\n }\n\n /**\n * Add child node references\n * @param childNodes - child NodeIndexDocument instances\n */\n public async addChildren(childNodes: NodeIndexDocument[]): Promise<void> {\n const newChildren: NodeReference[] = [];\n for (const node of childNodes) {\n const nodeData = await node.load();\n newChildren.push({\n id: node.id,\n href: `../${node.id}`,\n obb: nodeData.obb,\n mbs: nodeData.mbs\n });\n }\n this.children = this.children.concat(childNodes);\n\n let data: Node3DIndexDocument | null = this.data;\n if (this.converter.options.instantNodeWriting) {\n data = (await this.load()) as Node3DIndexDocument;\n }\n if (data) {\n data.children = data.children ?? [];\n data.children = data.children.concat(newChildren);\n }\n if (this.converter.options.instantNodeWriting && data) {\n await this.write(data);\n }\n }\n\n /**\n * Add neighbors to child nodes of this node\n */\n public async addNeighbors(): Promise<void> {\n if (this.finalized) {\n return;\n }\n const nodeData = await this.load();\n for (const childNode of this.children) {\n const childNodeData = await childNode.load();\n childNodeData.neighbors = childNodeData.neighbors ?? [];\n\n // Don't do large amount of \"neightbors\" to avoid big memory consumption\n if (Number(nodeData?.children?.length) < 1000) {\n for (const neighbor of nodeData.children || []) {\n if (childNode.id === neighbor.id) {\n continue; // eslint-disable-line\n }\n\n childNodeData.neighbors.push({...neighbor});\n }\n } else {\n // eslint-disable-next-line no-console, no-undef\n console.warn(\n `Node ${childNode.id}: neighbors attribute is omited because of large number of neigbors`\n );\n delete childNodeData.neighbors;\n }\n\n if (this.converter.options.instantNodeWriting && childNodeData) {\n await childNode.write(childNodeData);\n }\n await childNode.save();\n }\n // The save after adding neighbors is the last one. Finalize the the node\n this.finalize();\n }\n\n /** Save 3DNodeIndexDocument in file on disk */\n public async save(): Promise<void> {\n if (this.data) {\n await this.write(this.data);\n }\n }\n\n /** Finalize the node */\n private finalize(): void {\n this._finalized = true;\n for (const child of this.children) {\n child.flush();\n }\n }\n\n /**\n * Write 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md\n * @param node - Node3DIndexDocument object\n */\n private async write(node: Node3DIndexDocument): Promise<void> {\n const path = join(this.converter.layers0Path, 'nodes', this.id);\n if (this.converter.options.slpk) {\n await this.converter.writeQueue.enqueue(\n {\n archiveKey: `nodes/${this.id}/3dNodeIndexDocument.json.gz`,\n writePromise: () =>\n writeFileForSlpk(\n path,\n JSON.stringify(node),\n '3dNodeIndexDocument.json',\n true,\n this.converter.compressList\n )\n },\n true\n );\n } else {\n await this.converter.writeQueue.enqueue(\n {writePromise: () => writeFile(path, JSON.stringify(node))},\n true\n );\n }\n }\n\n /**\n * Load 3DNodeIndexDocument data from file on disk\n * @returns 3DNodeIndexDocument object\n */\n private async load(): Promise<Node3DIndexDocument> {\n if (this.data) {\n return this.data;\n }\n const path = this.id;\n const parentNodePath = join(this.converter.layers0Path, 'nodes', path);\n let parentNodeFileName = 'index.json';\n if (this.converter.options.slpk) {\n parentNodeFileName = '3dNodeIndexDocument.json';\n }\n return (await openJson(parentNodePath, parentNodeFileName)) as Node3DIndexDocument;\n }\n\n /**\n * Unload the Node data\n */\n private flush(): void {\n this.data = null;\n }\n\n /**\n * Create root node of the tree\n * @param boundingVolumes - MBS and OOB bounding volumes data\n * @param converter - I3SConverter instance\n * @returns instance of NodeIndexDocument\n */\n static async createRootNode(\n boundingVolumes: BoundingVolumes,\n converter: I3SConverter\n ): Promise<NodeIndexDocument> {\n const rootData = NodeIndexDocument.createRootNodeIndexDocument(boundingVolumes);\n const rootNode = await new NodeIndexDocument(0, converter).addData(rootData);\n return rootNode;\n }\n\n /**\n * Create NodeIndexDocument instance\n * @param parentNode - parent NodeIndexDocument\n * @param boundingVolumes - MBS and OOB bounding volumes data\n * @param lodSelection - LOD metrics data\n * @param nodeInPage - node data in node pages\n * @param resources - resources extracted from gltf/b3dm file\n * @param converter - I3SConverter instance\n * @returns NodeIndexDocument instance\n */\n static async createNode(\n parentNode: NodeIndexDocument,\n boundingVolumes: BoundingVolumes,\n lodSelection: LodSelection[],\n nodeInPage: NodeInPage,\n resources: I3SConvertedResources,\n converter: I3SConverter\n ): Promise<NodeIndexDocument> {\n const data = await NodeIndexDocument.createNodeIndexDocument(\n parentNode,\n boundingVolumes,\n lodSelection,\n nodeInPage,\n resources\n );\n const node = await new NodeIndexDocument(nodeInPage.index, converter).addData(data);\n return node;\n }\n\n /**\n * Form 3DNodeIndexDocument data for the root node\n * @param boundingVolumes - mbs and obb data about node's bounding volume\n * @return 3DNodeIndexDocument data https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md\n */\n static createRootNodeIndexDocument(boundingVolumes: BoundingVolumes): Node3DIndexDocument {\n const root0data = {\n version: `{${uuidv4().toUpperCase()}}`,\n id: 'root',\n level: 0,\n lodSelection: [\n {\n metricType: 'maxScreenThresholdSQ',\n maxError: 0\n },\n {\n metricType: 'maxScreenThreshold',\n maxError: 0\n }\n ],\n ...boundingVolumes,\n children: []\n };\n return transform(root0data, nodeTemplate());\n }\n\n /**\n * Create a new Node3DIndexDocument\n * @param parentNode - 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object of the parent node\n * @param boundingVolumes - Bounding volumes\n * @param lodSelection - Level of Details (LOD) metrics\n * @param nodeInPage - corresponding node object in a node page\n * @param resources - the node resources data\n * @param resources.texture - texture image\n * @param resources.attributes - feature attributes\n * @return 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object\n */\n static async createNodeIndexDocument(\n parentNode: NodeIndexDocument,\n boundingVolumes: BoundingVolumes,\n lodSelection: LodSelection[],\n nodeInPage: NodeInPage,\n resources: I3SConvertedResources\n ): Promise<Node3DIndexDocument> {\n const {texture, attributes} = resources;\n const nodeId = nodeInPage.index!;\n const parentNodeData = await parentNode.load();\n const nodeData = {\n version: parentNodeData.version,\n id: nodeId.toString(),\n level: parentNodeData.level! + 1,\n ...boundingVolumes,\n lodSelection,\n parentNode: {\n id: parentNode.id,\n href: `../${parentNode.id}`,\n mbs: parentNodeData.mbs,\n obb: parentNodeData.obb\n },\n children: [],\n neighbors: []\n };\n const node = transform(nodeData, nodeTemplate());\n\n if (nodeInPage.mesh) {\n node.geometryData = [{href: './geometries/0'}];\n node.sharedResource = {href: './shared'};\n\n if (texture) {\n node.textureData = [{href: './textures/0'}, {href: './textures/1'}];\n }\n\n if (\n attributes &&\n attributes.length &&\n parentNode.converter.layers0?.attributeStorageInfo?.length\n ) {\n node.attributeData = [];\n const minimumLength =\n attributes.length < parentNode.converter.layers0.attributeStorageInfo.length\n ? attributes.length\n : parentNode.converter.layers0.attributeStorageInfo.length;\n for (let index = 0; index < minimumLength; index++) {\n const folderName = parentNode.converter.layers0.attributeStorageInfo[index].key;\n node.attributeData.push({href: `./attributes/${folderName}/0`});\n }\n }\n }\n\n return node;\n }\n}\n"],"mappings":"AAAA,SAAQA,IAAI,QAAO,MAAM;AAQzB,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,SAAQC,EAAE,IAAIC,MAAM,QAAO,MAAM;AAAC,SAC1BC,QAAQ,EAAEC,SAAS,EAAEC,gBAAgB;AAAA,SAErCC,IAAI,IAAIC,YAAY;AAS5B,OAAO,MAAMC,iBAAiB,CAAC;EAiB7B,IAAIC,SAASA,CAAA,EAAY;IACvB,OAAO,IAAI,CAACC,UAAU;EACxB;EAOAC,WAAWA,CAACC,EAAU,EAAEC,SAAuB,EAAE;IAAA,KAxB1CD,EAAE;IAAA,KAEFE,QAAQ;IAAA,KAERC,IAAI,GAA+B,IAAI;IAAA,KAEvCC,QAAQ,GAAwB,EAAE;IAAA,KAEjCH,SAAS;IAAA,KAMTH,UAAU,GAAY,KAAK;IAWjC,IAAI,CAACI,QAAQ,GAAGF,EAAE;IAClB,IAAI,CAACA,EAAE,GAAGA,EAAE,KAAK,CAAC,GAAG,MAAM,GAAGA,EAAE,CAACK,QAAQ,CAAC,CAAC;IAC3C,IAAI,CAACJ,SAAS,GAAGA,SAAS;EAC5B;EAOA,MAAaK,OAAOA,CAACH,IAAyB,EAA8B;IAC1E,IAAI,IAAI,CAACF,SAAS,CAACM,OAAO,CAACC,kBAAkB,EAAE;MAC7C,MAAM,IAAI,CAACC,KAAK,CAACN,IAAI,CAAC;IACxB,CAAC,MAAM;MACL,IAAI,CAACA,IAAI,GAAGA,IAAI;IAClB;IACA,OAAO,IAAI;EACb;EAMA,MAAaO,WAAWA,CAACC,UAA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,CAACtD,SAAS,CAAC4E,OAAO,cAAAL,qBAAA,gBAAAC,sBAAA,GAA5BD,qBAAA,CAA8BM,oBAAoB,cAAAL,sBAAA,eAAlDA,sBAAA,CAAoD5C,MAAM,EAC1D;QACAhB,IAAI,CAACkE,aAAa,GAAG,EAAE;QACvB,MAAMC,aAAa,GACjBZ,UAAU,CAACvC,MAAM,GAAG0B,UAAU,CAACtD,SAAS,CAAC4E,OAAO,CAACC,oBAAoB,CAACjD,MAAM,GACxEuC,UAAU,CAACvC,MAAM,GACjB0B,UAAU,CAACtD,SAAS,CAAC4E,OAAO,CAACC,oBAAoB,CAACjD,MAAM;QAC9D,KAAK,IAAI+B,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGoB,aAAa,EAAEpB,KAAK,EAAE,EAAE;UAClD,MAAMqB,UAAU,GAAG1B,UAAU,CAACtD,SAAS,CAAC4E,OAAO,CAACC,oBAAoB,CAAClB,KAAK,CAAC,CAACsB,GAAG;UAC/ErE,IAAI,CAACkE,aAAa,CAAC/D,IAAI,CAAC;YAACC,IAAI,EAAG,gBAAegE,UAAW;UAAG,CAAC,CAAC;QACjE;MACF;IACF;IAEA,OAAOpE,IAAI;EACb;AACF"}
1
+ {"version":3,"file":"node-index-document.js","names":["join","transform","v4","uuidv4","openJson","writeFile","writeFileForSlpk","NODE","nodeTemplate","NodeIndexDocument","finalized","_finalized","constructor","id","converter","inPageId","data","children","toString","addData","options","instantNodeWriting","write","addChildren","childNodes","newChildren","node","nodeData","load","push","href","obb","mbs","concat","_data$children","addNeighbors","childNode","_childNodeData$neighb","_nodeData$children","childNodeData","neighbors","Number","length","neighbor","console","warn","save","finalize","child","flush","path","layers0Path","slpk","writeQueue","enqueue","archiveKey","writePromise","JSON","stringify","compressList","parentNodePath","parentNodeFileName","createRootNode","boundingVolumes","rootData","createRootNodeIndexDocument","rootNode","createNode","parentNode","lodSelection","nodeInPage","resources","createNodeIndexDocument","index","root0data","version","toUpperCase","level","metricType","maxError","nodeId","parentNodeData","mesh","_parentNode$converter","_parentNode$converter2","_parentNode$converter3","_parentNode$converter4","geometryData","sharedResource","texture","texelCountHint","textureData","attributes","layers0","attributeStorageInfo","attributesCount","_resources$attributes","attributesLength","attributeData","minimumLength","folderName","key"],"sources":["../../../src/i3s-converter/helpers/node-index-document.ts"],"sourcesContent":["import {join} from 'path';\nimport {\n BoundingVolumes,\n LodSelection,\n Node3DIndexDocument,\n NodeInPage,\n NodeReference\n} from '@loaders.gl/i3s';\nimport transform from 'json-map-transform';\nimport {v4 as uuidv4} from 'uuid';\nimport {openJson, writeFile, writeFileForSlpk} from '../../lib/utils/file-utils';\nimport I3SConverter from '../i3s-converter';\nimport {NODE as nodeTemplate} from '../json-templates/node';\nimport {I3SConvertedResources} from '../types';\nimport {DumpMetadata} from '../../lib/utils/conversion-dump';\n\n/**\n * Wrapper for https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md data\n * The class allows working with 3DNodeIndexDocument in 2 modes:\n * in memory: the data is stored in `data` field\n * on disk: the data is written on disk in a file. The file can be rewritten when new childrend or neighbors have to be added\n */\nexport class NodeIndexDocument {\n /** Node id */\n public id: string;\n /** Id in node pages */\n public inPageId: number;\n /** 3DNodeIndexDocument data */\n public data: Node3DIndexDocument | null = null;\n /** children */\n public children: NodeIndexDocument[] = [];\n /** converter instance */\n private converter: I3SConverter;\n\n /**\n * Finalized property. It means that all child nodes are saved and their data\n * is unloaded\n */\n private _finalized: boolean = false;\n get finalized(): boolean {\n return this._finalized;\n }\n\n /**\n * Constructor\n * @param id - id of the node in node pages\n * @param converter - converter instance\n */\n constructor(id: number, converter: I3SConverter) {\n this.inPageId = id;\n this.id = id === 0 ? 'root' : id.toString();\n this.converter = converter;\n }\n\n /**\n * Add Node3DIndexDocument data to the node\n * @param data Node3DIndexDocument data\n * @returns this NodeIndexDocument instance (to recurring with constructor)\n */\n public async addData(data: Node3DIndexDocument): Promise<NodeIndexDocument> {\n if (this.converter.options.instantNodeWriting) {\n await this.write(data);\n } else {\n this.data = data;\n }\n return this;\n }\n\n /**\n * Add child node references\n * @param childNodes - child NodeIndexDocument instances\n */\n public async addChildren(childNodes: NodeIndexDocument[]): Promise<void> {\n const newChildren: NodeReference[] = [];\n for (const node of childNodes) {\n const nodeData = await node.load();\n newChildren.push({\n id: node.id,\n href: `../${node.id}`,\n obb: nodeData.obb,\n mbs: nodeData.mbs\n });\n }\n this.children = this.children.concat(childNodes);\n\n let data: Node3DIndexDocument | null = this.data;\n if (this.converter.options.instantNodeWriting) {\n data = (await this.load()) as Node3DIndexDocument;\n }\n if (data) {\n data.children = data.children ?? [];\n data.children = data.children.concat(newChildren);\n }\n if (this.converter.options.instantNodeWriting && data) {\n await this.write(data);\n }\n }\n\n /**\n * Add neighbors to child nodes of this node\n */\n public async addNeighbors(): Promise<void> {\n if (this.finalized) {\n return;\n }\n const nodeData = await this.load();\n for (const childNode of this.children) {\n const childNodeData = await childNode.load();\n childNodeData.neighbors = childNodeData.neighbors ?? [];\n\n // Don't do large amount of \"neightbors\" to avoid big memory consumption\n if (Number(nodeData?.children?.length) < 1000) {\n for (const neighbor of nodeData.children || []) {\n if (childNode.id === neighbor.id) {\n continue; // eslint-disable-line\n }\n\n childNodeData.neighbors.push({...neighbor});\n }\n } else {\n // eslint-disable-next-line no-console, no-undef\n console.warn(\n `Node ${childNode.id}: neighbors attribute is omited because of large number of neigbors`\n );\n delete childNodeData.neighbors;\n }\n\n if (this.converter.options.instantNodeWriting && childNodeData) {\n await childNode.write(childNodeData);\n }\n await childNode.save();\n }\n // The save after adding neighbors is the last one. Finalize the the node\n this.finalize();\n }\n\n /** Save 3DNodeIndexDocument in file on disk */\n public async save(): Promise<void> {\n if (this.data) {\n await this.write(this.data);\n }\n }\n\n /** Finalize the node */\n private finalize(): void {\n this._finalized = true;\n for (const child of this.children) {\n child.flush();\n }\n }\n\n /**\n * Write 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md\n * @param node - Node3DIndexDocument object\n */\n private async write(node: Node3DIndexDocument): Promise<void> {\n const path = join(this.converter.layers0Path, 'nodes', this.id);\n if (this.converter.options.slpk) {\n await this.converter.writeQueue.enqueue(\n {\n archiveKey: `nodes/${this.id}/3dNodeIndexDocument.json.gz`,\n writePromise: () =>\n writeFileForSlpk(\n path,\n JSON.stringify(node),\n '3dNodeIndexDocument.json',\n true,\n this.converter.compressList\n )\n },\n true\n );\n } else {\n await this.converter.writeQueue.enqueue(\n {writePromise: () => writeFile(path, JSON.stringify(node))},\n true\n );\n }\n }\n\n /**\n * Load 3DNodeIndexDocument data from file on disk\n * @returns 3DNodeIndexDocument object\n */\n private async load(): Promise<Node3DIndexDocument> {\n if (this.data) {\n return this.data;\n }\n const path = this.id;\n const parentNodePath = join(this.converter.layers0Path, 'nodes', path);\n let parentNodeFileName = 'index.json';\n if (this.converter.options.slpk) {\n parentNodeFileName = '3dNodeIndexDocument.json';\n }\n return (await openJson(parentNodePath, parentNodeFileName)) as Node3DIndexDocument;\n }\n\n /**\n * Unload the Node data\n */\n private flush(): void {\n this.data = null;\n }\n\n /**\n * Create root node of the tree\n * @param boundingVolumes - MBS and OOB bounding volumes data\n * @param converter - I3SConverter instance\n * @returns instance of NodeIndexDocument\n */\n static async createRootNode(\n boundingVolumes: BoundingVolumes,\n converter: I3SConverter\n ): Promise<NodeIndexDocument> {\n const rootData = NodeIndexDocument.createRootNodeIndexDocument(boundingVolumes);\n const rootNode = await new NodeIndexDocument(0, converter).addData(rootData);\n return rootNode;\n }\n\n /**\n * Create NodeIndexDocument instance\n * @param parentNode - parent NodeIndexDocument\n * @param boundingVolumes - MBS and OOB bounding volumes data\n * @param lodSelection - LOD metrics data\n * @param nodeInPage - node data in node pages\n * @param resources - resources extracted from gltf/b3dm file\n * @param converter - I3SConverter instance\n * @returns NodeIndexDocument instance\n */\n static async createNode(\n parentNode: NodeIndexDocument,\n boundingVolumes: BoundingVolumes,\n lodSelection: LodSelection[],\n nodeInPage: NodeInPage,\n resources: I3SConvertedResources,\n converter: I3SConverter\n ): Promise<NodeIndexDocument> {\n const data = await NodeIndexDocument.createNodeIndexDocument(\n parentNode,\n boundingVolumes,\n lodSelection,\n nodeInPage,\n resources\n );\n const node = await new NodeIndexDocument(nodeInPage.index, converter).addData(data);\n return node;\n }\n\n /**\n * Form 3DNodeIndexDocument data for the root node\n * @param boundingVolumes - mbs and obb data about node's bounding volume\n * @return 3DNodeIndexDocument data https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md\n */\n static createRootNodeIndexDocument(boundingVolumes: BoundingVolumes): Node3DIndexDocument {\n const root0data = {\n version: `{${uuidv4().toUpperCase()}}`,\n id: 'root',\n level: 0,\n lodSelection: [\n {\n metricType: 'maxScreenThresholdSQ',\n maxError: 0\n },\n {\n metricType: 'maxScreenThreshold',\n maxError: 0\n }\n ],\n ...boundingVolumes,\n children: []\n };\n return transform(root0data, nodeTemplate());\n }\n\n /**\n * Create a new Node3DIndexDocument\n * @param parentNode - 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object of the parent node\n * @param boundingVolumes - Bounding volumes\n * @param lodSelection - Level of Details (LOD) metrics\n * @param nodeInPage - corresponding node object in a node page\n * @param resources - the node resources data\n * @param resources.texture - texture image\n * @param resources.attributes - feature attributes\n * @return 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object\n */\n static async createNodeIndexDocument(\n parentNode: NodeIndexDocument,\n boundingVolumes: BoundingVolumes,\n lodSelection: LodSelection[],\n nodeInPage: NodeInPage,\n resources: I3SConvertedResources | DumpMetadata\n ): Promise<Node3DIndexDocument> {\n const nodeId = nodeInPage.index!;\n const parentNodeData = await parentNode.load();\n const nodeData = {\n version: parentNodeData.version,\n id: nodeId.toString(),\n level: parentNodeData.level! + 1,\n ...boundingVolumes,\n lodSelection,\n parentNode: {\n id: parentNode.id,\n href: `../${parentNode.id}`,\n mbs: parentNodeData.mbs,\n obb: parentNodeData.obb\n },\n children: [],\n neighbors: []\n };\n const node = transform(nodeData, nodeTemplate());\n\n if (nodeInPage.mesh) {\n node.geometryData = [{href: './geometries/0'}];\n node.sharedResource = {href: './shared'};\n\n if (\n ('texture' in resources && resources.texture) ||\n ('texelCountHint' in resources && resources.texelCountHint)\n ) {\n node.textureData = [{href: './textures/0'}, {href: './textures/1'}];\n }\n\n if (\n ('attributes' in resources &&\n resources.attributes &&\n resources.attributes.length &&\n parentNode.converter.layers0?.attributeStorageInfo?.length) ||\n ('attributesCount' in resources &&\n resources.attributesCount &&\n parentNode.converter.layers0?.attributeStorageInfo?.length)\n ) {\n const attributesLength =\n ('attributes' in resources ? resources.attributes?.length : resources.attributesCount) ||\n 0;\n node.attributeData = [];\n const minimumLength =\n attributesLength < parentNode.converter.layers0.attributeStorageInfo.length\n ? attributesLength\n : parentNode.converter.layers0.attributeStorageInfo.length;\n for (let index = 0; index < minimumLength; index++) {\n const folderName = parentNode.converter.layers0.attributeStorageInfo[index].key;\n node.attributeData.push({href: `./attributes/${folderName}/0`});\n }\n }\n }\n\n return node;\n }\n}\n"],"mappings":"AAAA,SAAQA,IAAI,QAAO,MAAM;AAQzB,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,SAAQC,EAAE,IAAIC,MAAM,QAAO,MAAM;AAAC,SAC1BC,QAAQ,EAAEC,SAAS,EAAEC,gBAAgB;AAAA,SAErCC,IAAI,IAAIC,YAAY;AAU5B,OAAO,MAAMC,iBAAiB,CAAC;EAiB7B,IAAIC,SAASA,CAAA,EAAY;IACvB,OAAO,IAAI,CAACC,UAAU;EACxB;EAOAC,WAAWA,CAACC,EAAU,EAAEC,SAAuB,EAAE;IAAA,KAxB1CD,EAAE;IAAA,KAEFE,QAAQ;IAAA,KAERC,IAAI,GAA+B,IAAI;IAAA,KAEvCC,QAAQ,GAAwB,EAAE;IAAA,KAEjCH,SAAS;IAAA,KAMTH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BAAgB,GAAG7B,UAAU,CAACtD,SAAS,CAAC+E,OAAO,CAACC,oBAAoB,CAACpD,MAAM,GACvEuD,gBAAgB,GAChB7B,UAAU,CAACtD,SAAS,CAAC+E,OAAO,CAACC,oBAAoB,CAACpD,MAAM;QAC9D,KAAK,IAAI+B,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAG0B,aAAa,EAAE1B,KAAK,EAAE,EAAE;UAClD,MAAM2B,UAAU,GAAGhC,UAAU,CAACtD,SAAS,CAAC+E,OAAO,CAACC,oBAAoB,CAACrB,KAAK,CAAC,CAAC4B,GAAG;UAC/E3E,IAAI,CAACwE,aAAa,CAACrE,IAAI,CAAC;YAACC,IAAI,EAAG,gBAAesE,UAAW;UAAG,CAAC,CAAC;QACjE;MACF;IACF;IAEA,OAAO1E,IAAI;EACb;AACF"}
@@ -65,7 +65,7 @@ export class Progress {
65
65
  return diff;
66
66
  }
67
67
  getTimeRemaining() {
68
- if (!this._stepsDone || !this.startTime) {
68
+ if (!this._stepsTotal || !this._stepsDone || !this.startTime) {
69
69
  return null;
70
70
  }
71
71
  const timeRemainingInMilliSeconds = (this._stepsTotal - this._stepsDone) * this.milliSecForOneStep;
@@ -1 +1 @@
1
- {"version":3,"file":"progress.js","names":["process","timeConverter","THRESHOLD_DEFAULT","Progress","constructor","options","arguments","length","undefined","_stepsTotal","_stepsDone","startTime","stopTime","timeOfUpdatingStepsDone","milliSecForOneStep","trust","numberOfDigitsInPercentage","threshold","getTime","hrtime","bigint","stepsTotal","Math","ceil","log10","stepsDone","getCurrentTimeInMilliSeconds","diff","isVelocityTrust","startMonitoring","stopMonitoring","getPercent","percent","getPercentString","toFixed","getTimeCurrentlyElapsed","currentTime","getTimeRemaining","timeRemainingInMilliSeconds","timeRemaining","getTimeRemainingString","timeRemainingObject","current","previous","dev","abs","Number","BigInt"],"sources":["../../../src/i3s-converter/helpers/progress.ts"],"sourcesContent":["import process from 'process';\nimport {timeConverter} from '../../lib/utils/statistic-utills';\n\n/** Defines a threshold that is used to check if the process velocity can be consifered trust. */\nconst THRESHOLD_DEFAULT = 0.2;\n\n/**\n * Implements methods to keep track on the progress of a long process.\n */\nexport class Progress {\n /** Total amount of work, e.g. number of files to save or number of bytes to send */\n private _stepsTotal: number = 0;\n /** Amount of work already done */\n private _stepsDone: number = 0;\n /** Time in milli-seconds when the process started */\n private startTime: number = 0;\n /** Time in milli-seconds when the process stopped */\n private stopTime: number = 0;\n /** Time in milli-seconds when stepsDone was updated */\n private timeOfUpdatingStepsDone: number = 0;\n /** Time in milli-seconds spent for performing one step*/\n private milliSecForOneStep: number = 0;\n private trust: boolean = false;\n /**\n * The number of digits to appear after decimal point in the string representation of the count of steps already done.\n * It's calculated based on the total count of steps.\n */\n private numberOfDigitsInPercentage: number = 0;\n /** Defines a threshold that is used to check if the process velocity can be consifered trust. */\n private threshold: number;\n /** Function that is used to get the time stamp */\n private getTime: () => bigint;\n\n constructor(options: {threshold?: number; getTime?: () => bigint} = {}) {\n this.getTime = options.getTime || process.hrtime.bigint;\n this.threshold = options.threshold || THRESHOLD_DEFAULT;\n }\n\n /** Total amount of work, e.g. number of files to save or number of bytes to send */\n get stepsTotal() {\n return this._stepsTotal;\n }\n\n set stepsTotal(stepsTotal) {\n this._stepsTotal = stepsTotal;\n this.numberOfDigitsInPercentage =\n this.stepsTotal > 100 ? Math.ceil(Math.log10(this.stepsTotal)) - 2 : 0;\n }\n\n /** Amount of work already done */\n get stepsDone() {\n return this._stepsDone;\n }\n\n set stepsDone(stepsDone) {\n this._stepsDone = stepsDone;\n this.timeOfUpdatingStepsDone = this.getCurrentTimeInMilliSeconds();\n if (this._stepsDone) {\n const diff = this.timeOfUpdatingStepsDone - this.startTime;\n const milliSecForOneStep = diff / this._stepsDone;\n\n this.trust = this.isVelocityTrust(milliSecForOneStep, this.milliSecForOneStep);\n this.milliSecForOneStep = milliSecForOneStep;\n }\n }\n\n /**\n * Saves the current time as we start monitoring the process.\n */\n startMonitoring() {\n this.startTime = this.getCurrentTimeInMilliSeconds();\n this.milliSecForOneStep = 0;\n this.trust = false;\n this.timeOfUpdatingStepsDone = 0;\n this.stopTime = 0;\n this.stepsDone = 0;\n }\n\n /**\n * Saves the current time as we stop monitoring the process.\n */\n stopMonitoring() {\n this.stopTime = this.getCurrentTimeInMilliSeconds();\n }\n\n /**\n * Gets percentage of the work already done.\n * @returns percentage of the work already done.\n */\n getPercent(): number | null {\n if (!this._stepsTotal) {\n return null;\n }\n const percent = (this._stepsDone / this._stepsTotal) * 100.0;\n return percent;\n }\n\n /**\n * Gets string representation of percentage of the work already done.\n * @returns string representation of percentage or an empty string if the percetage value cannot be calculated.\n */\n getPercentString() {\n const percent = this.getPercent();\n return percent !== null ? percent.toFixed(this.numberOfDigitsInPercentage) : '';\n }\n\n /**\n * Gets the time elapsed since the monitoring started\n * @returns Number of milliseconds elapsed\n */\n getTimeCurrentlyElapsed(): number {\n const currentTime = this.stopTime ? this.stopTime : this.getCurrentTimeInMilliSeconds();\n const diff = currentTime - this.startTime;\n return diff;\n }\n\n /**\n * Gets the time remaining (expected at the moment of updating 'stepsDone') to complete the work.\n * @returns Number of milliseconds remaining\n */\n getTimeRemaining(): {timeRemaining: number; trust: boolean} | null {\n if (!this._stepsDone || !this.startTime) {\n return null;\n }\n\n const timeRemainingInMilliSeconds =\n (this._stepsTotal - this._stepsDone) * this.milliSecForOneStep;\n return {timeRemaining: timeRemainingInMilliSeconds, trust: this.trust};\n }\n\n /**\n * Gets the string representation of the time remaining (expected at the moment of updating 'stepsDone') to complete the work.\n * @returns string representation of the time remaining.\n * It's an empty string if the time cannot be pedicted or it's still being calculated.\n */\n getTimeRemainingString(): string {\n const timeRemainingObject = this.getTimeRemaining();\n return timeRemainingObject?.trust ? timeConverter(timeRemainingObject.timeRemaining) : '';\n }\n\n /**\n * Check if the computed velociy of the process can be considered trust.\n * At the beginning of the process the number of samples collected ('time necessary to perform one step' averaged) is too small,\n * which results in huge deviation of the cumputed velocity of the process.\n * It makes sense to perform the check before reporting the time remainig so the end user is not confused.\n * @param current - current value\n * @param previous - previous value\n * @returns true if the computed velociy can be considered trust, or false otherwise\n */\n private isVelocityTrust(current: number, previous: number): boolean {\n if (previous) {\n const dev = Math.abs((current - previous) / previous);\n return dev < this.threshold;\n }\n return false;\n }\n\n /**\n * Gets current time in milliseconds.\n * @returns current time in milliseconds.\n */\n private getCurrentTimeInMilliSeconds(): number {\n // process.hrtime.bigint() returns the time in nanoseconds. We need the time in milliseconds.\n return Number(this.getTime() / BigInt(1e6));\n }\n}\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,SAAS;AAAC,SACtBC,aAAa;AAGrB,MAAMC,iBAAiB,GAAG,GAAG;AAK7B,OAAO,MAAMC,QAAQ,CAAC;EAwBpBC,WAAWA,CAAA,EAA6D;IAAA,IAA5DC,OAAqD,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAAA,KAtB9DG,WAAW,GAAW,CAAC;IAAA,KAEvBC,UAAU,GAAW,CAAC;IAAA,KAEtBC,SAAS,GAAW,CAAC;IAAA,KAErBC,QAAQ,GAAW,CAAC;IAAA,KAEpBC,uBAAuB,GAAW,CAAC;IAAA,KAEnCC,kBAAkB,GAAW,CAAC;IAAA,KAC9BC,KAAK,GAAY,KAAK;IAAA,KAKtBC,0BAA0B,GAAW,CAAC;IAAA,KAEtCC,SAAS;IAAA,KAETC,OAAO;IAGb,IAAI,CAACA,OAAO,GAAGb,OAAO,CAACa,OAAO,IAAIlB,OAAO,CAACmB,MAAM,CAACC,MAAM;IACvD,IAAI,CAACH,SAAS,GAAGZ,OAAO,CAACY,SAAS,IAAIf,iBAAiB;EACzD;EAGA,IAAImB,UAAUA,CAAA,EAAG;IACf,OAAO,IAAI,CAACZ,WAAW;EACzB;EAEA,IAAIY,UAAUA,CAACA,UAAU,EAAE;IACzB,IAAI,CAACZ,WAAW,GAAGY,UAAU;IAC7B,IAAI,CAACL,0BAA0B,GA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OAAO,KAAK;EACd;EAMQS,4BAA4BA,CAAA,EAAW;IAE7C,OAAOoB,MAAM,CAAC,IAAI,CAAC5B,OAAO,CAAC,CAAC,GAAG6B,MAAM,CAAC,GAAG,CAAC,CAAC;EAC7C;AACF"}
1
+ {"version":3,"file":"progress.js","names":["process","timeConverter","THRESHOLD_DEFAULT","Progress","constructor","options","arguments","length","undefined","_stepsTotal","_stepsDone","startTime","stopTime","timeOfUpdatingStepsDone","milliSecForOneStep","trust","numberOfDigitsInPercentage","threshold","getTime","hrtime","bigint","stepsTotal","Math","ceil","log10","stepsDone","getCurrentTimeInMilliSeconds","diff","isVelocityTrust","startMonitoring","stopMonitoring","getPercent","percent","getPercentString","toFixed","getTimeCurrentlyElapsed","currentTime","getTimeRemaining","timeRemainingInMilliSeconds","timeRemaining","getTimeRemainingString","timeRemainingObject","current","previous","dev","abs","Number","BigInt"],"sources":["../../../src/i3s-converter/helpers/progress.ts"],"sourcesContent":["import process from 'process';\nimport {timeConverter} from '../../lib/utils/statistic-utills';\n\n/** Defines a threshold that is used to check if the process velocity can be consifered trust. */\nconst THRESHOLD_DEFAULT = 0.2;\n\n/**\n * Implements methods to keep track on the progress of a long process.\n */\nexport class Progress {\n /** Total amount of work, e.g. number of files to save or number of bytes to send */\n private _stepsTotal: number = 0;\n /** Amount of work already done */\n private _stepsDone: number = 0;\n /** Time in milli-seconds when the process started */\n private startTime: number = 0;\n /** Time in milli-seconds when the process stopped */\n private stopTime: number = 0;\n /** Time in milli-seconds when stepsDone was updated */\n private timeOfUpdatingStepsDone: number = 0;\n /** Time in milli-seconds spent for performing one step*/\n private milliSecForOneStep: number = 0;\n private trust: boolean = false;\n /**\n * The number of digits to appear after decimal point in the string representation of the count of steps already done.\n * It's calculated based on the total count of steps.\n */\n private numberOfDigitsInPercentage: number = 0;\n /** Defines a threshold that is used to check if the process velocity can be consifered trust. */\n private threshold: number;\n /** Function that is used to get the time stamp */\n private getTime: () => bigint;\n\n constructor(options: {threshold?: number; getTime?: () => bigint} = {}) {\n this.getTime = options.getTime || process.hrtime.bigint;\n this.threshold = options.threshold || THRESHOLD_DEFAULT;\n }\n\n /** Total amount of work, e.g. number of files to save or number of bytes to send */\n get stepsTotal() {\n return this._stepsTotal;\n }\n\n set stepsTotal(stepsTotal) {\n this._stepsTotal = stepsTotal;\n this.numberOfDigitsInPercentage =\n this.stepsTotal > 100 ? Math.ceil(Math.log10(this.stepsTotal)) - 2 : 0;\n }\n\n /** Amount of work already done */\n get stepsDone() {\n return this._stepsDone;\n }\n\n set stepsDone(stepsDone) {\n this._stepsDone = stepsDone;\n this.timeOfUpdatingStepsDone = this.getCurrentTimeInMilliSeconds();\n if (this._stepsDone) {\n const diff = this.timeOfUpdatingStepsDone - this.startTime;\n const milliSecForOneStep = diff / this._stepsDone;\n\n this.trust = this.isVelocityTrust(milliSecForOneStep, this.milliSecForOneStep);\n this.milliSecForOneStep = milliSecForOneStep;\n }\n }\n\n /**\n * Saves the current time as we start monitoring the process.\n */\n startMonitoring() {\n this.startTime = this.getCurrentTimeInMilliSeconds();\n this.milliSecForOneStep = 0;\n this.trust = false;\n this.timeOfUpdatingStepsDone = 0;\n this.stopTime = 0;\n this.stepsDone = 0;\n }\n\n /**\n * Saves the current time as we stop monitoring the process.\n */\n stopMonitoring() {\n this.stopTime = this.getCurrentTimeInMilliSeconds();\n }\n\n /**\n * Gets percentage of the work already done.\n * @returns percentage of the work already done.\n */\n getPercent(): number | null {\n if (!this._stepsTotal) {\n return null;\n }\n const percent = (this._stepsDone / this._stepsTotal) * 100.0;\n return percent;\n }\n\n /**\n * Gets string representation of percentage of the work already done.\n * @returns string representation of percentage or an empty string if the percetage value cannot be calculated.\n */\n getPercentString() {\n const percent = this.getPercent();\n return percent !== null ? percent.toFixed(this.numberOfDigitsInPercentage) : '';\n }\n\n /**\n * Gets the time elapsed since the monitoring started\n * @returns Number of milliseconds elapsed\n */\n getTimeCurrentlyElapsed(): number {\n const currentTime = this.stopTime ? this.stopTime : this.getCurrentTimeInMilliSeconds();\n const diff = currentTime - this.startTime;\n return diff;\n }\n\n /**\n * Gets the time remaining (expected at the moment of updating 'stepsDone') to complete the work.\n * @returns Number of milliseconds remaining\n */\n getTimeRemaining(): {timeRemaining: number; trust: boolean} | null {\n if (!this._stepsTotal || !this._stepsDone || !this.startTime) {\n return null;\n }\n\n const timeRemainingInMilliSeconds =\n (this._stepsTotal - this._stepsDone) * this.milliSecForOneStep;\n return {timeRemaining: timeRemainingInMilliSeconds, trust: this.trust};\n }\n\n /**\n * Gets the string representation of the time remaining (expected at the moment of updating 'stepsDone') to complete the work.\n * @returns string representation of the time remaining.\n * It's an empty string if the time cannot be pedicted or it's still being calculated.\n */\n getTimeRemainingString(): string {\n const timeRemainingObject = this.getTimeRemaining();\n return timeRemainingObject?.trust ? timeConverter(timeRemainingObject.timeRemaining) : '';\n }\n\n /**\n * Check if the computed velociy of the process can be considered trust.\n * At the beginning of the process the number of samples collected ('time necessary to perform one step' averaged) is too small,\n * which results in huge deviation of the cumputed velocity of the process.\n * It makes sense to perform the check before reporting the time remainig so the end user is not confused.\n * @param current - current value\n * @param previous - previous value\n * @returns true if the computed velociy can be considered trust, or false otherwise\n */\n private isVelocityTrust(current: number, previous: number): boolean {\n if (previous) {\n const dev = Math.abs((current - previous) / previous);\n return dev < this.threshold;\n }\n return false;\n }\n\n /**\n * Gets current time in milliseconds.\n * @returns current time in milliseconds.\n */\n private getCurrentTimeInMilliSeconds(): number {\n // process.hrtime.bigint() returns the time in nanoseconds. We need the time in milliseconds.\n return Number(this.getTime() / BigInt(1e6));\n }\n}\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,SAAS;AAAC,SACtBC,aAAa;AAGrB,MAAMC,iBAAiB,GAAG,GAAG;AAK7B,OAAO,MAAMC,QAAQ,CAAC;EAwBpBC,WAAWA,CAAA,EAA6D;IAAA,IAA5DC,OAAqD,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,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EAAE;MAC5D,OAAO,IAAI;IACb;IAEA,MAAM2B,2BAA2B,GAC/B,CAAC,IAAI,CAAC7B,WAAW,GAAG,IAAI,CAACC,UAAU,IAAI,IAAI,CAACI,kBAAkB;IAChE,OAAO;MAACyB,aAAa,EAAED,2BAA2B;MAAEvB,KAAK,EAAE,IAAI,CAACA;IAAK,CAAC;EACxE;EAOAyB,sBAAsBA,CAAA,EAAW;IAC/B,MAAMC,mBAAmB,GAAG,IAAI,CAACJ,gBAAgB,CAAC,CAAC;IACnD,OAAOI,mBAAmB,aAAnBA,mBAAmB,eAAnBA,mBAAmB,CAAE1B,KAAK,GAAGd,aAAa,CAACwC,mBAAmB,CAACF,aAAa,CAAC,GAAG,EAAE;EAC3F;EAWQX,eAAeA,CAACc,OAAe,EAAEC,QAAgB,EAAW;IAClE,IAAIA,QAAQ,EAAE;MACZ,MAAMC,GAAG,GAAGtB,IAAI,CAACuB,GAAG,CAAC,CAACH,OAAO,GAAGC,QAAQ,IAAIA,QAAQ,CAAC;MACrD,OAAOC,GAAG,GAAG,IAAI,CAAC3B,SAAS;IAC7B;IACA,OAAO,KAAK;EACd;EAMQS,4BAA4BA,CAAA,EAAW;IAE7C,OAAOoB,MAAM,CAAC,IAAI,CAAC5B,OAAO,CAAC,CAAC,GAAG6B,MAAM,CAAC,GAAG,CAAC,CAAC;EAC7C;AACF"}
@@ -9,6 +9,7 @@ import { I3SMaterialDefinition } from '@loaders.gl/i3s';
9
9
  import { PreprocessData } from './types';
10
10
  import WriteQueue from '../lib/utils/write-queue';
11
11
  import { Progress } from './helpers/progress';
12
+ import { ConversionDump } from '../lib/utils/conversion-dump';
12
13
  /**
13
14
  * Converter from 3d-tiles tileset to i3s layer
14
15
  */
@@ -49,6 +50,7 @@ export default class I3SConverter {
49
50
  compressList: string[] | null;
50
51
  preprocessData: PreprocessData;
51
52
  progresses: Record<string, Progress>;
53
+ conversionDump: ConversionDump;
52
54
  constructor();
53
55
  /**
54
56
  * Convert a 3d tileset
@@ -140,6 +142,24 @@ export default class I3SConverter {
140
142
  * @param currentTraversalProps - traversal properties of the current node
141
143
  */
142
144
  private finalizeTile;
145
+ /**
146
+ * Generate NodeIndexDocument
147
+ * @param boundingVolumes - Bounding volumes
148
+ * @param resources - converted or dumped node resources data
149
+ * @param parentNode - 3DNodeIndexDocument of parent node
150
+ * @param sourceTile - source 3DTile data
151
+ * @param isDumped - indicator if the node is dumped
152
+ * @return NodeIndexDocument, nodeInPage and node data
153
+ */
154
+ private _generateNodeIndexDocument;
155
+ /**
156
+ * Restore 3DNodeIndexDocument from a comversion dump file
157
+ * @param parentNode - 3DNodeIndexDocument of parent node
158
+ * @param sourceTile - source 3DTile data
159
+ * @param transformationMatrix - transformation matrix of the current tile, calculated recursively multiplying
160
+ * transform of all parent tiles and transform of the current tile
161
+ */
162
+ private _restoreNode;
143
163
  /**
144
164
  * Convert tile to one or more I3S nodes
145
165
  * @param parentNode - 3DNodeIndexDocument of parent node
@@ -185,6 +205,8 @@ export default class I3SConverter {
185
205
  * @param resources.texture - texture image
186
206
  * @param resources.sharedResources - shared resource data object
187
207
  * @param resources.attributes - feature attributes
208
+ * @param nodePath - node path
209
+ * @param sourceTile - source tile (3DTile)
188
210
  * @return {Promise<void>}
189
211
  */
190
212
  private _writeResources;
@@ -194,6 +216,8 @@ export default class I3SConverter {
194
216
  * @param compressedGeometry - Uint8Array with compressed (draco) geometry
195
217
  * @param childPath - a child path to write resources
196
218
  * @param slpkChildPath - resource path inside *slpk file
219
+ * @param sourceId - source filename
220
+ * @param nodeId - nodeId of a converted node for the writing
197
221
  */
198
222
  private _writeGeometries;
199
223
  /**
@@ -202,6 +226,8 @@ export default class I3SConverter {
202
226
  * @param childPath - a child path to write resources
203
227
  * @param slpkChildPath - resource path inside *slpk file
204
228
  * @param nodePath - a node path
229
+ * @param sourceId - source filename
230
+ * @param nodeId - nodeId of a converted node for the writing
205
231
  */
206
232
  private _writeShared;
207
233
  /**
@@ -209,6 +235,8 @@ export default class I3SConverter {
209
235
  * @param texture - the texture image
210
236
  * @param childPath - a child path to write resources
211
237
  * @param slpkChildPath - the resource path inside *slpk file
238
+ * @param sourceId - source filename
239
+ * @param nodeId - nodeId of a converted node for the writing
212
240
  */
213
241
  private _writeTexture;
214
242
  /**
@@ -218,6 +246,8 @@ export default class I3SConverter {
218
246
  * @param format
219
247
  * @param childPath
220
248
  * @param slpkChildPath
249
+ * @param sourceId
250
+ * @param nodeId
221
251
  */
222
252
  private writeTextureFile;
223
253
  /**
@@ -225,6 +255,8 @@ export default class I3SConverter {
225
255
  * @param attributes - feature attributes
226
256
  * @param childPath - a child path to write resources
227
257
  * @param slpkChildPath - the resource path inside *slpk file
258
+ * @param sourceId - source filename
259
+ * @param nodeId - nodeId of a converted node for the writing
228
260
  */
229
261
  private _writeAttributes;
230
262
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"i3s-converter.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/i3s-converter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,qBAAqB,EAAC,MAAM,mCAAmC,CAAC;AAExE,OAAO,KAAK,EAEV,oBAAoB,EAGpB,+BAA+B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EACV,YAAY,EAKb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAOrC,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAuB7C,OAAO,EAAiB,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAC,qBAAqB,EAA8B,MAAM,iBAAiB,CAAC;AAGnF,OAAO,EAGL,cAAc,EAEf,MAAM,SAAS,CAAC;AAEjB,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAkBlD,OAAO,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAY5C;;GAEG;AACH,MAAM,CAAC,OAAO,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