@loaders.gl/tile-converter 4.3.0-alpha.4 → 4.3.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.
- 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/converter-cli.js +0 -13
- package/dist/converter.min.cjs +89 -89
- 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/i3s-converter.d.ts +24 -23
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +60 -130
- 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 +82 -194
- package/dist/index.cjs.map +2 -2
- package/dist/lib/utils/statistic-utills.d.ts +4 -1
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
- package/dist/lib/utils/statistic-utills.js +4 -23
- package/dist/pgm-loader.js +1 -1
- package/package.json +19 -20
- package/src/3d-tiles-converter/3d-tiles-converter.ts +2 -1
- package/src/converter-cli.ts +0 -19
- 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/i3s-converter.ts +88 -154
- package/src/i3s-server/app.ts +7 -10
- package/src/i3s-server/bin/www.ts +6 -0
- package/src/lib/utils/statistic-utills.ts +5 -27
- 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/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
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import '@loaders.gl/polyfills';
|
|
2
|
-
import SLPKExtractor from "./slpk-extractor/slpk-extractor.js";
|
|
3
|
-
import { getURLValue, validateOptionsWithEqual } from "./lib/utils/cli-utils.js";
|
|
4
|
-
/**
|
|
5
|
-
* CLI entry
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
async function main() {
|
|
9
|
-
const [, , ...args] = process.argv;
|
|
10
|
-
if (args.length === 0) {
|
|
11
|
-
printHelp();
|
|
12
|
-
}
|
|
13
|
-
const validatedOptionsArr = validateOptionsWithEqual(args);
|
|
14
|
-
const options = parseOptions(validatedOptionsArr);
|
|
15
|
-
const validatedOptions = validateOptions(options);
|
|
16
|
-
await convert(validatedOptions);
|
|
17
|
-
}
|
|
18
|
-
main().catch((error) => {
|
|
19
|
-
console.log(error); // eslint-disable-line no-console
|
|
20
|
-
process.exit(1); // eslint-disable-line no-process-exit
|
|
21
|
-
});
|
|
22
|
-
/**
|
|
23
|
-
* Output for `npx slpk-extractor --help`
|
|
24
|
-
*/
|
|
25
|
-
function printHelp() {
|
|
26
|
-
// eslint-disable-next-line no-console
|
|
27
|
-
console.log('cli: converter slpk to I3S...');
|
|
28
|
-
// eslint-disable-next-line no-console
|
|
29
|
-
console.log('--output [Output folder, default: "data" folder]');
|
|
30
|
-
// eslint-disable-next-line no-console
|
|
31
|
-
console.log('--tileset [SLPK file]');
|
|
32
|
-
process.exit(0); // eslint-disable-line no-process-exit
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Run extraction process
|
|
36
|
-
* @param options validated slpk-extractor options
|
|
37
|
-
*/
|
|
38
|
-
async function convert(options) {
|
|
39
|
-
// eslint-disable-next-line no-console
|
|
40
|
-
console.log('------------------------------------------------');
|
|
41
|
-
// eslint-disable-next-line no-console
|
|
42
|
-
console.log('Starting conversion of SLPK');
|
|
43
|
-
// eslint-disable-next-line no-console
|
|
44
|
-
console.log('------------------------------------------------');
|
|
45
|
-
const slpkExtractor = new SLPKExtractor();
|
|
46
|
-
slpkExtractor.extract({
|
|
47
|
-
inputUrl: options.tileset,
|
|
48
|
-
outputPath: options.output
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
// OPTIONS
|
|
52
|
-
/**
|
|
53
|
-
* Validate input options of the CLI command
|
|
54
|
-
* @param options - input options of the CLI command
|
|
55
|
-
* @returns validated options
|
|
56
|
-
*/
|
|
57
|
-
function validateOptions(options) {
|
|
58
|
-
const mandatoryOptionsWithExceptions = {
|
|
59
|
-
// eslint-disable-next-line no-console
|
|
60
|
-
output: () => console.log('Missed: --output [Output path name]'),
|
|
61
|
-
// eslint-disable-next-line no-console
|
|
62
|
-
tileset: () => console.log('Missed: --tileset [SLPK file]')
|
|
63
|
-
};
|
|
64
|
-
const exceptions = [];
|
|
65
|
-
for (const mandatoryOption in mandatoryOptionsWithExceptions) {
|
|
66
|
-
const optionValue = options[mandatoryOption];
|
|
67
|
-
if (!optionValue) {
|
|
68
|
-
exceptions.push(mandatoryOptionsWithExceptions[mandatoryOption]);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (exceptions.length) {
|
|
72
|
-
exceptions.forEach((exeption) => exeption());
|
|
73
|
-
process.exit(1); // eslint-disable-line no-process-exit
|
|
74
|
-
}
|
|
75
|
-
return options;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Parse option from the cli arguments array
|
|
79
|
-
* @param args
|
|
80
|
-
* @returns
|
|
81
|
-
*/
|
|
82
|
-
function parseOptions(args) {
|
|
83
|
-
const opts = {};
|
|
84
|
-
// eslint-disable-next-line complexity
|
|
85
|
-
args.forEach((arg, index) => {
|
|
86
|
-
if (arg.indexOf('--') === 0) {
|
|
87
|
-
switch (arg) {
|
|
88
|
-
case '--tileset':
|
|
89
|
-
opts.tileset = getURLValue(index, args);
|
|
90
|
-
break;
|
|
91
|
-
case '--output':
|
|
92
|
-
opts.output = getURLValue(index, args);
|
|
93
|
-
break;
|
|
94
|
-
case '--help':
|
|
95
|
-
printHelp();
|
|
96
|
-
break;
|
|
97
|
-
default:
|
|
98
|
-
// eslint-disable-next-line no-console
|
|
99
|
-
console.warn(`Unknown option ${arg}`);
|
|
100
|
-
process.exit(0); // eslint-disable-line
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
return opts;
|
|
105
|
-
}
|