@loaders.gl/tile-converter 4.2.0-alpha.4 → 4.2.0-alpha.6
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.
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +4 -4
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +349 -293
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +261 -200
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +14 -5
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js +83 -77
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +44 -21
- package/dist/3d-tiles-converter/json-templates/tileset.js +32 -33
- package/dist/constants.js +0 -1
- package/dist/converter-cli.js +257 -234
- package/dist/converter.min.cjs +95 -105
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/deps-installer/deps-installer.js +78 -59
- package/dist/i3s-converter/helpers/attribute-metadata-info.js +210 -153
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +146 -103
- package/dist/i3s-converter/helpers/coordinate-converter.js +100 -65
- package/dist/i3s-converter/helpers/create-scene-server-path.js +14 -9
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.js +170 -105
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js +205 -212
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +17 -3
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +1189 -830
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +109 -97
- package/dist/i3s-converter/helpers/load-3d-tiles.js +103 -66
- package/dist/i3s-converter/helpers/node-debug.js +98 -54
- package/dist/i3s-converter/helpers/node-index-document.d.ts +11 -4
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.js +255 -177
- package/dist/i3s-converter/helpers/node-pages.d.ts +1 -1
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +299 -193
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +92 -60
- package/dist/i3s-converter/helpers/progress.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/progress.js +139 -83
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts +9 -2
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js +33 -13
- package/dist/i3s-converter/i3s-converter.d.ts +7 -7
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +1165 -895
- package/dist/i3s-converter/json-templates/geometry-definitions.js +70 -79
- package/dist/i3s-converter/json-templates/layers.js +120 -121
- package/dist/i3s-converter/json-templates/metadata.js +19 -20
- package/dist/i3s-converter/json-templates/node.js +73 -71
- package/dist/i3s-converter/json-templates/scene-server.js +25 -26
- package/dist/i3s-converter/json-templates/shared-resources.js +107 -108
- package/dist/i3s-converter/json-templates/store.js +96 -94
- package/dist/i3s-converter/types.js +35 -23
- package/dist/i3s-server/app.js +15 -12
- package/dist/i3s-server/bin/i3s-server.min.cjs +69 -69
- package/dist/i3s-server/bin/www.js +16 -7
- package/dist/i3s-server/controllers/index-controller.js +18 -15
- package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -1
- package/dist/i3s-server/controllers/slpk-controller.js +24 -11
- package/dist/i3s-server/routes/index.js +13 -9
- package/dist/i3s-server/routes/slpk-router.d.ts.map +1 -1
- package/dist/i3s-server/routes/slpk-router.js +26 -19
- package/dist/i3s-server/utils/create-scene-server.js +15 -10
- package/dist/i3s-server/utils/server-utils.d.ts.map +1 -1
- package/dist/i3s-server/utils/server-utils.js +52 -32
- package/dist/index.cjs +616 -967
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/lib/json-schemas/conversion-dump-json-schema.js +243 -421
- package/dist/lib/utils/cli-utils.d.ts.map +1 -1
- package/dist/lib/utils/cli-utils.js +65 -36
- package/dist/lib/utils/compress-util.js +20 -15
- package/dist/lib/utils/conversion-dump.d.ts +10 -2
- package/dist/lib/utils/conversion-dump.d.ts.map +1 -1
- package/dist/lib/utils/conversion-dump.js +242 -197
- package/dist/lib/utils/file-utils.d.ts +1 -1
- package/dist/lib/utils/file-utils.d.ts.map +1 -1
- package/dist/lib/utils/file-utils.js +120 -74
- package/dist/lib/utils/geometry-utils.js +13 -7
- package/dist/lib/utils/lod-conversion-utils.js +65 -33
- package/dist/lib/utils/queue.js +12 -13
- package/dist/lib/utils/statistic-utills.d.ts +6 -23
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
- package/dist/lib/utils/statistic-utills.js +58 -55
- package/dist/lib/utils/write-queue.d.ts +2 -2
- package/dist/lib/utils/write-queue.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.js +72 -86
- package/dist/pgm-loader.js +17 -13
- package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -1
- package/dist/slpk-extractor/slpk-extractor.js +60 -50
- package/dist/slpk-extractor-cli.d.ts.map +1 -1
- package/dist/slpk-extractor-cli.js +90 -59
- package/dist/slpk-extractor.min.cjs +1 -1
- package/package.json +27 -26
- package/src/3d-tiles-converter/3d-tiles-converter.ts +21 -10
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +1 -0
- package/src/3d-tiles-converter/helpers/load-i3s.ts +3 -27
- package/src/converter-cli.ts +4 -2
- package/src/deps-installer/deps-installer.ts +7 -0
- package/src/i3s-converter/helpers/attribute-metadata-info.ts +1 -1
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +3 -1
- package/src/i3s-converter/helpers/coordinate-converter.ts +2 -2
- package/src/i3s-converter/helpers/feature-attributes.ts +5 -2
- package/src/i3s-converter/helpers/geometry-attributes.ts +6 -5
- package/src/i3s-converter/helpers/geometry-converter.ts +118 -72
- package/src/i3s-converter/helpers/gltf-attributes.ts +12 -13
- package/src/i3s-converter/helpers/node-index-document.ts +18 -10
- package/src/i3s-converter/helpers/node-pages.ts +27 -29
- package/src/i3s-converter/helpers/preprocess-3d-tiles.ts +1 -0
- package/src/i3s-converter/helpers/progress.ts +1 -0
- package/src/i3s-converter/helpers/tileset-traversal.ts +22 -13
- package/src/i3s-converter/i3s-converter.ts +173 -114
- package/src/i3s-converter/json-templates/node.ts +1 -1
- package/src/i3s-server/bin/www.ts +6 -4
- package/src/i3s-server/controllers/slpk-controller.ts +4 -2
- package/src/i3s-server/routes/index.ts +10 -7
- package/src/i3s-server/routes/slpk-router.ts +22 -16
- package/src/i3s-server/utils/server-utils.ts +6 -4
- package/src/lib/utils/cli-utils.ts +2 -0
- package/src/lib/utils/conversion-dump.ts +35 -20
- package/src/lib/utils/file-utils.ts +11 -11
- package/src/lib/utils/statistic-utills.ts +5 -6
- package/src/lib/utils/write-queue.ts +2 -2
- package/src/slpk-extractor/slpk-extractor.ts +2 -1
- package/src/slpk-extractor-cli.ts +16 -8
- package/dist/3d-tiles-converter/3d-tiles-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/texture-atlas.js.map +0 -1
- package/dist/3d-tiles-converter/json-templates/tileset.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/converter-cli.js.map +0 -1
- package/dist/deps-installer/deps-installer.js.map +0 -1
- package/dist/i3s-converter/helpers/attribute-metadata-info.js.map +0 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js.map +0 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/create-scene-server-path.js.map +0 -1
- package/dist/i3s-converter/helpers/feature-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/load-3d-tiles.js.map +0 -1
- package/dist/i3s-converter/helpers/node-debug.js.map +0 -1
- package/dist/i3s-converter/helpers/node-index-document.js.map +0 -1
- package/dist/i3s-converter/helpers/node-pages.js.map +0 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js.map +0 -1
- package/dist/i3s-converter/helpers/progress.js.map +0 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js.map +0 -1
- package/dist/i3s-converter/i3s-converter.js.map +0 -1
- package/dist/i3s-converter/json-templates/geometry-definitions.js.map +0 -1
- package/dist/i3s-converter/json-templates/layers.js.map +0 -1
- package/dist/i3s-converter/json-templates/metadata.js.map +0 -1
- package/dist/i3s-converter/json-templates/node.js.map +0 -1
- package/dist/i3s-converter/json-templates/scene-server.js.map +0 -1
- package/dist/i3s-converter/json-templates/shared-resources.js.map +0 -1
- package/dist/i3s-converter/json-templates/store.js.map +0 -1
- package/dist/i3s-converter/types.js.map +0 -1
- package/dist/i3s-server/README.md +0 -63
- package/dist/i3s-server/app.js.map +0 -1
- package/dist/i3s-server/bin/www.js.map +0 -1
- package/dist/i3s-server/certs/cert.pem +0 -19
- package/dist/i3s-server/certs/key.pem +0 -27
- package/dist/i3s-server/controllers/index-controller.js.map +0 -1
- package/dist/i3s-server/controllers/slpk-controller.js.map +0 -1
- package/dist/i3s-server/routes/index.js.map +0 -1
- package/dist/i3s-server/routes/slpk-router.js.map +0 -1
- package/dist/i3s-server/utils/create-scene-server.js.map +0 -1
- package/dist/i3s-server/utils/server-utils.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/json-schemas/conversion-dump-json-schema.js.map +0 -1
- package/dist/lib/utils/cli-utils.js.map +0 -1
- package/dist/lib/utils/compress-util.js.map +0 -1
- package/dist/lib/utils/conversion-dump.js.map +0 -1
- package/dist/lib/utils/file-utils.js.map +0 -1
- package/dist/lib/utils/geometry-utils.js.map +0 -1
- package/dist/lib/utils/lod-conversion-utils.js.map +0 -1
- package/dist/lib/utils/queue.js.map +0 -1
- package/dist/lib/utils/statistic-utills.js.map +0 -1
- package/dist/lib/utils/write-queue.js.map +0 -1
- package/dist/pgm-loader.js.map +0 -1
- package/dist/slpk-extractor/slpk-extractor.js.map +0 -1
- package/dist/slpk-extractor-cli.js.map +0 -1
- package/src/lib/utils/statistic-utills.d.ts +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/cli-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CASpE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"cli-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/cli-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CASpE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAOjE;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAWjE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAOrE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAStE"}
|
|
@@ -1,47 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get string option value from cli arguments
|
|
3
|
+
* @param index - option's name index in the argument's array.
|
|
4
|
+
* The value of the option should be next to name of the option.
|
|
5
|
+
* @param args - cli arguments array
|
|
6
|
+
* @returns - string value of the option
|
|
7
|
+
*/
|
|
1
8
|
export function getStringValue(index, args) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
if (index + 1 >= args.length) {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
const value = args[index + 1];
|
|
13
|
+
if (value.indexOf('--') === 0) {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
10
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Modyfy URL path to be compatible with fetch
|
|
20
|
+
* @param index - option's name index in the argument's array.
|
|
21
|
+
* The value of the option should be next to name of the option.
|
|
22
|
+
* @param args - cli arguments array
|
|
23
|
+
* @returns - string value of the option
|
|
24
|
+
*/
|
|
11
25
|
export function getURLValue(index, args) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
const value = getStringValue(index, args);
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.log(`Input tileset value: ${value}`);
|
|
29
|
+
// eslint-disable-next-line no-console
|
|
30
|
+
console.log(`Modified tileset value: ${value.replace(/\\/g, '/')}`);
|
|
31
|
+
return value.replace(/\\/g, '/');
|
|
16
32
|
}
|
|
17
33
|
export function validateOptionsWithEqual(args) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
return args.reduce((acc, curr) => {
|
|
35
|
+
const equalSignIndex = curr.indexOf('=');
|
|
36
|
+
const beforeEqual = curr.slice(0, equalSignIndex);
|
|
37
|
+
const afterEqual = curr.slice(equalSignIndex + 1, curr.length);
|
|
38
|
+
const condition = curr.includes('=') && curr.startsWith('--') && afterEqual;
|
|
39
|
+
if (condition) {
|
|
40
|
+
return acc.concat(beforeEqual, afterEqual);
|
|
41
|
+
}
|
|
42
|
+
return acc.concat(curr);
|
|
43
|
+
}, []);
|
|
28
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Get integer option value from cli arguments
|
|
47
|
+
* @param index - option's name index in the argument's array
|
|
48
|
+
* The value of the option should be next to name of the option.
|
|
49
|
+
* @param args - cli arguments array
|
|
50
|
+
* @returns - number value of the option
|
|
51
|
+
*/
|
|
29
52
|
export function getIntegerValue(index, args) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
53
|
+
const stringValue = getStringValue(index, args);
|
|
54
|
+
const result = Number.parseInt(stringValue);
|
|
55
|
+
if (isFinite(result)) {
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
return NaN;
|
|
36
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Get boolean option value from cli arguments
|
|
62
|
+
* @param index - option's name index in the argument's array
|
|
63
|
+
* The value of the option should be next to name of the option.
|
|
64
|
+
* @param args - cli arguments array
|
|
65
|
+
* @returns - boolean value of the option
|
|
66
|
+
*/
|
|
37
67
|
export function getBooleanValue(index, args) {
|
|
38
|
-
|
|
39
|
-
|
|
68
|
+
const stringValue = getStringValue(index, args).toLowerCase().trim();
|
|
69
|
+
if (['--no-draco', '--split-nodes'].includes(args[index]) && !stringValue) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
if (!stringValue || stringValue === 'true') {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
40
75
|
return false;
|
|
41
|
-
}
|
|
42
|
-
if (!stringValue || stringValue === 'true') {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
return false;
|
|
46
76
|
}
|
|
47
|
-
//# sourceMappingURL=cli-utils.js.map
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import { createGzip } from 'zlib';
|
|
2
2
|
import { createReadStream, createWriteStream } from 'fs';
|
|
3
|
+
/**
|
|
4
|
+
* Compress file to gzip file
|
|
5
|
+
*
|
|
6
|
+
* @param pathFile - the path to the file
|
|
7
|
+
* @return the path to the gzip file
|
|
8
|
+
*/
|
|
3
9
|
export function compressFileWithGzip(pathFile) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const compressedPathFile = `${pathFile}.gz`;
|
|
11
|
+
const gzip = createGzip();
|
|
12
|
+
const input = createReadStream(pathFile);
|
|
13
|
+
const output = createWriteStream(compressedPathFile);
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
input.on('end', () => {
|
|
16
|
+
console.log(`${compressedPathFile} compressed and saved.`); // eslint-disable-line no-undef,no-console
|
|
17
|
+
resolve(compressedPathFile);
|
|
18
|
+
});
|
|
19
|
+
input.on('error', (error) => {
|
|
20
|
+
console.log(`${compressedPathFile}: compression error!`); // eslint-disable-line no-undef,no-console
|
|
21
|
+
reject(error);
|
|
22
|
+
});
|
|
23
|
+
input.pipe(gzip).pipe(output);
|
|
12
24
|
});
|
|
13
|
-
input.on('error', error => {
|
|
14
|
-
console.log(`${compressedPathFile}: compression error!`);
|
|
15
|
-
reject(error);
|
|
16
|
-
});
|
|
17
|
-
input.pipe(gzip).pipe(output);
|
|
18
|
-
});
|
|
19
25
|
}
|
|
20
|
-
//# sourceMappingURL=compress-util.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BoundingVolumes, I3SMaterialDefinition, TextureSetDefinitionFormats } from '@loaders.gl/i3s';
|
|
2
|
-
import { AttributeMetadataInfoObject } from
|
|
2
|
+
import { AttributeMetadataInfoObject } from "../../i3s-converter/helpers/attribute-metadata-info.js";
|
|
3
3
|
export type ConversionDumpOptions = {
|
|
4
4
|
inputUrl: string;
|
|
5
5
|
outputPath: string;
|
|
@@ -39,7 +39,7 @@ export type TextureSetDefinition = {
|
|
|
39
39
|
atlas?: boolean;
|
|
40
40
|
};
|
|
41
41
|
export declare class ConversionDump {
|
|
42
|
-
/**Restored/resumed dump indicator */
|
|
42
|
+
/** Restored/resumed dump indicator */
|
|
43
43
|
restored: boolean;
|
|
44
44
|
/** Conversion options */
|
|
45
45
|
private options?;
|
|
@@ -115,6 +115,14 @@ export declare class ConversionDump {
|
|
|
115
115
|
sourceId?: string;
|
|
116
116
|
resourceType?: string;
|
|
117
117
|
}[], writeResults: PromiseSettledResult<string | null>[]): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Update done status for a node
|
|
120
|
+
* @param sourceId - source resource Id
|
|
121
|
+
* @param outputId - output node/tile Id
|
|
122
|
+
* @param resourceType - type of resource
|
|
123
|
+
* @returns void
|
|
124
|
+
*/
|
|
125
|
+
private updateNodes;
|
|
118
126
|
/**
|
|
119
127
|
* Update 3d-tiles-converter dump file
|
|
120
128
|
* @param filename - source filename
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversion-dump.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/conversion-dump.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,eAAe,EAAE,qBAAqB,EAAE,2BAA2B,EAAC,MAAM,iBAAiB,CAAC;AACpG,OAAO,EAAC,2BAA2B,EAAC
|
|
1
|
+
{"version":3,"file":"conversion-dump.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/conversion-dump.ts"],"names":[],"mappings":"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"}
|
|
@@ -6,206 +6,251 @@ import process from 'process';
|
|
|
6
6
|
import Ajv from 'ajv';
|
|
7
7
|
import { dumpJsonSchema } from "../json-schemas/conversion-dump-json-schema.js";
|
|
8
8
|
export class ConversionDump {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
9
|
+
/** Restored/resumed dump indicator */
|
|
10
|
+
restored = false;
|
|
11
|
+
/** Conversion options */
|
|
12
|
+
options;
|
|
13
|
+
/** Tiles conversion progress status map */
|
|
14
|
+
tilesConverted;
|
|
15
|
+
/** Textures formats definitions */
|
|
16
|
+
textureSetDefinitions;
|
|
17
|
+
/** Attributes Metadata */
|
|
18
|
+
attributeMetadataInfo;
|
|
19
|
+
/** Array of materials definitions */
|
|
20
|
+
materialDefinitions;
|
|
21
|
+
constructor() {
|
|
22
|
+
this.tilesConverted = {};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a dump with convertion options
|
|
26
|
+
* @param currentOptions - converter options
|
|
27
|
+
*/
|
|
28
|
+
async createDump(currentOptions) {
|
|
29
|
+
const { tilesetName, slpk, egmFilePath, inputUrl, outputPath, draco = true, maxDepth, token, generateTextures, generateBoundingVolumes, mergeMaterials = true, metadataClass, analyze = false } = currentOptions;
|
|
30
|
+
this.options = {
|
|
31
|
+
tilesetName,
|
|
32
|
+
slpk,
|
|
33
|
+
egmFilePath,
|
|
34
|
+
inputUrl,
|
|
35
|
+
outputPath,
|
|
36
|
+
draco,
|
|
37
|
+
maxDepth,
|
|
38
|
+
token,
|
|
39
|
+
generateTextures,
|
|
40
|
+
generateBoundingVolumes,
|
|
41
|
+
mergeMaterials,
|
|
42
|
+
metadataClass,
|
|
43
|
+
analyze
|
|
44
|
+
};
|
|
45
|
+
const dumpFilename = join(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`);
|
|
46
|
+
if (await isFileExists(dumpFilename)) {
|
|
47
|
+
try {
|
|
48
|
+
const dump = await openJson(join(this.options.outputPath, this.options.tilesetName), `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`);
|
|
49
|
+
const { options, tilesConverted, textureSetDefinitions, attributeMetadataInfo, materialDefinitions } = dump;
|
|
50
|
+
const ajv = new Ajv();
|
|
51
|
+
const dumpJsonValidate = ajv.compile(dumpJsonSchema);
|
|
52
|
+
const isDumpValid = dumpJsonValidate(dump);
|
|
53
|
+
if (isDumpValid && isDeepStrictEqual(options, JSON.parse(JSON.stringify(this.options)))) {
|
|
54
|
+
this.tilesConverted = tilesConverted;
|
|
55
|
+
this.textureSetDefinitions = textureSetDefinitions;
|
|
56
|
+
this.attributeMetadataInfo = attributeMetadataInfo;
|
|
57
|
+
this.materialDefinitions = materialDefinitions;
|
|
58
|
+
this.restored = true;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
// prettier-ignore
|
|
64
|
+
console.log('Can\'t open dump file', error); // eslint-disable-line no-console
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
await this.deleteDumpFile();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Reset a dump
|
|
71
|
+
*/
|
|
72
|
+
reset() {
|
|
73
|
+
this.restored = false;
|
|
74
|
+
this.tilesConverted = {};
|
|
75
|
+
if (this.textureSetDefinitions) {
|
|
76
|
+
delete this.textureSetDefinitions;
|
|
77
|
+
}
|
|
78
|
+
if (this.attributeMetadataInfo) {
|
|
79
|
+
delete this.attributeMetadataInfo;
|
|
80
|
+
}
|
|
81
|
+
if (this.materialDefinitions) {
|
|
82
|
+
delete this.materialDefinitions;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Update conversion status in the dump file
|
|
87
|
+
*/
|
|
88
|
+
async updateDumpFile() {
|
|
89
|
+
if (this.options?.outputPath && this.options.tilesetName) {
|
|
90
|
+
try {
|
|
91
|
+
const time = process.hrtime();
|
|
92
|
+
await writeFile(join(this.options.outputPath, this.options.tilesetName), JSON.stringify({
|
|
93
|
+
options: this.options,
|
|
94
|
+
tilesConverted: this.tilesConverted,
|
|
95
|
+
textureSetDefinitions: this.textureSetDefinitions,
|
|
96
|
+
attributeMetadataInfo: this.attributeMetadataInfo,
|
|
97
|
+
materialDefinitions: this.materialDefinitions
|
|
98
|
+
}), `${this.options.tilesetName}${DUMP_FILE_SUFFIX}.${time[0]}.${time[1]}`);
|
|
99
|
+
await renameFile(join(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}.${time[0]}.${time[1]}`), join(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`));
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
// prettier-ignore
|
|
103
|
+
console.log('Can\'t update dump file', error); // eslint-disable-line no-console
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Delete a dump file
|
|
109
|
+
*/
|
|
110
|
+
async deleteDumpFile() {
|
|
111
|
+
if (this.options?.outputPath &&
|
|
112
|
+
this.options.tilesetName &&
|
|
113
|
+
(await isFileExists(join(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`)))) {
|
|
114
|
+
await removeFile(join(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Get record from the tilesConverted Map
|
|
119
|
+
* @param fileName - source filename
|
|
120
|
+
* @returns existing object from the tilesConverted Map
|
|
121
|
+
*/
|
|
122
|
+
getRecord(fileName) {
|
|
123
|
+
return this.tilesConverted[fileName];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Set a record for the dump file
|
|
127
|
+
* @param fileName - key - source filename
|
|
128
|
+
* @param object - value
|
|
129
|
+
*/
|
|
130
|
+
setRecord(fileName, object) {
|
|
131
|
+
this.tilesConverted[fileName] = object;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Add a node into the dump file for the source file record
|
|
135
|
+
* @param fileName - source filename
|
|
136
|
+
* @param nodeId - nodeId of the node
|
|
137
|
+
*/
|
|
138
|
+
async addNode(filename, nodeId, dumpMetadata) {
|
|
139
|
+
const { nodes } = this.getRecord(filename) || { nodes: [] };
|
|
140
|
+
nodes.push({ nodeId, done: false, dumpMetadata });
|
|
141
|
+
if (nodes.length === 1) {
|
|
142
|
+
this.setRecord(filename, { nodes });
|
|
143
|
+
}
|
|
144
|
+
await this.updateDumpFile();
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Clear dump record got the source filename
|
|
148
|
+
* @param fileName - source filename
|
|
149
|
+
*/
|
|
150
|
+
clearDumpRecord(filename) {
|
|
151
|
+
this.setRecord(filename, { nodes: [] });
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Add textures definitions into the dump file
|
|
155
|
+
* @param textureDefinitions - textures definitions array
|
|
156
|
+
*/
|
|
157
|
+
addTexturesDefinitions(textureDefinitions) {
|
|
158
|
+
this.textureSetDefinitions = textureDefinitions;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Update done status object for the writing resources
|
|
162
|
+
* @param fileName - key - source filename
|
|
163
|
+
* @param nodeId - nodeId for the source filename
|
|
164
|
+
* @param resourceType - resource type to update status
|
|
165
|
+
* @param value - value
|
|
166
|
+
*/
|
|
167
|
+
updateDoneStatus(filename, nodeId, resourceType, value) {
|
|
168
|
+
const nodeDump = this.tilesConverted[filename]?.nodes.find((element) => element.nodeId === nodeId);
|
|
169
|
+
if (nodeDump) {
|
|
170
|
+
if (!nodeDump.progress) {
|
|
171
|
+
nodeDump.progress = {};
|
|
172
|
+
}
|
|
173
|
+
nodeDump.progress[resourceType] = value;
|
|
174
|
+
if (!value) {
|
|
175
|
+
nodeDump.done = false;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Update dump file according to writing results
|
|
181
|
+
* @param changedRecords - array of parameters ids for the written resources
|
|
182
|
+
* @param writeResults - array of writing resource files results
|
|
183
|
+
*/
|
|
184
|
+
async updateConvertedTilesDump(changedRecords, writeResults) {
|
|
185
|
+
for (let i = 0; i < changedRecords.length; i++) {
|
|
186
|
+
if (changedRecords[i] && 'value' in writeResults[i]) {
|
|
187
|
+
const { sourceId, resourceType, outputId } = changedRecords[i];
|
|
188
|
+
this.updateNodes(sourceId, outputId, resourceType);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
await this.updateDumpFile();
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Update done status for a node
|
|
195
|
+
* @param sourceId - source resource Id
|
|
196
|
+
* @param outputId - output node/tile Id
|
|
197
|
+
* @param resourceType - type of resource
|
|
198
|
+
* @returns void
|
|
199
|
+
*/
|
|
200
|
+
updateNodes(sourceId, outputId, resourceType) {
|
|
201
|
+
if (!sourceId || !resourceType || !outputId) {
|
|
202
|
+
return;
|
|
70
203
|
}
|
|
71
|
-
} catch (error) {
|
|
72
|
-
console.log("Can't open dump file", error);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
await this.deleteDumpFile();
|
|
76
|
-
}
|
|
77
|
-
reset() {
|
|
78
|
-
this.restored = false;
|
|
79
|
-
this.tilesConverted = {};
|
|
80
|
-
if (this.textureSetDefinitions) {
|
|
81
|
-
delete this.textureSetDefinitions;
|
|
82
|
-
}
|
|
83
|
-
if (this.attributeMetadataInfo) {
|
|
84
|
-
delete this.attributeMetadataInfo;
|
|
85
|
-
}
|
|
86
|
-
if (this.materialDefinitions) {
|
|
87
|
-
delete this.materialDefinitions;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
async updateDumpFile() {
|
|
91
|
-
var _this$options;
|
|
92
|
-
if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.outputPath && this.options.tilesetName) {
|
|
93
|
-
try {
|
|
94
|
-
const time = process.hrtime();
|
|
95
|
-
await writeFile(join(this.options.outputPath, this.options.tilesetName), JSON.stringify({
|
|
96
|
-
options: this.options,
|
|
97
|
-
tilesConverted: this.tilesConverted,
|
|
98
|
-
textureSetDefinitions: this.textureSetDefinitions,
|
|
99
|
-
attributeMetadataInfo: this.attributeMetadataInfo,
|
|
100
|
-
materialDefinitions: this.materialDefinitions
|
|
101
|
-
}), `${this.options.tilesetName}${DUMP_FILE_SUFFIX}.${time[0]}.${time[1]}`);
|
|
102
|
-
await renameFile(join(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}.${time[0]}.${time[1]}`), join(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`));
|
|
103
|
-
} catch (error) {
|
|
104
|
-
console.log("Can't update dump file", error);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
async deleteDumpFile() {
|
|
109
|
-
var _this$options2;
|
|
110
|
-
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.outputPath && this.options.tilesetName && (await isFileExists(join(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`)))) {
|
|
111
|
-
await removeFile(join(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
getRecord(fileName) {
|
|
115
|
-
return this.tilesConverted[fileName];
|
|
116
|
-
}
|
|
117
|
-
setRecord(fileName, object) {
|
|
118
|
-
this.tilesConverted[fileName] = object;
|
|
119
|
-
}
|
|
120
|
-
async addNode(filename, nodeId, dumpMetadata) {
|
|
121
|
-
const {
|
|
122
|
-
nodes
|
|
123
|
-
} = this.getRecord(filename) || {
|
|
124
|
-
nodes: []
|
|
125
|
-
};
|
|
126
|
-
nodes.push({
|
|
127
|
-
nodeId,
|
|
128
|
-
done: false,
|
|
129
|
-
dumpMetadata
|
|
130
|
-
});
|
|
131
|
-
if (nodes.length === 1) {
|
|
132
|
-
this.setRecord(filename, {
|
|
133
|
-
nodes
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
await this.updateDumpFile();
|
|
137
|
-
}
|
|
138
|
-
clearDumpRecord(filename) {
|
|
139
|
-
this.setRecord(filename, {
|
|
140
|
-
nodes: []
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
addTexturesDefinitions(textureDefinitions) {
|
|
144
|
-
this.textureSetDefinitions = textureDefinitions;
|
|
145
|
-
}
|
|
146
|
-
updateDoneStatus(filename, nodeId, resourceType, value) {
|
|
147
|
-
var _this$tilesConverted$;
|
|
148
|
-
const nodeDump = (_this$tilesConverted$ = this.tilesConverted[filename]) === null || _this$tilesConverted$ === void 0 ? void 0 : _this$tilesConverted$.nodes.find(element => element.nodeId === nodeId);
|
|
149
|
-
if (nodeDump) {
|
|
150
|
-
if (!nodeDump.progress) {
|
|
151
|
-
nodeDump.progress = {};
|
|
152
|
-
}
|
|
153
|
-
nodeDump.progress[resourceType] = value;
|
|
154
|
-
if (!value) {
|
|
155
|
-
nodeDump.done = false;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
async updateConvertedTilesDump(changedRecords, writeResults) {
|
|
160
|
-
for (let i = 0; i < changedRecords.length; i++) {
|
|
161
|
-
if (changedRecords[i] && 'value' in writeResults[i]) {
|
|
162
|
-
const {
|
|
163
|
-
sourceId,
|
|
164
|
-
resourceType,
|
|
165
|
-
outputId
|
|
166
|
-
} = changedRecords[i];
|
|
167
|
-
if (!sourceId || !resourceType || !outputId) continue;
|
|
168
204
|
for (const node of this.tilesConverted[sourceId].nodes) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
205
|
+
if (node.nodeId === outputId && node.progress) {
|
|
206
|
+
node.progress[resourceType] = true;
|
|
207
|
+
let done = false;
|
|
208
|
+
for (const key in node.progress) {
|
|
209
|
+
done = node.progress[key];
|
|
210
|
+
if (!done)
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
node.done = done;
|
|
214
|
+
if (node.done) {
|
|
215
|
+
delete node.progress;
|
|
216
|
+
}
|
|
217
|
+
break;
|
|
175
218
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Update 3d-tiles-converter dump file
|
|
223
|
+
* @param filename - source filename
|
|
224
|
+
* @param nodeId - nodeId
|
|
225
|
+
* @param done - conversion status
|
|
226
|
+
*/
|
|
227
|
+
async updateConvertedNodesDumpFile(filename, nodeId, done) {
|
|
228
|
+
const nodeDump = this.tilesConverted[filename]?.nodes.find((element) => element.nodeId === nodeId);
|
|
229
|
+
if (nodeDump) {
|
|
230
|
+
nodeDump.done = done;
|
|
231
|
+
await this.updateDumpFile();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Check is source file conversion complete
|
|
236
|
+
* @param filename - source filename
|
|
237
|
+
* @returns true if source file conversion complete
|
|
238
|
+
*/
|
|
239
|
+
isFileConversionComplete(filename) {
|
|
240
|
+
let result = true;
|
|
241
|
+
for (const node of this.tilesConverted[filename]?.nodes || []) {
|
|
242
|
+
if (!node.done) {
|
|
243
|
+
result = false;
|
|
244
|
+
break;
|
|
179
245
|
}
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
246
|
}
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
await this.updateDumpFile();
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
isFileConversionComplete(filename) {
|
|
196
|
-
var _this$tilesConverted$4, _this$tilesConverted$5;
|
|
197
|
-
let result = true;
|
|
198
|
-
for (const node of ((_this$tilesConverted$3 = this.tilesConverted[filename]) === null || _this$tilesConverted$3 === void 0 ? void 0 : _this$tilesConverted$3.nodes) || []) {
|
|
199
|
-
var _this$tilesConverted$3;
|
|
200
|
-
if (!node.done) {
|
|
201
|
-
result = false;
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return result && ((_this$tilesConverted$4 = this.tilesConverted[filename]) === null || _this$tilesConverted$4 === void 0 ? void 0 : (_this$tilesConverted$5 = _this$tilesConverted$4.nodes) === null || _this$tilesConverted$5 === void 0 ? void 0 : _this$tilesConverted$5.length) > 0;
|
|
206
|
-
}
|
|
207
|
-
setMaterialsDefinitions(materialDefinitions) {
|
|
208
|
-
this.materialDefinitions = materialDefinitions;
|
|
209
|
-
}
|
|
247
|
+
return result && this.tilesConverted[filename]?.nodes?.length > 0;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Set materialDefinitions into a dump
|
|
251
|
+
* @param materialDefinitions - Array materialDefinitions
|
|
252
|
+
*/
|
|
253
|
+
setMaterialsDefinitions(materialDefinitions) {
|
|
254
|
+
this.materialDefinitions = materialDefinitions;
|
|
255
|
+
}
|
|
210
256
|
}
|
|
211
|
-
//# sourceMappingURL=conversion-dump.js.map
|
|
@@ -36,7 +36,7 @@ export declare function isFileExists(fileName: string): Promise<boolean>;
|
|
|
36
36
|
*
|
|
37
37
|
* @param path
|
|
38
38
|
*/
|
|
39
|
-
export declare function removeDir(path: string):
|
|
39
|
+
export declare function removeDir(path: string): any;
|
|
40
40
|
/**
|
|
41
41
|
* Remove file with path
|
|
42
42
|
*
|