@loaders.gl/tile-converter 4.3.0-alpha.4 → 4.3.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 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +2 -2
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js +5 -4
- package/dist/converter-cli.js +2 -20
- package/dist/converter.min.cjs +69 -69
- package/dist/deps-installer/deps-installer.js +1 -1
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.js +6 -14
- 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 +14 -40
- package/dist/i3s-converter/helpers/progress.js +1 -1
- package/dist/i3s-converter/i3s-converter.d.ts +23 -23
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +64 -134
- package/dist/i3s-server/app.d.ts +2 -1
- package/dist/i3s-server/app.d.ts.map +1 -1
- package/dist/i3s-server/app.js +7 -10
- package/dist/i3s-server/bin/i3s-server.min.cjs +71 -71
- package/dist/i3s-server/bin/www.js +5 -0
- package/dist/index.cjs +92 -185
- package/dist/index.cjs.map +3 -3
- package/dist/lib/utils/statistic-utils.d.ts +20 -0
- package/dist/lib/utils/statistic-utils.d.ts.map +1 -0
- package/dist/lib/utils/{statistic-utills.js → statistic-utils.js} +17 -4
- package/dist/pgm-loader.js +1 -1
- package/package.json +19 -20
- package/src/3d-tiles-converter/3d-tiles-converter.ts +4 -3
- package/src/3d-tiles-converter/helpers/load-i3s.ts +5 -4
- package/src/converter-cli.ts +3 -28
- package/src/i3s-converter/helpers/node-index-document.ts +16 -26
- package/src/i3s-converter/helpers/node-pages.ts +20 -46
- package/src/i3s-converter/helpers/progress.ts +1 -1
- package/src/i3s-converter/i3s-converter.ts +92 -160
- package/src/i3s-server/app.ts +7 -10
- package/src/i3s-server/bin/www.ts +6 -0
- package/src/lib/utils/{statistic-utills.ts → statistic-utils.ts} +21 -4
- package/bin/slpk-extractor.js +0 -2
- package/dist/i3s-server/controllers/index-controller.d.ts +0 -8
- package/dist/i3s-server/controllers/index-controller.d.ts.map +0 -1
- package/dist/i3s-server/controllers/index-controller.js +0 -31
- package/dist/i3s-server/routes/index.d.ts +0 -2
- package/dist/i3s-server/routes/index.d.ts.map +0 -1
- package/dist/i3s-server/routes/index.js +0 -17
- package/dist/lib/utils/statistic-utills.d.ts +0 -8
- package/dist/lib/utils/statistic-utills.d.ts.map +0 -1
- package/dist/slpk-extractor/slpk-extractor.d.ts +0 -23
- package/dist/slpk-extractor/slpk-extractor.d.ts.map +0 -1
- package/dist/slpk-extractor/slpk-extractor.js +0 -73
- package/dist/slpk-extractor-cli.d.ts +0 -17
- package/dist/slpk-extractor-cli.d.ts.map +0 -1
- package/dist/slpk-extractor-cli.js +0 -105
- package/dist/slpk-extractor.min.cjs +0 -344
- package/src/i3s-server/controllers/index-controller.ts +0 -32
- package/src/i3s-server/routes/index.ts +0 -18
- package/src/slpk-extractor/slpk-extractor.ts +0 -102
- package/src/slpk-extractor-cli.ts +0 -136
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts time value to string.
|
|
3
|
+
* @param time - high-resolution real time in a [seconds, nanoseconds] tuple Array, or a value on milliseconds.
|
|
4
|
+
* @returns string representation of the time
|
|
5
|
+
*/
|
|
6
|
+
export declare function timeConverter(time: number | [number, number]): string;
|
|
7
|
+
/**
|
|
8
|
+
* Calculates overall datatset size
|
|
9
|
+
* @param params - params object
|
|
10
|
+
* @param params.slpk - if dataset is in slpk format
|
|
11
|
+
* @param params.outputPath - path to the folder containing the dataset
|
|
12
|
+
* @param params.tilesetName - tileset name
|
|
13
|
+
* @returns dataset size in bytes
|
|
14
|
+
*/
|
|
15
|
+
export declare function calculateDatasetSize(params: {
|
|
16
|
+
slpk?: boolean;
|
|
17
|
+
outputPath: string;
|
|
18
|
+
tilesetName: string;
|
|
19
|
+
}): Promise<number | null>;
|
|
20
|
+
//# sourceMappingURL=statistic-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statistic-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/statistic-utils.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAarE;AA6BD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkBzB"}
|
|
@@ -41,7 +41,15 @@ function timeConverterFromSecondsAndMilliseconds(timeInSeconds, milliseconds) {
|
|
|
41
41
|
}
|
|
42
42
|
return result;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Calculates overall datatset size
|
|
46
|
+
* @param params - params object
|
|
47
|
+
* @param params.slpk - if dataset is in slpk format
|
|
48
|
+
* @param params.outputPath - path to the folder containing the dataset
|
|
49
|
+
* @param params.tilesetName - tileset name
|
|
50
|
+
* @returns dataset size in bytes
|
|
51
|
+
*/
|
|
52
|
+
export async function calculateDatasetSize(params) {
|
|
45
53
|
const { slpk, outputPath, tilesetName } = params;
|
|
46
54
|
const fullOutputPath = getAbsoluteFilePath(outputPath);
|
|
47
55
|
try {
|
|
@@ -51,7 +59,7 @@ export async function calculateFilesSize(params) {
|
|
|
51
59
|
return stat.size;
|
|
52
60
|
}
|
|
53
61
|
const directoryPath = join(fullOutputPath, tilesetName);
|
|
54
|
-
const totalSize = await
|
|
62
|
+
const totalSize = await getDirectorySize(directoryPath);
|
|
55
63
|
return totalSize;
|
|
56
64
|
}
|
|
57
65
|
catch (error) {
|
|
@@ -59,13 +67,18 @@ export async function calculateFilesSize(params) {
|
|
|
59
67
|
return null;
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Calculates directory size
|
|
72
|
+
* @param dirPath - path to the directory
|
|
73
|
+
* @returns directory size in bytes
|
|
74
|
+
*/
|
|
75
|
+
async function getDirectorySize(dirPath) {
|
|
63
76
|
let totalFileSize = 0;
|
|
64
77
|
const files = await fs.readdir(dirPath);
|
|
65
78
|
for (const file of files) {
|
|
66
79
|
const fileStat = await fs.stat(join(dirPath, file));
|
|
67
80
|
if (fileStat.isDirectory()) {
|
|
68
|
-
totalFileSize += await
|
|
81
|
+
totalFileSize += await getDirectorySize(join(dirPath, file));
|
|
69
82
|
}
|
|
70
83
|
else {
|
|
71
84
|
totalFileSize += fileStat.size;
|
package/dist/pgm-loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Geoid, parsePGM } from '@math.gl/geoid';
|
|
2
2
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
3
3
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
4
|
-
const VERSION = typeof "4.3.0-alpha.
|
|
4
|
+
const VERSION = typeof "4.3.0-alpha.5" !== 'undefined' ? "4.3.0-alpha.5" : 'latest';
|
|
5
5
|
export { Geoid };
|
|
6
6
|
/**
|
|
7
7
|
* Loader for PGM - Netpbm grayscale image format
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tile-converter",
|
|
3
|
-
"version": "4.3.0-alpha.
|
|
3
|
+
"version": "4.3.0-alpha.6",
|
|
4
4
|
"description": "Converter",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"bin": {
|
|
31
31
|
"i3s-server": "./bin/i3s-server.js",
|
|
32
|
-
"slpk-extractor": "./bin/slpk-extractor.js",
|
|
33
32
|
"tile-converter": "./bin/converter.js"
|
|
34
33
|
},
|
|
35
34
|
"files": [
|
|
@@ -46,27 +45,26 @@
|
|
|
46
45
|
"process": false
|
|
47
46
|
},
|
|
48
47
|
"scripts": {
|
|
49
|
-
"pre-build": "npm run build-converter-bundle && npm run build-
|
|
48
|
+
"pre-build": "npm run build-converter-bundle && npm run build-i3s-server-bundle && npm run copy-certificates",
|
|
50
49
|
"build-converter-bundle": "esbuild src/converter-cli.ts --outfile=dist/converter.min.cjs --platform=node --target=esnext,node14 --external:join-images --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\"",
|
|
51
|
-
"build-slpk-extractor-bundle": "esbuild src/slpk-extractor-cli.ts --outfile=dist/slpk-extractor.min.cjs --platform=node --target=esnext,node14 --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\"",
|
|
52
50
|
"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
51
|
"copy-certificates": "cp -R src/i3s-server/certs dist/i3s-server"
|
|
54
52
|
},
|
|
55
53
|
"dependencies": {
|
|
56
|
-
"@loaders.gl/3d-tiles": "4.3.0-alpha.
|
|
57
|
-
"@loaders.gl/compression": "4.3.0-alpha.
|
|
58
|
-
"@loaders.gl/crypto": "4.3.0-alpha.
|
|
59
|
-
"@loaders.gl/draco": "4.3.0-alpha.
|
|
60
|
-
"@loaders.gl/gltf": "4.3.0-alpha.
|
|
61
|
-
"@loaders.gl/i3s": "4.3.0-alpha.
|
|
62
|
-
"@loaders.gl/images": "4.3.0-alpha.
|
|
63
|
-
"@loaders.gl/loader-utils": "4.3.0-alpha.
|
|
64
|
-
"@loaders.gl/math": "4.3.0-alpha.
|
|
65
|
-
"@loaders.gl/polyfills": "4.3.0-alpha.
|
|
66
|
-
"@loaders.gl/textures": "4.3.0-alpha.
|
|
67
|
-
"@loaders.gl/tiles": "4.3.0-alpha.
|
|
68
|
-
"@loaders.gl/worker-utils": "4.3.0-alpha.
|
|
69
|
-
"@loaders.gl/zip": "4.3.0-alpha.
|
|
54
|
+
"@loaders.gl/3d-tiles": "4.3.0-alpha.6",
|
|
55
|
+
"@loaders.gl/compression": "4.3.0-alpha.6",
|
|
56
|
+
"@loaders.gl/crypto": "4.3.0-alpha.6",
|
|
57
|
+
"@loaders.gl/draco": "4.3.0-alpha.6",
|
|
58
|
+
"@loaders.gl/gltf": "4.3.0-alpha.6",
|
|
59
|
+
"@loaders.gl/i3s": "4.3.0-alpha.6",
|
|
60
|
+
"@loaders.gl/images": "4.3.0-alpha.6",
|
|
61
|
+
"@loaders.gl/loader-utils": "4.3.0-alpha.6",
|
|
62
|
+
"@loaders.gl/math": "4.3.0-alpha.6",
|
|
63
|
+
"@loaders.gl/polyfills": "4.3.0-alpha.6",
|
|
64
|
+
"@loaders.gl/textures": "4.3.0-alpha.6",
|
|
65
|
+
"@loaders.gl/tiles": "4.3.0-alpha.6",
|
|
66
|
+
"@loaders.gl/worker-utils": "4.3.0-alpha.6",
|
|
67
|
+
"@loaders.gl/zip": "4.3.0-alpha.6",
|
|
70
68
|
"@math.gl/core": "^4.0.0",
|
|
71
69
|
"@math.gl/culling": "^4.0.0",
|
|
72
70
|
"@math.gl/geoid": "^4.0.0",
|
|
@@ -89,10 +87,11 @@
|
|
|
89
87
|
"sharp": "^0.31.3"
|
|
90
88
|
},
|
|
91
89
|
"devDependencies": {
|
|
92
|
-
"@types/express": "^4.17.17"
|
|
90
|
+
"@types/express": "^4.17.17",
|
|
91
|
+
"@types/inquirer": "^9.0.7"
|
|
93
92
|
},
|
|
94
93
|
"peerDependencies": {
|
|
95
94
|
"@loaders.gl/core": "^4.0.0"
|
|
96
95
|
},
|
|
97
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "315f2e232fc4e6a477c41de800a54d3e3d957e8c"
|
|
98
97
|
}
|
|
@@ -17,7 +17,7 @@ import {PGMLoader} from '../pgm-loader';
|
|
|
17
17
|
import {i3sObbTo3dTilesObb} from './helpers/i3s-obb-to-3d-tiles-obb';
|
|
18
18
|
import {convertScreenThresholdToGeometricError} from '../lib/utils/lod-conversion-utils';
|
|
19
19
|
import {writeFile, removeDir} from '../lib/utils/file-utils';
|
|
20
|
-
import {
|
|
20
|
+
import {calculateDatasetSize, timeConverter} from '../lib/utils/statistic-utils';
|
|
21
21
|
import {TILESET as tilesetTemplate} from './json-templates/tileset';
|
|
22
22
|
import {createObbFromMbs} from '../i3s-converter/helpers/coordinate-converter';
|
|
23
23
|
import {WorkerFarm} from '@loaders.gl/worker-utils';
|
|
@@ -29,6 +29,7 @@ import {I3SLoaderOptions} from '@loaders.gl/i3s/src/i3s-loader';
|
|
|
29
29
|
import {ZipFileSystem} from '../../../zip/src';
|
|
30
30
|
import {ConversionDump, ConversionDumpOptions} from '../lib/utils/conversion-dump';
|
|
31
31
|
import {Progress} from '../i3s-converter/helpers/progress';
|
|
32
|
+
import {PromptModule} from 'inquirer';
|
|
32
33
|
|
|
33
34
|
const I3S = 'I3S';
|
|
34
35
|
|
|
@@ -88,7 +89,7 @@ export default class Tiles3DConverter {
|
|
|
88
89
|
tilesetName: string;
|
|
89
90
|
maxDepth?: number;
|
|
90
91
|
egmFilePath: string;
|
|
91
|
-
inquirer?:
|
|
92
|
+
inquirer?: {prompt: PromptModule};
|
|
92
93
|
analyze?: boolean;
|
|
93
94
|
}): Promise<string | undefined> {
|
|
94
95
|
if (isBrowser) {
|
|
@@ -474,7 +475,7 @@ export default class Tiles3DConverter {
|
|
|
474
475
|
outputPath: string;
|
|
475
476
|
tilesetName: string;
|
|
476
477
|
}): Promise<void> {
|
|
477
|
-
const filesSize = await
|
|
478
|
+
const filesSize = await calculateDatasetSize(params);
|
|
478
479
|
const diff = process.hrtime(this.conversionStartTime);
|
|
479
480
|
const conversionTime = timeConverter(diff);
|
|
480
481
|
|
|
@@ -115,13 +115,14 @@ export async function getNodeCount(fileSystem: ZipFileSystem | null): Promise<nu
|
|
|
115
115
|
if (!fileSystem?.fileProvider) {
|
|
116
116
|
return 0;
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
const nodeSet = new Set();
|
|
119
119
|
const filesIterator = makeZipCDHeaderIterator(fileSystem.fileProvider);
|
|
120
120
|
for await (const file of filesIterator) {
|
|
121
121
|
const filename = file.fileName;
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
const nodeNumberSearchResult = /^nodes\/(\d+)\//.exec(filename);
|
|
123
|
+
if (nodeNumberSearchResult) {
|
|
124
|
+
nodeSet.add(nodeNumberSearchResult[1]);
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
|
-
return
|
|
127
|
+
return nodeSet.size;
|
|
127
128
|
}
|
package/src/converter-cli.ts
CHANGED
|
@@ -30,14 +30,11 @@ type TileConversionOptions = {
|
|
|
30
30
|
instantNodeWriting: boolean;
|
|
31
31
|
/** Try to merge similar materials to be able to merge meshes into one node (I3S to 3DTiles conversion only) */
|
|
32
32
|
mergeMaterials: boolean;
|
|
33
|
-
/** 3DTiles->I3S only. location of 7z.exe archiver to create slpk on Windows OS, default: "C:\Program Files\7-Zip\7z.exe" */
|
|
34
|
-
sevenZipExe: string;
|
|
35
33
|
/** location of the Earth Gravity Model (*.pgm) file to convert heights from ellipsoidal to gravity-related format,
|
|
34
|
+
* "None" for not using Earth Gravity Model (*.pgm)
|
|
36
35
|
* default: "./deps/egm2008-5.pgm". A model file can be loaded from GeographicLib
|
|
37
36
|
* https://geographiclib.sourceforge.io/html/geoid.html */
|
|
38
37
|
egm: string;
|
|
39
|
-
/** 3DTiles->I3S only. Whether the converter uses Earth Gravity Model (*.pgm) */
|
|
40
|
-
noEgm: boolean;
|
|
41
38
|
/** 3DTile->I3S only. Token for Cesium ION tileset authentication. */
|
|
42
39
|
token?: string;
|
|
43
40
|
/** 3DTiles->I3S only. Enable draco compression for geometry. Default: true */
|
|
@@ -54,8 +51,6 @@ type TileConversionOptions = {
|
|
|
54
51
|
validate: boolean;
|
|
55
52
|
/** Maximal depth of the hierarchical tiles tree traversal, default: infinite */
|
|
56
53
|
maxDepth?: number;
|
|
57
|
-
/** 3DTiles->I3S only. Whether the converter generates *.slpk (Scene Layer Package) I3S output file */
|
|
58
|
-
slpk: boolean;
|
|
59
54
|
/** adds hash file to the slpk if there's no one */
|
|
60
55
|
addHash: boolean;
|
|
61
56
|
/** Feature metadata class from EXT_FEATURE_METADATA or EXT_STRUCTURAL_METADATA extensions */
|
|
@@ -178,18 +173,13 @@ function printHelp(): void {
|
|
|
178
173
|
console.log(
|
|
179
174
|
'--split-nodes [Prevent to merge similar materials that could lead to incorrect visualization (I3S to 3DTiles conversion only)]'
|
|
180
175
|
);
|
|
181
|
-
console.log('--slpk [Generate slpk (Scene Layer Packages) I3S output file]');
|
|
182
176
|
console.log(
|
|
183
177
|
'--tileset [tileset.json file (3DTiles) / http://..../SceneServer/layers/0 resource (I3S)]'
|
|
184
178
|
);
|
|
185
179
|
console.log('--input-type [tileset input type: I3S or 3DTILES]');
|
|
186
180
|
console.log(
|
|
187
|
-
'--
|
|
181
|
+
'--egm [location of Earth Gravity Model *.pgm file to convert heights from ellipsoidal to gravity-related format or "None" to not use it. A model file can be loaded from GeographicLib https://geographiclib.sourceforge.io/html/geoid.html], default: "./deps/egm2008-5.zip"'
|
|
188
182
|
);
|
|
189
|
-
console.log(
|
|
190
|
-
'--egm [location of Earth Gravity Model *.pgm file to convert heights from ellipsoidal to gravity-related format. A model file can be loaded from GeographicLib https://geographiclib.sourceforge.io/html/geoid.html], default: "./deps/egm2008-5.zip"'
|
|
191
|
-
);
|
|
192
|
-
console.log('--no-egm [Disable Geod transformation via the EGM file]');
|
|
193
183
|
console.log('--token [Token for Cesium ION tilesets authentication]');
|
|
194
184
|
console.log('--no-draco [Disable draco compression for geometry]');
|
|
195
185
|
console.log(
|
|
@@ -236,8 +226,6 @@ async function convert(options: ValidatedTileConversionOptions) {
|
|
|
236
226
|
outputPath: options.output,
|
|
237
227
|
tilesetName: options.name,
|
|
238
228
|
maxDepth: options.maxDepth,
|
|
239
|
-
slpk: options.slpk,
|
|
240
|
-
sevenZipExe: options.sevenZipExe,
|
|
241
229
|
egmFilePath: options.egm,
|
|
242
230
|
token: options.token,
|
|
243
231
|
draco: options.draco,
|
|
@@ -277,7 +265,6 @@ function validateOptions(
|
|
|
277
265
|
condition: (value: any) => addHash || Boolean(value) || Boolean(options.analyze)
|
|
278
266
|
},
|
|
279
267
|
output: {getMessage: () => console.log('Missed: --output [Output path name]')},
|
|
280
|
-
sevenZipExe: {getMessage: () => console.log('Missed: --7zExe [7z archiver executable path]')},
|
|
281
268
|
egm: {getMessage: () => console.log('Missed: --egm [*.pgm earth gravity model file path]')},
|
|
282
269
|
tileset: {getMessage: () => console.log('Missed: --tileset [tileset.json file]')},
|
|
283
270
|
inputType: {
|
|
@@ -315,17 +302,14 @@ function parseOptions(args: string[]): TileConversionOptions {
|
|
|
315
302
|
output: 'data',
|
|
316
303
|
instantNodeWriting: false,
|
|
317
304
|
mergeMaterials: true,
|
|
318
|
-
sevenZipExe: 'C:\\Program Files\\7-Zip\\7z.exe',
|
|
319
305
|
egm: join(process.cwd(), 'deps', 'egm2008-5.pgm'),
|
|
320
306
|
draco: true,
|
|
321
307
|
installDependencies: false,
|
|
322
308
|
generateTextures: false,
|
|
323
309
|
generateBoundingVolumes: false,
|
|
324
310
|
validate: false,
|
|
325
|
-
slpk: false,
|
|
326
311
|
addHash: false,
|
|
327
|
-
quiet: false
|
|
328
|
-
noEgm: false
|
|
312
|
+
quiet: false
|
|
329
313
|
};
|
|
330
314
|
|
|
331
315
|
// eslint-disable-next-line complexity
|
|
@@ -353,21 +337,12 @@ function parseOptions(args: string[]): TileConversionOptions {
|
|
|
353
337
|
case '--max-depth':
|
|
354
338
|
opts.maxDepth = getIntegerValue(index, args);
|
|
355
339
|
break;
|
|
356
|
-
case '--slpk':
|
|
357
|
-
opts.slpk = getBooleanValue(index, args);
|
|
358
|
-
break;
|
|
359
340
|
case '--add-hash':
|
|
360
341
|
opts.addHash = getBooleanValue(index, args);
|
|
361
342
|
break;
|
|
362
|
-
case '--7zExe':
|
|
363
|
-
opts.sevenZipExe = getStringValue(index, args);
|
|
364
|
-
break;
|
|
365
343
|
case '--egm':
|
|
366
344
|
opts.egm = getStringValue(index, args);
|
|
367
345
|
break;
|
|
368
|
-
case '--no-egm':
|
|
369
|
-
opts.noEgm = getBooleanValue(index, args);
|
|
370
|
-
break;
|
|
371
346
|
case '--token':
|
|
372
347
|
opts.token = getStringValue(index, args);
|
|
373
348
|
break;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from '@loaders.gl/i3s';
|
|
9
9
|
import transform from 'json-map-transform';
|
|
10
10
|
import {v4 as uuidv4} from 'uuid';
|
|
11
|
-
import {openJson,
|
|
11
|
+
import {openJson, writeFileForSlpk} from '../../lib/utils/file-utils';
|
|
12
12
|
import I3SConverter from '../i3s-converter';
|
|
13
13
|
import {NODE as nodeTemplate} from '../json-templates/node';
|
|
14
14
|
import {I3SConvertedResources} from '../types';
|
|
@@ -155,27 +155,20 @@ export class NodeIndexDocument {
|
|
|
155
155
|
*/
|
|
156
156
|
private async write(node: Node3DIndexDocument): Promise<void> {
|
|
157
157
|
const path = join(this.converter.layers0Path, 'nodes', this.id);
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
{
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
);
|
|
173
|
-
} else {
|
|
174
|
-
await this.converter.writeQueue.enqueue(
|
|
175
|
-
{writePromise: () => writeFile(path, JSON.stringify(node))},
|
|
176
|
-
true
|
|
177
|
-
);
|
|
178
|
-
}
|
|
158
|
+
await this.converter.writeQueue.enqueue(
|
|
159
|
+
{
|
|
160
|
+
archiveKey: `nodes/${this.id}/3dNodeIndexDocument.json.gz`,
|
|
161
|
+
writePromise: () =>
|
|
162
|
+
writeFileForSlpk(
|
|
163
|
+
path,
|
|
164
|
+
JSON.stringify(node),
|
|
165
|
+
'3dNodeIndexDocument.json',
|
|
166
|
+
true,
|
|
167
|
+
this.converter.compressList
|
|
168
|
+
)
|
|
169
|
+
},
|
|
170
|
+
true
|
|
171
|
+
);
|
|
179
172
|
}
|
|
180
173
|
|
|
181
174
|
/**
|
|
@@ -188,10 +181,7 @@ export class NodeIndexDocument {
|
|
|
188
181
|
}
|
|
189
182
|
const path = this.id;
|
|
190
183
|
const parentNodePath = join(this.converter.layers0Path, 'nodes', path);
|
|
191
|
-
|
|
192
|
-
if (this.converter.options.slpk) {
|
|
193
|
-
parentNodeFileName = '3dNodeIndexDocument.json';
|
|
194
|
-
}
|
|
184
|
+
const parentNodeFileName = '3dNodeIndexDocument.json';
|
|
195
185
|
return (await openJson(parentNodePath, parentNodeFileName)) as Node3DIndexDocument;
|
|
196
186
|
}
|
|
197
187
|
|
|
@@ -51,7 +51,7 @@ export default class NodePages {
|
|
|
51
51
|
* @param writeFileFunc - function to save one nodePage into a file
|
|
52
52
|
* @param nodesPerPage - length limit for one nodePage. An additional nodePage is created when this limit is met
|
|
53
53
|
*/
|
|
54
|
-
constructor(writeFileFunc, nodesPerPage, converter: I3SConverter) {
|
|
54
|
+
constructor(writeFileFunc, nodesPerPage: number, converter: I3SConverter) {
|
|
55
55
|
this.nodesPerPage = nodesPerPage;
|
|
56
56
|
this.nodesCounter = 0;
|
|
57
57
|
// @ts-expect-error
|
|
@@ -75,16 +75,9 @@ export default class NodePages {
|
|
|
75
75
|
* @param nodePageId - node page id
|
|
76
76
|
* @returns file path and file name
|
|
77
77
|
*/
|
|
78
|
-
private getNodePageFileName(nodePageId): {filePath: string; fileName: string} {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (this.converter.options.slpk) {
|
|
82
|
-
filePath = join(this.converter.layers0Path, 'nodepages');
|
|
83
|
-
fileName = `${nodePageId.toString()}.json`;
|
|
84
|
-
} else {
|
|
85
|
-
filePath = join(this.converter.layers0Path, 'nodepages', nodePageId.toString());
|
|
86
|
-
fileName = 'index.json';
|
|
87
|
-
}
|
|
78
|
+
private getNodePageFileName(nodePageId: number): {filePath: string; fileName: string} {
|
|
79
|
+
const filePath = join(this.converter.layers0Path, 'nodepages');
|
|
80
|
+
const fileName = `${nodePageId.toString()}.json`;
|
|
88
81
|
return {filePath, fileName};
|
|
89
82
|
}
|
|
90
83
|
|
|
@@ -190,23 +183,14 @@ export default class NodePages {
|
|
|
190
183
|
nodePage.nodes.push(node);
|
|
191
184
|
}
|
|
192
185
|
const nodePageStr = JSON.stringify(nodePage);
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
{
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
);
|
|
202
|
-
} else {
|
|
203
|
-
await this.converter.writeQueue.enqueue(
|
|
204
|
-
{
|
|
205
|
-
writePromise: () => this.writeFile(filePath, nodePageStr)
|
|
206
|
-
},
|
|
207
|
-
true
|
|
208
|
-
);
|
|
209
|
-
}
|
|
186
|
+
await this.converter.writeQueue.enqueue(
|
|
187
|
+
{
|
|
188
|
+
archiveKey: `nodePages/${nodePageIndex.toString()}.json.gz`,
|
|
189
|
+
writePromise: () =>
|
|
190
|
+
this.writeFile(filePath, nodePageStr, fileName, true, this.converter.compressList)
|
|
191
|
+
},
|
|
192
|
+
true
|
|
193
|
+
);
|
|
210
194
|
}
|
|
211
195
|
|
|
212
196
|
/**
|
|
@@ -236,25 +220,15 @@ export default class NodePages {
|
|
|
236
220
|
await this.saveMetadata();
|
|
237
221
|
return;
|
|
238
222
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
await this.saveMetadata();
|
|
249
|
-
} else {
|
|
250
|
-
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
251
|
-
const nodePageStr = JSON.stringify(nodePage);
|
|
252
|
-
const nodePagePath = join(this.converter.layers0Path, 'nodepages', index.toString());
|
|
253
|
-
await this.converter.writeQueue.enqueue({
|
|
254
|
-
writePromise: () => this.writeFile(nodePagePath, nodePageStr)
|
|
255
|
-
});
|
|
256
|
-
}
|
|
223
|
+
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
224
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
225
|
+
const slpkPath = join(this.converter.layers0Path, 'nodepages');
|
|
226
|
+
await this.converter.writeQueue.enqueue({
|
|
227
|
+
archiveKey: `nodePages/${index.toString()}.json.gz`,
|
|
228
|
+
writePromise: () => this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`)
|
|
229
|
+
});
|
|
257
230
|
}
|
|
231
|
+
await this.saveMetadata();
|
|
258
232
|
}
|
|
259
233
|
|
|
260
234
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import process from 'process';
|
|
2
|
-
import {timeConverter} from '../../lib/utils/statistic-
|
|
2
|
+
import {timeConverter} from '../../lib/utils/statistic-utils';
|
|
3
3
|
|
|
4
4
|
/** Defines a threshold that is used to check if the process velocity can be consifered trust. */
|
|
5
5
|
const THRESHOLD_DEFAULT = 0.2;
|