@loaders.gl/tile-converter 3.0.10 → 3.0.14

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 (32) hide show
  1. package/dist/dist.es5.min.js +14 -14
  2. package/dist/dist.es5.min.js.map +1 -1
  3. package/dist/dist.min.js +14 -14
  4. package/dist/dist.min.js.map +1 -1
  5. package/dist/es5/i3s-converter/i3s-converter.js +27 -16
  6. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  7. package/dist/es5/pgm-loader.js +1 -1
  8. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +11 -11
  9. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  10. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +1 -1
  11. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  12. package/dist/esm/i3s-converter/helpers/geometry-converter.js +2 -2
  13. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  14. package/dist/esm/i3s-converter/helpers/node-debug.js +2 -2
  15. package/dist/esm/i3s-converter/helpers/node-debug.js.map +1 -1
  16. package/dist/esm/i3s-converter/helpers/node-pages.js +2 -2
  17. package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
  18. package/dist/esm/i3s-converter/i3s-converter.js +36 -28
  19. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  20. package/dist/esm/i3s-converter/json-templates/shared-resources.js +2 -2
  21. package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -1
  22. package/dist/esm/i3s-server/controllers/index-controller.js +1 -1
  23. package/dist/esm/i3s-server/controllers/index-controller.js.map +1 -1
  24. package/dist/esm/lib/utils/compress-util.js +13 -13
  25. package/dist/esm/lib/utils/compress-util.js.map +1 -1
  26. package/dist/esm/lib/utils/file-utils.js +1 -1
  27. package/dist/esm/lib/utils/file-utils.js.map +1 -1
  28. package/dist/esm/lib/utils/statistic-utills.js +5 -5
  29. package/dist/esm/lib/utils/statistic-utills.js.map +1 -1
  30. package/dist/esm/pgm-loader.js +1 -1
  31. package/package.json +14 -14
  32. package/src/i3s-converter/i3s-converter.ts +10 -3
@@ -84,6 +84,7 @@ var SHORT_INT_TYPE = 'Int32';
84
84
  var DOUBLE_TYPE = 'double';
85
85
  var OBJECT_ID_TYPE = 'OBJECTID';
86
86
  var REFRESH_TOKEN_TIMEOUT = 1800;
87
+ var CESIUM_DATASET_PREFIX = 'https://';
87
88
 
88
89
  var I3SConverter = function () {
89
90
  function I3SConverter() {
@@ -104,6 +105,7 @@ var I3SConverter = function () {
104
105
  (0, _defineProperty2.default)(this, "refreshTokenTime", void 0);
105
106
  (0, _defineProperty2.default)(this, "sourceTileset", void 0);
106
107
  (0, _defineProperty2.default)(this, "geoidHeightModel", void 0);
108
+ (0, _defineProperty2.default)(this, "Loader", _dTiles.Tiles3DLoader);
107
109
  this.nodePages = new _nodePages.default(_fileUtils.writeFile, HARDCODED_NODES_PER_PAGE);
108
110
  this.fileMap = {};
109
111
  this.options = {};
@@ -142,11 +144,12 @@ var I3SConverter = function () {
142
144
  inputUrl: inputUrl
143
145
  };
144
146
  this.validate = validate;
147
+ this.Loader = inputUrl.indexOf(CESIUM_DATASET_PREFIX) !== -1 ? _dTiles.CesiumIonLoader : _dTiles.Tiles3DLoader;
145
148
  console.log('Loading egm file...');
146
- _context.next = 7;
149
+ _context.next = 8;
147
150
  return (0, _core.load)(egmFilePath, _pgmLoader.PGMLoader);
148
151
 
149
- case 7:
152
+ case 8:
150
153
  this.geoidHeightModel = _context.sent;
151
154
  console.log('Loading egm file completed!');
152
155
 
@@ -154,10 +157,10 @@ var I3SConverter = function () {
154
157
  this.nodePages.useWriteFunction(_fileUtils.writeFileForSlpk);
155
158
  }
156
159
 
157
- _context.next = 12;
160
+ _context.next = 13;
158
161
  return this._fetchPreloadOptions();
159
162
 
160
- case 12:
163
+ case 13:
161
164
  preloadOptions = _context.sent;
162
165
  tilesetOptions = {
163
166
  loadOptions: {}
@@ -170,27 +173,27 @@ var I3SConverter = function () {
170
173
  }
171
174
 
172
175
  Object.assign(tilesetOptions, preloadOptions);
173
- _context.next = 18;
174
- return (0, _core.load)(inputUrl, _dTiles.CesiumIonLoader, tilesetOptions.loadOptions);
176
+ _context.next = 19;
177
+ return (0, _core.load)(inputUrl, this.Loader, tilesetOptions.loadOptions);
175
178
 
176
- case 18:
179
+ case 19:
177
180
  sourceTilesetJson = _context.sent;
178
181
  this.sourceTileset = new _tiles.Tileset3D(sourceTilesetJson, tilesetOptions);
179
- _context.next = 22;
182
+ _context.next = 23;
180
183
  return this._createAndSaveTileset(outputPath, tilesetName);
181
184
 
182
- case 22:
183
- _context.next = 24;
185
+ case 23:
186
+ _context.next = 25;
184
187
  return this._finishConversion({
185
188
  slpk: slpk,
186
189
  outputPath: outputPath,
187
190
  tilesetName: tilesetName
188
191
  });
189
192
 
190
- case 24:
193
+ case 25:
191
194
  return _context.abrupt("return", sourceTilesetJson);
192
195
 
193
- case 25:
196
+ case 26:
194
197
  case "end":
195
198
  return _context.stop();
196
199
  }
@@ -1620,20 +1623,28 @@ var I3SConverter = function () {
1620
1623
  while (1) {
1621
1624
  switch (_context18.prev = _context18.next) {
1622
1625
  case 0:
1626
+ if (this.Loader.preload) {
1627
+ _context18.next = 2;
1628
+ break;
1629
+ }
1630
+
1631
+ return _context18.abrupt("return", {});
1632
+
1633
+ case 2:
1623
1634
  options = {
1624
1635
  'cesium-ion': {
1625
1636
  accessToken: this.options.token || ION_DEFAULT_TOKEN
1626
1637
  }
1627
1638
  };
1628
- _context18.next = 3;
1629
- return _dTiles.CesiumIonLoader.preload(this.options.inputUrl, options);
1639
+ _context18.next = 5;
1640
+ return this.Loader.preload(this.options.inputUrl, options);
1630
1641
 
1631
- case 3:
1642
+ case 5:
1632
1643
  preloadOptions = _context18.sent;
1633
1644
  this.refreshTokenTime = _process.default.hrtime();
1634
1645
  return _context18.abrupt("return", _objectSpread(_objectSpread({}, options), preloadOptions));
1635
1646
 
1636
- case 6:
1647
+ case 8:
1637
1648
  case "end":
1638
1649
  return _context18.stop();
1639
1650
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/i3s-converter/i3s-converter.ts"],"names":["ION_DEFAULT_TOKEN","process","env","IonToken","HARDCODED_NODES_PER_PAGE","_3D_TILES","_3D_OBJECT_LAYER_TYPE","STRING_TYPE","SHORT_INT_TYPE","DOUBLE_TYPE","OBJECT_ID_TYPE","REFRESH_TOKEN_TIMEOUT","I3SConverter","nodePages","NodePages","writeFile","fileMap","options","layers0Path","materialMap","Map","materialDefinitions","vertexCounter","layers0","featuresHashArray","refinementCounter","tilesCount","tilesWithAddRefineCount","validate","boundingVolumeWarnings","conversionStartTime","hrtime","tilesetName","slpk","egmFilePath","inputUrl","outputPath","draco","sevenZipExe","maxDepth","token","console","log","PGMLoader","geoidHeightModel","useWriteFunction","writeFileForSlpk","_fetchPreloadOptions","preloadOptions","tilesetOptions","loadOptions","headers","fetch","Object","assign","CesiumIonLoader","sourceTilesetJson","sourceTileset","Tileset3D","_createAndSaveTileset","_finishConversion","tilesetPath","_formLayers0","sourceRootTile","root","boundingVolumes","parentId","push","lodThreshold","obb","children","isCreateSlpk","root0","_formRootNodeIndexDocument","_convertNodesTree","_writeLayers0","_writeNodeIndexDocument","save","_createSlpk","extent","layers0data","version","toUpperCase","id","name","href","store","nodesPerPage","compressGeometry","layersTemplate","root0data","level","lodSelection","metricType","maxError","nodeTemplate","_loadTile","content","type","_createNode","child","childPath","path","JSON","stringify","_addChildrenWithNeighborsAndWriteFile","parentNode","sourceTiles","unloadContent","nodePath","rootPath","slpkTilesetPath","slpkFileName","data","childNodes","_addChildren","_addNeighborsAndWriteFile","sourceTile","node","length","neighbor","neighbors","warn","parentTile","_checkAddRefinementTypeForTile","_updateTilesetOptions","maxScreenThresholdSQ","find","val","batchTable","batchTableJson","_convertAttributeStorageInfo","_convertResources","resourcesData","nodes","emptyResources","geometry","compressedGeometry","texture","sharedResources","meshMaterial","vertexCount","attributes","featureCount","resources","nodeInPage","_createNodeInNodePages","_createNodeIndexDocument","mesh","_writeResources","firstNode","sourceTileContent","attributeStorageInfo","_convertBatchTableInfoToNodeAttributes","Number","nodesCounter","definition","attribute","nodeId","updateMaterialByNodeId","_findOrCreateMaterial","texelCountHint","image","height","width","updateTexelCountHintByNodeId","updateVertexCountByNodeId","updateNodeAttributeByNodeId","updateFeatureCountByNodeId","index","nodeData","toString","mbs","geometryData","sharedResource","textureData","attributeData","folderName","key","geometryBuffer","slpkChildPath","_writeGeometries","_writeShared","_writeTexture","_writeAttributes","slpkGeometryPath","geometryPath","slpkCompressedGeometryPath","compressedGeometryPath","sharedData","SHARED_RESOURCES_TEMPLATE","sharedDataStr","slpkSharedPath","sharedPath","format","_getFormatByMimeType","mimeType","textureSetDefinitions","formats","bufferView","slpkTexturePath","compress","texturePath","fileBuffer","Uint8Array","slpkAttributesPath","attributesPath","material","hash","has","get","newMaterialId","set","attributeIndex","attributeType","storageAttribute","ordering","header","property","valueType","attributeValues","valuesPerElement","_setupIdAttribute","_setupStringAttribute","_setupDoubleAttribute","isInteger","unshift","encoding","attributeByteCounts","fieldAttributeType","alias","batchTableWithObjectId","OBJECTID","firstAttribute","getAttributeType","_createdStorageAttribute","_getFieldAttributeType","fieldAttribute","_createFieldAttribute","popupInfo","_createPopupInfo","fields","layerType","title","mediaInfos","fieldInfos","popupElements","expressionInfos","fieldName","visible","isEditable","label","params","addRefinementPercentage","filesSize","diff","conversionTime","accessToken","preload","refreshTokenTime","tile","ADD_TILE_REFINEMENT","refine"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAIA,IAAMA,iBAAiB,GACrBC,iBAAQC,GAAR,CAAYC,QAAZ,IACA,0NAFF;AAGA,I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gBAAAA,IADR,GACe9P,iBAAQ8B,MAAR,CAAe,KAAKoO,gBAApB,CADf;;AAAA,sBAEMJ,IAAI,CAAC,CAAD,CAAJ,GAAUpP,qBAFhB;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAKE,qBAAKwP,gBAAL,GAAwBlQ,iBAAQ8B,MAAR,EAAxB;AALF;AAAA,uBAO+B,KAAKgB,oBAAL,EAP/B;;AAAA;AAOQC,gBAAAA,cAPR;AAQE,qBAAKS,aAAL,CAAmBxC,OAAnB,mCAAiC,KAAKwC,aAAL,CAAmBxC,OAApD,GAAgE+B,cAAhE;;AACA,oBAAIA,cAAc,CAACG,OAAnB,EAA4B;AAC1B,uBAAKM,aAAL,CAAmBP,WAAnB,CAA+BE,KAA/B,mCACK,KAAKK,aAAL,CAAmBP,WAAnB,CAA+BE,KADpC;AAEED,oBAAAA,OAAO,EAAEH,cAAc,CAACG;AAF1B;AAIAV,kBAAAA,OAAO,CAACC,GAAR,CAAY,6CAAZ;AACD;;AAfH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAqBA,wCAAuC0N,IAAvC,EAA+D;AAC7D,UAAMC,mBAAmB,GAAG,CAA5B;;AAEA,UAAID,IAAI,CAACE,MAAL,KAAgBD,mBAApB,EAAyC;AACvC,aAAK5O,iBAAL,CAAuBE,uBAAvB,IAAkD,CAAlD;AACAc,QAAAA,OAAO,CAACiF,IAAR,CAAa,yCAAb;AACD;;AAED,WAAKjG,iBAAL,CAAuBC,UAAvB,IAAqC,CAArC;AACD","sourcesContent":["import type {Tileset3DProps} from '@loaders.gl/tiles';\nimport type {GLTFMaterial} from '@loaders.gl/gltf';\nimport type {BatchTableJson, B3DMContent} from '@loaders.gl/3d-tiles';\n\nimport type {\n AttributeStorageInfo,\n SceneLayer3D,\n BoundingVolumes,\n Node3DIndexDocument,\n NodeReference,\n I3SGeometry,\n MaxScreenThresholdSQ,\n NodeInPage,\n LodSelection,\n SharedResources,\n TextureImage,\n Attribute,\n ESRIField,\n Field,\n PopupInfo\n} from '@loaders.gl/i3s';\nimport {load} from '@loaders.gl/core';\nimport {Tileset3D} from '@loaders.gl/tiles';\nimport {CesiumIonLoader} from '@loaders.gl/3d-tiles';\nimport {join} from 'path';\nimport {v4 as uuidv4} from 'uuid';\nimport process from 'process';\nimport transform from 'json-map-transform';\nimport md5 from 'md5';\n\nimport NodePages from './helpers/node-pages';\nimport {writeFile, removeDir, writeFileForSlpk} from '../lib/utils/file-utils';\nimport {\n compressWithChildProcess\n // generateHash128FromZip,\n // addFileToZip\n} from '../lib/utils/compress-util';\nimport {calculateFilesSize, timeConverter} from '../lib/utils/statistic-utills';\nimport convertB3dmToI3sGeometry from './helpers/geometry-converter';\nimport {\n createBoundingVolumes,\n convertCommonToI3SExtentCoordinate\n} from './helpers/coordinate-converter';\nimport {createSceneServerPath} from './helpers/create-scene-server-path';\nimport {convertGeometricErrorToScreenThreshold} from '../lib/utils/lod-conversion-utils';\nimport {PGMLoader} from '../pgm-loader';\n\nimport {LAYERS as layersTemplate} from './json-templates/layers';\nimport {NODE as nodeTemplate} from './json-templates/node';\nimport {SHARED_RESOURCES_TEMPLATE} from './json-templates/shared-resources';\nimport {validateNodeBoundingVolumes} from './helpers/node-debug';\nimport {GeoidHeightModel} from '../lib/geoid-height-model';\nimport TileHeader from '@loaders.gl/tiles/src/tileset/tile-3d';\n\nconst ION_DEFAULT_TOKEN =\n process.env.IonToken || // eslint-disable-line\n 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ'; // eslint-disable-line\nconst HARDCODED_NODES_PER_PAGE = 64;\nconst _3D_TILES = '3DTILES';\nconst _3D_OBJECT_LAYER_TYPE = '3DObject';\nconst STRING_TYPE = 'string';\nconst SHORT_INT_TYPE = 'Int32';\nconst DOUBLE_TYPE = 'double';\nconst OBJECT_ID_TYPE = 'OBJECTID';\nconst REFRESH_TOKEN_TIMEOUT = 1800; // 30 minutes in seconds\n// const FS_FILE_TOO_LARGE = 'ERR_FS_FILE_TOO_LARGE';\n\n/**\n * Converter from 3d-tiles tileset to i3s layer\n */\nexport default class I3SConverter {\n nodePages: NodePages;\n fileMap: {[key: string]: string};\n options: any;\n layers0Path: string;\n materialMap: Map<any, any>;\n materialDefinitions: GLTFMaterial[];\n vertexCounter: number;\n layers0: SceneLayer3D;\n featuresHashArray: string[];\n refinementCounter: {\n tilesCount: number;\n tilesWithAddRefineCount: number;\n };\n validate: boolean;\n boundingVolumeWarnings?: string[];\n conversionStartTime: [number, number];\n refreshTokenTime: [number, number];\n sourceTileset: Tileset3D | null;\n geoidHeightModel: GeoidHeightModel | null;\n\n constructor() {\n this.nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE);\n this.fileMap = {};\n this.options = {};\n this.layers0Path = '';\n this.materialMap = new Map();\n this.materialDefinitions = [];\n this.vertexCounter = 0;\n this.layers0 = null;\n this.featuresHashArray = [];\n this.refinementCounter = {\n tilesCount: 0,\n tilesWithAddRefineCount: 0\n };\n this.validate = false;\n this.boundingVolumeWarnings = null;\n }\n\n /**\n * Convert a 3d tileset\n * @param options\n * @param options.inputUrl the url to read the tileset from\n * @param options.outputPath the output filename\n * @param options.tilesetName the output name of the tileset\n * @param options.maxDepth The max tree depth of conversion\n * @param options.slpk Generate slpk (Scene Layer Packages) output file\n * @param options.sevenZipExe Location of 7z.exe archiver to create slpk on Windows\n * @param options.egmFilePath location of *.pgm file to convert heights from ellipsoidal to gravity-related format\n * @param options.token Token for Cesium ION tilesets authentication\n * @param options.draco Generate I3S 1.7 draco compressed geometries\n * @param options.validate -enable validation\n */\n async convert(options: {\n inputUrl: string;\n outputPath: string;\n tilesetName: string;\n sevenZipExe: string;\n egmFilePath?: string;\n maxDepth?: number;\n slpk?: boolean;\n token?: string;\n draco?: boolean;\n validate?: boolean;\n }): Promise<any> {\n this.conversionStartTime = process.hrtime();\n const {\n tilesetName,\n slpk,\n egmFilePath,\n inputUrl,\n validate,\n outputPath,\n draco,\n sevenZipExe,\n maxDepth,\n token\n } = options;\n this.options = {maxDepth, slpk, sevenZipExe, egmFilePath, draco, token, inputUrl};\n this.validate = validate;\n\n console.log('Loading egm file...'); // eslint-disable-line\n this.geoidHeightModel = await load(egmFilePath, PGMLoader);\n console.log('Loading egm file completed!'); // eslint-disable-line\n\n if (slpk) {\n this.nodePages.useWriteFunction(writeFileForSlpk);\n }\n\n const preloadOptions = await this._fetchPreloadOptions();\n const tilesetOptions: Tileset3DProps = {loadOptions: {}};\n if (preloadOptions.headers) {\n tilesetOptions.loadOptions.fetch = {headers: preloadOptions.headers};\n }\n Object.assign(tilesetOptions, preloadOptions);\n const sourceTilesetJson = await load(inputUrl, CesiumIonLoader, tilesetOptions.loadOptions);\n // console.log(tilesetJson); // eslint-disable-line\n this.sourceTileset = new Tileset3D(sourceTilesetJson, tilesetOptions);\n\n await this._createAndSaveTileset(outputPath, tilesetName);\n await this._finishConversion({slpk, outputPath, tilesetName});\n return sourceTilesetJson;\n }\n\n /**\n * Convert and save the layer and embedded tiles\n * @param outputPath - path to save output data\n * @param tilesetName - new tileset path\n */\n private async _createAndSaveTileset(outputPath: string, tilesetName: string): Promise<void> {\n const tilesetPath = join(`${outputPath}`, `${tilesetName}`);\n // Removing the tilesetPath needed to exclude erroneous files after conversion\n try {\n await removeDir(tilesetPath);\n } catch (e) {\n // do nothing\n }\n\n this.layers0Path = join(tilesetPath, 'SceneServer', 'layers', '0');\n\n this._formLayers0(tilesetName);\n\n this.materialDefinitions = [];\n this.materialMap = new Map();\n\n const sourceRootTile = this.sourceTileset.root;\n const boundingVolumes = createBoundingVolumes(sourceRootTile, this.geoidHeightModel);\n const parentId = this.nodePages.push({\n lodThreshold: 0,\n obb: boundingVolumes.obb,\n children: []\n });\n\n const isCreateSlpk = this.options.slpk;\n const root0 = this._formRootNodeIndexDocument(boundingVolumes);\n\n await this._convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes);\n\n this.layers0.materialDefinitions = this.materialDefinitions;\n await this._writeLayers0();\n createSceneServerPath(tilesetName, this.layers0, tilesetPath);\n await this._writeNodeIndexDocument(root0, 'root', join(this.layers0Path, 'nodes', 'root'));\n await this.nodePages.save(this.layers0Path, this.fileMap, isCreateSlpk);\n await this._createSlpk(tilesetPath);\n }\n\n /**\n * Form object of 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md\n * @param tilesetName - Name of layer\n */\n private _formLayers0(tilesetName: string): void {\n const extent = convertCommonToI3SExtentCoordinate(this.sourceTileset);\n const layers0data = {\n version: `{${uuidv4().toUpperCase()}}`,\n id: 0,\n name: tilesetName,\n href: './layers/0',\n store: {\n id: `{${uuidv4().toUpperCase()}}`,\n extent\n },\n nodePages: {\n nodesPerPage: HARDCODED_NODES_PER_PAGE\n },\n compressGeometry: this.options.draco\n };\n\n this.layers0 = transform(layers0data, layersTemplate);\n }\n\n /**\n * Convert and save the layer and embedded tiles\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 private _formRootNodeIndexDocument(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 * Form object of 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md\n * @param root0 - 3DNodeIndexDocument of root node https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md\n * @param sourceRootTile - Source (3DTile) tile data\n * @param parentId - node id in node pages\n * @param boundingVolumes - mbs and obb data about node's bounding volume\n */\n private async _convertNodesTree(\n root0: Node3DIndexDocument,\n sourceRootTile: TileHeader,\n parentId: number,\n boundingVolumes: BoundingVolumes\n ): Promise<void> {\n await this.sourceTileset._loadTile(sourceRootTile);\n if (sourceRootTile.content && sourceRootTile.content.type === 'b3dm') {\n root0.children.push({\n id: '1',\n href: './1',\n ...boundingVolumes\n });\n const [child] = await this._createNode(root0, sourceRootTile, parentId, 0);\n const childPath = join(this.layers0Path, 'nodes', child.path);\n\n if (this.options.slpk) {\n this.fileMap['nodes/1/3dNodeIndexDocument.json.gz'] = await writeFileForSlpk(\n childPath,\n JSON.stringify(child),\n '3dNodeIndexDocument.json'\n );\n } else {\n await writeFile(childPath, JSON.stringify(child));\n }\n } else {\n await this._addChildrenWithNeighborsAndWriteFile({\n parentNode: root0,\n sourceTiles: sourceRootTile.children,\n parentId,\n level: 1\n });\n }\n await sourceRootTile.unloadContent();\n }\n\n /**\n * Write 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md in file\n */\n private async _writeLayers0(): Promise<void> {\n if (this.options.slpk) {\n this.fileMap['3dSceneLayer.json.gz'] = await writeFileForSlpk(\n this.layers0Path,\n JSON.stringify(this.layers0),\n '3dSceneLayer.json'\n );\n } else {\n await writeFile(this.layers0Path, JSON.stringify(this.layers0));\n }\n }\n\n /**\n * Write 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md in file\n */\n private async _writeNodeIndexDocument(\n root0: Node3DIndexDocument,\n nodePath: string,\n rootPath: string\n ): Promise<void> {\n if (this.options.slpk) {\n this.fileMap[`nodes/${nodePath}/3dNodeIndexDocument.json.gz`] = await writeFileForSlpk(\n rootPath,\n JSON.stringify(root0),\n '3dNodeIndexDocument.json'\n );\n } else {\n await writeFile(rootPath, JSON.stringify(root0));\n }\n }\n\n /**\n * Pack files into *.slpk archive\n * @param tilesetPath - Path to save file\n */\n private async _createSlpk(tilesetPath: string): Promise<void> {\n if (this.options.slpk) {\n const slpkTilesetPath = join(tilesetPath, 'SceneServer', 'layers', '0');\n const slpkFileName = `${tilesetPath}.slpk`;\n await compressWithChildProcess(\n slpkTilesetPath,\n slpkFileName,\n 0,\n '.',\n this.options.sevenZipExe\n );\n\n // TODO: `addFileToZip` corrupts archive so it can't be validated with windows i3s_converter.exe\n // const fileHash128Path = `${tilesetPath}/@specialIndexFileHASH128@`;\n // try {\n // await generateHash128FromZip(slpkFileName, fileHash128Path);\n // await addFileToZip(\n // tilesetPath,\n // '@specialIndexFileHASH128@',\n // slpkFileName,\n // this.options.sevenZipExe\n // );\n // } catch (error) {\n // if (error.code === FS_FILE_TOO_LARGE) {\n // console.warn(`${slpkFileName} file is too big to generate a hash`); // eslint-disable-line\n // } else {\n // console.error(error); // eslint-disable-line\n // }\n // }\n // All converted files are contained in slpk now they can be deleted\n try {\n await removeDir(tilesetPath);\n } catch (e) {\n // do nothing\n }\n }\n }\n\n /**\n * Add child nodes recursively and write them to files\n * @param data - arguments\n * @param data.sourceTiles - array of source child nodes\n * @param data.parentNode - 3DNodeIndexDocument of parent node for processing child nodes\n * @param data.parentId - id of parent node in node pages\n * @param data.level - level of node (distanse to root node in the tree)\n */\n private async _addChildrenWithNeighborsAndWriteFile(data: {\n parentNode: Node3DIndexDocument;\n sourceTiles: TileHeader[];\n parentId: number;\n level: number;\n }): Promise<void> {\n const childNodes = [];\n await this._addChildren({...data, childNodes});\n await this._addNeighborsAndWriteFile(data.parentNode, childNodes);\n }\n\n /**\n * Add child nodes recursively and write them to files\n * @param data - arguments\n * @param data.childNodes - array of target child nodes\n * @param data.sourceTiles - array of source child nodes\n * @param data.parentNode - 3DNodeIndexDocument of parent node for processing child nodes\n * @param data.parentId - id of parent node in node pages\n * @param data.level - level of node (distanse to root node in the tree)\n */\n private async _addChildren(data: {\n childNodes: NodeReference[];\n sourceTiles: TileHeader[];\n parentNode: Node3DIndexDocument;\n parentId: number;\n level: number;\n }): Promise<void> {\n const {childNodes, sourceTiles, parentNode, parentId, level} = data;\n if (this.options.maxDepth && level > this.options.maxDepth) {\n return;\n }\n for (const sourceTile of sourceTiles) {\n if (sourceTile.type === 'json') {\n await this.sourceTileset._loadTile(sourceTile);\n await this._addChildren({\n parentNode,\n sourceTiles: sourceTile.children,\n childNodes,\n parentId,\n level: level + 1\n });\n await sourceTile.unloadContent();\n } else {\n const boundingVolumes = createBoundingVolumes(sourceTile, this.geoidHeightModel);\n const children = await this._createNode(parentNode, sourceTile, parentId, level);\n for (const child of children) {\n parentNode.children.push({\n id: child.id,\n href: `../${child.path}`,\n ...boundingVolumes\n });\n childNodes.push(child);\n }\n }\n if (sourceTile.id) {\n console.log(sourceTile.id); // eslint-disable-line\n }\n }\n }\n\n /**\n * Add neightbors to 3DNodeIndexDocument and write it in a file\n * @param parentNode - arguments\n * @param childNodes - array of target child nodes\n */\n private async _addNeighborsAndWriteFile(\n parentNode: Node3DIndexDocument,\n childNodes: Node3DIndexDocument[]\n ): Promise<void> {\n for (const node of childNodes) {\n const childPath = join(this.layers0Path, 'nodes', node.path);\n const nodePath = node.path;\n delete node.path;\n\n // Don't do large amount of \"neightbors\" to avoid big memory consumption\n if (parentNode.children.length < 1000) {\n for (const neighbor of parentNode.children) {\n // eslint-disable-next-line max-depth\n if (node.id === neighbor.id) {\n continue; // eslint-disable-line\n }\n\n node.neighbors.push({...neighbor});\n }\n } else {\n // eslint-disable-next-line no-console, no-undef\n console.warn(\n `Node ${node.id}: neighbors attribute is omited because of large number of neigbors`\n );\n delete node.neighbors;\n }\n await this._writeNodeIndexDocument(node, nodePath, childPath);\n node.neighbors = [];\n }\n }\n\n /**\n * Convert tile to one or more I3S nodes\n * @param parentTile - parent 3DNodeIndexDocument\n * @param sourceTile - source tile (3DTile)\n * @param parentId - id of parent node in node pages\n * @param level - level of node (distanse to root node in the tree)\n */\n private async _createNode(\n parentTile: Node3DIndexDocument,\n sourceTile: TileHeader,\n parentId: number,\n level: number\n ): Promise<Node3DIndexDocument[]> {\n if (this.validate) {\n this._checkAddRefinementTypeForTile(sourceTile);\n }\n\n await this._updateTilesetOptions();\n await this.sourceTileset._loadTile(sourceTile);\n const boundingVolumes = createBoundingVolumes(sourceTile, this.geoidHeightModel);\n\n const lodSelection = convertGeometricErrorToScreenThreshold(sourceTile, boundingVolumes);\n const maxScreenThresholdSQ = lodSelection.find(\n (val) => val.metricType === 'maxScreenThresholdSQ'\n ) || {maxError: 0};\n\n const batchTable = sourceTile?.content?.batchTableJson;\n\n if (batchTable) {\n this._convertAttributeStorageInfo(sourceTile.content);\n }\n\n const resourcesData = await this._convertResources(sourceTile);\n\n const nodes = [];\n const emptyResources = {\n geometry: null,\n compressedGeometry: null,\n texture: null,\n sharedResources: null,\n meshMaterial: null,\n vertexCount: null,\n attributes: null,\n featureCount: null\n };\n for (const resources of resourcesData || [emptyResources]) {\n const nodeInPage = this._createNodeInNodePages(\n maxScreenThresholdSQ,\n boundingVolumes,\n sourceTile,\n parentId,\n resources\n );\n const node = this._createNodeIndexDocument(\n parentTile,\n boundingVolumes,\n lodSelection,\n nodeInPage,\n resources\n );\n\n if (nodeInPage.mesh) {\n await this._writeResources(resources, node.path);\n }\n\n if (this.validate) {\n this.boundingVolumeWarnings = validateNodeBoundingVolumes(node);\n\n if (this.boundingVolumeWarnings && this.boundingVolumeWarnings.length) {\n console.warn('Bounding Volume Warnings: ', ...this.boundingVolumeWarnings); //eslint-disable-line\n }\n }\n\n nodes.push(node);\n }\n\n sourceTile.unloadContent();\n\n const firstNode = nodes[0];\n await this._addChildrenWithNeighborsAndWriteFile({\n parentNode: firstNode,\n sourceTiles: sourceTile.children,\n parentId: firstNode.id,\n level: level + 1\n });\n return nodes;\n }\n\n /**\n * Convert attributesStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * from B3DM batch table\n * @param sourceTileContent - tile content of 3DTile\n * @return {void}\n */\n private _convertAttributeStorageInfo(sourceTileContent: B3DMContent): void {\n // In legacy b3dm files sometimes sourceTileContent is null.\n const batchTable = sourceTileContent && sourceTileContent.batchTableJson;\n if (batchTable && !this.layers0.attributeStorageInfo.length) {\n this._convertBatchTableInfoToNodeAttributes(batchTable);\n }\n }\n\n /**\n * Convert tile to one or more I3S nodes\n * @param sourceTile - source tile (3DTile)\n * result.geometry - ArrayBuffer with geometry attributes\n * result.compressedGeometry - ArrayBuffer with compressed (draco) geometry\n * result.texture - texture image\n * result.sharedResources - shared resource data object\n * result.meshMaterial - PBR-like material object\n * result.vertexCount - number of vertices in geometry\n * result.attributes - feature attributes\n * result.featureCount - number of features\n */\n private async _convertResources(sourceTile: TileHeader): Promise<I3SGeometry[]> {\n if (!sourceTile.content || sourceTile.content.type !== 'b3dm') {\n return null;\n }\n const resourcesData = await convertB3dmToI3sGeometry(\n sourceTile.content,\n Number(this.nodePages.nodesCounter),\n this.featuresHashArray,\n this.layers0.attributeStorageInfo,\n this.options.draco\n );\n return resourcesData;\n }\n\n /**\n * Create a new node object (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/node.cmn.md)\n * in node pages (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/nodePage.cmn.md)\n * @param maxScreenThresholdSQ - Level of Details (LOD) metric\n * @param boundingVolumes - Bounding volumes\n * @param sourceTile - source tile (3DTile)\n * @param parentId - id of parent node in node pages\n * @param resources - the node resources data\n * @param resources.meshMaterial - PBR-like material object\n * @param resources.texture - texture image\n * @param resources.vertexCount - number of vertices in geometry\n * @param resources.featureCount - number of features\n * @return the node object in node pages\n */\n private _createNodeInNodePages(\n maxScreenThresholdSQ: MaxScreenThresholdSQ,\n boundingVolumes: BoundingVolumes,\n sourceTile: TileHeader,\n parentId: number,\n resources: I3SGeometry\n ): NodeInPage {\n const {meshMaterial, texture, vertexCount, featureCount} = resources;\n const nodeInPage = {\n lodThreshold: maxScreenThresholdSQ.maxError,\n obb: boundingVolumes.obb,\n children: [],\n mesh: null\n };\n if (sourceTile.content && sourceTile.content.type === 'b3dm') {\n nodeInPage.mesh = {\n geometry: {\n definition: texture ? 0 : 1\n },\n attribute: {}\n };\n }\n const nodeId = this.nodePages.push(nodeInPage, parentId);\n\n if (meshMaterial) {\n this.nodePages.updateMaterialByNodeId(nodeId, this._findOrCreateMaterial(meshMaterial));\n }\n\n if (texture) {\n const texelCountHint = texture.image.height * texture.image.width;\n this.nodePages.updateTexelCountHintByNodeId(nodeId, texelCountHint);\n }\n\n if (vertexCount) {\n this.vertexCounter += vertexCount;\n this.nodePages.updateVertexCountByNodeId(nodeId, vertexCount);\n }\n this.nodePages.updateNodeAttributeByNodeId(nodeId);\n if (featureCount) {\n this.nodePages.updateFeatureCountByNodeId(nodeId, featureCount);\n }\n\n return nodeInPage;\n }\n\n /**\n * Create a new node page object in node pages\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 private _createNodeIndexDocument(\n parentNode: Node3DIndexDocument,\n boundingVolumes: BoundingVolumes,\n lodSelection: LodSelection[],\n nodeInPage: NodeInPage,\n resources: I3SGeometry\n ): Node3DIndexDocument {\n const {texture, attributes} = resources;\n const nodeId = nodeInPage.index;\n const nodeData = {\n version: parentNode.version,\n id: nodeId.toString(),\n path: nodeId.toString(),\n level: parentNode.level + 1,\n ...boundingVolumes,\n lodSelection,\n parentNode: {\n id: parentNode.id,\n href: `../${parentNode.id}`,\n mbs: parentNode.mbs,\n obb: parentNode.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'}];\n }\n\n if (\n attributes &&\n attributes.length &&\n this.layers0.attributeStorageInfo &&\n this.layers0.attributeStorageInfo.length\n ) {\n node.attributeData = [];\n for (let index = 0; index < attributes.length; index++) {\n const folderName = this.layers0.attributeStorageInfo[index].key;\n node.attributeData.push({href: `./attributes/${folderName}/0`});\n }\n }\n }\n\n return node;\n }\n\n /**\n * Write node resources in files\n * @param resources - source tile (3DTile)\n * @param resources.geometry - Uint8Array with geometry attributes\n * @param resources.compressedGeometry - Uint8Array with compressed (draco) geometry\n * @param resources.texture - texture image\n * @param resources.sharedResources - shared resource data object\n * @param resources.attributes - feature attributes\n * @return {Promise<void>}\n */\n private async _writeResources(resources: I3SGeometry, nodePath: string): Promise<void> {\n const {\n geometry: geometryBuffer,\n compressedGeometry,\n texture,\n sharedResources,\n attributes\n } = resources;\n const childPath = join(this.layers0Path, 'nodes', nodePath);\n const slpkChildPath = join('nodes', nodePath);\n\n await this._writeGeometries(geometryBuffer, compressedGeometry, childPath, slpkChildPath);\n await this._writeShared(sharedResources, childPath, slpkChildPath, nodePath);\n await this._writeTexture(texture, childPath, slpkChildPath);\n await this._writeAttributes(attributes, childPath, slpkChildPath);\n }\n\n /**\n * Write non-compressed and compressed geometries in files\n * @param geometryBuffer - Uint8Array with geometry attributes\n * @param compressedGeometry - Uint8Array with compressed (draco) geometry\n * @param childPath - a child path to write resources\n * @param slpkChildPath - resource path inside *slpk file\n */\n private async _writeGeometries(\n geometryBuffer: ArrayBuffer,\n compressedGeometry: ArrayBuffer,\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (this.options.slpk) {\n const slpkGeometryPath = join(childPath, 'geometries');\n this.fileMap[`${slpkChildPath}/geometries/0.bin.gz`] = await writeFileForSlpk(\n slpkGeometryPath,\n geometryBuffer,\n '0.bin'\n );\n } else {\n const geometryPath = join(childPath, 'geometries/0/');\n await writeFile(geometryPath, geometryBuffer, 'index.bin');\n }\n\n if (this.options.draco) {\n if (this.options.slpk) {\n const slpkCompressedGeometryPath = join(childPath, 'geometries');\n this.fileMap[`${slpkChildPath}/geometries/1.bin.gz`] = await writeFileForSlpk(\n slpkCompressedGeometryPath,\n compressedGeometry,\n '1.bin'\n );\n } else {\n const compressedGeometryPath = join(childPath, 'geometries/1/');\n await writeFile(compressedGeometryPath, compressedGeometry, 'index.bin');\n }\n }\n }\n\n /**\n * Write shared resources in a file\n * @param sharedResources - shared resource data object\n * @param childPath - a child path to write resources\n * @param slpkChildPath - resource path inside *slpk file\n * @param nodePath - a node path\n */\n private async _writeShared(\n sharedResources: SharedResources,\n childPath: string,\n slpkChildPath: string,\n nodePath: string\n ): Promise<void> {\n sharedResources.nodePath = nodePath;\n const sharedData = transform(sharedResources, SHARED_RESOURCES_TEMPLATE);\n const sharedDataStr = JSON.stringify(sharedData);\n if (this.options.slpk) {\n const slpkSharedPath = join(childPath, 'shared');\n this.fileMap[`${slpkChildPath}/shared/sharedResource.json.gz`] = await writeFileForSlpk(\n slpkSharedPath,\n sharedDataStr,\n 'sharedResource.json'\n );\n } else {\n const sharedPath = join(childPath, 'shared/');\n await writeFile(sharedPath, sharedDataStr);\n }\n }\n\n /**\n * Write the texture image in a file\n * @param texture - the texture image\n * @param childPath - a child path to write resources\n * @param slpkChildPath - the resource path inside *slpk file\n */\n private async _writeTexture(\n texture: TextureImage,\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (texture) {\n const format = this._getFormatByMimeType(texture.mimeType);\n if (!this.layers0.textureSetDefinitions.length) {\n this.layers0.textureSetDefinitions.push({\n formats: [\n {\n name: '0',\n format\n }\n ]\n });\n }\n\n const textureData = texture.bufferView.data;\n if (this.options.slpk) {\n const slpkTexturePath = join(childPath, 'textures');\n const compress = false;\n this.fileMap[`${slpkChildPath}/textures/0.${format}`] = await writeFileForSlpk(\n slpkTexturePath,\n textureData,\n `0.${format}`,\n compress\n );\n } else {\n const texturePath = join(childPath, 'textures/0/');\n await writeFile(texturePath, textureData, `index.${format}`);\n }\n }\n }\n\n /**\n * Write feature attributes in files\n * @param attributes - feature attributes\n * @param childPath - a child path to write resources\n * @param slpkChildPath - the resource path inside *slpk file\n */\n private async _writeAttributes(\n attributes: ArrayBuffer[],\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (\n attributes.length &&\n this.layers0.attributeStorageInfo &&\n this.layers0.attributeStorageInfo.length\n ) {\n for (let index = 0; index < attributes.length; index++) {\n const folderName = this.layers0.attributeStorageInfo[index].key;\n const fileBuffer = new Uint8Array(attributes[index]);\n\n if (this.options.slpk) {\n const slpkAttributesPath = join(childPath, 'attributes', folderName);\n this.fileMap[`${slpkChildPath}/attributes/${folderName}.bin.gz`] = await writeFileForSlpk(\n slpkAttributesPath,\n fileBuffer,\n '0.bin'\n );\n } else {\n const attributesPath = join(childPath, `attributes/${folderName}/0`);\n await writeFile(attributesPath, fileBuffer, 'index.bin');\n }\n }\n }\n }\n\n /**\n * Return file format by its MIME type\n * @param mimeType - feature attributes\n */\n private _getFormatByMimeType(mimeType: string): string {\n switch (mimeType) {\n case 'image/jpeg':\n return 'jpg';\n case 'image/png':\n return 'png';\n default:\n return 'jpg';\n }\n }\n\n /**\n * Find or create material in materialDefinitions array\n * @param material - end-to-end index of the node\n * @return material id\n */\n private _findOrCreateMaterial(material: GLTFMaterial): number {\n const hash = md5(JSON.stringify(material));\n if (this.materialMap.has(hash)) {\n return this.materialMap.get(hash);\n }\n const newMaterialId = this.materialDefinitions.push(material) - 1;\n this.materialMap.set(hash, newMaterialId);\n return newMaterialId;\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 batch table.\\\n * @param attributeType - attribute type.\n * @return Updated storageAttribute.\n */\n private _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 this._setupIdAttribute(storageAttribute);\n break;\n case STRING_TYPE:\n this._setupStringAttribute(storageAttribute);\n break;\n case DOUBLE_TYPE:\n this._setupDoubleAttribute(storageAttribute);\n break;\n case SHORT_INT_TYPE:\n break;\n default:\n this._setupStringAttribute(storageAttribute);\n }\n\n return storageAttribute;\n }\n\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 batchTable\n */\n private 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 * Setup storage attribute as string.\n * @param storageAttribute - attribute for map segmentation.\n */\n private _setupStringAttribute(storageAttribute: AttributeStorageInfo): void {\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 */\n private _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 */\n private _setupDoubleAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Float64',\n valuesPerElement: 1\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 */\n private _createFieldAttribute(key: string, fieldAttributeType: ESRIField): Field {\n return {\n name: key,\n type: fieldAttributeType,\n alias: key\n };\n }\n\n /**\n * Do conversion of 3DTiles batch table to I3s node attributes.\n * @param batchTable - Table with layer meta data.\n */\n private _convertBatchTableInfoToNodeAttributes(batchTable: BatchTableJson): void {\n let attributeIndex = 0;\n const batchTableWithObjectId = {\n OBJECTID: [0],\n ...batchTable\n };\n\n for (const key in batchTableWithObjectId) {\n const firstAttribute = batchTableWithObjectId[key][0];\n const attributeType = this.getAttributeType(key, firstAttribute);\n\n const storageAttribute = this._createdStorageAttribute(attributeIndex, key, attributeType);\n const fieldAttributeType = this._getFieldAttributeType(attributeType);\n const fieldAttribute = this._createFieldAttribute(key, fieldAttributeType);\n const popupInfo = this._createPopupInfo(batchTableWithObjectId);\n\n this.layers0.attributeStorageInfo.push(storageAttribute);\n this.layers0.fields.push(fieldAttribute);\n this.layers0.popupInfo = popupInfo;\n this.layers0.layerType = _3D_OBJECT_LAYER_TYPE;\n\n attributeIndex += 1;\n }\n }\n\n /**\n * Find and return attribute type based on key form Batch table.\n * @param attributeType\n */\n private _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 * Generate popup info to show metadata on the map.\n * @param batchTable - Batch table data with OBJECTID.\n * @return data for correct rendering of popup.\n */\n private _createPopupInfo(batchTable: BatchTableJson): PopupInfo {\n const title = '{OBJECTID}';\n const mediaInfos = [];\n const fieldInfos = [];\n const popupElements = [];\n const expressionInfos = [];\n\n for (const key in batchTable) {\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 * Print statistics in the end of conversion\n * @param params - output files data\n */\n private async _finishConversion(params: {\n slpk: boolean;\n outputPath: string;\n tilesetName: string;\n }): Promise<void> {\n const {tilesCount, tilesWithAddRefineCount} = this.refinementCounter;\n const addRefinementPercentage = tilesWithAddRefineCount\n ? (tilesWithAddRefineCount / tilesCount) * 100\n : 0;\n const filesSize = await calculateFilesSize(params);\n const diff = process.hrtime(this.conversionStartTime);\n const conversionTime = timeConverter(diff);\n console.log(`------------------------------------------------`); // eslint-disable-line no-undef, no-console\n console.log(`Finishing conversion of ${_3D_TILES}`); // eslint-disable-line no-undef, no-console\n console.log(`Total conversion time: ${conversionTime}`); // eslint-disable-line no-undef, no-console\n console.log(`Vertex count: `, this.vertexCounter); // eslint-disable-line no-undef, no-console\n console.log(`File(s) size: `, filesSize, ' bytes'); // eslint-disable-line no-undef, no-console\n console.log(`Percentage of tiles with \"ADD\" refinement type:`, addRefinementPercentage, '%'); // eslint-disable-line no-undef, no-console\n console.log(`------------------------------------------------`); // eslint-disable-line no-undef, no-console\n }\n\n /**\n * Fetch preload options for ION tileset\n */\n private async _fetchPreloadOptions(): Promise<any> {\n const options = {\n 'cesium-ion': {accessToken: this.options.token || ION_DEFAULT_TOKEN}\n };\n const preloadOptions = await CesiumIonLoader.preload(this.options.inputUrl, options);\n this.refreshTokenTime = process.hrtime();\n return {...options, ...preloadOptions};\n }\n\n /**\n * Update options of source tileset\n */\n private async _updateTilesetOptions(): Promise<void> {\n const diff = process.hrtime(this.refreshTokenTime);\n if (diff[0] < REFRESH_TOKEN_TIMEOUT) {\n return;\n }\n this.refreshTokenTime = process.hrtime();\n\n const preloadOptions = await this._fetchPreloadOptions();\n this.sourceTileset.options = {...this.sourceTileset.options, ...preloadOptions};\n if (preloadOptions.headers) {\n this.sourceTileset.loadOptions.fetch = {\n ...this.sourceTileset.loadOptions.fetch,\n headers: preloadOptions.headers\n };\n console.log('Authorization Bearer token has been updated'); // eslint-disable-line no-undef, no-console\n }\n }\n\n /** Do calculations of all tiles and tiles with \"ADD\" type of refinement.\n * @param tile\n */\n private _checkAddRefinementTypeForTile(tile: TileHeader): void {\n const ADD_TILE_REFINEMENT = 1;\n\n if (tile.refine === ADD_TILE_REFINEMENT) {\n this.refinementCounter.tilesWithAddRefineCount += 1;\n console.warn('This tile uses \"ADD\" type of refinement'); // eslint-disable-line\n }\n\n this.refinementCounter.tilesCount += 1;\n }\n}\n"],"file":"i3s-converter.js"}
1
+ {"version":3,"sources":["../../../src/i3s-converter/i3s-converter.ts"],"names":["ION_DEFAULT_TOKEN","process","env","IonToken","HARDCODED_NODES_PER_PAGE","_3D_TILES","_3D_OBJECT_LAYER_TYPE","STRING_TYPE","SHORT_INT_TYPE","DOUBLE_TYPE","OBJECT_ID_TYPE","REFRESH_TOKEN_TIMEOUT","CESIUM_DATASET_PREFIX","I3SConverter","Tiles3DLoader","nodePages","NodePages","writeFile","fileMap","options","layers0Path","materialMap","Map","materialDefinitions","vertexCounter","layers0","featuresHashArray","refinementCounter","tilesCount","tilesWithAddRefineCount","validate","boundingVolumeWarnings","conversionStartTime","hrtime","tilesetName","slpk","egmFilePath","inputUrl","outputPath","draco","sevenZipExe","maxDepth","token","Loader","indexOf","CesiumIonLoader","console","log","PGMLoader","geoidHeightModel","useWriteFunction","writeFileForSlpk","_fetchPreloadOptions","preloadOptions","tilesetOptions","loadOptions","headers","fetch","Object","assign","sourceTilesetJson","sourceTileset","Tileset3D","_createAndSaveTileset","_finishConversion","tilesetPath","_formLayers0","sourceRootTile","root","boundingVolumes","parentId","push","lodThreshold","obb","children","isCreateSlpk","root0","_formRootNodeIndexDocument","_convertNodesTree","_writeLayers0","_writeNodeIndexDocument","save","_createSlpk","extent","layers0data","version","toUpperCase","id","name","href","store","nodesPerPage","compressGeometry","layersTemplate","root0data","level","lodSelection","metricType","maxError","nodeTemplate","_loadTile","content","type","_createNode","child","childPath","path","JSON","stringify","_addChildrenWithNeighborsAndWriteFile","parentNode","sourceTiles","unloadContent","nodePath","rootPath","slpkTilesetPath","slpkFileName","data","childNodes","_addChildren","_addNeighborsAndWriteFile","sourceTile","node","length","neighbor","neighbors","warn","parentTile","_checkAddRefinementTypeForTile","_updateTilesetOptions","maxScreenThresholdSQ","find","val","batchTable","batchTableJson","_convertAttributeStorageInfo","_convertResources","resourcesData","nodes","emptyResources","geometry","compressedGeometry","texture","sharedResources","meshMaterial","vertexCount","attributes","featureCount","resources","nodeInPage","_createNodeInNodePages","_createNodeIndexDocument","mesh","_writeResources","firstNode","sourceTileContent","attributeStorageInfo","_convertBatchTableInfoToNodeAttributes","Number","nodesCounter","definition","attribute","nodeId","updateMaterialByNodeId","_findOrCreateMaterial","texelCountHint","image","height","width","updateTexelCountHintByNodeId","updateVertexCountByNodeId","updateNodeAttributeByNodeId","updateFeatureCountByNodeId","index","nodeData","toString","mbs","geometryData","sharedResource","textureData","attributeData","folderName","key","geometryBuffer","slpkChildPath","_writeGeometries","_writeShared","_writeTexture","_writeAttributes","slpkGeometryPath","geometryPath","slpkCompressedGeometryPath","compressedGeometryPath","sharedData","SHARED_RESOURCES_TEMPLATE","sharedDataStr","slpkSharedPath","sharedPath","format","_getFormatByMimeType","mimeType","textureSetDefinitions","formats","bufferView","slpkTexturePath","compress","texturePath","fileBuffer","Uint8Array","slpkAttributesPath","attributesPath","material","hash","has","get","newMaterialId","set","attributeIndex","attributeType","storageAttribute","ordering","header","property","valueType","attributeValues","valuesPerElement","_setupIdAttribute","_setupStringAttribute","_setupDoubleAttribute","isInteger","unshift","encoding","attributeByteCounts","fieldAttributeType","alias","batchTableWithObjectId","OBJECTID","firstAttribute","getAttributeType","_createdStorageAttribute","_getFieldAttributeType","fieldAttribute","_createFieldAttribute","popupInfo","_createPopupInfo","fields","layerType","title","mediaInfos","fieldInfos","popupElements","expressionInfos","fieldName","visible","isEditable","label","params","addRefinementPercentage","filesSize","diff","conversionTime","preload","accessToken","refreshTokenTime","tile","ADD_TILE_REFINEMENT","refine"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAKA,IAAMA,iBAAiB,GACrBC,iBAAQC,GAAR,CAAYC,QAAZ,IACA,0NAFF;AAGA,IAAMC,wBAAwB,GAAG,EAAjC;AACA,IAAMC,SAAS,GAAG,SAAlB;AACA,IAAMC,qBAAqB,GAAG,UAA9B;AACA,IAAMC,WAAW,GAAG,QAApB;AACA,IAAMC,cAAc,GAAG,OAAvB;AACA,IAAMC,WAAW,GAAG,QAApB;AACA,IAAMC,cAAc,GAAG,UAAvB;AACA,IAAMC,qBAAqB,GAAG,IAA9B;AACA,IAAMC,qBAAqB,GAAG,UAA9B;;IAMqBC,Y;AAsBnB,0BAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kDAFaC,qBAEb;AACZ,SAAKC,SAAL,GAAiB,IAAIC,kBAAJ,CAAcC,oBAAd,EAAyBb,wBAAzB,CAAjB;AACA,SAAKc,OAAL,GAAe,EAAf;AACA,SAAKC,OAAL,GAAe,EAAf;AACA,SAAKC,WAAL,GAAmB,EAAnB;AACA,SAAKC,WAAL,GAAmB,IAAIC,GAAJ,EAAnB;AACA,SAAKC,mBAAL,GAA2B,EAA3B;AACA,SAA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AL,CAAmBN,WAAnB,CAA+BE,KAA/B,mCACK,KAAKI,aAAL,CAAmBN,WAAnB,CAA+BE,KADpC;AAEED,oBAAAA,OAAO,EAAEH,cAAc,CAACG;AAF1B;AAIAV,kBAAAA,OAAO,CAACC,GAAR,CAAY,6CAAZ;AACD;;AAfH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAqBA,wCAAuCyN,IAAvC,EAA+D;AAC7D,UAAMC,mBAAmB,GAAG,CAA5B;;AAEA,UAAID,IAAI,CAACE,MAAL,KAAgBD,mBAApB,EAAyC;AACvC,aAAK9O,iBAAL,CAAuBE,uBAAvB,IAAkD,CAAlD;AACAiB,QAAAA,OAAO,CAACgF,IAAR,CAAa,yCAAb;AACD;;AAED,WAAKnG,iBAAL,CAAuBC,UAAvB,IAAqC,CAArC;AACD","sourcesContent":["import type {Tileset3DProps} from '@loaders.gl/tiles';\nimport type {GLTFMaterial} from '@loaders.gl/gltf';\nimport type {BatchTableJson, B3DMContent} from '@loaders.gl/3d-tiles';\n\nimport type {\n AttributeStorageInfo,\n SceneLayer3D,\n BoundingVolumes,\n Node3DIndexDocument,\n NodeReference,\n I3SGeometry,\n MaxScreenThresholdSQ,\n NodeInPage,\n LodSelection,\n SharedResources,\n TextureImage,\n Attribute,\n ESRIField,\n Field,\n PopupInfo\n} from '@loaders.gl/i3s';\nimport {load} from '@loaders.gl/core';\nimport {Tileset3D} from '@loaders.gl/tiles';\nimport {CesiumIonLoader, Tiles3DLoader} from '@loaders.gl/3d-tiles';\nimport {join} from 'path';\nimport {v4 as uuidv4} from 'uuid';\nimport process from 'process';\nimport transform from 'json-map-transform';\nimport md5 from 'md5';\n\nimport NodePages from './helpers/node-pages';\nimport {writeFile, removeDir, writeFileForSlpk} from '../lib/utils/file-utils';\nimport {\n compressWithChildProcess\n // generateHash128FromZip,\n // addFileToZip\n} from '../lib/utils/compress-util';\nimport {calculateFilesSize, timeConverter} from '../lib/utils/statistic-utills';\nimport convertB3dmToI3sGeometry from './helpers/geometry-converter';\nimport {\n createBoundingVolumes,\n convertCommonToI3SExtentCoordinate\n} from './helpers/coordinate-converter';\nimport {createSceneServerPath} from './helpers/create-scene-server-path';\nimport {convertGeometricErrorToScreenThreshold} from '../lib/utils/lod-conversion-utils';\nimport {PGMLoader} from '../pgm-loader';\n\nimport {LAYERS as layersTemplate} from './json-templates/layers';\nimport {NODE as nodeTemplate} from './json-templates/node';\nimport {SHARED_RESOURCES_TEMPLATE} from './json-templates/shared-resources';\nimport {validateNodeBoundingVolumes} from './helpers/node-debug';\nimport {GeoidHeightModel} from '../lib/geoid-height-model';\nimport TileHeader from '@loaders.gl/tiles/src/tileset/tile-3d';\nimport {LoaderWithParser} from '@loaders.gl/loader-utils';\n\nconst ION_DEFAULT_TOKEN =\n process.env.IonToken || // eslint-disable-line\n 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ'; // eslint-disable-line\nconst HARDCODED_NODES_PER_PAGE = 64;\nconst _3D_TILES = '3DTILES';\nconst _3D_OBJECT_LAYER_TYPE = '3DObject';\nconst STRING_TYPE = 'string';\nconst SHORT_INT_TYPE = 'Int32';\nconst DOUBLE_TYPE = 'double';\nconst OBJECT_ID_TYPE = 'OBJECTID';\nconst REFRESH_TOKEN_TIMEOUT = 1800; // 30 minutes in seconds\nconst CESIUM_DATASET_PREFIX = 'https://';\n// const FS_FILE_TOO_LARGE = 'ERR_FS_FILE_TOO_LARGE';\n\n/**\n * Converter from 3d-tiles tileset to i3s layer\n */\nexport default class I3SConverter {\n nodePages: NodePages;\n fileMap: {[key: string]: string};\n options: any;\n layers0Path: string;\n materialMap: Map<any, any>;\n materialDefinitions: GLTFMaterial[];\n vertexCounter: number;\n layers0: SceneLayer3D;\n featuresHashArray: string[];\n refinementCounter: {\n tilesCount: number;\n tilesWithAddRefineCount: number;\n };\n validate: boolean;\n boundingVolumeWarnings?: string[];\n conversionStartTime: [number, number];\n refreshTokenTime: [number, number];\n sourceTileset: Tileset3D | null;\n geoidHeightModel: GeoidHeightModel | null;\n Loader: LoaderWithParser = Tiles3DLoader;\n\n constructor() {\n this.nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE);\n this.fileMap = {};\n this.options = {};\n this.layers0Path = '';\n this.materialMap = new Map();\n this.materialDefinitions = [];\n this.vertexCounter = 0;\n this.layers0 = null;\n this.featuresHashArray = [];\n this.refinementCounter = {\n tilesCount: 0,\n tilesWithAddRefineCount: 0\n };\n this.validate = false;\n this.boundingVolumeWarnings = null;\n }\n\n /**\n * Convert a 3d tileset\n * @param options\n * @param options.inputUrl the url to read the tileset from\n * @param options.outputPath the output filename\n * @param options.tilesetName the output name of the tileset\n * @param options.maxDepth The max tree depth of conversion\n * @param options.slpk Generate slpk (Scene Layer Packages) output file\n * @param options.sevenZipExe Location of 7z.exe archiver to create slpk on Windows\n * @param options.egmFilePath location of *.pgm file to convert heights from ellipsoidal to gravity-related format\n * @param options.token Token for Cesium ION tilesets authentication\n * @param options.draco Generate I3S 1.7 draco compressed geometries\n * @param options.validate -enable validation\n */\n async convert(options: {\n inputUrl: string;\n outputPath: string;\n tilesetName: string;\n sevenZipExe: string;\n egmFilePath?: string;\n maxDepth?: number;\n slpk?: boolean;\n token?: string;\n draco?: boolean;\n validate?: boolean;\n }): Promise<any> {\n this.conversionStartTime = process.hrtime();\n const {\n tilesetName,\n slpk,\n egmFilePath,\n inputUrl,\n validate,\n outputPath,\n draco,\n sevenZipExe,\n maxDepth,\n token\n } = options;\n this.options = {maxDepth, slpk, sevenZipExe, egmFilePath, draco, token, inputUrl};\n this.validate = validate;\n this.Loader = inputUrl.indexOf(CESIUM_DATASET_PREFIX) !== -1 ? CesiumIonLoader : Tiles3DLoader;\n\n console.log('Loading egm file...'); // eslint-disable-line\n this.geoidHeightModel = await load(egmFilePath, PGMLoader);\n console.log('Loading egm file completed!'); // eslint-disable-line\n\n if (slpk) {\n this.nodePages.useWriteFunction(writeFileForSlpk);\n }\n\n const preloadOptions = await this._fetchPreloadOptions();\n const tilesetOptions: Tileset3DProps = {loadOptions: {}};\n if (preloadOptions.headers) {\n tilesetOptions.loadOptions.fetch = {headers: preloadOptions.headers};\n }\n Object.assign(tilesetOptions, preloadOptions);\n const sourceTilesetJson = await load(inputUrl, this.Loader, tilesetOptions.loadOptions);\n // console.log(tilesetJson); // eslint-disable-line\n this.sourceTileset = new Tileset3D(sourceTilesetJson, tilesetOptions);\n\n await this._createAndSaveTileset(outputPath, tilesetName);\n await this._finishConversion({slpk, outputPath, tilesetName});\n return sourceTilesetJson;\n }\n\n /**\n * Convert and save the layer and embedded tiles\n * @param outputPath - path to save output data\n * @param tilesetName - new tileset path\n */\n private async _createAndSaveTileset(outputPath: string, tilesetName: string): Promise<void> {\n const tilesetPath = join(`${outputPath}`, `${tilesetName}`);\n // Removing the tilesetPath needed to exclude erroneous files after conversion\n try {\n await removeDir(tilesetPath);\n } catch (e) {\n // do nothing\n }\n\n this.layers0Path = join(tilesetPath, 'SceneServer', 'layers', '0');\n\n this._formLayers0(tilesetName);\n\n this.materialDefinitions = [];\n this.materialMap = new Map();\n\n const sourceRootTile = this.sourceTileset.root;\n const boundingVolumes = createBoundingVolumes(sourceRootTile, this.geoidHeightModel);\n const parentId = this.nodePages.push({\n lodThreshold: 0,\n obb: boundingVolumes.obb,\n children: []\n });\n\n const isCreateSlpk = this.options.slpk;\n const root0 = this._formRootNodeIndexDocument(boundingVolumes);\n\n await this._convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes);\n\n this.layers0.materialDefinitions = this.materialDefinitions;\n await this._writeLayers0();\n createSceneServerPath(tilesetName, this.layers0, tilesetPath);\n await this._writeNodeIndexDocument(root0, 'root', join(this.layers0Path, 'nodes', 'root'));\n await this.nodePages.save(this.layers0Path, this.fileMap, isCreateSlpk);\n await this._createSlpk(tilesetPath);\n }\n\n /**\n * Form object of 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md\n * @param tilesetName - Name of layer\n */\n private _formLayers0(tilesetName: string): void {\n const extent = convertCommonToI3SExtentCoordinate(this.sourceTileset);\n const layers0data = {\n version: `{${uuidv4().toUpperCase()}}`,\n id: 0,\n name: tilesetName,\n href: './layers/0',\n store: {\n id: `{${uuidv4().toUpperCase()}}`,\n extent\n },\n nodePages: {\n nodesPerPage: HARDCODED_NODES_PER_PAGE\n },\n compressGeometry: this.options.draco\n };\n\n this.layers0 = transform(layers0data, layersTemplate);\n }\n\n /**\n * Convert and save the layer and embedded tiles\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 private _formRootNodeIndexDocument(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 * Form object of 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md\n * @param root0 - 3DNodeIndexDocument of root node https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md\n * @param sourceRootTile - Source (3DTile) tile data\n * @param parentId - node id in node pages\n * @param boundingVolumes - mbs and obb data about node's bounding volume\n */\n private async _convertNodesTree(\n root0: Node3DIndexDocument,\n sourceRootTile: TileHeader,\n parentId: number,\n boundingVolumes: BoundingVolumes\n ): Promise<void> {\n await this.sourceTileset._loadTile(sourceRootTile);\n if (sourceRootTile.content && sourceRootTile.content.type === 'b3dm') {\n root0.children.push({\n id: '1',\n href: './1',\n ...boundingVolumes\n });\n const [child] = await this._createNode(root0, sourceRootTile, parentId, 0);\n const childPath = join(this.layers0Path, 'nodes', child.path);\n\n if (this.options.slpk) {\n this.fileMap['nodes/1/3dNodeIndexDocument.json.gz'] = await writeFileForSlpk(\n childPath,\n JSON.stringify(child),\n '3dNodeIndexDocument.json'\n );\n } else {\n await writeFile(childPath, JSON.stringify(child));\n }\n } else {\n await this._addChildrenWithNeighborsAndWriteFile({\n parentNode: root0,\n sourceTiles: sourceRootTile.children,\n parentId,\n level: 1\n });\n }\n await sourceRootTile.unloadContent();\n }\n\n /**\n * Write 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md in file\n */\n private async _writeLayers0(): Promise<void> {\n if (this.options.slpk) {\n this.fileMap['3dSceneLayer.json.gz'] = await writeFileForSlpk(\n this.layers0Path,\n JSON.stringify(this.layers0),\n '3dSceneLayer.json'\n );\n } else {\n await writeFile(this.layers0Path, JSON.stringify(this.layers0));\n }\n }\n\n /**\n * Write 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md in file\n */\n private async _writeNodeIndexDocument(\n root0: Node3DIndexDocument,\n nodePath: string,\n rootPath: string\n ): Promise<void> {\n if (this.options.slpk) {\n this.fileMap[`nodes/${nodePath}/3dNodeIndexDocument.json.gz`] = await writeFileForSlpk(\n rootPath,\n JSON.stringify(root0),\n '3dNodeIndexDocument.json'\n );\n } else {\n await writeFile(rootPath, JSON.stringify(root0));\n }\n }\n\n /**\n * Pack files into *.slpk archive\n * @param tilesetPath - Path to save file\n */\n private async _createSlpk(tilesetPath: string): Promise<void> {\n if (this.options.slpk) {\n const slpkTilesetPath = join(tilesetPath, 'SceneServer', 'layers', '0');\n const slpkFileName = `${tilesetPath}.slpk`;\n await compressWithChildProcess(\n slpkTilesetPath,\n slpkFileName,\n 0,\n '.',\n this.options.sevenZipExe\n );\n\n // TODO: `addFileToZip` corrupts archive so it can't be validated with windows i3s_converter.exe\n // const fileHash128Path = `${tilesetPath}/@specialIndexFileHASH128@`;\n // try {\n // await generateHash128FromZip(slpkFileName, fileHash128Path);\n // await addFileToZip(\n // tilesetPath,\n // '@specialIndexFileHASH128@',\n // slpkFileName,\n // this.options.sevenZipExe\n // );\n // } catch (error) {\n // if (error.code === FS_FILE_TOO_LARGE) {\n // console.warn(`${slpkFileName} file is too big to generate a hash`); // eslint-disable-line\n // } else {\n // console.error(error); // eslint-disable-line\n // }\n // }\n // All converted files are contained in slpk now they can be deleted\n try {\n await removeDir(tilesetPath);\n } catch (e) {\n // do nothing\n }\n }\n }\n\n /**\n * Add child nodes recursively and write them to files\n * @param data - arguments\n * @param data.sourceTiles - array of source child nodes\n * @param data.parentNode - 3DNodeIndexDocument of parent node for processing child nodes\n * @param data.parentId - id of parent node in node pages\n * @param data.level - level of node (distanse to root node in the tree)\n */\n private async _addChildrenWithNeighborsAndWriteFile(data: {\n parentNode: Node3DIndexDocument;\n sourceTiles: TileHeader[];\n parentId: number;\n level: number;\n }): Promise<void> {\n const childNodes = [];\n await this._addChildren({...data, childNodes});\n await this._addNeighborsAndWriteFile(data.parentNode, childNodes);\n }\n\n /**\n * Add child nodes recursively and write them to files\n * @param data - arguments\n * @param data.childNodes - array of target child nodes\n * @param data.sourceTiles - array of source child nodes\n * @param data.parentNode - 3DNodeIndexDocument of parent node for processing child nodes\n * @param data.parentId - id of parent node in node pages\n * @param data.level - level of node (distanse to root node in the tree)\n */\n private async _addChildren(data: {\n childNodes: NodeReference[];\n sourceTiles: TileHeader[];\n parentNode: Node3DIndexDocument;\n parentId: number;\n level: number;\n }): Promise<void> {\n const {childNodes, sourceTiles, parentNode, parentId, level} = data;\n if (this.options.maxDepth && level > this.options.maxDepth) {\n return;\n }\n for (const sourceTile of sourceTiles) {\n if (sourceTile.type === 'json') {\n await this.sourceTileset._loadTile(sourceTile);\n await this._addChildren({\n parentNode,\n sourceTiles: sourceTile.children,\n childNodes,\n parentId,\n level: level + 1\n });\n await sourceTile.unloadContent();\n } else {\n const boundingVolumes = createBoundingVolumes(sourceTile, this.geoidHeightModel);\n const children = await this._createNode(parentNode, sourceTile, parentId, level);\n for (const child of children) {\n parentNode.children.push({\n id: child.id,\n href: `../${child.path}`,\n ...boundingVolumes\n });\n childNodes.push(child);\n }\n }\n if (sourceTile.id) {\n console.log(sourceTile.id); // eslint-disable-line\n }\n }\n }\n\n /**\n * Add neightbors to 3DNodeIndexDocument and write it in a file\n * @param parentNode - arguments\n * @param childNodes - array of target child nodes\n */\n private async _addNeighborsAndWriteFile(\n parentNode: Node3DIndexDocument,\n childNodes: Node3DIndexDocument[]\n ): Promise<void> {\n for (const node of childNodes) {\n const childPath = join(this.layers0Path, 'nodes', node.path);\n const nodePath = node.path;\n delete node.path;\n\n // Don't do large amount of \"neightbors\" to avoid big memory consumption\n if (parentNode.children.length < 1000) {\n for (const neighbor of parentNode.children) {\n // eslint-disable-next-line max-depth\n if (node.id === neighbor.id) {\n continue; // eslint-disable-line\n }\n\n node.neighbors.push({...neighbor});\n }\n } else {\n // eslint-disable-next-line no-console, no-undef\n console.warn(\n `Node ${node.id}: neighbors attribute is omited because of large number of neigbors`\n );\n delete node.neighbors;\n }\n await this._writeNodeIndexDocument(node, nodePath, childPath);\n node.neighbors = [];\n }\n }\n\n /**\n * Convert tile to one or more I3S nodes\n * @param parentTile - parent 3DNodeIndexDocument\n * @param sourceTile - source tile (3DTile)\n * @param parentId - id of parent node in node pages\n * @param level - level of node (distanse to root node in the tree)\n */\n private async _createNode(\n parentTile: Node3DIndexDocument,\n sourceTile: TileHeader,\n parentId: number,\n level: number\n ): Promise<Node3DIndexDocument[]> {\n if (this.validate) {\n this._checkAddRefinementTypeForTile(sourceTile);\n }\n\n await this._updateTilesetOptions();\n await this.sourceTileset._loadTile(sourceTile);\n const boundingVolumes = createBoundingVolumes(sourceTile, this.geoidHeightModel);\n\n const lodSelection = convertGeometricErrorToScreenThreshold(sourceTile, boundingVolumes);\n const maxScreenThresholdSQ = lodSelection.find(\n (val) => val.metricType === 'maxScreenThresholdSQ'\n ) || {maxError: 0};\n\n const batchTable = sourceTile?.content?.batchTableJson;\n\n if (batchTable) {\n this._convertAttributeStorageInfo(sourceTile.content);\n }\n\n const resourcesData = await this._convertResources(sourceTile);\n\n const nodes = [];\n const emptyResources = {\n geometry: null,\n compressedGeometry: null,\n texture: null,\n sharedResources: null,\n meshMaterial: null,\n vertexCount: null,\n attributes: null,\n featureCount: null\n };\n for (const resources of resourcesData || [emptyResources]) {\n const nodeInPage = this._createNodeInNodePages(\n maxScreenThresholdSQ,\n boundingVolumes,\n sourceTile,\n parentId,\n resources\n );\n const node = this._createNodeIndexDocument(\n parentTile,\n boundingVolumes,\n lodSelection,\n nodeInPage,\n resources\n );\n\n if (nodeInPage.mesh) {\n await this._writeResources(resources, node.path);\n }\n\n if (this.validate) {\n this.boundingVolumeWarnings = validateNodeBoundingVolumes(node);\n\n if (this.boundingVolumeWarnings && this.boundingVolumeWarnings.length) {\n console.warn('Bounding Volume Warnings: ', ...this.boundingVolumeWarnings); //eslint-disable-line\n }\n }\n\n nodes.push(node);\n }\n\n sourceTile.unloadContent();\n\n const firstNode = nodes[0];\n await this._addChildrenWithNeighborsAndWriteFile({\n parentNode: firstNode,\n sourceTiles: sourceTile.children,\n parentId: firstNode.id,\n level: level + 1\n });\n return nodes;\n }\n\n /**\n * Convert attributesStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * from B3DM batch table\n * @param sourceTileContent - tile content of 3DTile\n * @return {void}\n */\n private _convertAttributeStorageInfo(sourceTileContent: B3DMContent): void {\n // In legacy b3dm files sometimes sourceTileContent is null.\n const batchTable = sourceTileContent && sourceTileContent.batchTableJson;\n if (batchTable && !this.layers0.attributeStorageInfo.length) {\n this._convertBatchTableInfoToNodeAttributes(batchTable);\n }\n }\n\n /**\n * Convert tile to one or more I3S nodes\n * @param sourceTile - source tile (3DTile)\n * result.geometry - ArrayBuffer with geometry attributes\n * result.compressedGeometry - ArrayBuffer with compressed (draco) geometry\n * result.texture - texture image\n * result.sharedResources - shared resource data object\n * result.meshMaterial - PBR-like material object\n * result.vertexCount - number of vertices in geometry\n * result.attributes - feature attributes\n * result.featureCount - number of features\n */\n private async _convertResources(sourceTile: TileHeader): Promise<I3SGeometry[]> {\n if (!sourceTile.content || sourceTile.content.type !== 'b3dm') {\n return null;\n }\n const resourcesData = await convertB3dmToI3sGeometry(\n sourceTile.content,\n Number(this.nodePages.nodesCounter),\n this.featuresHashArray,\n this.layers0.attributeStorageInfo,\n this.options.draco\n );\n return resourcesData;\n }\n\n /**\n * Create a new node object (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/node.cmn.md)\n * in node pages (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/nodePage.cmn.md)\n * @param maxScreenThresholdSQ - Level of Details (LOD) metric\n * @param boundingVolumes - Bounding volumes\n * @param sourceTile - source tile (3DTile)\n * @param parentId - id of parent node in node pages\n * @param resources - the node resources data\n * @param resources.meshMaterial - PBR-like material object\n * @param resources.texture - texture image\n * @param resources.vertexCount - number of vertices in geometry\n * @param resources.featureCount - number of features\n * @return the node object in node pages\n */\n private _createNodeInNodePages(\n maxScreenThresholdSQ: MaxScreenThresholdSQ,\n boundingVolumes: BoundingVolumes,\n sourceTile: TileHeader,\n parentId: number,\n resources: I3SGeometry\n ): NodeInPage {\n const {meshMaterial, texture, vertexCount, featureCount} = resources;\n const nodeInPage = {\n lodThreshold: maxScreenThresholdSQ.maxError,\n obb: boundingVolumes.obb,\n children: [],\n mesh: null\n };\n if (sourceTile.content && sourceTile.content.type === 'b3dm') {\n nodeInPage.mesh = {\n geometry: {\n definition: texture ? 0 : 1\n },\n attribute: {}\n };\n }\n const nodeId = this.nodePages.push(nodeInPage, parentId);\n\n if (meshMaterial) {\n this.nodePages.updateMaterialByNodeId(nodeId, this._findOrCreateMaterial(meshMaterial));\n }\n\n if (texture) {\n const texelCountHint = texture.image.height * texture.image.width;\n this.nodePages.updateTexelCountHintByNodeId(nodeId, texelCountHint);\n }\n\n if (vertexCount) {\n this.vertexCounter += vertexCount;\n this.nodePages.updateVertexCountByNodeId(nodeId, vertexCount);\n }\n this.nodePages.updateNodeAttributeByNodeId(nodeId);\n if (featureCount) {\n this.nodePages.updateFeatureCountByNodeId(nodeId, featureCount);\n }\n\n return nodeInPage;\n }\n\n /**\n * Create a new node page object in node pages\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 private _createNodeIndexDocument(\n parentNode: Node3DIndexDocument,\n boundingVolumes: BoundingVolumes,\n lodSelection: LodSelection[],\n nodeInPage: NodeInPage,\n resources: I3SGeometry\n ): Node3DIndexDocument {\n const {texture, attributes} = resources;\n const nodeId = nodeInPage.index;\n const nodeData = {\n version: parentNode.version,\n id: nodeId.toString(),\n path: nodeId.toString(),\n level: parentNode.level + 1,\n ...boundingVolumes,\n lodSelection,\n parentNode: {\n id: parentNode.id,\n href: `../${parentNode.id}`,\n mbs: parentNode.mbs,\n obb: parentNode.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'}];\n }\n\n if (\n attributes &&\n attributes.length &&\n this.layers0.attributeStorageInfo &&\n this.layers0.attributeStorageInfo.length\n ) {\n node.attributeData = [];\n for (let index = 0; index < attributes.length; index++) {\n const folderName = this.layers0.attributeStorageInfo[index].key;\n node.attributeData.push({href: `./attributes/${folderName}/0`});\n }\n }\n }\n\n return node;\n }\n\n /**\n * Write node resources in files\n * @param resources - source tile (3DTile)\n * @param resources.geometry - Uint8Array with geometry attributes\n * @param resources.compressedGeometry - Uint8Array with compressed (draco) geometry\n * @param resources.texture - texture image\n * @param resources.sharedResources - shared resource data object\n * @param resources.attributes - feature attributes\n * @return {Promise<void>}\n */\n private async _writeResources(resources: I3SGeometry, nodePath: string): Promise<void> {\n const {\n geometry: geometryBuffer,\n compressedGeometry,\n texture,\n sharedResources,\n attributes\n } = resources;\n const childPath = join(this.layers0Path, 'nodes', nodePath);\n const slpkChildPath = join('nodes', nodePath);\n\n await this._writeGeometries(geometryBuffer, compressedGeometry, childPath, slpkChildPath);\n await this._writeShared(sharedResources, childPath, slpkChildPath, nodePath);\n await this._writeTexture(texture, childPath, slpkChildPath);\n await this._writeAttributes(attributes, childPath, slpkChildPath);\n }\n\n /**\n * Write non-compressed and compressed geometries in files\n * @param geometryBuffer - Uint8Array with geometry attributes\n * @param compressedGeometry - Uint8Array with compressed (draco) geometry\n * @param childPath - a child path to write resources\n * @param slpkChildPath - resource path inside *slpk file\n */\n private async _writeGeometries(\n geometryBuffer: ArrayBuffer,\n compressedGeometry: ArrayBuffer,\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (this.options.slpk) {\n const slpkGeometryPath = join(childPath, 'geometries');\n this.fileMap[`${slpkChildPath}/geometries/0.bin.gz`] = await writeFileForSlpk(\n slpkGeometryPath,\n geometryBuffer,\n '0.bin'\n );\n } else {\n const geometryPath = join(childPath, 'geometries/0/');\n await writeFile(geometryPath, geometryBuffer, 'index.bin');\n }\n\n if (this.options.draco) {\n if (this.options.slpk) {\n const slpkCompressedGeometryPath = join(childPath, 'geometries');\n this.fileMap[`${slpkChildPath}/geometries/1.bin.gz`] = await writeFileForSlpk(\n slpkCompressedGeometryPath,\n compressedGeometry,\n '1.bin'\n );\n } else {\n const compressedGeometryPath = join(childPath, 'geometries/1/');\n await writeFile(compressedGeometryPath, compressedGeometry, 'index.bin');\n }\n }\n }\n\n /**\n * Write shared resources in a file\n * @param sharedResources - shared resource data object\n * @param childPath - a child path to write resources\n * @param slpkChildPath - resource path inside *slpk file\n * @param nodePath - a node path\n */\n private async _writeShared(\n sharedResources: SharedResources,\n childPath: string,\n slpkChildPath: string,\n nodePath: string\n ): Promise<void> {\n sharedResources.nodePath = nodePath;\n const sharedData = transform(sharedResources, SHARED_RESOURCES_TEMPLATE);\n const sharedDataStr = JSON.stringify(sharedData);\n if (this.options.slpk) {\n const slpkSharedPath = join(childPath, 'shared');\n this.fileMap[`${slpkChildPath}/shared/sharedResource.json.gz`] = await writeFileForSlpk(\n slpkSharedPath,\n sharedDataStr,\n 'sharedResource.json'\n );\n } else {\n const sharedPath = join(childPath, 'shared/');\n await writeFile(sharedPath, sharedDataStr);\n }\n }\n\n /**\n * Write the texture image in a file\n * @param texture - the texture image\n * @param childPath - a child path to write resources\n * @param slpkChildPath - the resource path inside *slpk file\n */\n private async _writeTexture(\n texture: TextureImage,\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (texture) {\n const format = this._getFormatByMimeType(texture.mimeType);\n if (!this.layers0.textureSetDefinitions.length) {\n this.layers0.textureSetDefinitions.push({\n formats: [\n {\n name: '0',\n format\n }\n ]\n });\n }\n\n const textureData = texture.bufferView.data;\n if (this.options.slpk) {\n const slpkTexturePath = join(childPath, 'textures');\n const compress = false;\n this.fileMap[`${slpkChildPath}/textures/0.${format}`] = await writeFileForSlpk(\n slpkTexturePath,\n textureData,\n `0.${format}`,\n compress\n );\n } else {\n const texturePath = join(childPath, 'textures/0/');\n await writeFile(texturePath, textureData, `index.${format}`);\n }\n }\n }\n\n /**\n * Write feature attributes in files\n * @param attributes - feature attributes\n * @param childPath - a child path to write resources\n * @param slpkChildPath - the resource path inside *slpk file\n */\n private async _writeAttributes(\n attributes: ArrayBuffer[],\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (\n attributes.length &&\n this.layers0.attributeStorageInfo &&\n this.layers0.attributeStorageInfo.length\n ) {\n for (let index = 0; index < attributes.length; index++) {\n const folderName = this.layers0.attributeStorageInfo[index].key;\n const fileBuffer = new Uint8Array(attributes[index]);\n\n if (this.options.slpk) {\n const slpkAttributesPath = join(childPath, 'attributes', folderName);\n this.fileMap[`${slpkChildPath}/attributes/${folderName}.bin.gz`] = await writeFileForSlpk(\n slpkAttributesPath,\n fileBuffer,\n '0.bin'\n );\n } else {\n const attributesPath = join(childPath, `attributes/${folderName}/0`);\n await writeFile(attributesPath, fileBuffer, 'index.bin');\n }\n }\n }\n }\n\n /**\n * Return file format by its MIME type\n * @param mimeType - feature attributes\n */\n private _getFormatByMimeType(mimeType: string): string {\n switch (mimeType) {\n case 'image/jpeg':\n return 'jpg';\n case 'image/png':\n return 'png';\n default:\n return 'jpg';\n }\n }\n\n /**\n * Find or create material in materialDefinitions array\n * @param material - end-to-end index of the node\n * @return material id\n */\n private _findOrCreateMaterial(material: GLTFMaterial): number {\n const hash = md5(JSON.stringify(material));\n if (this.materialMap.has(hash)) {\n return this.materialMap.get(hash);\n }\n const newMaterialId = this.materialDefinitions.push(material) - 1;\n this.materialMap.set(hash, newMaterialId);\n return newMaterialId;\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 batch table.\\\n * @param attributeType - attribute type.\n * @return Updated storageAttribute.\n */\n private _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 this._setupIdAttribute(storageAttribute);\n break;\n case STRING_TYPE:\n this._setupStringAttribute(storageAttribute);\n break;\n case DOUBLE_TYPE:\n this._setupDoubleAttribute(storageAttribute);\n break;\n case SHORT_INT_TYPE:\n break;\n default:\n this._setupStringAttribute(storageAttribute);\n }\n\n return storageAttribute;\n }\n\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 batchTable\n */\n private 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 * Setup storage attribute as string.\n * @param storageAttribute - attribute for map segmentation.\n */\n private _setupStringAttribute(storageAttribute: AttributeStorageInfo): void {\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 */\n private _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 */\n private _setupDoubleAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Float64',\n valuesPerElement: 1\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 */\n private _createFieldAttribute(key: string, fieldAttributeType: ESRIField): Field {\n return {\n name: key,\n type: fieldAttributeType,\n alias: key\n };\n }\n\n /**\n * Do conversion of 3DTiles batch table to I3s node attributes.\n * @param batchTable - Table with layer meta data.\n */\n private _convertBatchTableInfoToNodeAttributes(batchTable: BatchTableJson): void {\n let attributeIndex = 0;\n const batchTableWithObjectId = {\n OBJECTID: [0],\n ...batchTable\n };\n\n for (const key in batchTableWithObjectId) {\n const firstAttribute = batchTableWithObjectId[key][0];\n const attributeType = this.getAttributeType(key, firstAttribute);\n\n const storageAttribute = this._createdStorageAttribute(attributeIndex, key, attributeType);\n const fieldAttributeType = this._getFieldAttributeType(attributeType);\n const fieldAttribute = this._createFieldAttribute(key, fieldAttributeType);\n const popupInfo = this._createPopupInfo(batchTableWithObjectId);\n\n this.layers0.attributeStorageInfo.push(storageAttribute);\n this.layers0.fields.push(fieldAttribute);\n this.layers0.popupInfo = popupInfo;\n this.layers0.layerType = _3D_OBJECT_LAYER_TYPE;\n\n attributeIndex += 1;\n }\n }\n\n /**\n * Find and return attribute type based on key form Batch table.\n * @param attributeType\n */\n private _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 * Generate popup info to show metadata on the map.\n * @param batchTable - Batch table data with OBJECTID.\n * @return data for correct rendering of popup.\n */\n private _createPopupInfo(batchTable: BatchTableJson): PopupInfo {\n const title = '{OBJECTID}';\n const mediaInfos = [];\n const fieldInfos = [];\n const popupElements = [];\n const expressionInfos = [];\n\n for (const key in batchTable) {\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 * Print statistics in the end of conversion\n * @param params - output files data\n */\n private async _finishConversion(params: {\n slpk: boolean;\n outputPath: string;\n tilesetName: string;\n }): Promise<void> {\n const {tilesCount, tilesWithAddRefineCount} = this.refinementCounter;\n const addRefinementPercentage = tilesWithAddRefineCount\n ? (tilesWithAddRefineCount / tilesCount) * 100\n : 0;\n const filesSize = await calculateFilesSize(params);\n const diff = process.hrtime(this.conversionStartTime);\n const conversionTime = timeConverter(diff);\n console.log(`------------------------------------------------`); // eslint-disable-line no-undef, no-console\n console.log(`Finishing conversion of ${_3D_TILES}`); // eslint-disable-line no-undef, no-console\n console.log(`Total conversion time: ${conversionTime}`); // eslint-disable-line no-undef, no-console\n console.log(`Vertex count: `, this.vertexCounter); // eslint-disable-line no-undef, no-console\n console.log(`File(s) size: `, filesSize, ' bytes'); // eslint-disable-line no-undef, no-console\n console.log(`Percentage of tiles with \"ADD\" refinement type:`, addRefinementPercentage, '%'); // eslint-disable-line no-undef, no-console\n console.log(`------------------------------------------------`); // eslint-disable-line no-undef, no-console\n }\n\n /**\n * Fetch preload options for ION tileset\n */\n private async _fetchPreloadOptions(): Promise<any> {\n if (!this.Loader.preload) {\n return {};\n }\n const options = {\n 'cesium-ion': {accessToken: this.options.token || ION_DEFAULT_TOKEN}\n };\n const preloadOptions = await this.Loader.preload(this.options.inputUrl, options);\n this.refreshTokenTime = process.hrtime();\n return {...options, ...preloadOptions};\n }\n\n /**\n * Update options of source tileset\n */\n private async _updateTilesetOptions(): Promise<void> {\n const diff = process.hrtime(this.refreshTokenTime);\n if (diff[0] < REFRESH_TOKEN_TIMEOUT) {\n return;\n }\n this.refreshTokenTime = process.hrtime();\n\n const preloadOptions = await this._fetchPreloadOptions();\n this.sourceTileset.options = {...this.sourceTileset.options, ...preloadOptions};\n if (preloadOptions.headers) {\n this.sourceTileset.loadOptions.fetch = {\n ...this.sourceTileset.loadOptions.fetch,\n headers: preloadOptions.headers\n };\n console.log('Authorization Bearer token has been updated'); // eslint-disable-line no-undef, no-console\n }\n }\n\n /** Do calculations of all tiles and tiles with \"ADD\" type of refinement.\n * @param tile\n */\n private _checkAddRefinementTypeForTile(tile: TileHeader): void {\n const ADD_TILE_REFINEMENT = 1;\n\n if (tile.refine === ADD_TILE_REFINEMENT) {\n this.refinementCounter.tilesWithAddRefineCount += 1;\n console.warn('This tile uses \"ADD\" type of refinement'); // eslint-disable-line\n }\n\n this.refinementCounter.tilesCount += 1;\n }\n}\n"],"file":"i3s-converter.js"}
@@ -7,7 +7,7 @@ exports.PGMLoader = void 0;
7
7
 
8
8
  var _pgmParser = require("./lib/pgm-parser");
9
9
 
10
- var VERSION = typeof "3.0.10" !== 'undefined' ? "3.0.10" : 'latest';
10
+ var VERSION = typeof "3.0.14" !== 'undefined' ? "3.0.14" : 'latest';
11
11
  var PGMLoader = {
12
12
  name: 'PGM - Netpbm grayscale image format',
13
13
  id: 'pgm',
@@ -61,7 +61,7 @@ export default class Tiles3DConverter {
61
61
  this.sourceTileset.root.header.obb = createObbFromMbs(this.sourceTileset.root.header.mbs);
62
62
  }
63
63
 
64
- this.tilesetPath = join(`${outputPath}`, `${tilesetName}`);
64
+ this.tilesetPath = join("".concat(outputPath), "".concat(tilesetName));
65
65
  this.attributeStorageInfo = sourceTilesetJson.attributeStorageInfo;
66
66
 
67
67
  try {
@@ -120,10 +120,10 @@ export default class Tiles3DConverter {
120
120
  };
121
121
  const b3dm = await new B3dmConverter().convert(sourceChild, attributes);
122
122
  child.content = {
123
- uri: `${sourceChild.id}.b3dm`,
123
+ uri: "".concat(sourceChild.id, ".b3dm"),
124
124
  boundingVolume
125
125
  };
126
- await writeFile(this.tilesetPath, new Uint8Array(b3dm), `${sourceChild.id}.b3dm`);
126
+ await writeFile(this.tilesetPath, new Uint8Array(b3dm), "".concat(sourceChild.id, ".b3dm"));
127
127
  parentNode.children.push(child);
128
128
  sourceChild.unloadContent();
129
129
  await this._addChildren(sourceChild, child, level + 1);
@@ -137,7 +137,7 @@ export default class Tiles3DConverter {
137
137
  let header;
138
138
 
139
139
  if (this.sourceTileset.tileset.nodePages) {
140
- console.log(`Node conversion: ${childNodeInfo.id}`);
140
+ console.log("Node conversion: ".concat(childNodeInfo.id));
141
141
  header = await this.sourceTileset.tileset.nodePagesTile.formTileFromNodePages(childNodeInfo.id);
142
142
  } else {
143
143
  const {
@@ -152,7 +152,7 @@ export default class Tiles3DConverter {
152
152
  loadContent: false
153
153
  }
154
154
  };
155
- console.log(`Node conversion: ${nodeUrl}`);
155
+ console.log("Node conversion: ".concat(nodeUrl));
156
156
  header = await load(nodeUrl, loader, options);
157
157
  }
158
158
 
@@ -227,12 +227,12 @@ export default class Tiles3DConverter {
227
227
  const filesSize = await calculateFilesSize(params);
228
228
  const diff = process.hrtime(this.conversionStartTime);
229
229
  const conversionTime = timeConverter(diff);
230
- console.log(`------------------------------------------------`);
231
- console.log(`Finish conversion of ${I3S}`);
232
- console.log(`Total conversion time: ${conversionTime}`);
233
- console.log(`Vertex count: `, this.vertexCounter);
234
- console.log(`File(s) size: `, filesSize, ' bytes');
235
- console.log(`------------------------------------------------`);
230
+ console.log("------------------------------------------------");
231
+ console.log("Finish conversion of ".concat(I3S));
232
+ console.log("Total conversion time: ".concat(conversionTime));
233
+ console.log("Vertex count: ", this.vertexCounter);
234
+ console.log("File(s) size: ", filesSize, ' bytes');
235
+ console.log("------------------------------------------------");
236
236
  }
237
237
 
238
238
  }