@loaders.gl/tile-converter 4.0.0-alpha.10 → 4.0.0-alpha.12
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/bin/slpk-extractor.js +4 -0
- package/dist/3d-tiles-attributes-worker.js +1 -1
- package/dist/converter-cli.js +18 -84
- package/dist/converter.min.js +50 -50
- package/dist/dist.min.js +21 -18
- package/dist/es5/3d-tiles-attributes-worker.js +1 -1
- package/dist/es5/converter-cli.js +18 -63
- package/dist/es5/converter-cli.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +1 -1
- package/dist/es5/i3s-attributes-worker.js +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/preprocess-3d-tiles.js +2 -2
- package/dist/es5/i3s-converter/helpers/preprocess-3d-tiles.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +59 -38
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/lib/utils/cli-utils.js +57 -0
- package/dist/es5/lib/utils/cli-utils.js.map +1 -0
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/es5/slpk-extractor/helpers/file-handle-provider.js +181 -0
- package/dist/es5/slpk-extractor/helpers/file-handle-provider.js.map +1 -0
- package/dist/es5/slpk-extractor/slpk-extractor.js +172 -0
- package/dist/es5/slpk-extractor/slpk-extractor.js.map +1 -0
- package/dist/es5/slpk-extractor-cli.js +117 -0
- package/dist/es5/slpk-extractor-cli.js.map +1 -0
- package/dist/esm/3d-tiles-attributes-worker.js +1 -1
- package/dist/esm/converter-cli.js +1 -46
- package/dist/esm/converter-cli.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -1
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/preprocess-3d-tiles.js +1 -1
- package/dist/esm/i3s-converter/helpers/preprocess-3d-tiles.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +22 -9
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/lib/utils/cli-utils.js +47 -0
- package/dist/esm/lib/utils/cli-utils.js.map +1 -0
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/esm/slpk-extractor/helpers/file-handle-provider.js +43 -0
- package/dist/esm/slpk-extractor/helpers/file-handle-provider.js.map +1 -0
- package/dist/esm/slpk-extractor/slpk-extractor.js +63 -0
- package/dist/esm/slpk-extractor/slpk-extractor.js.map +1 -0
- package/dist/esm/slpk-extractor-cli.js +74 -0
- package/dist/esm/slpk-extractor-cli.js.map +1 -0
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +1 -2
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js +1 -2
- 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 +2 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +2 -3
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +1 -2
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +21 -6
- package/dist/lib/utils/cli-utils.d.ts +34 -0
- package/dist/lib/utils/cli-utils.d.ts.map +1 -0
- package/dist/lib/utils/cli-utils.js +82 -0
- package/dist/slpk-extractor/helpers/file-handle-provider.d.ts +48 -0
- package/dist/slpk-extractor/helpers/file-handle-provider.d.ts.map +1 -0
- package/dist/slpk-extractor/helpers/file-handle-provider.js +71 -0
- package/dist/slpk-extractor/slpk-extractor.d.ts +23 -0
- package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -0
- package/dist/slpk-extractor/slpk-extractor.js +78 -0
- package/dist/slpk-extractor-cli.d.ts +17 -0
- package/dist/slpk-extractor-cli.d.ts.map +1 -0
- package/dist/slpk-extractor-cli.js +102 -0
- package/dist/slpk-extractor.min.js +189 -0
- package/package.json +17 -15
- package/src/converter-cli.ts +7 -72
- package/src/i3s-converter/helpers/coordinate-converter.ts +1 -2
- package/src/i3s-converter/helpers/gltf-attributes.ts +7 -8
- package/src/i3s-converter/helpers/preprocess-3d-tiles.ts +1 -3
- package/src/i3s-converter/i3s-converter.ts +24 -7
- package/src/lib/utils/cli-utils.ts +78 -0
- package/src/slpk-extractor/helpers/file-handle-provider.ts +91 -0
- package/src/slpk-extractor/slpk-extractor.ts +102 -0
- package/src/slpk-extractor-cli.ts +128 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/* eslint-disable no-console */
|
|
7
|
+
require("@loaders.gl/polyfills");
|
|
8
|
+
const slpk_extractor_1 = __importDefault(require("./slpk-extractor/slpk-extractor"));
|
|
9
|
+
const cli_utils_1 = require("./lib/utils/cli-utils");
|
|
10
|
+
/**
|
|
11
|
+
* CLI entry
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
async function main() {
|
|
15
|
+
const [, , ...args] = process.argv;
|
|
16
|
+
if (args.length === 0) {
|
|
17
|
+
printHelp();
|
|
18
|
+
}
|
|
19
|
+
const validatedOptionsArr = (0, cli_utils_1.validateOptionsWithEqual)(args);
|
|
20
|
+
const options = parseOptions(validatedOptionsArr);
|
|
21
|
+
const validatedOptions = validateOptions(options);
|
|
22
|
+
await convert(validatedOptions);
|
|
23
|
+
}
|
|
24
|
+
main().catch((error) => {
|
|
25
|
+
console.log(error);
|
|
26
|
+
process.exit(1); // eslint-disable-line
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Output for `npx slpk-extractor --help`
|
|
30
|
+
*/
|
|
31
|
+
function printHelp() {
|
|
32
|
+
console.log('cli: converter slpk to I3S...');
|
|
33
|
+
console.log('--output [Output folder, default: "data" folder]');
|
|
34
|
+
console.log('--tileset [SLPK file]');
|
|
35
|
+
process.exit(0); // eslint-disable-line
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Run extraction process
|
|
39
|
+
* @param options validated slpk-extractor options
|
|
40
|
+
*/
|
|
41
|
+
async function convert(options) {
|
|
42
|
+
console.log(`------------------------------------------------`); // eslint-disable-line
|
|
43
|
+
console.log(`Starting conversion of SLPK`); // eslint-disable-line
|
|
44
|
+
console.log(`------------------------------------------------`); // eslint-disable-line
|
|
45
|
+
const slpkExtractor = new slpk_extractor_1.default();
|
|
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
|
+
output: () => console.log('Missed: --output [Output path name]'),
|
|
60
|
+
tileset: () => console.log('Missed: --tileset [SLPK file]')
|
|
61
|
+
};
|
|
62
|
+
const exceptions = [];
|
|
63
|
+
for (const mandatoryOption in mandatoryOptionsWithExceptions) {
|
|
64
|
+
const optionValue = options[mandatoryOption];
|
|
65
|
+
if (!optionValue) {
|
|
66
|
+
exceptions.push(mandatoryOptionsWithExceptions[mandatoryOption]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (exceptions.length) {
|
|
70
|
+
exceptions.forEach((exeption) => exeption());
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
return options;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Parse option from the cli arguments array
|
|
77
|
+
* @param args
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
function parseOptions(args) {
|
|
81
|
+
const opts = {};
|
|
82
|
+
// eslint-disable-next-line complexity
|
|
83
|
+
args.forEach((arg, index) => {
|
|
84
|
+
if (arg.indexOf('--') === 0) {
|
|
85
|
+
switch (arg) {
|
|
86
|
+
case '--tileset':
|
|
87
|
+
opts.tileset = (0, cli_utils_1.getURLValue)(index, args);
|
|
88
|
+
break;
|
|
89
|
+
case '--output':
|
|
90
|
+
opts.output = (0, cli_utils_1.getURLValue)(index, args);
|
|
91
|
+
break;
|
|
92
|
+
case '--help':
|
|
93
|
+
printHelp();
|
|
94
|
+
break;
|
|
95
|
+
default:
|
|
96
|
+
console.warn(`Unknown option ${arg}`);
|
|
97
|
+
process.exit(0); // eslint-disable-line
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return opts;
|
|
102
|
+
}
|