@loaders.gl/tile-converter 4.4.0-alpha.2 → 4.4.0-alpha.9
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/converter.min.cjs +89 -98
- package/dist/i3s-server/bin/i3s-server.min.cjs +78 -78
- package/package.json +16 -16
- package/src/3d-tiles-converter/3d-tiles-converter.ts +11 -7
- package/src/3d-tiles-converter/helpers/load-i3s.ts +5 -5
- package/src/converter-cli.ts +2 -2
- package/src/i3s-converter/helpers/geometry-converter.ts +17 -1
- package/src/i3s-converter/helpers/load-3d-tiles.ts +24 -9
- package/src/i3s-converter/i3s-converter.ts +25 -9
- package/src/i3s-server/controllers/slpk-controller.ts +2 -2
- package/src/lib/utils/compress-util.ts +1 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +0 -115
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +0 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +0 -388
- package/dist/3d-tiles-converter/helpers/3d-tiles-content-converter.d.ts +0 -88
- package/dist/3d-tiles-converter/helpers/3d-tiles-content-converter.d.ts.map +0 -1
- package/dist/3d-tiles-converter/helpers/3d-tiles-content-converter.js +0 -380
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +0 -13
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts.map +0 -1
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -19
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts +0 -37
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +0 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js +0 -98
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts +0 -10
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts.map +0 -1
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +0 -50
- package/dist/3d-tiles-converter/json-templates/tileset.d.ts +0 -15
- package/dist/3d-tiles-converter/json-templates/tileset.d.ts.map +0 -1
- package/dist/3d-tiles-converter/json-templates/tileset.js +0 -39
- package/dist/constants.d.ts +0 -3
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -2
- package/dist/converter-cli.d.ts +0 -2
- package/dist/converter-cli.d.ts.map +0 -1
- package/dist/converter-cli.js +0 -290
- package/dist/deps-installer/deps-installer.d.ts +0 -19
- package/dist/deps-installer/deps-installer.d.ts.map +0 -1
- package/dist/deps-installer/deps-installer.js +0 -95
- package/dist/i3s-converter/helpers/attribute-metadata-info.d.ts +0 -84
- package/dist/i3s-converter/helpers/attribute-metadata-info.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/attribute-metadata-info.js +0 -219
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +0 -26
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +0 -165
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +0 -39
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js +0 -118
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts +0 -9
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/create-scene-server-path.js +0 -21
- package/dist/i3s-converter/helpers/feature-attributes.d.ts +0 -54
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/feature-attributes.js +0 -193
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +0 -8
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js +0 -226
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +0 -60
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +0 -1309
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +0 -28
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +0 -122
- package/dist/i3s-converter/helpers/load-3d-tiles.d.ts +0 -33
- package/dist/i3s-converter/helpers/load-3d-tiles.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/load-3d-tiles.js +0 -121
- package/dist/i3s-converter/helpers/node-debug.d.ts +0 -8
- package/dist/i3s-converter/helpers/node-debug.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/node-debug.js +0 -116
- package/dist/i3s-converter/helpers/node-index-document.d.ts +0 -111
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/node-index-document.js +0 -269
- package/dist/i3s-converter/helpers/node-pages.d.ts +0 -156
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/node-pages.js +0 -285
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +0 -22
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +0 -104
- package/dist/i3s-converter/helpers/progress.d.ts +0 -90
- package/dist/i3s-converter/helpers/progress.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/progress.js +0 -148
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts +0 -32
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js +0 -34
- package/dist/i3s-converter/i3s-converter.d.ts +0 -312
- package/dist/i3s-converter/i3s-converter.d.ts.map +0 -1
- package/dist/i3s-converter/i3s-converter.js +0 -1191
- package/dist/i3s-converter/json-templates/geometry-definitions.d.ts +0 -7
- package/dist/i3s-converter/json-templates/geometry-definitions.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/geometry-definitions.js +0 -80
- package/dist/i3s-converter/json-templates/layers.d.ts +0 -70
- package/dist/i3s-converter/json-templates/layers.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/layers.js +0 -132
- package/dist/i3s-converter/json-templates/metadata.d.ts +0 -22
- package/dist/i3s-converter/json-templates/metadata.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/metadata.js +0 -21
- package/dist/i3s-converter/json-templates/node.d.ts +0 -61
- package/dist/i3s-converter/json-templates/node.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/node.js +0 -82
- package/dist/i3s-converter/json-templates/scene-server.d.ts +0 -28
- package/dist/i3s-converter/json-templates/scene-server.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/scene-server.js +0 -27
- package/dist/i3s-converter/json-templates/shared-resources.d.ts +0 -14
- package/dist/i3s-converter/json-templates/shared-resources.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/shared-resources.js +0 -122
- package/dist/i3s-converter/json-templates/store.d.ts +0 -95
- package/dist/i3s-converter/json-templates/store.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/store.js +0 -100
- package/dist/i3s-converter/types.d.ts +0 -226
- package/dist/i3s-converter/types.d.ts.map +0 -1
- package/dist/i3s-converter/types.js +0 -37
- package/dist/i3s-server/app.d.ts +0 -3
- package/dist/i3s-server/app.d.ts.map +0 -1
- package/dist/i3s-server/app.js +0 -31
- package/dist/i3s-server/bin/www.d.ts +0 -3
- package/dist/i3s-server/bin/www.d.ts.map +0 -1
- package/dist/i3s-server/bin/www.js +0 -46
- package/dist/i3s-server/controllers/slpk-controller.d.ts +0 -13
- package/dist/i3s-server/controllers/slpk-controller.d.ts.map +0 -1
- package/dist/i3s-server/controllers/slpk-controller.js +0 -32
- package/dist/i3s-server/routes/slpk-router.d.ts +0 -3
- package/dist/i3s-server/routes/slpk-router.d.ts.map +0 -1
- package/dist/i3s-server/routes/slpk-router.js +0 -40
- package/dist/i3s-server/utils/create-scene-server.d.ts +0 -17
- package/dist/i3s-server/utils/create-scene-server.d.ts.map +0 -1
- package/dist/i3s-server/utils/create-scene-server.js +0 -18
- package/dist/i3s-server/utils/server-utils.d.ts +0 -21
- package/dist/i3s-server/utils/server-utils.d.ts.map +0 -1
- package/dist/i3s-server/utils/server-utils.js +0 -60
- package/dist/index.cjs +0 -6228
- package/dist/index.cjs.map +0 -7
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/lib/json-schemas/conversion-dump-json-schema.d.ts +0 -463
- package/dist/lib/json-schemas/conversion-dump-json-schema.d.ts.map +0 -1
- package/dist/lib/json-schemas/conversion-dump-json-schema.js +0 -285
- package/dist/lib/utils/cli-utils.d.ts +0 -34
- package/dist/lib/utils/cli-utils.d.ts.map +0 -1
- package/dist/lib/utils/cli-utils.js +0 -76
- package/dist/lib/utils/compress-util.d.ts +0 -8
- package/dist/lib/utils/compress-util.d.ts.map +0 -1
- package/dist/lib/utils/compress-util.js +0 -25
- package/dist/lib/utils/conversion-dump.d.ts +0 -147
- package/dist/lib/utils/conversion-dump.d.ts.map +0 -1
- package/dist/lib/utils/conversion-dump.js +0 -257
- package/dist/lib/utils/file-utils.d.ts +0 -57
- package/dist/lib/utils/file-utils.d.ts.map +0 -1
- package/dist/lib/utils/file-utils.js +0 -140
- package/dist/lib/utils/geometry-utils.d.ts +0 -9
- package/dist/lib/utils/geometry-utils.d.ts.map +0 -1
- package/dist/lib/utils/geometry-utils.js +0 -14
- package/dist/lib/utils/lod-conversion-utils.d.ts +0 -42
- package/dist/lib/utils/lod-conversion-utils.d.ts.map +0 -1
- package/dist/lib/utils/lod-conversion-utils.js +0 -71
- package/dist/lib/utils/queue.d.ts +0 -7
- package/dist/lib/utils/queue.d.ts.map +0 -1
- package/dist/lib/utils/queue.js +0 -14
- package/dist/lib/utils/statistic-utils.d.ts +0 -20
- package/dist/lib/utils/statistic-utils.d.ts.map +0 -1
- package/dist/lib/utils/statistic-utils.js +0 -88
- package/dist/lib/utils/write-queue.d.ts +0 -44
- package/dist/lib/utils/write-queue.d.ts.map +0 -1
- package/dist/lib/utils/write-queue.js +0 -82
- package/dist/pgm-loader.d.ts +0 -28
- package/dist/pgm-loader.d.ts.map +0 -1
- package/dist/pgm-loader.js +0 -24
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import transform from 'json-map-transform';
|
|
2
|
-
const ASSET = () => ({
|
|
3
|
-
version: {
|
|
4
|
-
path: 'version',
|
|
5
|
-
default: '1.0'
|
|
6
|
-
}
|
|
7
|
-
});
|
|
8
|
-
const TILE = () => ({
|
|
9
|
-
boundingVolume: {
|
|
10
|
-
path: 'boundingVolume'
|
|
11
|
-
},
|
|
12
|
-
geometricError: {
|
|
13
|
-
path: 'geometricError'
|
|
14
|
-
},
|
|
15
|
-
refine: {
|
|
16
|
-
path: 'refine'
|
|
17
|
-
},
|
|
18
|
-
content: {
|
|
19
|
-
path: 'content'
|
|
20
|
-
},
|
|
21
|
-
children: {
|
|
22
|
-
path: 'children',
|
|
23
|
-
transform: (val) => val.map((tile) => transform(tile, TILE()))
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
export const TILESET = () => ({
|
|
27
|
-
asset: {
|
|
28
|
-
path: 'asset',
|
|
29
|
-
transform: (val) => transform(val, ASSET())
|
|
30
|
-
},
|
|
31
|
-
geometricError: {
|
|
32
|
-
path: 'root',
|
|
33
|
-
transform: (val) => val.geometricError
|
|
34
|
-
},
|
|
35
|
-
root: {
|
|
36
|
-
path: 'root',
|
|
37
|
-
transform: (val) => transform(val, TILE())
|
|
38
|
-
}
|
|
39
|
-
});
|
package/dist/constants.d.ts
DELETED
package/dist/constants.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,yEACsC,CAAC;AACzE,eAAO,MAAM,gBAAgB,eAAe,CAAC"}
|
package/dist/constants.js
DELETED
package/dist/converter-cli.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"converter-cli.d.ts","sourceRoot":"","sources":["../src/converter-cli.ts"],"names":[],"mappings":"AACA,OAAO,uBAAuB,CAAC"}
|
package/dist/converter-cli.js
DELETED
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import '@loaders.gl/polyfills';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
import inquirer from 'inquirer';
|
|
5
|
-
import { I3SConverter, Tiles3DConverter } from '@loaders.gl/tile-converter';
|
|
6
|
-
import { DepsInstaller } from "./deps-installer/deps-installer.js";
|
|
7
|
-
import { getBooleanValue, getIntegerValue, getStringValue, getURLValue, validateOptionsWithEqual } from "./lib/utils/cli-utils.js";
|
|
8
|
-
import { addOneFile, composeHashFile, makeZipCDHeaderIterator } from '@loaders.gl/zip';
|
|
9
|
-
import { FileHandleFile } from '@loaders.gl/loader-utils';
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
import { copyFile } from 'node:fs/promises';
|
|
12
|
-
const TILESET_TYPE = {
|
|
13
|
-
I3S: 'I3S',
|
|
14
|
-
_3DTILES: '3DTILES'
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* CLI entry
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
// eslint-disable-next-line max-statements
|
|
21
|
-
async function main() {
|
|
22
|
-
const [, , ...args] = process.argv;
|
|
23
|
-
if (args.length === 0) {
|
|
24
|
-
printHelp();
|
|
25
|
-
}
|
|
26
|
-
const validatedOptionsArr = validateOptionsWithEqual(args);
|
|
27
|
-
const options = parseOptions(validatedOptionsArr);
|
|
28
|
-
if (options.installDependencies) {
|
|
29
|
-
const depthInstaller = new DepsInstaller();
|
|
30
|
-
depthInstaller.install('deps');
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (options.addHash) {
|
|
34
|
-
const validatedOptions = validateOptions(options, true);
|
|
35
|
-
let finalPath = validatedOptions.tileset;
|
|
36
|
-
if (!options.quiet) {
|
|
37
|
-
if (validatedOptions.output === 'data') {
|
|
38
|
-
const nameWithoutExt = validatedOptions.tileset.substring(0, validatedOptions.tileset.length - 5);
|
|
39
|
-
const result = await inquirer.prompt([
|
|
40
|
-
{
|
|
41
|
-
name: 'isNewFileRequired',
|
|
42
|
-
type: 'list',
|
|
43
|
-
message: 'What would you like to do?',
|
|
44
|
-
choices: [
|
|
45
|
-
{
|
|
46
|
-
name: 'Add hash file to the current SLPK file',
|
|
47
|
-
value: false
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: `Create a new file ${nameWithoutExt}-hash.slpk with hash file inside`,
|
|
51
|
-
value: true
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
]);
|
|
56
|
-
if (result.isNewFileRequired) {
|
|
57
|
-
finalPath = `${nameWithoutExt}-hash.slpk`;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
finalPath = validatedOptions.output;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (finalPath !== validatedOptions.tileset) {
|
|
65
|
-
await copyFile(validatedOptions.tileset, finalPath);
|
|
66
|
-
}
|
|
67
|
-
const hashTable = await composeHashFile(makeZipCDHeaderIterator(new FileHandleFile(finalPath)));
|
|
68
|
-
await addOneFile(finalPath, hashTable, '@specialIndexFileHASH128@');
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
const validatedOptions = validateOptions(options);
|
|
72
|
-
await convert(validatedOptions);
|
|
73
|
-
}
|
|
74
|
-
main().catch((error) => {
|
|
75
|
-
console.log(error);
|
|
76
|
-
process.exit(1); // eslint-disable-line no-process-exit
|
|
77
|
-
});
|
|
78
|
-
/**
|
|
79
|
-
* Output for `npx tile-converter --help`
|
|
80
|
-
*/
|
|
81
|
-
function printHelp() {
|
|
82
|
-
console.log('cli: converter 3dTiles to I3S or I3S to 3dTiles...');
|
|
83
|
-
console.log('--install-dependencies [Run the script for installing dependencies. Run this options separate from others. Now "*.pgm" file installation is implemented]');
|
|
84
|
-
console.log('--max-depth [Maximal depth of hierarchical tiles tree traversal, default: infinite]');
|
|
85
|
-
console.log('--name [Tileset name]');
|
|
86
|
-
console.log('--output [Output folder, default: "data" folder]');
|
|
87
|
-
console.log('--instant-node-writing [Keep created 3DNodeIndexDocument files on disk instead of memory. This option reduces memory usage but decelerates conversion speed]');
|
|
88
|
-
console.log('--split-nodes [Prevent merging similar materials that could lead to incorrect visualization (I3S to 3DTiles conversion only)]');
|
|
89
|
-
console.log('--slpk [(Deprecated since version 4.3.0) Whether the converter generates *.slpk (Scene Layer Package) I3S output files. Note: For versions 4.3.0 and up *.slpk is the default output without this option specified.]');
|
|
90
|
-
console.log('--tileset [tileset.json file (3DTiles) / http://..../SceneServer/layers/0 resource (I3S)]');
|
|
91
|
-
console.log('--input-type [tileset input type: I3S or 3DTILES]');
|
|
92
|
-
console.log('--output-version [3DTiles version: 1.0 or 1.1, default: 1.1]. This option supports only 1.0/1.1 values for 3DTiles output. I3S output version setting is not supported yet.');
|
|
93
|
-
console.log('--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"');
|
|
94
|
-
console.log('--token [Token for Cesium ION tilesets authentication]');
|
|
95
|
-
console.log('--no-draco [Disable draco compression for geometry]');
|
|
96
|
-
console.log('--generate-textures [Enable KTX2 textures generation if only one of (JPG, PNG) texture is provided or generate JPG texture if only KTX2 is provided]');
|
|
97
|
-
console.log('--generate-bounding-volumes [Generate obb and mbs bounding volumes from geometry]');
|
|
98
|
-
console.log('--analyze [Analyze the input tileset content without conversion, default: false]');
|
|
99
|
-
console.log('--metadata-class [One of the list of feature metadata classes, detected by converter on "analyze" stage, default: not set]');
|
|
100
|
-
console.log('--validate [Enable validation]');
|
|
101
|
-
console.log('--quiet [Skip all prompts that stop conversion and wait for a user input: default: false]');
|
|
102
|
-
process.exit(0); // eslint-disable-line
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Run conversion process
|
|
106
|
-
* @param options validated tile-converter options
|
|
107
|
-
*/
|
|
108
|
-
async function convert(options) {
|
|
109
|
-
console.log(`------------------------------------------------`); // eslint-disable-line
|
|
110
|
-
console.log(`Starting conversion of ${options.inputType}`); // eslint-disable-line
|
|
111
|
-
console.log(`------------------------------------------------`); // eslint-disable-line
|
|
112
|
-
const inputType = options.inputType.toUpperCase();
|
|
113
|
-
switch (inputType) {
|
|
114
|
-
case TILESET_TYPE.I3S:
|
|
115
|
-
const tiles3DConverter = new Tiles3DConverter();
|
|
116
|
-
await tiles3DConverter.convert({
|
|
117
|
-
inputUrl: options.tileset,
|
|
118
|
-
outputPath: options.output,
|
|
119
|
-
outputVersion: options.outputVersion,
|
|
120
|
-
tilesetName: options.name,
|
|
121
|
-
maxDepth: options.maxDepth,
|
|
122
|
-
egmFilePath: options.egm,
|
|
123
|
-
analyze: options.analyze,
|
|
124
|
-
inquirer: options.quiet ? undefined : inquirer
|
|
125
|
-
});
|
|
126
|
-
break;
|
|
127
|
-
case TILESET_TYPE._3DTILES:
|
|
128
|
-
const converter = new I3SConverter();
|
|
129
|
-
await converter.convert({
|
|
130
|
-
inputUrl: options.tileset,
|
|
131
|
-
outputPath: options.output,
|
|
132
|
-
tilesetName: options.name,
|
|
133
|
-
maxDepth: options.maxDepth,
|
|
134
|
-
egmFilePath: options.egm,
|
|
135
|
-
token: options.token,
|
|
136
|
-
draco: options.draco,
|
|
137
|
-
mergeMaterials: options.mergeMaterials,
|
|
138
|
-
generateTextures: options.generateTextures,
|
|
139
|
-
generateBoundingVolumes: options.generateBoundingVolumes,
|
|
140
|
-
validate: options.validate,
|
|
141
|
-
instantNodeWriting: options.instantNodeWriting,
|
|
142
|
-
metadataClass: options.metadataClass,
|
|
143
|
-
analyze: options.analyze,
|
|
144
|
-
inquirer: options.quiet ? undefined : inquirer
|
|
145
|
-
});
|
|
146
|
-
break;
|
|
147
|
-
default:
|
|
148
|
-
printHelp();
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
// OPTIONS
|
|
152
|
-
/**
|
|
153
|
-
* Validate input options of the CLI command
|
|
154
|
-
* @param options - input options of the CLI command
|
|
155
|
-
* @returns validated options
|
|
156
|
-
*/
|
|
157
|
-
function validateOptions(options, addHash) {
|
|
158
|
-
const mandatoryOptionsWithExceptions = {
|
|
159
|
-
name: {
|
|
160
|
-
getMessage: () => console.log('Missed: --name [Tileset name]'),
|
|
161
|
-
condition: (value) => addHash || Boolean(value) || Boolean(options.analyze)
|
|
162
|
-
},
|
|
163
|
-
output: { getMessage: () => console.log('Missed: --output [Output path name]') },
|
|
164
|
-
egm: { getMessage: () => console.log('Missed: --egm [*.pgm earth gravity model file path]') },
|
|
165
|
-
tileset: { getMessage: () => console.log('Missed: --tileset [tileset.json file]') },
|
|
166
|
-
inputType: {
|
|
167
|
-
getMessage: () => console.log('Missed/Incorrect: --input-type [tileset input type: I3S or 3DTILES]'),
|
|
168
|
-
condition: (value) => addHash || (Boolean(value) && Object.values(TILESET_TYPE).includes(value.toUpperCase()))
|
|
169
|
-
},
|
|
170
|
-
outputVersion: {
|
|
171
|
-
getMessage: () => console.log('Incorrect: --output-version [1.0 or 1.1] is for --input-type "I3S" only'),
|
|
172
|
-
condition: (value) => addHash ||
|
|
173
|
-
(Boolean(value) &&
|
|
174
|
-
Object.values(['1.0', '1.1']).includes(value) &&
|
|
175
|
-
Boolean(options.inputType === 'I3S')) ||
|
|
176
|
-
Boolean(options.inputType !== 'I3S') ||
|
|
177
|
-
Boolean(options.analyze)
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
const exceptions = [];
|
|
181
|
-
for (const mandatoryOption in mandatoryOptionsWithExceptions) {
|
|
182
|
-
const optionValue = options[mandatoryOption];
|
|
183
|
-
const conditionFunc = mandatoryOptionsWithExceptions[mandatoryOption].condition;
|
|
184
|
-
const testValue = conditionFunc ? conditionFunc(optionValue) : optionValue;
|
|
185
|
-
if (!testValue) {
|
|
186
|
-
exceptions.push(mandatoryOptionsWithExceptions[mandatoryOption].getMessage);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
if (exceptions.length) {
|
|
190
|
-
exceptions.forEach((exeption) => exeption());
|
|
191
|
-
process.exit(1); // eslint-disable-line no-process-exit
|
|
192
|
-
}
|
|
193
|
-
return options;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Parse option from the cli arguments array
|
|
197
|
-
* @param args
|
|
198
|
-
* @returns
|
|
199
|
-
*/
|
|
200
|
-
function parseOptions(args) {
|
|
201
|
-
const opts = {
|
|
202
|
-
output: 'data',
|
|
203
|
-
outputVersion: '1.1',
|
|
204
|
-
instantNodeWriting: false,
|
|
205
|
-
mergeMaterials: true,
|
|
206
|
-
egm: join(process.cwd(), 'deps', 'egm2008-5.pgm'),
|
|
207
|
-
draco: true,
|
|
208
|
-
installDependencies: false,
|
|
209
|
-
generateTextures: false,
|
|
210
|
-
generateBoundingVolumes: false,
|
|
211
|
-
validate: false,
|
|
212
|
-
addHash: false,
|
|
213
|
-
quiet: false
|
|
214
|
-
};
|
|
215
|
-
// eslint-disable-next-line complexity
|
|
216
|
-
args.forEach((arg, index) => {
|
|
217
|
-
if (arg.indexOf('--') === 0) {
|
|
218
|
-
switch (arg) {
|
|
219
|
-
case '--input-type':
|
|
220
|
-
opts.inputType = getStringValue(index, args);
|
|
221
|
-
break;
|
|
222
|
-
case '--tileset':
|
|
223
|
-
opts.tileset = getURLValue(index, args);
|
|
224
|
-
break;
|
|
225
|
-
case '--name':
|
|
226
|
-
opts.name = getStringValue(index, args);
|
|
227
|
-
break;
|
|
228
|
-
case '--output':
|
|
229
|
-
opts.output = getStringValue(index, args);
|
|
230
|
-
break;
|
|
231
|
-
case '--output-version':
|
|
232
|
-
opts.outputVersion = getStringValue(index, args);
|
|
233
|
-
break;
|
|
234
|
-
case '--instant-node-writing':
|
|
235
|
-
opts.instantNodeWriting = getBooleanValue(index, args);
|
|
236
|
-
break;
|
|
237
|
-
case '--split-nodes':
|
|
238
|
-
opts.mergeMaterials = getBooleanValue(index, args);
|
|
239
|
-
break;
|
|
240
|
-
case '--max-depth':
|
|
241
|
-
opts.maxDepth = getIntegerValue(index, args);
|
|
242
|
-
break;
|
|
243
|
-
case '--add-hash':
|
|
244
|
-
opts.addHash = getBooleanValue(index, args);
|
|
245
|
-
break;
|
|
246
|
-
case '--egm':
|
|
247
|
-
opts.egm = getStringValue(index, args);
|
|
248
|
-
break;
|
|
249
|
-
case '--token':
|
|
250
|
-
opts.token = getStringValue(index, args);
|
|
251
|
-
break;
|
|
252
|
-
case '--no-draco':
|
|
253
|
-
opts.draco = getBooleanValue(index, args);
|
|
254
|
-
break;
|
|
255
|
-
case '--validate':
|
|
256
|
-
opts.validate = getBooleanValue(index, args);
|
|
257
|
-
break;
|
|
258
|
-
case '--install-dependencies':
|
|
259
|
-
opts.installDependencies = getBooleanValue(index, args);
|
|
260
|
-
break;
|
|
261
|
-
case '--generate-textures':
|
|
262
|
-
opts.generateTextures = getBooleanValue(index, args);
|
|
263
|
-
break;
|
|
264
|
-
case '--generate-bounding-volumes':
|
|
265
|
-
opts.generateBoundingVolumes = getBooleanValue(index, args);
|
|
266
|
-
break;
|
|
267
|
-
case '--analyze':
|
|
268
|
-
opts.analyze = getBooleanValue(index, args);
|
|
269
|
-
break;
|
|
270
|
-
case '--quiet':
|
|
271
|
-
opts.quiet = getBooleanValue(index, args);
|
|
272
|
-
break;
|
|
273
|
-
case '--metadata-class':
|
|
274
|
-
opts.metadataClass = getStringValue(index, args);
|
|
275
|
-
break;
|
|
276
|
-
case '--help':
|
|
277
|
-
printHelp();
|
|
278
|
-
break;
|
|
279
|
-
// we need this option for backward compatibility
|
|
280
|
-
// do nothing but don't throw the error
|
|
281
|
-
case '--slpk':
|
|
282
|
-
break;
|
|
283
|
-
default:
|
|
284
|
-
console.warn(`Unknown option ${arg}`);
|
|
285
|
-
process.exit(0); // eslint-disable-line
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
return opts;
|
|
290
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Install external dependencies for converter:
|
|
3
|
-
* * PGM file (implemented);
|
|
4
|
-
* * Draco library (not implemented);
|
|
5
|
-
* * 7z archiver (not implemented);
|
|
6
|
-
*/
|
|
7
|
-
export declare class DepsInstaller {
|
|
8
|
-
/**
|
|
9
|
-
* Run instalation
|
|
10
|
-
* @param path destination folder
|
|
11
|
-
* @param workersPath destination folder for workers.
|
|
12
|
-
* This path is '' by default and is not used by tile-converter.
|
|
13
|
-
* It is used in tests to prevent rewriting actual workers during tests running
|
|
14
|
-
*/
|
|
15
|
-
install(path?: string): Promise<void>;
|
|
16
|
-
private installFromNpm;
|
|
17
|
-
private installFromUrl;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=deps-installer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deps-installer.d.ts","sourceRoot":"","sources":["../../src/deps-installer/deps-installer.ts"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,qBAAa,aAAa;IACxB;;;;;;OAMG;IAEG,OAAO,CAAC,IAAI,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,CAAC;YAuEjC,cAAc;YAiBd,cAAc;CAS7B"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright vis.gl contributors
|
|
4
|
-
import { load, fetchFile } from '@loaders.gl/core';
|
|
5
|
-
import { ZipLoader } from '@loaders.gl/zip';
|
|
6
|
-
import { writeFile } from "../lib/utils/file-utils.js";
|
|
7
|
-
import { join, dirname } from 'path';
|
|
8
|
-
import { ChildProcessProxy } from '@loaders.gl/worker-utils';
|
|
9
|
-
import { DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS } from '@loaders.gl/draco';
|
|
10
|
-
import { BASIS_EXTERNAL_LIBRARIES } from '@loaders.gl/textures';
|
|
11
|
-
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
12
|
-
const VERSION = typeof "4.4.0-alpha.1" !== 'undefined' ? "4.4.0-alpha.1" : 'latest';
|
|
13
|
-
const PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';
|
|
14
|
-
/**
|
|
15
|
-
* Install external dependencies for converter:
|
|
16
|
-
* * PGM file (implemented);
|
|
17
|
-
* * Draco library (not implemented);
|
|
18
|
-
* * 7z archiver (not implemented);
|
|
19
|
-
*/
|
|
20
|
-
export class DepsInstaller {
|
|
21
|
-
/**
|
|
22
|
-
* Run instalation
|
|
23
|
-
* @param path destination folder
|
|
24
|
-
* @param workersPath destination folder for workers.
|
|
25
|
-
* This path is '' by default and is not used by tile-converter.
|
|
26
|
-
* It is used in tests to prevent rewriting actual workers during tests running
|
|
27
|
-
*/
|
|
28
|
-
// eslint-disable-next-line max-statements
|
|
29
|
-
async install(path = '') {
|
|
30
|
-
console.log('Installing "EGM2008-5" model...'); // eslint-disable-line no-console
|
|
31
|
-
const fileMap = await load(PGM_LINK, ZipLoader, {});
|
|
32
|
-
let depsPath = process.cwd();
|
|
33
|
-
if (path) {
|
|
34
|
-
depsPath = join(depsPath, path);
|
|
35
|
-
}
|
|
36
|
-
await writeFile(depsPath, new Uint8Array(fileMap['geoids/egm2008-5.pgm']), 'egm2008-5.pgm');
|
|
37
|
-
console.log('Installing "I3S Content Loader" worker'); // eslint-disable-line no-console
|
|
38
|
-
await this.installFromNpm('i3s', 'i3s-content-worker-node.js');
|
|
39
|
-
console.log('Installing "Draco Loader" worker'); // eslint-disable-line no-console
|
|
40
|
-
await this.installFromNpm('draco', 'draco-worker-node.js');
|
|
41
|
-
console.log('Installing "Draco Writer" worker'); // eslint-disable-line no-console
|
|
42
|
-
await this.installFromNpm('draco', 'draco-writer-worker-node.js');
|
|
43
|
-
console.log('Installing "Basis Loader" worker'); // eslint-disable-line no-console
|
|
44
|
-
await this.installFromNpm('textures', 'basis-worker-node.js');
|
|
45
|
-
console.log('Installing "KTX2 Basis Writer" worker'); // eslint-disable-line no-console
|
|
46
|
-
await this.installFromNpm('textures', 'ktx2-basis-writer-worker-node.js');
|
|
47
|
-
console.log('Installing "Draco decoder" library'); // eslint-disable-line no-console
|
|
48
|
-
await this.installFromUrl(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER], 'draco', DRACO_EXTERNAL_LIBRARIES.DECODER);
|
|
49
|
-
await this.installFromUrl(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM], 'draco', DRACO_EXTERNAL_LIBRARIES.DECODER_WASM);
|
|
50
|
-
console.log('Installing "Draco encoder" library'); // eslint-disable-line no-console
|
|
51
|
-
await this.installFromUrl(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.ENCODER], 'draco', DRACO_EXTERNAL_LIBRARIES.ENCODER);
|
|
52
|
-
console.log('Installing "Basis transcoder" library'); // eslint-disable-line no-console
|
|
53
|
-
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.TRANSCODER, 'libs');
|
|
54
|
-
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.TRANSCODER_WASM, 'libs');
|
|
55
|
-
console.log('Installing "Basis encoder" library'); // eslint-disable-line no-console
|
|
56
|
-
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.ENCODER, 'libs');
|
|
57
|
-
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.ENCODER_WASM, 'libs');
|
|
58
|
-
// eslint-disable-next-line no-console
|
|
59
|
-
console.log('Installing "join-images" npm package');
|
|
60
|
-
const childProcess = new ChildProcessProxy();
|
|
61
|
-
const nodeDir = dirname(process.execPath);
|
|
62
|
-
await childProcess.start({
|
|
63
|
-
command: `"${nodeDir}/${process.platform === 'win32' ? 'npm.cmd' : 'npm'}"`,
|
|
64
|
-
// `npm install sharp join-images` works unstable. It fails because installed `sharp` version
|
|
65
|
-
// may be different from the version required by `join-images`. Pointing to specific versions
|
|
66
|
-
// resolve this issue
|
|
67
|
-
arguments: ['install', 'sharp@0.30.4', 'join-images@1.1.3'],
|
|
68
|
-
wait: 0,
|
|
69
|
-
ignoreStderr: true,
|
|
70
|
-
spawn: { shell: true }
|
|
71
|
-
});
|
|
72
|
-
console.log('All dependencies were installed succesfully.'); // eslint-disable-line no-console
|
|
73
|
-
}
|
|
74
|
-
async installFromNpm(module, name, extraPath = '') {
|
|
75
|
-
const fileResponse = await fetchFile(`https://unpkg.com/@loaders.gl/${module}@${VERSION}/dist/${extraPath}/${name}`);
|
|
76
|
-
if (fileResponse.status < 200 || fileResponse.status >= 300) {
|
|
77
|
-
throw new Error(`Failed to load resource ${name}`);
|
|
78
|
-
}
|
|
79
|
-
const fileData = await fileResponse.arrayBuffer();
|
|
80
|
-
if (!fileData) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const path = join(process.cwd(), 'modules', module, 'dist', extraPath);
|
|
84
|
-
await writeFile(path, fileData, name);
|
|
85
|
-
}
|
|
86
|
-
async installFromUrl(url, module, name) {
|
|
87
|
-
const fileResponse = await fetchFile(url);
|
|
88
|
-
const fileData = await fileResponse.arrayBuffer();
|
|
89
|
-
if (!fileData) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const path = join(process.cwd(), 'modules', module, 'dist', 'libs');
|
|
93
|
-
await writeFile(path, fileData, name);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { Attribute, AttributeStorageInfo, Field, PopupInfo } from '@loaders.gl/i3s';
|
|
2
|
-
export type AttributeMetadataInfoObject = {
|
|
3
|
-
attributeStorageInfo: AttributeStorageInfo[];
|
|
4
|
-
fields: Field[];
|
|
5
|
-
popupInfo: PopupInfo | undefined;
|
|
6
|
-
};
|
|
7
|
-
export declare class AttributeMetadataInfo {
|
|
8
|
-
private _attributeStorageInfo;
|
|
9
|
-
private _fields;
|
|
10
|
-
private _popupInfo;
|
|
11
|
-
constructor();
|
|
12
|
-
get attributeStorageInfo(): AttributeStorageInfo[];
|
|
13
|
-
get fields(): Field[];
|
|
14
|
-
get popupInfo(): PopupInfo | undefined;
|
|
15
|
-
/**
|
|
16
|
-
* Creates and stores Attribute Storage Info, Fields and PopupInfo objects based on attribute's types.
|
|
17
|
-
* Appends objects that have not been stored yet.
|
|
18
|
-
* @param attributeTypesMap - set of attribute's types
|
|
19
|
-
* @example AttributeStorageInfo, Fields and PopupInfo already contain objects for the following attributes:
|
|
20
|
-
* {
|
|
21
|
-
* color: 'string',
|
|
22
|
-
* name: 'string',
|
|
23
|
-
* opt_uint8: 'Int32'
|
|
24
|
-
* }
|
|
25
|
-
* Then, we call the addMetadataInfo method with the following attributeTypesMap:
|
|
26
|
-
* {
|
|
27
|
-
* // The same attributes
|
|
28
|
-
* color: 'string',
|
|
29
|
-
* name: 'string',
|
|
30
|
-
* opt_uint8: 'Int32',
|
|
31
|
-
* // New attributes
|
|
32
|
-
* opt_uint64: 'string',
|
|
33
|
-
* opt_float32: 'double',
|
|
34
|
-
* }
|
|
35
|
-
* The method creates and stores objects for opt_uint64, opt_float32 attributes.
|
|
36
|
-
*/
|
|
37
|
-
addMetadataInfo(attributeTypesMap: Record<string, Attribute>): void;
|
|
38
|
-
/**
|
|
39
|
-
* Set AttributeMetadataInfo from object
|
|
40
|
-
* @param object - object with AttributeMetadataInfo props
|
|
41
|
-
*/
|
|
42
|
-
fromObject(object: AttributeMetadataInfoObject): void;
|
|
43
|
-
/**
|
|
44
|
-
* Generates storage attribute for map segmentation.
|
|
45
|
-
* @param attributeIndex - order index of attribute (f_0, f_1 ...).
|
|
46
|
-
* @param key - attribute key from propertyTable.
|
|
47
|
-
* @param attributeType - attribute type.
|
|
48
|
-
* @return Updated storageAttribute.
|
|
49
|
-
*/
|
|
50
|
-
private createStorageAttribute;
|
|
51
|
-
/**
|
|
52
|
-
* Finds and returns attribute type based on key form propertyTable.
|
|
53
|
-
* @param attributeType
|
|
54
|
-
*/
|
|
55
|
-
private getFieldAttributeType;
|
|
56
|
-
/**
|
|
57
|
-
* Sets up Id attribute for map segmentation.
|
|
58
|
-
* @param storageAttribute - attribute for map segmentation .
|
|
59
|
-
*/
|
|
60
|
-
private setupIdAttribute;
|
|
61
|
-
/**
|
|
62
|
-
* Sets up storage attribute as string.
|
|
63
|
-
* @param storageAttribute - attribute for map segmentation.
|
|
64
|
-
*/
|
|
65
|
-
private setupStringAttribute;
|
|
66
|
-
/**
|
|
67
|
-
* Sets up double attribute for map segmentation.
|
|
68
|
-
* @param storageAttribute - attribute for map segmentation .
|
|
69
|
-
*/
|
|
70
|
-
private setupDoubleAttribute;
|
|
71
|
-
/**
|
|
72
|
-
* Sets up field attribute for map segmentation.
|
|
73
|
-
* @param key - attribute for map segmentation.
|
|
74
|
-
* @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').
|
|
75
|
-
*/
|
|
76
|
-
private createFieldAttribute;
|
|
77
|
-
/**
|
|
78
|
-
* Generates popup info to show metadata on the map.
|
|
79
|
-
* @param propertyNames - array of property names including OBJECTID.
|
|
80
|
-
* @return data for correct rendering of popup.
|
|
81
|
-
*/
|
|
82
|
-
private createPopupInfo;
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=attribute-metadata-info.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attribute-metadata-info.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/attribute-metadata-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,oBAAoB,EAEpB,KAAK,EAEL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAIzB,MAAM,MAAM,2BAA2B,GAAG;IACxC,oBAAoB,EAAE,oBAAoB,EAAE,CAAC;IAC7C,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,qBAAa,qBAAqB;IAChC,OAAO,CAAC,qBAAqB,CAAyB;IACtD,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,UAAU,CAAwB;;IAO1C,IAAI,oBAAoB,IAAI,oBAAoB,EAAE,CAEjD;IAED,IAAI,MAAM,IAAI,KAAK,EAAE,CAEpB;IAED,IAAI,SAAS,IAAI,SAAS,GAAG,SAAS,CAErC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,eAAe,CAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI;IA0CnE;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,2BAA2B;IAM9C;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;IAgC9B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAe7B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAO5B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAQ5B;;;;OAIG;IACH,OAAO,CAAC,eAAe;CA+BxB"}
|