@loaders.gl/tile-converter 4.2.0-alpha.3 → 4.2.0-alpha.5

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 (144) hide show
  1. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +3 -3
  2. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
  3. package/dist/3d-tiles-converter/3d-tiles-converter.js +329 -293
  4. package/dist/3d-tiles-converter/helpers/b3dm-converter.js +257 -200
  5. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +14 -5
  6. package/dist/3d-tiles-converter/helpers/load-i3s.js +106 -75
  7. package/dist/3d-tiles-converter/helpers/texture-atlas.js +44 -21
  8. package/dist/3d-tiles-converter/json-templates/tileset.js +32 -33
  9. package/dist/constants.js +0 -1
  10. package/dist/converter-cli.js +255 -234
  11. package/dist/converter.min.cjs +80 -90
  12. package/dist/deps-installer/deps-installer.js +73 -59
  13. package/dist/i3s-converter/helpers/attribute-metadata-info.js +207 -153
  14. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +1 -1
  15. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
  16. package/dist/i3s-converter/helpers/batch-ids-extensions.js +145 -103
  17. package/dist/i3s-converter/helpers/coordinate-converter.js +100 -65
  18. package/dist/i3s-converter/helpers/create-scene-server-path.js +14 -9
  19. package/dist/i3s-converter/helpers/feature-attributes.js +168 -105
  20. package/dist/i3s-converter/helpers/geometry-attributes.d.ts +1 -1
  21. package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
  22. package/dist/i3s-converter/helpers/geometry-attributes.js +204 -212
  23. package/dist/i3s-converter/helpers/geometry-converter.d.ts +2 -2
  24. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  25. package/dist/i3s-converter/helpers/geometry-converter.js +1148 -829
  26. package/dist/i3s-converter/helpers/gltf-attributes.d.ts +1 -1
  27. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
  28. package/dist/i3s-converter/helpers/gltf-attributes.js +111 -97
  29. package/dist/i3s-converter/helpers/load-3d-tiles.js +103 -66
  30. package/dist/i3s-converter/helpers/node-debug.js +98 -54
  31. package/dist/i3s-converter/helpers/node-index-document.d.ts +3 -3
  32. package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
  33. package/dist/i3s-converter/helpers/node-index-document.js +248 -177
  34. package/dist/i3s-converter/helpers/node-pages.d.ts +1 -1
  35. package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
  36. package/dist/i3s-converter/helpers/node-pages.js +299 -194
  37. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +1 -1
  38. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
  39. package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +92 -60
  40. package/dist/i3s-converter/helpers/progress.js +134 -83
  41. package/dist/i3s-converter/helpers/tileset-traversal.d.ts +1 -1
  42. package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -1
  43. package/dist/i3s-converter/helpers/tileset-traversal.js +24 -13
  44. package/dist/i3s-converter/i3s-converter.d.ts +7 -7
  45. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  46. package/dist/i3s-converter/i3s-converter.js +1044 -898
  47. package/dist/i3s-converter/json-templates/geometry-definitions.js +70 -79
  48. package/dist/i3s-converter/json-templates/layers.js +120 -121
  49. package/dist/i3s-converter/json-templates/metadata.js +19 -20
  50. package/dist/i3s-converter/json-templates/node.js +73 -71
  51. package/dist/i3s-converter/json-templates/scene-server.js +25 -26
  52. package/dist/i3s-converter/json-templates/shared-resources.js +107 -108
  53. package/dist/i3s-converter/json-templates/store.js +96 -94
  54. package/dist/i3s-converter/types.js +35 -23
  55. package/dist/i3s-server/app.js +15 -12
  56. package/dist/i3s-server/bin/www.js +14 -7
  57. package/dist/i3s-server/controllers/index-controller.js +18 -15
  58. package/dist/i3s-server/controllers/slpk-controller.js +22 -11
  59. package/dist/i3s-server/routes/index.js +9 -8
  60. package/dist/i3s-server/routes/slpk-router.js +18 -17
  61. package/dist/i3s-server/utils/create-scene-server.js +15 -10
  62. package/dist/i3s-server/utils/server-utils.js +49 -32
  63. package/dist/index.cjs +292 -851
  64. package/dist/index.cjs.map +7 -0
  65. package/dist/index.d.ts +2 -2
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +0 -1
  68. package/dist/lib/json-schemas/conversion-dump-json-schema.js +243 -421
  69. package/dist/lib/utils/cli-utils.js +63 -36
  70. package/dist/lib/utils/compress-util.js +20 -15
  71. package/dist/lib/utils/conversion-dump.d.ts +1 -1
  72. package/dist/lib/utils/conversion-dump.d.ts.map +1 -1
  73. package/dist/lib/utils/conversion-dump.js +209 -187
  74. package/dist/lib/utils/file-utils.js +122 -74
  75. package/dist/lib/utils/geometry-utils.js +13 -7
  76. package/dist/lib/utils/lod-conversion-utils.js +65 -33
  77. package/dist/lib/utils/queue.js +12 -13
  78. package/dist/lib/utils/statistic-utills.d.ts +6 -23
  79. package/dist/lib/utils/statistic-utills.js +64 -59
  80. package/dist/lib/utils/write-queue.d.ts +2 -2
  81. package/dist/lib/utils/write-queue.d.ts.map +1 -1
  82. package/dist/lib/utils/write-queue.js +68 -86
  83. package/dist/pgm-loader.js +17 -13
  84. package/dist/slpk-extractor/slpk-extractor.js +59 -50
  85. package/dist/slpk-extractor-cli.js +82 -59
  86. package/package.json +18 -18
  87. package/dist/3d-tiles-converter/3d-tiles-converter.js.map +0 -1
  88. package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +0 -1
  89. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +0 -1
  90. package/dist/3d-tiles-converter/helpers/load-i3s.js.map +0 -1
  91. package/dist/3d-tiles-converter/helpers/texture-atlas.js.map +0 -1
  92. package/dist/3d-tiles-converter/json-templates/tileset.js.map +0 -1
  93. package/dist/constants.js.map +0 -1
  94. package/dist/converter-cli.js.map +0 -1
  95. package/dist/deps-installer/deps-installer.js.map +0 -1
  96. package/dist/i3s-converter/helpers/attribute-metadata-info.js.map +0 -1
  97. package/dist/i3s-converter/helpers/batch-ids-extensions.js.map +0 -1
  98. package/dist/i3s-converter/helpers/coordinate-converter.js.map +0 -1
  99. package/dist/i3s-converter/helpers/create-scene-server-path.js.map +0 -1
  100. package/dist/i3s-converter/helpers/feature-attributes.js.map +0 -1
  101. package/dist/i3s-converter/helpers/geometry-attributes.js.map +0 -1
  102. package/dist/i3s-converter/helpers/geometry-converter.js.map +0 -1
  103. package/dist/i3s-converter/helpers/gltf-attributes.js.map +0 -1
  104. package/dist/i3s-converter/helpers/load-3d-tiles.js.map +0 -1
  105. package/dist/i3s-converter/helpers/node-debug.js.map +0 -1
  106. package/dist/i3s-converter/helpers/node-index-document.js.map +0 -1
  107. package/dist/i3s-converter/helpers/node-pages.js.map +0 -1
  108. package/dist/i3s-converter/helpers/preprocess-3d-tiles.js.map +0 -1
  109. package/dist/i3s-converter/helpers/progress.js.map +0 -1
  110. package/dist/i3s-converter/helpers/tileset-traversal.js.map +0 -1
  111. package/dist/i3s-converter/i3s-converter.js.map +0 -1
  112. package/dist/i3s-converter/json-templates/geometry-definitions.js.map +0 -1
  113. package/dist/i3s-converter/json-templates/layers.js.map +0 -1
  114. package/dist/i3s-converter/json-templates/metadata.js.map +0 -1
  115. package/dist/i3s-converter/json-templates/node.js.map +0 -1
  116. package/dist/i3s-converter/json-templates/scene-server.js.map +0 -1
  117. package/dist/i3s-converter/json-templates/shared-resources.js.map +0 -1
  118. package/dist/i3s-converter/json-templates/store.js.map +0 -1
  119. package/dist/i3s-converter/types.js.map +0 -1
  120. package/dist/i3s-server/README.md +0 -63
  121. package/dist/i3s-server/app.js.map +0 -1
  122. package/dist/i3s-server/bin/www.js.map +0 -1
  123. package/dist/i3s-server/certs/cert.pem +0 -19
  124. package/dist/i3s-server/certs/key.pem +0 -27
  125. package/dist/i3s-server/controllers/index-controller.js.map +0 -1
  126. package/dist/i3s-server/controllers/slpk-controller.js.map +0 -1
  127. package/dist/i3s-server/routes/index.js.map +0 -1
  128. package/dist/i3s-server/routes/slpk-router.js.map +0 -1
  129. package/dist/i3s-server/utils/create-scene-server.js.map +0 -1
  130. package/dist/i3s-server/utils/server-utils.js.map +0 -1
  131. package/dist/index.js.map +0 -1
  132. package/dist/lib/json-schemas/conversion-dump-json-schema.js.map +0 -1
  133. package/dist/lib/utils/cli-utils.js.map +0 -1
  134. package/dist/lib/utils/compress-util.js.map +0 -1
  135. package/dist/lib/utils/conversion-dump.js.map +0 -1
  136. package/dist/lib/utils/file-utils.js.map +0 -1
  137. package/dist/lib/utils/geometry-utils.js.map +0 -1
  138. package/dist/lib/utils/lod-conversion-utils.js.map +0 -1
  139. package/dist/lib/utils/queue.js.map +0 -1
  140. package/dist/lib/utils/statistic-utills.js.map +0 -1
  141. package/dist/lib/utils/write-queue.js.map +0 -1
  142. package/dist/pgm-loader.js.map +0 -1
  143. package/dist/slpk-extractor/slpk-extractor.js.map +0 -1
  144. package/dist/slpk-extractor-cli.js.map +0 -1
@@ -1,96 +1,78 @@
1
1
  import { Queue } from "./queue.js";
2
2
  import process from 'process';
3
- const MEMORY_LIMIT = 4 * 1024 * 1024 * 1024;
3
+ /** Memory limit size is based on testing */
4
+ const MEMORY_LIMIT = 4 * 1024 * 1024 * 1024; // 4GB
4
5
  export default class WriteQueue extends Queue {
5
- constructor(conversionDump) {
6
- let listeningInterval = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2000;
7
- let writeConcurrency = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 400;
8
- super();
9
- this.intervalId = void 0;
10
- this.conversionDump = void 0;
11
- this.writePromise = null;
12
- this.fileMap = {};
13
- this.listeningInterval = void 0;
14
- this.writeConcurrency = void 0;
15
- this.conversionDump = conversionDump;
16
- this.listeningInterval = listeningInterval;
17
- this.writeConcurrency = writeConcurrency;
18
- }
19
- async enqueue(val) {
20
- let writeImmediately = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
21
- if (writeImmediately) {
22
- const {
23
- archiveKey,
24
- writePromise
25
- } = val;
26
- const result = await writePromise();
27
- if (archiveKey && result) {
28
- this.fileMap[archiveKey] = result;
29
- }
30
- } else {
31
- super.enqueue(val);
32
- if (process.memoryUsage().rss > MEMORY_LIMIT) {
33
- await this.startWrite();
34
- }
6
+ constructor(conversionDump, listeningInterval = 2000, writeConcurrency = 400) {
7
+ super();
8
+ this.writePromise = null;
9
+ this.fileMap = {};
10
+ this.conversionDump = conversionDump;
11
+ this.listeningInterval = listeningInterval;
12
+ this.writeConcurrency = writeConcurrency;
13
+ }
14
+ async enqueue(val, writeImmediately = false) {
15
+ if (writeImmediately) {
16
+ const { archiveKey, writePromise } = val;
17
+ const result = await writePromise();
18
+ if (archiveKey && result) {
19
+ this.fileMap[archiveKey] = result;
20
+ }
21
+ }
22
+ else {
23
+ super.enqueue(val);
24
+ /** https://nodejs.org/docs/latest-v14.x/api/process.html#process_process_memoryusage */
25
+ if (process.memoryUsage().rss > MEMORY_LIMIT) {
26
+ await this.startWrite();
27
+ }
28
+ }
29
+ }
30
+ startListening() {
31
+ this.intervalId = setInterval(this.startWrite.bind(this), this.listeningInterval);
35
32
  }
36
- }
37
- startListening() {
38
- this.intervalId = setInterval(this.startWrite.bind(this), this.listeningInterval);
39
- }
40
- stopListening() {
41
- if (this.intervalId) {
42
- clearInterval(this.intervalId);
33
+ stopListening() {
34
+ if (this.intervalId) {
35
+ clearInterval(this.intervalId);
36
+ }
43
37
  }
44
- }
45
- async startWrite() {
46
- if (!this.writePromise) {
47
- this.writePromise = this.doWrite();
38
+ async startWrite() {
39
+ if (!this.writePromise) {
40
+ this.writePromise = this.doWrite();
41
+ }
42
+ await this.writePromise;
43
+ this.writePromise = null;
48
44
  }
49
- await this.writePromise;
50
- this.writePromise = null;
51
- }
52
- async finalize() {
53
- this.stopListening();
54
- await this.startWrite();
55
- }
56
- async doWrite() {
57
- while (this.length) {
58
- const promises = [];
59
- const archiveKeys = [];
60
- const changedRecords = [];
61
- for (let i = 0; i < this.writeConcurrency; i++) {
62
- const item = this.dequeue();
63
- if (!item) {
64
- break;
45
+ async finalize() {
46
+ this.stopListening();
47
+ await this.startWrite();
48
+ }
49
+ async doWrite() {
50
+ while (this.length) {
51
+ const promises = [];
52
+ const archiveKeys = [];
53
+ const changedRecords = [];
54
+ for (let i = 0; i < this.writeConcurrency; i++) {
55
+ const item = this.dequeue();
56
+ if (!item) {
57
+ break;
58
+ }
59
+ const { archiveKey, sourceId, outputId, resourceType, writePromise } = item;
60
+ archiveKeys.push(archiveKey);
61
+ changedRecords.push({ sourceId, outputId, resourceType });
62
+ const promise = writePromise();
63
+ promises.push(promise);
64
+ }
65
+ const writeResults = await Promise.allSettled(promises);
66
+ this.updateFileMap(archiveKeys, writeResults);
67
+ await this.conversionDump.updateConvertedTilesDump(changedRecords, writeResults);
65
68
  }
66
- const {
67
- archiveKey,
68
- sourceId,
69
- outputId,
70
- resourceType,
71
- writePromise
72
- } = item;
73
- archiveKeys.push(archiveKey);
74
- changedRecords.push({
75
- sourceId,
76
- outputId,
77
- resourceType
78
- });
79
- const promise = writePromise();
80
- promises.push(promise);
81
- }
82
- const writeResults = await Promise.allSettled(promises);
83
- this.updateFileMap(archiveKeys, writeResults);
84
- await this.conversionDump.updateConvertedTilesDump(changedRecords, writeResults);
85
69
  }
86
- }
87
- updateFileMap(archiveKeys, writeResults) {
88
- for (let i = 0; i < archiveKeys.length; i++) {
89
- const archiveKey = archiveKeys[i];
90
- if (archiveKey && 'value' in writeResults[i]) {
91
- this.fileMap[archiveKey] = writeResults[i].value;
92
- }
70
+ updateFileMap(archiveKeys, writeResults) {
71
+ for (let i = 0; i < archiveKeys.length; i++) {
72
+ const archiveKey = archiveKeys[i];
73
+ if (archiveKey && 'value' in writeResults[i]) {
74
+ this.fileMap[archiveKey] = writeResults[i].value;
75
+ }
76
+ }
93
77
  }
94
- }
95
78
  }
96
- //# sourceMappingURL=write-queue.js.map
@@ -1,18 +1,22 @@
1
1
  import { Geoid, parsePGM } from '@math.gl/geoid';
2
- const VERSION = typeof "4.2.0-alpha.3" !== 'undefined' ? "4.2.0-alpha.3" : 'latest';
2
+ // __VERSION__ is injected by babel-plugin-version-inline
3
+ // @ts-ignore TS2304: Cannot find name '__VERSION__'.
4
+ const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
3
5
  export { Geoid };
6
+ /**
7
+ * Loader for PGM - Netpbm grayscale image format
8
+ */
4
9
  export const PGMLoader = {
5
- name: 'PGM - Netpbm grayscale image format',
6
- id: 'pgm',
7
- module: 'tile-converter',
8
- version: VERSION,
9
- mimeTypes: ['image/x-portable-graymap'],
10
- parse: async (arrayBuffer, options) => parsePGM(new Uint8Array(arrayBuffer), (options === null || options === void 0 ? void 0 : options.pgm) || {}),
11
- extensions: ['pgm'],
12
- options: {
13
- pgm: {
14
- cubic: false
10
+ name: 'PGM - Netpbm grayscale image format',
11
+ id: 'pgm',
12
+ module: 'tile-converter',
13
+ version: VERSION,
14
+ mimeTypes: ['image/x-portable-graymap'],
15
+ parse: async (arrayBuffer, options) => parsePGM(new Uint8Array(arrayBuffer), options?.pgm || {}),
16
+ extensions: ['pgm'],
17
+ options: {
18
+ pgm: {
19
+ cubic: false
20
+ }
15
21
  }
16
- }
17
22
  };
18
- //# sourceMappingURL=pgm-loader.js.map
@@ -5,59 +5,68 @@ import { FileHandleFile } from '@loaders.gl/loader-utils';
5
5
  import { parseZipLocalFileHeader } from '@loaders.gl/zip';
6
6
  import { GZipCompression } from '@loaders.gl/compression';
7
7
  import { writeFile } from "../lib/utils/file-utils.js";
8
- const indexNames = ['3dSceneLayer.json.gz', '3dNodeIndexDocument.json.gz', 'sharedResource.json.gz'];
8
+ const indexNames = [
9
+ '3dSceneLayer.json.gz',
10
+ '3dNodeIndexDocument.json.gz',
11
+ 'sharedResource.json.gz'
12
+ ];
13
+ /**
14
+ * Converter from slpk to i3s
15
+ */
9
16
  export default class SLPKExtractor {
10
- async extract(options) {
11
- if (isBrowser) {
12
- console.log(BROWSER_ERROR_MESSAGE);
13
- return BROWSER_ERROR_MESSAGE;
17
+ /**
18
+ * Extract slpk to i3s
19
+ * @param options
20
+ * @param options.inputUrl the url to read SLPK file
21
+ * @param options.outputPath the output filename
22
+ */
23
+ async extract(options) {
24
+ if (isBrowser) {
25
+ console.log(BROWSER_ERROR_MESSAGE);
26
+ return BROWSER_ERROR_MESSAGE;
27
+ }
28
+ const { inputUrl } = options;
29
+ const provider = new FileHandleFile(inputUrl);
30
+ let localHeader = await parseZipLocalFileHeader(0n, provider);
31
+ while (localHeader) {
32
+ await this.writeFile(await this.unGzip({
33
+ name: this.correctIndexNames(localHeader.fileName),
34
+ data: await provider.slice(localHeader.fileDataOffset, localHeader.fileDataOffset + localHeader.compressedSize)
35
+ }), options.outputPath);
36
+ localHeader = await parseZipLocalFileHeader(localHeader.fileDataOffset + localHeader?.compressedSize, provider);
37
+ }
38
+ return 'success';
14
39
  }
15
- const {
16
- inputUrl
17
- } = options;
18
- const provider = new FileHandleFile(inputUrl);
19
- let localHeader = await parseZipLocalFileHeader(0n, provider);
20
- while (localHeader) {
21
- var _localHeader;
22
- await this.writeFile(await this.unGzip({
23
- name: this.correctIndexNames(localHeader.fileName),
24
- data: await provider.slice(localHeader.fileDataOffset, localHeader.fileDataOffset + localHeader.compressedSize)
25
- }), options.outputPath);
26
- localHeader = await parseZipLocalFileHeader(localHeader.fileDataOffset + ((_localHeader = localHeader) === null || _localHeader === void 0 ? void 0 : _localHeader.compressedSize), provider);
40
+ /**
41
+ * Defines file name and path for i3s format
42
+ * @param fileName initial file name and path
43
+ */
44
+ correctIndexNames(fileName) {
45
+ if (indexNames.includes(path.filename(path.join('/', fileName)))) {
46
+ return path.join(path.dirname(fileName), 'index.json.gz');
47
+ }
48
+ // finds path with name part and extention part
49
+ let parts = /^(.*\/[^\/\.]*)(\..+)$/.exec(fileName);
50
+ if (!parts) {
51
+ return null;
52
+ }
53
+ return `${parts?.at(1)}/index${parts?.at(2)}`;
27
54
  }
28
- return 'success';
29
- }
30
- correctIndexNames(fileName) {
31
- if (indexNames.includes(path.filename(path.join('/', fileName)))) {
32
- return path.join(path.dirname(fileName), 'index.json.gz');
55
+ async unGzip(file) {
56
+ if (/\.gz$/.test(file.name ?? '')) {
57
+ const compression = new GZipCompression();
58
+ const decompressedData = await compression.decompress(file.data);
59
+ return { data: decompressedData, name: (file.name ?? '').slice(0, -3) };
60
+ }
61
+ return Promise.resolve(file);
33
62
  }
34
- let parts = /^(.*\/[^\/\.]*)(\..+)$/.exec(fileName);
35
- if (!parts) {
36
- return null;
63
+ async writeFile(options, outputPath) {
64
+ if (!options.name) {
65
+ return;
66
+ }
67
+ const finalPath = path.join(outputPath, options.name);
68
+ const dirName = path.dirname(finalPath);
69
+ const fileName = path.filename(finalPath);
70
+ await writeFile(dirName, options.data, fileName);
37
71
  }
38
- return `${parts === null || parts === void 0 ? void 0 : parts.at(1)}/index${parts === null || parts === void 0 ? void 0 : parts.at(2)}`;
39
- }
40
- async unGzip(file) {
41
- var _file$name;
42
- if (/\.gz$/.test((_file$name = file.name) !== null && _file$name !== void 0 ? _file$name : '')) {
43
- var _file$name2;
44
- const compression = new GZipCompression();
45
- const decompressedData = await compression.decompress(file.data);
46
- return {
47
- data: decompressedData,
48
- name: ((_file$name2 = file.name) !== null && _file$name2 !== void 0 ? _file$name2 : '').slice(0, -3)
49
- };
50
- }
51
- return Promise.resolve(file);
52
- }
53
- async writeFile(options, outputPath) {
54
- if (!options.name) {
55
- return;
56
- }
57
- const finalPath = path.join(outputPath, options.name);
58
- const dirName = path.dirname(finalPath);
59
- const fileName = path.filename(finalPath);
60
- await writeFile(dirName, options.data, fileName);
61
- }
62
72
  }
63
- //# sourceMappingURL=slpk-extractor.js.map
@@ -1,74 +1,97 @@
1
+ /* eslint-disable no-console */
1
2
  import '@loaders.gl/polyfills';
2
3
  import SLPKExtractor from "./slpk-extractor/slpk-extractor.js";
3
4
  import { getURLValue, validateOptionsWithEqual } from "./lib/utils/cli-utils.js";
5
+ /**
6
+ * CLI entry
7
+ * @returns
8
+ */
4
9
  async function main() {
5
- const [,, ...args] = process.argv;
6
- if (args.length === 0) {
7
- printHelp();
8
- }
9
- const validatedOptionsArr = validateOptionsWithEqual(args);
10
- const options = parseOptions(validatedOptionsArr);
11
- const validatedOptions = validateOptions(options);
12
- await convert(validatedOptions);
10
+ const [, , ...args] = process.argv;
11
+ if (args.length === 0) {
12
+ printHelp();
13
+ }
14
+ const validatedOptionsArr = validateOptionsWithEqual(args);
15
+ const options = parseOptions(validatedOptionsArr);
16
+ const validatedOptions = validateOptions(options);
17
+ await convert(validatedOptions);
13
18
  }
14
- main().catch(error => {
15
- console.log(error);
16
- process.exit(1);
19
+ main().catch((error) => {
20
+ console.log(error);
21
+ process.exit(1); // eslint-disable-line
17
22
  });
23
+ /**
24
+ * Output for `npx slpk-extractor --help`
25
+ */
18
26
  function printHelp() {
19
- console.log('cli: converter slpk to I3S...');
20
- console.log('--output [Output folder, default: "data" folder]');
21
- console.log('--tileset [SLPK file]');
22
- process.exit(0);
27
+ console.log('cli: converter slpk to I3S...');
28
+ console.log('--output [Output folder, default: "data" folder]');
29
+ console.log('--tileset [SLPK file]');
30
+ process.exit(0); // eslint-disable-line
23
31
  }
32
+ /**
33
+ * Run extraction process
34
+ * @param options validated slpk-extractor options
35
+ */
24
36
  async function convert(options) {
25
- console.log(`------------------------------------------------`);
26
- console.log(`Starting conversion of SLPK`);
27
- console.log(`------------------------------------------------`);
28
- const slpkExtractor = new SLPKExtractor();
29
- slpkExtractor.extract({
30
- inputUrl: options.tileset,
31
- outputPath: options.output
32
- });
37
+ console.log(`------------------------------------------------`); // eslint-disable-line
38
+ console.log(`Starting conversion of SLPK`); // eslint-disable-line
39
+ console.log(`------------------------------------------------`); // eslint-disable-line
40
+ const slpkExtractor = new SLPKExtractor();
41
+ slpkExtractor.extract({
42
+ inputUrl: options.tileset,
43
+ outputPath: options.output
44
+ });
33
45
  }
46
+ // OPTIONS
47
+ /**
48
+ * Validate input options of the CLI command
49
+ * @param options - input options of the CLI command
50
+ * @returns validated options
51
+ */
34
52
  function validateOptions(options) {
35
- const mandatoryOptionsWithExceptions = {
36
- output: () => console.log('Missed: --output [Output path name]'),
37
- tileset: () => console.log('Missed: --tileset [SLPK file]')
38
- };
39
- const exceptions = [];
40
- for (const mandatoryOption in mandatoryOptionsWithExceptions) {
41
- const optionValue = options[mandatoryOption];
42
- if (!optionValue) {
43
- exceptions.push(mandatoryOptionsWithExceptions[mandatoryOption]);
53
+ const mandatoryOptionsWithExceptions = {
54
+ output: () => console.log('Missed: --output [Output path name]'),
55
+ tileset: () => console.log('Missed: --tileset [SLPK file]')
56
+ };
57
+ const exceptions = [];
58
+ for (const mandatoryOption in mandatoryOptionsWithExceptions) {
59
+ const optionValue = options[mandatoryOption];
60
+ if (!optionValue) {
61
+ exceptions.push(mandatoryOptionsWithExceptions[mandatoryOption]);
62
+ }
63
+ }
64
+ if (exceptions.length) {
65
+ exceptions.forEach((exeption) => exeption());
66
+ process.exit(1);
44
67
  }
45
- }
46
- if (exceptions.length) {
47
- exceptions.forEach(exeption => exeption());
48
- process.exit(1);
49
- }
50
- return options;
68
+ return options;
51
69
  }
70
+ /**
71
+ * Parse option from the cli arguments array
72
+ * @param args
73
+ * @returns
74
+ */
52
75
  function parseOptions(args) {
53
- const opts = {};
54
- args.forEach((arg, index) => {
55
- if (arg.indexOf('--') === 0) {
56
- switch (arg) {
57
- case '--tileset':
58
- opts.tileset = getURLValue(index, args);
59
- break;
60
- case '--output':
61
- opts.output = getURLValue(index, args);
62
- break;
63
- case '--help':
64
- printHelp();
65
- break;
66
- default:
67
- console.warn(`Unknown option ${arg}`);
68
- process.exit(0);
69
- }
70
- }
71
- });
72
- return opts;
76
+ const opts = {};
77
+ // eslint-disable-next-line complexity
78
+ args.forEach((arg, index) => {
79
+ if (arg.indexOf('--') === 0) {
80
+ switch (arg) {
81
+ case '--tileset':
82
+ opts.tileset = getURLValue(index, args);
83
+ break;
84
+ case '--output':
85
+ opts.output = getURLValue(index, args);
86
+ break;
87
+ case '--help':
88
+ printHelp();
89
+ break;
90
+ default:
91
+ console.warn(`Unknown option ${arg}`);
92
+ process.exit(0); // eslint-disable-line
93
+ }
94
+ }
95
+ });
96
+ return opts;
73
97
  }
74
- //# sourceMappingURL=slpk-extractor-cli.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/tile-converter",
3
- "version": "4.2.0-alpha.3",
3
+ "version": "4.2.0-alpha.5",
4
4
  "description": "Converter",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -52,18 +52,18 @@
52
52
  "build-i3s-server-bundle": "esbuild src/i3s-server/bin/www.ts --outfile=dist/i3s-server/bin/i3s-server.min.cjs --platform=node --target=esnext,node14 --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\""
53
53
  },
54
54
  "dependencies": {
55
- "@loaders.gl/3d-tiles": "4.2.0-alpha.3",
56
- "@loaders.gl/crypto": "4.2.0-alpha.3",
57
- "@loaders.gl/draco": "4.2.0-alpha.3",
58
- "@loaders.gl/gltf": "4.2.0-alpha.3",
59
- "@loaders.gl/i3s": "4.2.0-alpha.3",
60
- "@loaders.gl/images": "4.2.0-alpha.3",
61
- "@loaders.gl/loader-utils": "4.2.0-alpha.3",
62
- "@loaders.gl/polyfills": "4.2.0-alpha.3",
63
- "@loaders.gl/textures": "4.2.0-alpha.3",
64
- "@loaders.gl/tiles": "4.2.0-alpha.3",
65
- "@loaders.gl/worker-utils": "4.2.0-alpha.3",
66
- "@loaders.gl/zip": "4.2.0-alpha.3",
55
+ "@loaders.gl/3d-tiles": "4.2.0-alpha.5",
56
+ "@loaders.gl/crypto": "4.2.0-alpha.5",
57
+ "@loaders.gl/draco": "4.2.0-alpha.5",
58
+ "@loaders.gl/gltf": "4.2.0-alpha.5",
59
+ "@loaders.gl/i3s": "4.2.0-alpha.5",
60
+ "@loaders.gl/images": "4.2.0-alpha.5",
61
+ "@loaders.gl/loader-utils": "4.2.0-alpha.5",
62
+ "@loaders.gl/polyfills": "4.2.0-alpha.5",
63
+ "@loaders.gl/textures": "4.2.0-alpha.5",
64
+ "@loaders.gl/tiles": "4.2.0-alpha.5",
65
+ "@loaders.gl/worker-utils": "4.2.0-alpha.5",
66
+ "@loaders.gl/zip": "4.2.0-alpha.5",
67
67
  "@math.gl/core": "^4.0.0",
68
68
  "@math.gl/culling": "^4.0.0",
69
69
  "@math.gl/geoid": "^4.0.0",
@@ -81,16 +81,16 @@
81
81
  "morgan": "~1.9.1",
82
82
  "uuid": "^9.0.0"
83
83
  },
84
- "peerDependencies": {
85
- "@loaders.gl/core": "^4.0.0"
86
- },
87
84
  "quarantinedDependencies": {
88
85
  "join-images": "^1.1.3",
89
86
  "sharp": "^0.31.3"
90
87
  },
91
- "gitHead": "cf18e05801314a62c9fc4c2a85e8888a8a852083",
92
88
  "devDependencies": {
93
89
  "@types/express": "^4.17.17",
94
90
  "@types/node": "^20.4.2"
95
- }
91
+ },
92
+ "peerDependencies": {
93
+ "@loaders.gl/core": "^4.0.0"
94
+ },
95
+ "gitHead": "32d95a81971f104e4dfeb88ab57065f05321a76a"
96
96
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"3d-tiles-converter.js","names":["join","process","transform","load","isBrowser","I3SLoader","I3SAttributeLoader","COORDINATE_SYSTEM","PGMLoader","i3sObbTo3dTilesObb","convertScreenThresholdToGeometricError","writeFile","removeDir","calculateFilesSize","timeConverter","TILESET","tilesetTemplate","createObbFromMbs","WorkerFarm","BROWSER_ERROR_MESSAGE","B3dmConverter","getNodeCount","loadFromArchive","loadI3SContent","openSLPK","ConversionDump","Progress","I3S","Tiles3DConverter","constructor","options","tilesetPath","vertexCounter","conversionStartTime","geoidHeightModel","sourceTileset","attributeStorageInfo","workerSource","slpkFilesystem","loaderOptions","_nodeWorkers","reuseWorkers","worker","i3s","coordinateSystem","LNGLAT_OFFSETS","decodeTextures","workerUrl","conversionDump","progress","convert","_this$sourceTileset","console","log","inputUrl","outputPath","tilesetName","maxDepth","egmFilePath","inquirer","analyze","hrtime","preprocessResult","preprocessConversion","startMonitoring","isTileset","rootNode","root","obb","mbs","createDump","restored","result","prompt","name","type","message","resumeConversion","reset","e","rootTile","boundingVolume","box","geometricError","children","refine","_addChildren","tileset","JSON","stringify","deleteDumpFile","stopMonitoring","_finishConversion","slpk","destroy","workerFarm","getWorkerFarm","nodesCount","stepsTotal","convertChildNode","parentSourceNode","parentNode","level","childNodeInfo","nextParentNode","sourceChild","_loadChildNode","contentUrl","isFileConversionComplete","id","child","_createChildAndBoundingVolume","push","content","vertexCount","featureAttributes","_loadChildAttributes","i3sAttributesData","tileContent","textureFormat","b3dmConverter","b3dm","addNode","Uint8Array","updateConvertedNodesDumpFile","stepsDone","timeRemainingString","timeRemaining","getTimeRemainingString","percentString","getPercentString","progressString","_this$sourceTileset2","header","nodePagesTile","formTileFromNodePages","parseInt","nodeUrl","_relativeUrlToFullUrl","url","href","isTileHeader","loadContent","uri","baseUrl","arguments","length","undefined","relativeUrl","resultArray","split","relativeUrlArray","folder","slice","promises","attributeUrls","index","attribute","attributeName","attributeType","_getAttributeType","attributesList","Promise","all","_replaceNestedArrays","Object","assign","attributeValues","valueType","objectIds","attributeObject","key","Array","from","params","filesSize","diff","conversionTime"],"sources":["../../src/3d-tiles-converter/3d-tiles-converter.ts"],"sourcesContent":["import type {\n AttributeStorageInfo,\n FeatureAttribute,\n NodeReference,\n I3STilesetHeader\n} from '@loaders.gl/i3s';\nimport type {Tile3DBoundingVolume, Tiles3DTileJSON} from '@loaders.gl/3d-tiles';\n\nimport {join} from 'path';\nimport process from 'process';\nimport transform from 'json-map-transform';\nimport {load, isBrowser} from '@loaders.gl/core';\nimport {I3SLoader, I3SAttributeLoader, COORDINATE_SYSTEM} from '@loaders.gl/i3s';\nimport {Geoid} from '@math.gl/geoid';\n\nimport {PGMLoader} from '../pgm-loader';\nimport {i3sObbTo3dTilesObb} from './helpers/i3s-obb-to-3d-tiles-obb';\nimport {convertScreenThresholdToGeometricError} from '../lib/utils/lod-conversion-utils';\nimport {writeFile, removeDir} from '../lib/utils/file-utils';\nimport {calculateFilesSize, timeConverter} from '../lib/utils/statistic-utills';\nimport {TILESET as tilesetTemplate} from './json-templates/tileset';\nimport {createObbFromMbs} from '../i3s-converter/helpers/coordinate-converter';\nimport {WorkerFarm} from '@loaders.gl/worker-utils';\nimport {BROWSER_ERROR_MESSAGE} from '../constants';\nimport B3dmConverter, {I3SAttributesData} from './helpers/b3dm-converter';\nimport {I3STileHeader} from '@loaders.gl/i3s/src/types';\nimport {getNodeCount, loadFromArchive, loadI3SContent, openSLPK} from './helpers/load-i3s';\nimport {I3SLoaderOptions} from '@loaders.gl/i3s/src/i3s-loader';\nimport {ZipFileSystem} from '../../../zip/src';\nimport {ConversionDump, ConversionDumpOptions} from '../lib/utils/conversion-dump';\nimport {Progress} from '../i3s-converter/helpers/progress';\n\nconst I3S = 'I3S';\n\n/**\n * Converter from i3s to 3d-tiles\n */\nexport default class Tiles3DConverter {\n options: any;\n tilesetPath: string;\n vertexCounter: number;\n conversionStartTime: [number, number];\n geoidHeightModel: Geoid | null;\n sourceTileset: I3STilesetHeader | null;\n attributeStorageInfo?: AttributeStorageInfo[] | null;\n workerSource: {[key: string]: string} = {};\n slpkFilesystem: ZipFileSystem | null = null;\n loaderOptions: I3SLoaderOptions = {\n _nodeWorkers: true,\n reuseWorkers: true,\n // TODO: converter freezes in the end because of i3s-content-worker\n worker: false,\n i3s: {coordinateSystem: COORDINATE_SYSTEM.LNGLAT_OFFSETS, decodeTextures: false},\n // We need to load local fs workers because nodejs can't load workers from the Internet\n 'i3s-content': {\n workerUrl: './modules/i3s/dist/i3s-content-worker-node.js'\n }\n };\n conversionDump: ConversionDump;\n progress: Progress;\n\n constructor() {\n this.options = {};\n this.tilesetPath = '';\n this.vertexCounter = 0;\n this.conversionStartTime = [0, 0];\n this.geoidHeightModel = null;\n this.sourceTileset = null;\n this.attributeStorageInfo = null;\n this.workerSource = {};\n this.conversionDump = new ConversionDump();\n this.progress = new Progress();\n }\n\n /**\n * Convert i3s format data to 3dTiles\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.egmFilePath location of *.pgm file to convert heights from ellipsoidal to gravity-related format\n * @param options.maxDepth The max tree depth of conversion\n */\n public async convert(options: {\n inputUrl: string;\n outputPath: string;\n tilesetName: string;\n maxDepth?: number;\n egmFilePath: string;\n inquirer?: Promise<unknown>;\n analyze?: boolean;\n }): Promise<any> {\n if (isBrowser) {\n console.log(BROWSER_ERROR_MESSAGE);\n return BROWSER_ERROR_MESSAGE;\n }\n const {inputUrl, outputPath, tilesetName, maxDepth, egmFilePath, inquirer, analyze} = options;\n this.conversionStartTime = process.hrtime();\n this.options = {maxDepth, inquirer};\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 this.slpkFilesystem = await openSLPK(inputUrl);\n\n let preprocessResult = true;\n if (analyze || this.slpkFilesystem) {\n preprocessResult = await this.preprocessConversion();\n if (!preprocessResult || analyze) {\n return;\n }\n }\n\n this.progress.startMonitoring();\n\n this.sourceTileset = await loadFromArchive(\n inputUrl,\n I3SLoader,\n {\n ...this.loaderOptions,\n // @ts-expect-error `isTileset` can be boolean of 'auto' but TS expects a string\n i3s: {...this.loaderOptions.i3s, isTileset: true}\n },\n this.slpkFilesystem\n );\n\n if (!this.sourceTileset) {\n return;\n }\n\n const rootNode = this.sourceTileset?.root;\n if (!rootNode.obb) {\n rootNode.obb = createObbFromMbs(rootNode.mbs);\n }\n\n this.tilesetPath = join(`${outputPath}`, `${tilesetName}`);\n this.attributeStorageInfo = this.sourceTileset.attributeStorageInfo;\n\n await this.conversionDump.createDump(options as ConversionDumpOptions);\n if (this.conversionDump.restored && this.options.inquirer) {\n const result = await this.options.inquirer.prompt([\n {\n name: 'resumeConversion',\n type: 'confirm',\n message:\n 'Dump file of the previous conversion exists, do you want to resume that conversion?'\n }\n ]);\n if (!result.resumeConversion) {\n this.conversionDump.reset();\n }\n }\n // Removing the tilesetPath needed to exclude erroneous files after conversion\n if (!this.conversionDump.restored) {\n try {\n await removeDir(this.tilesetPath);\n } catch (e) {\n // do nothing\n }\n }\n\n const rootTile: Tiles3DTileJSON = {\n boundingVolume: {\n box: i3sObbTo3dTilesObb(rootNode.obb, this.geoidHeightModel)\n },\n geometricError: convertScreenThresholdToGeometricError(rootNode),\n children: [],\n refine: 'REPLACE'\n };\n\n await this._addChildren(rootNode, rootTile, 1);\n\n const tileset = transform({root: rootTile}, tilesetTemplate());\n await writeFile(this.tilesetPath, JSON.stringify(tileset), 'tileset.json');\n await this.conversionDump.deleteDumpFile();\n\n this.progress.stopMonitoring();\n\n await this._finishConversion({slpk: false, outputPath, tilesetName});\n\n if (this.slpkFilesystem) {\n this.slpkFilesystem.destroy();\n }\n\n // Clean up worker pools\n const workerFarm = WorkerFarm.getWorkerFarm({});\n workerFarm.destroy();\n }\n\n /**\n * Preprocess stage of the tile converter. Calculate number of nodes\n * @returns true - the conversion is possible, false - the tileset's content is not supported\n */\n private async preprocessConversion(): Promise<boolean> {\n console.log(`Analyze source layer`);\n const nodesCount = await getNodeCount(this.slpkFilesystem);\n this.progress.stepsTotal = nodesCount;\n\n console.log(`------------------------------------------------`);\n console.log(`Preprocess results:`);\n if (this.slpkFilesystem) {\n console.log(`Node count: ${nodesCount}`);\n if (nodesCount === 0) {\n console.log('Node count is 0. The conversion will be interrupted.');\n console.log(`------------------------------------------------`);\n return false;\n }\n } else {\n console.log(`Node count cannot be calculated for the remote dataset`);\n }\n\n console.log(`------------------------------------------------`);\n return true;\n }\n\n /**\n * Convert particular I3S Node\n * @param parentSourceNode the parent node tile object (@loaders.gl/tiles/Tile3D)\n * @param parentNode object in resulting tileset\n * @param level a current level of a tree depth\n * @param childNodeInfo child node to convert\n */\n private async convertChildNode(\n parentSourceNode: I3STileHeader,\n parentNode: Tiles3DTileJSON,\n level: number,\n childNodeInfo: NodeReference\n ): Promise<void> {\n let nextParentNode = parentNode;\n const sourceChild = await this._loadChildNode(parentSourceNode, childNodeInfo);\n if (sourceChild.contentUrl) {\n if (\n this.conversionDump.restored &&\n this.conversionDump.isFileConversionComplete(`${sourceChild.id}.b3dm`) &&\n (sourceChild.obb || sourceChild.mbs)\n ) {\n const {child} = this._createChildAndBoundingVolume(sourceChild);\n parentNode.children.push(child);\n await this._addChildren(sourceChild, child, level + 1);\n return;\n }\n const content = await loadI3SContent(\n this.sourceTileset,\n sourceChild,\n this.loaderOptions,\n this.slpkFilesystem\n );\n\n if (!content) {\n await this._addChildren(sourceChild, parentNode, level + 1);\n return;\n }\n\n this.vertexCounter += content?.vertexCount || 0;\n\n let featureAttributes: FeatureAttribute | null = null;\n if (this.attributeStorageInfo) {\n featureAttributes = await this._loadChildAttributes(sourceChild, this.attributeStorageInfo);\n }\n\n const {child, boundingVolume} = this._createChildAndBoundingVolume(sourceChild);\n\n const i3sAttributesData: I3SAttributesData = {\n tileContent: content,\n box: boundingVolume.box || [],\n textureFormat: sourceChild.textureFormat\n };\n\n const b3dmConverter = new B3dmConverter();\n const b3dm = await b3dmConverter.convert(i3sAttributesData, featureAttributes);\n\n await this.conversionDump.addNode(`${sourceChild.id}.b3dm`, sourceChild.id);\n await writeFile(this.tilesetPath, new Uint8Array(b3dm), `${sourceChild.id}.b3dm`);\n await this.conversionDump.updateConvertedNodesDumpFile(\n `${sourceChild.id}.b3dm`,\n sourceChild.id,\n true\n );\n parentNode.children.push(child);\n nextParentNode = child;\n }\n\n this.progress.stepsDone += 1;\n let timeRemainingString = 'Calculating time left...';\n const timeRemaining = this.progress.getTimeRemainingString();\n if (timeRemaining) {\n timeRemainingString = `${timeRemaining} left`;\n }\n const percentString = this.progress.getPercentString();\n const progressString = percentString ? ` ${percentString}%, ${timeRemainingString}` : '';\n console.log(`[converted${progressString}]: ${childNodeInfo.id}`); // eslint-disable-line\n\n await this._addChildren(sourceChild, nextParentNode, level + 1);\n }\n\n /**\n * The recursive function of traversal of a nodes tree\n * @param parentSourceNode the parent node tile object (@loaders.gl/tiles/Tile3D)\n * @param parentNode object in resulting tileset\n * @param level a current level of a tree depth\n */\n private async _addChildren(\n parentSourceNode: I3STileHeader,\n parentNode: Tiles3DTileJSON,\n level: number\n ): Promise<void> {\n if (this.options.maxDepth && level > this.options.maxDepth) {\n return;\n }\n for (const childNodeInfo of parentSourceNode.children || []) {\n await this.convertChildNode(parentSourceNode, parentNode, level, childNodeInfo);\n }\n }\n\n /**\n * Load a child node having information from the node header\n * @param parentNode a parent node tile object (@loaders.gl/tiles/Tile3D)\n * @param childNodeInfo child information from 3DNodeIndexDocument\n * (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/nodeReference.cmn.md)\n */\n private async _loadChildNode(\n parentNode: I3STileHeader,\n childNodeInfo: NodeReference\n ): Promise<I3STileHeader> {\n let header;\n if (this.sourceTileset?.nodePagesTile) {\n console.log(`Node conversion: ${childNodeInfo.id}`); // eslint-disable-line no-console,no-undef\n header = await this.sourceTileset.nodePagesTile.formTileFromNodePages(\n parseInt(childNodeInfo.id)\n );\n } else {\n const nodeUrl = this._relativeUrlToFullUrl(parentNode.url, childNodeInfo.href!);\n // load metadata\n const options: I3SLoaderOptions = {\n i3s: {\n ...this.loaderOptions,\n // @ts-expect-error\n isTileHeader: true,\n loadContent: false\n }\n };\n\n console.log(`Node conversion: ${nodeUrl}`); // eslint-disable-line no-console,no-undef\n header = await loadFromArchive(nodeUrl, I3SLoader, options, this.slpkFilesystem);\n }\n return header;\n }\n\n /**\n * Create child and child's boundingVolume for the converted node\n * @param sourceChild\n * @returns child and child's boundingVolume\n */\n private _createChildAndBoundingVolume(sourceChild: I3STileHeader): {\n boundingVolume: Tile3DBoundingVolume;\n child: Tiles3DTileJSON;\n } {\n if (!sourceChild.obb) {\n sourceChild.obb = createObbFromMbs(sourceChild.mbs);\n }\n const boundingVolume: Tile3DBoundingVolume = {\n box: i3sObbTo3dTilesObb(sourceChild.obb, this.geoidHeightModel)\n };\n const child: Tiles3DTileJSON = {\n boundingVolume,\n geometricError: convertScreenThresholdToGeometricError(sourceChild),\n children: [],\n content: {\n uri: `${sourceChild.id}.b3dm`,\n boundingVolume\n }\n };\n return {boundingVolume, child};\n }\n\n /**\n * Make an url of a resource from its relative url having the base url\n * @param baseUrl the base url. A resulting url will be related from this url\n * @param relativeUrl a realtive url of a resource\n */\n private _relativeUrlToFullUrl(baseUrl: string = '', relativeUrl: string): string {\n let resultArray = baseUrl.split('/');\n const relativeUrlArray = relativeUrl.split('/');\n for (const folder of relativeUrlArray) {\n switch (folder) {\n case '.':\n continue; // eslint-disable-line no-continue\n case '..':\n resultArray = resultArray.slice(0, -1);\n break;\n default:\n resultArray.push(folder);\n }\n }\n return resultArray.join('/');\n }\n\n /**\n * Do loading all attributes related to particular node.\n * @param sourceChild\n * @param attributeStorageInfo\n * @returns Promise of attributes object.\n */\n private async _loadChildAttributes(\n sourceChild: I3STileHeader,\n attributeStorageInfo: AttributeStorageInfo[]\n ): Promise<FeatureAttribute> {\n const promises: any[] = [];\n const {attributeUrls = []} = sourceChild;\n\n for (let index = 0; index < attributeUrls.length; index++) {\n const inputUrl = attributeUrls[index];\n const attribute = attributeStorageInfo[index];\n const options = {\n attributeName: attribute.name,\n attributeType: this._getAttributeType(attribute)\n };\n\n promises.push(loadFromArchive(inputUrl, I3SAttributeLoader, options, this.slpkFilesystem));\n }\n const attributesList = await Promise.all(promises);\n this._replaceNestedArrays(attributesList);\n return Object.assign({}, ...attributesList);\n }\n\n /**\n * Returns attribute type for loading attributes\n * @param attribute\n * Workaround for I3S v1.6. There is no attribute.attributeValues.valueType field in attribute.\n * There is an 'Oid32' type if attribute has objectIds property.\n * Doc: https://github.com/Esri/i3s-spec/blob/master/docs/1.6/attributeStorageInfo.cmn.md\n */\n private _getAttributeType(attribute: AttributeStorageInfo): string {\n if (attribute.attributeValues) {\n return attribute.attributeValues.valueType;\n } else if (attribute.objectIds) {\n return 'Oid32';\n }\n return '';\n }\n\n /**\n * Make simple arrays from attribute typed arrays.\n * @param attributesList\n */\n private _replaceNestedArrays(attributesList: FeatureAttribute[]): void {\n for (let index = 0; index < attributesList.length; index++) {\n const attributeObject = attributesList[index];\n\n for (const key in attributeObject) {\n attributeObject[key] = Array.from(attributeObject[key]);\n }\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 filesSize = await calculateFilesSize(params);\n const diff = process.hrtime(this.conversionStartTime);\n const conversionTime = timeConverter(diff);\n\n console.log(`------------------------------------------------`); // eslint-disable-line\n console.log(`Finish conversion of ${I3S}`); // eslint-disable-line\n console.log(`Total conversion time: ${conversionTime}`); // eslint-disable-line\n console.log(`Vertex count: `, this.vertexCounter); // eslint-disable-line\n console.log(`File(s) size: `, filesSize, ' bytes'); // eslint-disable-line\n console.log(`------------------------------------------------`); // eslint-disable-line\n }\n}\n"],"mappings":"AAQA,SAAQA,IAAI,QAAO,MAAM;AACzB,OAAOC,OAAO,MAAM,SAAS;AAC7B,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,SAAQC,IAAI,EAAEC,SAAS,QAAO,kBAAkB;AAChD,SAAQC,SAAS,EAAEC,kBAAkB,EAAEC,iBAAiB,QAAO,iBAAiB;AAAC,SAGzEC,SAAS;AAAA,SACTC,kBAAkB;AAAA,SAClBC,sCAAsC;AAAA,SACtCC,SAAS,EAAEC,SAAS;AAAA,SACpBC,kBAAkB,EAAEC,aAAa;AAAA,SACjCC,OAAO,IAAIC,eAAe;AAAA,SAC1BC,gBAAgB;AACxB,SAAQC,UAAU,QAAO,0BAA0B;AAAC,SAC5CC,qBAAqB;AAAA,OACtBC,aAAa;A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