@loaders.gl/tile-converter 4.2.0-alpha.5 → 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 +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +42 -22
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +4 -0
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js +3 -28
- package/dist/converter-cli.js +4 -2
- package/dist/converter.min.cjs +95 -95
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/deps-installer/deps-installer.js +6 -1
- package/dist/i3s-converter/helpers/attribute-metadata-info.js +4 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +2 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js +2 -2
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.js +4 -2
- package/dist/i3s-converter/helpers/geometry-attributes.js +6 -5
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +15 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +52 -12
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +12 -14
- package/dist/i3s-converter/helpers/node-index-document.d.ts +8 -1
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.js +18 -11
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +27 -26
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/progress.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/progress.js +23 -18
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts +8 -1
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js +12 -3
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +190 -66
- package/dist/i3s-converter/json-templates/node.js +1 -1
- package/dist/i3s-server/bin/i3s-server.min.cjs +69 -69
- package/dist/i3s-server/bin/www.js +6 -4
- package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -1
- package/dist/i3s-server/controllers/slpk-controller.js +3 -1
- package/dist/i3s-server/routes/index.js +11 -8
- package/dist/i3s-server/routes/slpk-router.d.ts.map +1 -1
- package/dist/i3s-server/routes/slpk-router.js +24 -18
- package/dist/i3s-server/utils/server-utils.d.ts.map +1 -1
- package/dist/i3s-server/utils/server-utils.js +8 -5
- package/dist/index.cjs +419 -211
- package/dist/index.cjs.map +3 -3
- package/dist/lib/utils/cli-utils.d.ts.map +1 -1
- package/dist/lib/utils/cli-utils.js +2 -0
- package/dist/lib/utils/conversion-dump.d.ts +9 -1
- package/dist/lib/utils/conversion-dump.d.ts.map +1 -1
- package/dist/lib/utils/conversion-dump.js +44 -21
- 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 +10 -12
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
- package/dist/lib/utils/statistic-utills.js +5 -7
- package/dist/lib/utils/write-queue.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.js +7 -3
- package/dist/pgm-loader.js +1 -1
- package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -1
- package/dist/slpk-extractor/slpk-extractor.js +2 -1
- package/dist/slpk-extractor-cli.d.ts.map +1 -1
- package/dist/slpk-extractor-cli.js +16 -8
- package/dist/slpk-extractor.min.cjs +1 -1
- package/package.json +23 -22
- 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/src/lib/utils/statistic-utills.d.ts +0 -25
|
@@ -5,25 +5,31 @@ import {createSceneServer} from '../utils/create-scene-server';
|
|
|
5
5
|
const textDecoder = new TextDecoder();
|
|
6
6
|
|
|
7
7
|
export const sceneServerRouter = express.Router();
|
|
8
|
-
sceneServerRouter.get('*',
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
sceneServerRouter.get('*', (req, res, next) => {
|
|
9
|
+
async function routerCallback(req, res, next) {
|
|
10
|
+
const file = await getFileByUrl('/');
|
|
11
|
+
if (file) {
|
|
12
|
+
const layer = JSON.parse(textDecoder.decode(file));
|
|
13
|
+
const sceneServerResponse = createSceneServer(layer.name, layer);
|
|
14
|
+
res.send(sceneServerResponse);
|
|
15
|
+
} else {
|
|
16
|
+
res.status(404);
|
|
17
|
+
res.send('File not found');
|
|
18
|
+
}
|
|
17
19
|
}
|
|
20
|
+
routerCallback(req, res, next);
|
|
18
21
|
});
|
|
19
22
|
|
|
20
23
|
export const router = express.Router();
|
|
21
|
-
router.get('*',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
router.get('*', (req, res, next) => {
|
|
25
|
+
async function routerCallback(req, res, next) {
|
|
26
|
+
const file = await getFileByUrl(req.path.replace(/\/+$/, ''));
|
|
27
|
+
if (file) {
|
|
28
|
+
res.send(Buffer.from(file));
|
|
29
|
+
} else {
|
|
30
|
+
res.status(404);
|
|
31
|
+
res.send('File not found');
|
|
32
|
+
}
|
|
28
33
|
}
|
|
34
|
+
routerCallback(req, res, next);
|
|
29
35
|
});
|
|
@@ -32,7 +32,9 @@ export function normalizePort(val: string): number | string | false {
|
|
|
32
32
|
*/
|
|
33
33
|
export function formErrorHandler(
|
|
34
34
|
optionalPort: string | number
|
|
35
|
+
// eslint-disable-next-line no-undef
|
|
35
36
|
): (error: NodeJS.ErrnoException) => void {
|
|
37
|
+
// eslint-disable-next-line no-undef
|
|
36
38
|
return function onError(error: NodeJS.ErrnoException) {
|
|
37
39
|
if (error.syscall !== 'listen') {
|
|
38
40
|
throw error;
|
|
@@ -43,12 +45,12 @@ export function formErrorHandler(
|
|
|
43
45
|
// handle specific listen errors with friendly messages
|
|
44
46
|
switch (error.code) {
|
|
45
47
|
case 'EACCES':
|
|
46
|
-
console.error(`${bind} requires elevated privileges`); // eslint-disable-line no-console
|
|
47
|
-
process.exit(1); // eslint-disable-line no-process-exit
|
|
48
|
+
console.error(`${bind} requires elevated privileges`); // eslint-disable-line no-console
|
|
49
|
+
process.exit(1); // eslint-disable-line no-process-exit
|
|
48
50
|
break;
|
|
49
51
|
case 'EADDRINUSE':
|
|
50
|
-
console.error(`${bind} is already in use`); // eslint-disable-line no-console
|
|
51
|
-
process.exit(1); // eslint-disable-line no-process-exit
|
|
52
|
+
console.error(`${bind} is already in use`); // eslint-disable-line no-console
|
|
53
|
+
process.exit(1); // eslint-disable-line no-process-exit
|
|
52
54
|
break;
|
|
53
55
|
default:
|
|
54
56
|
throw error;
|
|
@@ -25,7 +25,9 @@ export function getStringValue(index: number, args: string[]): string {
|
|
|
25
25
|
*/
|
|
26
26
|
export function getURLValue(index: number, args: string[]): string {
|
|
27
27
|
const value = getStringValue(index, args);
|
|
28
|
+
// eslint-disable-next-line no-console
|
|
28
29
|
console.log(`Input tileset value: ${value}`);
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
29
31
|
console.log(`Modified tileset value: ${value.replace(/\\/g, '/')}`);
|
|
30
32
|
return value.replace(/\\/g, '/');
|
|
31
33
|
}
|
|
@@ -52,7 +52,7 @@ export type TextureSetDefinition = {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
export class ConversionDump {
|
|
55
|
-
/**Restored/resumed dump indicator */
|
|
55
|
+
/** Restored/resumed dump indicator */
|
|
56
56
|
restored: boolean = false;
|
|
57
57
|
/** Conversion options */
|
|
58
58
|
private options?: ConversionDumpOptions;
|
|
@@ -138,7 +138,8 @@ export class ConversionDump {
|
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
140
|
} catch (error) {
|
|
141
|
-
|
|
141
|
+
// prettier-ignore
|
|
142
|
+
console.log('Can\'t open dump file', error); // eslint-disable-line no-console
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
await this.deleteDumpFile();
|
|
@@ -192,7 +193,8 @@ export class ConversionDump {
|
|
|
192
193
|
)
|
|
193
194
|
);
|
|
194
195
|
} catch (error) {
|
|
195
|
-
|
|
196
|
+
// prettier-ignore
|
|
197
|
+
console.log('Can\'t update dump file', error); // eslint-disable-line no-console
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
200
|
}
|
|
@@ -305,30 +307,43 @@ export class ConversionDump {
|
|
|
305
307
|
async updateConvertedTilesDump(
|
|
306
308
|
changedRecords: {outputId?: number | string; sourceId?: string; resourceType?: string}[],
|
|
307
309
|
writeResults: PromiseSettledResult<string | null>[]
|
|
308
|
-
) {
|
|
310
|
+
): Promise<void> {
|
|
309
311
|
for (let i = 0; i < changedRecords.length; i++) {
|
|
310
312
|
if (changedRecords[i] && 'value' in writeResults[i]) {
|
|
311
313
|
const {sourceId, resourceType, outputId} = changedRecords[i];
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
314
|
+
this.updateNodes(sourceId, outputId, resourceType);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
await this.updateDumpFile();
|
|
318
|
+
}
|
|
316
319
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
320
|
+
/**
|
|
321
|
+
* Update done status for a node
|
|
322
|
+
* @param sourceId - source resource Id
|
|
323
|
+
* @param outputId - output node/tile Id
|
|
324
|
+
* @param resourceType - type of resource
|
|
325
|
+
* @returns void
|
|
326
|
+
*/
|
|
327
|
+
private updateNodes(sourceId?: string, outputId?: string | number, resourceType?: string) {
|
|
328
|
+
if (!sourceId || !resourceType || !outputId) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
for (const node of this.tilesConverted[sourceId].nodes) {
|
|
332
|
+
if (node.nodeId === outputId && node.progress) {
|
|
333
|
+
node.progress[resourceType] = true;
|
|
334
|
+
|
|
335
|
+
let done = false;
|
|
336
|
+
for (const key in node.progress) {
|
|
337
|
+
done = node.progress[key];
|
|
338
|
+
if (!done) break;
|
|
328
339
|
}
|
|
340
|
+
node.done = done;
|
|
341
|
+
if (node.done) {
|
|
342
|
+
delete node.progress;
|
|
343
|
+
}
|
|
344
|
+
break;
|
|
329
345
|
}
|
|
330
346
|
}
|
|
331
|
-
await this.updateDumpFile();
|
|
332
347
|
}
|
|
333
348
|
|
|
334
349
|
/**
|
|
@@ -20,7 +20,7 @@ export async function writeFile(
|
|
|
20
20
|
if (data instanceof Promise) {
|
|
21
21
|
toWriteData = new Uint8Array(await data);
|
|
22
22
|
} else if (data instanceof ArrayBuffer) {
|
|
23
|
-
toWriteData = new Uint8Array(data
|
|
23
|
+
toWriteData = new Uint8Array(data);
|
|
24
24
|
} else {
|
|
25
25
|
toWriteData = data;
|
|
26
26
|
}
|
|
@@ -31,7 +31,7 @@ export async function writeFile(
|
|
|
31
31
|
} catch (err) {
|
|
32
32
|
throw err;
|
|
33
33
|
}
|
|
34
|
-
console.log(`${pathFile} saved.`); // eslint-disable-line
|
|
34
|
+
console.log(`${pathFile} saved.`); // eslint-disable-line no-console
|
|
35
35
|
return pathFile;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -57,15 +57,13 @@ export async function writeFileForSlpk(
|
|
|
57
57
|
if (!compressList.includes(pathFile)) {
|
|
58
58
|
compressList.push(pathFile);
|
|
59
59
|
return `${pathFile}.gz`;
|
|
60
|
-
} else {
|
|
61
|
-
return null;
|
|
62
60
|
}
|
|
63
|
-
|
|
64
|
-
const pathGzFile = await compressFileWithGzip(pathFile);
|
|
65
|
-
// After compression, we don't need an uncompressed file
|
|
66
|
-
await removeFile(pathFile);
|
|
67
|
-
return pathGzFile;
|
|
61
|
+
return null;
|
|
68
62
|
}
|
|
63
|
+
const pathGzFile = await compressFileWithGzip(pathFile);
|
|
64
|
+
// After compression, we don't need an uncompressed file
|
|
65
|
+
await removeFile(pathFile);
|
|
66
|
+
return pathGzFile;
|
|
69
67
|
}
|
|
70
68
|
return pathFile;
|
|
71
69
|
}
|
|
@@ -79,7 +77,7 @@ export async function writeFileForSlpk(
|
|
|
79
77
|
export async function openJson(path: string, fileName: string): Promise<{[key: string]: any}> {
|
|
80
78
|
return new Promise((resolve, reject) => {
|
|
81
79
|
let count = 0;
|
|
82
|
-
console.log(`load ${path}/${fileName}.`); // eslint-disable-line
|
|
80
|
+
console.log(`load ${path}/${fileName}.`); // eslint-disable-line no-console
|
|
83
81
|
const intervalId = setInterval(() => {
|
|
84
82
|
const pathFile = join(path, fileName);
|
|
85
83
|
load(pathFile, JSONLoader)
|
|
@@ -119,6 +117,7 @@ export async function isFileExists(fileName: string): Promise<boolean> {
|
|
|
119
117
|
*/
|
|
120
118
|
export function removeDir(path: string) {
|
|
121
119
|
// (node:35607) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
|
|
120
|
+
// @ts-ignore
|
|
122
121
|
return fs.rm(path, {recursive: true});
|
|
123
122
|
}
|
|
124
123
|
|
|
@@ -148,6 +147,7 @@ export async function renameFile(oldPath: string, newPath: string): Promise<void
|
|
|
148
147
|
try {
|
|
149
148
|
await fs.rename(oldPath, newPath);
|
|
150
149
|
} catch (err) {
|
|
151
|
-
|
|
150
|
+
// prettier-ignore
|
|
151
|
+
console.log('Can\'t rename file', err); // eslint-disable-line no-console
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -14,13 +14,12 @@ export function timeConverter(time: number | [number, number]): string {
|
|
|
14
14
|
const timeInSeconds = Math.floor(time / milliSecondsInSecond);
|
|
15
15
|
const milliseconds = time - timeInSeconds * milliSecondsInSecond;
|
|
16
16
|
return timeConverterFromSecondsAndMilliseconds(timeInSeconds, milliseconds);
|
|
17
|
-
} else {
|
|
18
|
-
// time - high-resolution real time in a [seconds, nanoseconds] tuple Array
|
|
19
|
-
const nanoSecondsInMillisecond = 1e6;
|
|
20
|
-
const timeInSeconds = time[0];
|
|
21
|
-
const milliseconds = time[1] / nanoSecondsInMillisecond;
|
|
22
|
-
return timeConverterFromSecondsAndMilliseconds(timeInSeconds, milliseconds);
|
|
23
17
|
}
|
|
18
|
+
// time - high-resolution real time in a [seconds, nanoseconds] tuple Array
|
|
19
|
+
const nanoSecondsInMillisecond = 1e6;
|
|
20
|
+
const timeInSeconds = time[0];
|
|
21
|
+
const milliseconds = time[1] / nanoSecondsInMillisecond;
|
|
22
|
+
return timeConverterFromSecondsAndMilliseconds(timeInSeconds, milliseconds);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
function timeConverterFromSecondsAndMilliseconds(timeInSeconds: number, milliseconds: number) {
|
|
@@ -30,7 +30,7 @@ export type WriteQueueItem = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export default class WriteQueue<T extends WriteQueueItem> extends Queue<T> {
|
|
33
|
-
private intervalId?: NodeJS.
|
|
33
|
+
private intervalId?: NodeJS.Timer; // eslint-disable-line no-undef
|
|
34
34
|
private conversionDump: ConversionDump;
|
|
35
35
|
public writePromise: Promise<void> | null = null;
|
|
36
36
|
public fileMap: {[key: string]: string} = {};
|
|
@@ -65,7 +65,7 @@ export default class WriteQueue<T extends WriteQueueItem> extends Queue<T> {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
startListening() {
|
|
68
|
-
this.intervalId = setInterval(this.startWrite.bind(this), this.listeningInterval);
|
|
68
|
+
this.intervalId = setInterval(() => this.startWrite.bind(this), this.listeningInterval);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
stopListening() {
|
|
@@ -33,6 +33,7 @@ export default class SLPKExtractor {
|
|
|
33
33
|
*/
|
|
34
34
|
public async extract(options: {inputUrl: string; outputPath: string}): Promise<string> {
|
|
35
35
|
if (isBrowser) {
|
|
36
|
+
// eslint-disable-next-line no-console
|
|
36
37
|
console.log(BROWSER_ERROR_MESSAGE);
|
|
37
38
|
return BROWSER_ERROR_MESSAGE;
|
|
38
39
|
}
|
|
@@ -71,7 +72,7 @@ export default class SLPKExtractor {
|
|
|
71
72
|
return path.join(path.dirname(fileName), 'index.json.gz');
|
|
72
73
|
}
|
|
73
74
|
// finds path with name part and extention part
|
|
74
|
-
|
|
75
|
+
const parts = /^(.*\/[^\/\.]*)(\..+)$/.exec(fileName);
|
|
75
76
|
if (!parts) {
|
|
76
77
|
return null;
|
|
77
78
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
1
|
import '@loaders.gl/polyfills';
|
|
3
2
|
import SLPKExtractor from './slpk-extractor/slpk-extractor';
|
|
4
3
|
import {getURLValue, validateOptionsWithEqual} from './lib/utils/cli-utils';
|
|
@@ -41,18 +40,21 @@ async function main() {
|
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
main().catch((error) => {
|
|
44
|
-
console.log(error);
|
|
45
|
-
process.exit(1); // eslint-disable-line
|
|
43
|
+
console.log(error); // eslint-disable-line no-console
|
|
44
|
+
process.exit(1); // eslint-disable-line no-process-exit
|
|
46
45
|
});
|
|
47
46
|
|
|
48
47
|
/**
|
|
49
48
|
* Output for `npx slpk-extractor --help`
|
|
50
49
|
*/
|
|
51
50
|
function printHelp(): void {
|
|
51
|
+
// eslint-disable-next-line no-console
|
|
52
52
|
console.log('cli: converter slpk to I3S...');
|
|
53
|
+
// eslint-disable-next-line no-console
|
|
53
54
|
console.log('--output [Output folder, default: "data" folder]');
|
|
55
|
+
// eslint-disable-next-line no-console
|
|
54
56
|
console.log('--tileset [SLPK file]');
|
|
55
|
-
process.exit(0); // eslint-disable-line
|
|
57
|
+
process.exit(0); // eslint-disable-line no-process-exit
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
/**
|
|
@@ -60,9 +62,12 @@ function printHelp(): void {
|
|
|
60
62
|
* @param options validated slpk-extractor options
|
|
61
63
|
*/
|
|
62
64
|
async function convert(options: ValidatedSLPKExtractionOptions) {
|
|
63
|
-
|
|
64
|
-
console.log(
|
|
65
|
-
|
|
65
|
+
// eslint-disable-next-line no-console
|
|
66
|
+
console.log('------------------------------------------------');
|
|
67
|
+
// eslint-disable-next-line no-console
|
|
68
|
+
console.log('Starting conversion of SLPK');
|
|
69
|
+
// eslint-disable-next-line no-console
|
|
70
|
+
console.log('------------------------------------------------');
|
|
66
71
|
const slpkExtractor = new SLPKExtractor();
|
|
67
72
|
slpkExtractor.extract({
|
|
68
73
|
inputUrl: options.tileset,
|
|
@@ -80,7 +85,9 @@ function validateOptions(options: SLPKExtractionOptions): ValidatedSLPKExtractio
|
|
|
80
85
|
const mandatoryOptionsWithExceptions: {
|
|
81
86
|
[key: string]: () => void;
|
|
82
87
|
} = {
|
|
88
|
+
// eslint-disable-next-line no-console
|
|
83
89
|
output: () => console.log('Missed: --output [Output path name]'),
|
|
90
|
+
// eslint-disable-next-line no-console
|
|
84
91
|
tileset: () => console.log('Missed: --tileset [SLPK file]')
|
|
85
92
|
};
|
|
86
93
|
const exceptions: (() => void)[] = [];
|
|
@@ -92,7 +99,7 @@ function validateOptions(options: SLPKExtractionOptions): ValidatedSLPKExtractio
|
|
|
92
99
|
}
|
|
93
100
|
if (exceptions.length) {
|
|
94
101
|
exceptions.forEach((exeption) => exeption());
|
|
95
|
-
process.exit(1);
|
|
102
|
+
process.exit(1); // eslint-disable-line no-process-exit
|
|
96
103
|
}
|
|
97
104
|
return <ValidatedSLPKExtractionOptions>options;
|
|
98
105
|
}
|
|
@@ -119,6 +126,7 @@ function parseOptions(args: string[]): SLPKExtractionOptions {
|
|
|
119
126
|
printHelp();
|
|
120
127
|
break;
|
|
121
128
|
default:
|
|
129
|
+
// eslint-disable-next-line no-console
|
|
122
130
|
console.warn(`Unknown option ${arg}`);
|
|
123
131
|
process.exit(0); // eslint-disable-line
|
|
124
132
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Do milliseconds time conversion to readable time string.
|
|
3
|
-
* @param tile - 3d-tiles tile Object
|
|
4
|
-
* @param coordinates - node converted coordinates
|
|
5
|
-
* @returns String which characterizes conversion time period
|
|
6
|
-
*/
|
|
7
|
-
export function timeConverter(time: [number, number]): String;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Calculate files sizes after conversion.
|
|
11
|
-
* @param params - Object with params of conversion.
|
|
12
|
-
* @returns Promise with generated files size in bytes.
|
|
13
|
-
*/
|
|
14
|
-
export function calculateFilesSize(params: {
|
|
15
|
-
slpk: boolean;
|
|
16
|
-
outputPath: string;
|
|
17
|
-
tilesetName: string;
|
|
18
|
-
}): Number;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Reqursivelly calculate files sizes in directory.
|
|
22
|
-
* @param dirPath - Directory path.
|
|
23
|
-
* @returns Promise with files size in directory.
|
|
24
|
-
*/
|
|
25
|
-
export function getTotalFilesSize(dirPath: string): Number;
|