@loaders.gl/tile-converter 4.2.0-alpha.4 → 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 +4 -4
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +349 -293
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +261 -200
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +14 -5
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js +83 -77
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +44 -21
- package/dist/3d-tiles-converter/json-templates/tileset.js +32 -33
- package/dist/constants.js +0 -1
- package/dist/converter-cli.js +257 -234
- package/dist/converter.min.cjs +95 -105
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/deps-installer/deps-installer.js +78 -59
- package/dist/i3s-converter/helpers/attribute-metadata-info.js +210 -153
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +146 -103
- package/dist/i3s-converter/helpers/coordinate-converter.js +100 -65
- package/dist/i3s-converter/helpers/create-scene-server-path.js +14 -9
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.js +170 -105
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js +205 -212
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +17 -3
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +1189 -830
- 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 +109 -97
- package/dist/i3s-converter/helpers/load-3d-tiles.js +103 -66
- package/dist/i3s-converter/helpers/node-debug.js +98 -54
- package/dist/i3s-converter/helpers/node-index-document.d.ts +11 -4
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.js +255 -177
- 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 +299 -193
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +92 -60
- package/dist/i3s-converter/helpers/progress.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/progress.js +139 -83
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts +9 -2
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js +33 -13
- package/dist/i3s-converter/i3s-converter.d.ts +7 -7
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +1165 -895
- package/dist/i3s-converter/json-templates/geometry-definitions.js +70 -79
- package/dist/i3s-converter/json-templates/layers.js +120 -121
- package/dist/i3s-converter/json-templates/metadata.js +19 -20
- package/dist/i3s-converter/json-templates/node.js +73 -71
- package/dist/i3s-converter/json-templates/scene-server.js +25 -26
- package/dist/i3s-converter/json-templates/shared-resources.js +107 -108
- package/dist/i3s-converter/json-templates/store.js +96 -94
- package/dist/i3s-converter/types.js +35 -23
- package/dist/i3s-server/app.js +15 -12
- package/dist/i3s-server/bin/i3s-server.min.cjs +69 -69
- package/dist/i3s-server/bin/www.js +16 -7
- package/dist/i3s-server/controllers/index-controller.js +18 -15
- package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -1
- package/dist/i3s-server/controllers/slpk-controller.js +24 -11
- package/dist/i3s-server/routes/index.js +13 -9
- package/dist/i3s-server/routes/slpk-router.d.ts.map +1 -1
- package/dist/i3s-server/routes/slpk-router.js +26 -19
- package/dist/i3s-server/utils/create-scene-server.js +15 -10
- package/dist/i3s-server/utils/server-utils.d.ts.map +1 -1
- package/dist/i3s-server/utils/server-utils.js +52 -32
- package/dist/index.cjs +616 -967
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/lib/json-schemas/conversion-dump-json-schema.js +243 -421
- package/dist/lib/utils/cli-utils.d.ts.map +1 -1
- package/dist/lib/utils/cli-utils.js +65 -36
- package/dist/lib/utils/compress-util.js +20 -15
- package/dist/lib/utils/conversion-dump.d.ts +10 -2
- package/dist/lib/utils/conversion-dump.d.ts.map +1 -1
- package/dist/lib/utils/conversion-dump.js +242 -197
- 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 +120 -74
- package/dist/lib/utils/geometry-utils.js +13 -7
- package/dist/lib/utils/lod-conversion-utils.js +65 -33
- package/dist/lib/utils/queue.js +12 -13
- package/dist/lib/utils/statistic-utills.d.ts +6 -23
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
- package/dist/lib/utils/statistic-utills.js +58 -55
- package/dist/lib/utils/write-queue.d.ts +2 -2
- package/dist/lib/utils/write-queue.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.js +72 -86
- package/dist/pgm-loader.js +17 -13
- package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -1
- package/dist/slpk-extractor/slpk-extractor.js +60 -50
- package/dist/slpk-extractor-cli.d.ts.map +1 -1
- package/dist/slpk-extractor-cli.js +90 -59
- package/dist/slpk-extractor.min.cjs +1 -1
- package/package.json +27 -26
- 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/dist/3d-tiles-converter/3d-tiles-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/texture-atlas.js.map +0 -1
- package/dist/3d-tiles-converter/json-templates/tileset.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/converter-cli.js.map +0 -1
- package/dist/deps-installer/deps-installer.js.map +0 -1
- package/dist/i3s-converter/helpers/attribute-metadata-info.js.map +0 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js.map +0 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/create-scene-server-path.js.map +0 -1
- package/dist/i3s-converter/helpers/feature-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/load-3d-tiles.js.map +0 -1
- package/dist/i3s-converter/helpers/node-debug.js.map +0 -1
- package/dist/i3s-converter/helpers/node-index-document.js.map +0 -1
- package/dist/i3s-converter/helpers/node-pages.js.map +0 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js.map +0 -1
- package/dist/i3s-converter/helpers/progress.js.map +0 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js.map +0 -1
- package/dist/i3s-converter/i3s-converter.js.map +0 -1
- package/dist/i3s-converter/json-templates/geometry-definitions.js.map +0 -1
- package/dist/i3s-converter/json-templates/layers.js.map +0 -1
- package/dist/i3s-converter/json-templates/metadata.js.map +0 -1
- package/dist/i3s-converter/json-templates/node.js.map +0 -1
- package/dist/i3s-converter/json-templates/scene-server.js.map +0 -1
- package/dist/i3s-converter/json-templates/shared-resources.js.map +0 -1
- package/dist/i3s-converter/json-templates/store.js.map +0 -1
- package/dist/i3s-converter/types.js.map +0 -1
- package/dist/i3s-server/README.md +0 -63
- package/dist/i3s-server/app.js.map +0 -1
- package/dist/i3s-server/bin/www.js.map +0 -1
- package/dist/i3s-server/certs/cert.pem +0 -19
- package/dist/i3s-server/certs/key.pem +0 -27
- package/dist/i3s-server/controllers/index-controller.js.map +0 -1
- package/dist/i3s-server/controllers/slpk-controller.js.map +0 -1
- package/dist/i3s-server/routes/index.js.map +0 -1
- package/dist/i3s-server/routes/slpk-router.js.map +0 -1
- package/dist/i3s-server/utils/create-scene-server.js.map +0 -1
- package/dist/i3s-server/utils/server-utils.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/json-schemas/conversion-dump-json-schema.js.map +0 -1
- package/dist/lib/utils/cli-utils.js.map +0 -1
- package/dist/lib/utils/compress-util.js.map +0 -1
- package/dist/lib/utils/conversion-dump.js.map +0 -1
- package/dist/lib/utils/file-utils.js.map +0 -1
- package/dist/lib/utils/geometry-utils.js.map +0 -1
- package/dist/lib/utils/lod-conversion-utils.js.map +0 -1
- package/dist/lib/utils/queue.js.map +0 -1
- package/dist/lib/utils/statistic-utills.js.map +0 -1
- package/dist/lib/utils/write-queue.js.map +0 -1
- package/dist/pgm-loader.js.map +0 -1
- package/dist/slpk-extractor/slpk-extractor.js.map +0 -1
- package/dist/slpk-extractor-cli.js.map +0 -1
- package/src/lib/utils/statistic-utills.d.ts +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps-installer.d.ts","sourceRoot":"","sources":["../../src/deps-installer/deps-installer.ts"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,qBAAa,aAAa;IACxB;;;;;;OAMG;
|
|
1
|
+
{"version":3,"file":"deps-installer.d.ts","sourceRoot":"","sources":["../../src/deps-installer/deps-installer.ts"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,qBAAa,aAAa;IACxB;;;;;;OAMG;IAEG,OAAO,CAAC,IAAI,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,CAAC;YAsEjC,cAAc;YAiBd,cAAc;CAS7B"}
|
|
@@ -5,68 +5,87 @@ import { join, dirname } from 'path';
|
|
|
5
5
|
import { ChildProcessProxy } from '@loaders.gl/worker-utils';
|
|
6
6
|
import { DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS } from '@loaders.gl/draco';
|
|
7
7
|
import { BASIS_EXTERNAL_LIBRARIES } from '@loaders.gl/textures';
|
|
8
|
-
|
|
8
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
9
|
+
const VERSION = typeof "4.2.0-alpha.5" !== 'undefined' ? "4.2.0-alpha.5" : 'latest';
|
|
9
10
|
const PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';
|
|
11
|
+
/**
|
|
12
|
+
* Install external dependencies for converter:
|
|
13
|
+
* * PGM file (implemented);
|
|
14
|
+
* * Draco library (not implemented);
|
|
15
|
+
* * 7z archiver (not implemented);
|
|
16
|
+
*/
|
|
10
17
|
export class DepsInstaller {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Run instalation
|
|
20
|
+
* @param path destination folder
|
|
21
|
+
* @param workersPath destination folder for workers.
|
|
22
|
+
* This path is '' by default and is not used by tile-converter.
|
|
23
|
+
* It is used in tests to prevent rewriting actual workers during tests running
|
|
24
|
+
*/
|
|
25
|
+
// eslint-disable-next-line max-statements
|
|
26
|
+
async install(path = '') {
|
|
27
|
+
console.log('Installing "EGM2008-5" model...'); // eslint-disable-line no-console
|
|
28
|
+
const fileMap = await load(PGM_LINK, ZipLoader, {});
|
|
29
|
+
let depsPath = process.cwd();
|
|
30
|
+
if (path) {
|
|
31
|
+
depsPath = join(depsPath, path);
|
|
32
|
+
}
|
|
33
|
+
await writeFile(depsPath, new Uint8Array(fileMap['geoids/egm2008-5.pgm']), 'egm2008-5.pgm');
|
|
34
|
+
console.log('Installing "I3S Content Loader" worker'); // eslint-disable-line no-console
|
|
35
|
+
await this.installFromNpm('i3s', 'i3s-content-worker-node.js');
|
|
36
|
+
console.log('Installing "Draco Loader" worker'); // eslint-disable-line no-console
|
|
37
|
+
await this.installFromNpm('draco', 'draco-worker-node.js');
|
|
38
|
+
console.log('Installing "Draco Writer" worker'); // eslint-disable-line no-console
|
|
39
|
+
await this.installFromNpm('draco', 'draco-writer-worker-node.js');
|
|
40
|
+
console.log('Installing "Basis Loader" worker'); // eslint-disable-line no-console
|
|
41
|
+
await this.installFromNpm('textures', 'basis-worker-node.js');
|
|
42
|
+
console.log('Installing "KTX2 Basis Writer" worker'); // eslint-disable-line no-console
|
|
43
|
+
await this.installFromNpm('textures', 'ktx2-basis-writer-worker-node.js');
|
|
44
|
+
console.log('Installing "Draco decoder" library'); // eslint-disable-line no-console
|
|
45
|
+
await this.installFromUrl(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER], 'draco', DRACO_EXTERNAL_LIBRARIES.DECODER);
|
|
46
|
+
await this.installFromUrl(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM], 'draco', DRACO_EXTERNAL_LIBRARIES.DECODER_WASM);
|
|
47
|
+
console.log('Installing "Draco encoder" library'); // eslint-disable-line no-console
|
|
48
|
+
await this.installFromUrl(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.ENCODER], 'draco', DRACO_EXTERNAL_LIBRARIES.ENCODER);
|
|
49
|
+
console.log('Installing "Basis transcoder" library'); // eslint-disable-line no-console
|
|
50
|
+
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.TRANSCODER, 'libs');
|
|
51
|
+
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.TRANSCODER_WASM, 'libs');
|
|
52
|
+
console.log('Installing "Basis encoder" library'); // eslint-disable-line no-console
|
|
53
|
+
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.ENCODER, 'libs');
|
|
54
|
+
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.ENCODER_WASM, 'libs');
|
|
55
|
+
// eslint-disable-next-line no-console
|
|
56
|
+
console.log('Installing "join-images" npm package');
|
|
57
|
+
const childProcess = new ChildProcessProxy();
|
|
58
|
+
const nodeDir = dirname(process.execPath);
|
|
59
|
+
await childProcess.start({
|
|
60
|
+
command: `${nodeDir}/${process.platform === 'win32' ? 'npm.cmd' : 'npm'}`,
|
|
61
|
+
// `npm install sharp join-images` works unstable. It fails because installed `sharp` version
|
|
62
|
+
// may be different from the version required by `join-images`. Pointing to specific versions
|
|
63
|
+
// resolve this issue
|
|
64
|
+
arguments: ['install', 'sharp@0.30.4', 'join-images@1.1.3'],
|
|
65
|
+
wait: 0,
|
|
66
|
+
ignoreStderr: true
|
|
67
|
+
});
|
|
68
|
+
console.log('All dependencies were installed succesfully.'); // eslint-disable-line no-console
|
|
18
69
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
console.log('Installing "Draco decoder" library');
|
|
31
|
-
await this.installFromUrl(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER], 'draco', DRACO_EXTERNAL_LIBRARIES.DECODER);
|
|
32
|
-
await this.installFromUrl(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM], 'draco', DRACO_EXTERNAL_LIBRARIES.DECODER_WASM);
|
|
33
|
-
console.log('Installing "Draco encoder" library');
|
|
34
|
-
await this.installFromUrl(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.ENCODER], 'draco', DRACO_EXTERNAL_LIBRARIES.ENCODER);
|
|
35
|
-
console.log('Installing "Basis transcoder" library');
|
|
36
|
-
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.TRANSCODER, 'libs');
|
|
37
|
-
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.TRANSCODER_WASM, 'libs');
|
|
38
|
-
console.log('Installing "Basis encoder" library');
|
|
39
|
-
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.ENCODER, 'libs');
|
|
40
|
-
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.ENCODER_WASM, 'libs');
|
|
41
|
-
console.log('Installing "join-images" npm package');
|
|
42
|
-
const childProcess = new ChildProcessProxy();
|
|
43
|
-
const nodeDir = dirname(process.execPath);
|
|
44
|
-
await childProcess.start({
|
|
45
|
-
command: `${nodeDir}/${process.platform === 'win32' ? 'npm.cmd' : 'npm'}`,
|
|
46
|
-
arguments: ['install', 'sharp@0.30.4', 'join-images@1.1.3'],
|
|
47
|
-
wait: 0,
|
|
48
|
-
ignoreStderr: true
|
|
49
|
-
});
|
|
50
|
-
console.log('All dependencies were installed succesfully.');
|
|
51
|
-
}
|
|
52
|
-
async installFromNpm(module, name) {
|
|
53
|
-
let extraPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
54
|
-
const fileResponse = await fetchFile(`https://unpkg.com/@loaders.gl/${module}@${VERSION}/dist/${extraPath}/${name}`);
|
|
55
|
-
const fileData = await fileResponse.arrayBuffer();
|
|
56
|
-
if (!fileData) {
|
|
57
|
-
return;
|
|
70
|
+
async installFromNpm(module, name, extraPath = '') {
|
|
71
|
+
const fileResponse = await fetchFile(`https://unpkg.com/@loaders.gl/${module}@${VERSION}/dist/${extraPath}/${name}`);
|
|
72
|
+
if (fileResponse.status < 200 || fileResponse.status >= 300) {
|
|
73
|
+
throw new Error(`Failed to load resource ${name}`);
|
|
74
|
+
}
|
|
75
|
+
const fileData = await fileResponse.arrayBuffer();
|
|
76
|
+
if (!fileData) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const path = join(process.cwd(), 'modules', module, 'dist', extraPath);
|
|
80
|
+
await writeFile(path, fileData, name);
|
|
58
81
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
82
|
+
async installFromUrl(url, module, name) {
|
|
83
|
+
const fileResponse = await fetchFile(url);
|
|
84
|
+
const fileData = await fileResponse.arrayBuffer();
|
|
85
|
+
if (!fileData) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const path = join(process.cwd(), 'modules', module, 'dist', 'libs');
|
|
89
|
+
await writeFile(path, fileData, name);
|
|
67
90
|
}
|
|
68
|
-
const path = join(process.cwd(), 'modules', module, 'dist', 'libs');
|
|
69
|
-
await writeFile(path, fileData, name);
|
|
70
|
-
}
|
|
71
91
|
}
|
|
72
|
-
//# sourceMappingURL=deps-installer.js.map
|
|
@@ -1,162 +1,219 @@
|
|
|
1
1
|
import { AttributeType } from "../types.js";
|
|
2
2
|
export class AttributeMetadataInfo {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
get attributeStorageInfo() {
|
|
11
|
-
return this._attributeStorageInfo;
|
|
12
|
-
}
|
|
13
|
-
get fields() {
|
|
14
|
-
return this._fields;
|
|
15
|
-
}
|
|
16
|
-
get popupInfo() {
|
|
17
|
-
return this._popupInfo;
|
|
18
|
-
}
|
|
19
|
-
addMetadataInfo(attributeTypesMap) {
|
|
20
|
-
if (!Object.keys(attributeTypesMap).length) {
|
|
21
|
-
return;
|
|
3
|
+
_attributeStorageInfo;
|
|
4
|
+
_fields;
|
|
5
|
+
_popupInfo;
|
|
6
|
+
constructor() {
|
|
7
|
+
this._attributeStorageInfo = [];
|
|
8
|
+
this._fields = [];
|
|
22
9
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
...attributeTypesMap
|
|
26
|
-
};
|
|
27
|
-
let isUpdated = false;
|
|
28
|
-
let attributeIndex = this._attributeStorageInfo.length;
|
|
29
|
-
for (const key in attributeTypes) {
|
|
30
|
-
const elementFound = this._attributeStorageInfo.find(element => element.name === key);
|
|
31
|
-
if (!elementFound) {
|
|
32
|
-
const attributeType = attributeTypes[key];
|
|
33
|
-
const storageAttribute = this.createStorageAttribute(attributeIndex, key, attributeType);
|
|
34
|
-
const fieldAttributeType = this.getFieldAttributeType(attributeType);
|
|
35
|
-
const fieldAttribute = this.createFieldAttribute(key, fieldAttributeType);
|
|
36
|
-
this._attributeStorageInfo.push(storageAttribute);
|
|
37
|
-
this._fields.push(fieldAttribute);
|
|
38
|
-
attributeIndex += 1;
|
|
39
|
-
isUpdated = true;
|
|
40
|
-
}
|
|
10
|
+
get attributeStorageInfo() {
|
|
11
|
+
return this._attributeStorageInfo;
|
|
41
12
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
for (let info of this._attributeStorageInfo) {
|
|
45
|
-
attributeNames.push(info.name);
|
|
46
|
-
}
|
|
47
|
-
this._popupInfo = this.createPopupInfo(attributeNames);
|
|
13
|
+
get fields() {
|
|
14
|
+
return this._fields;
|
|
48
15
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this._attributeStorageInfo = object.attributeStorageInfo;
|
|
52
|
-
this._fields = object.fields;
|
|
53
|
-
this._popupInfo = object.popupInfo;
|
|
54
|
-
}
|
|
55
|
-
createStorageAttribute(attributeIndex, key, attributeType) {
|
|
56
|
-
const storageAttribute = {
|
|
57
|
-
key: `f_${attributeIndex}`,
|
|
58
|
-
name: key,
|
|
59
|
-
ordering: ['attributeValues'],
|
|
60
|
-
header: [{
|
|
61
|
-
property: 'count',
|
|
62
|
-
valueType: 'UInt32'
|
|
63
|
-
}],
|
|
64
|
-
attributeValues: {
|
|
65
|
-
valueType: 'Int32',
|
|
66
|
-
valuesPerElement: 1
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
switch (attributeType) {
|
|
70
|
-
case AttributeType.OBJECT_ID_TYPE:
|
|
71
|
-
this.setupIdAttribute(storageAttribute);
|
|
72
|
-
break;
|
|
73
|
-
case AttributeType.STRING_TYPE:
|
|
74
|
-
this.setupStringAttribute(storageAttribute);
|
|
75
|
-
break;
|
|
76
|
-
case AttributeType.DOUBLE_TYPE:
|
|
77
|
-
this.setupDoubleAttribute(storageAttribute);
|
|
78
|
-
break;
|
|
79
|
-
case AttributeType.SHORT_INT_TYPE:
|
|
80
|
-
break;
|
|
81
|
-
default:
|
|
82
|
-
this.setupStringAttribute(storageAttribute);
|
|
16
|
+
get popupInfo() {
|
|
17
|
+
return this._popupInfo;
|
|
83
18
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Creates and stores Attribute Storage Info, Fields and PopupInfo objects based on attribute's types.
|
|
21
|
+
* Appends objects that have not been stored yet.
|
|
22
|
+
* @param attributeTypesMap - set of attribute's types
|
|
23
|
+
* @example AttributeStorageInfo, Fields and PopupInfo already contain objects for the following attributes:
|
|
24
|
+
* {
|
|
25
|
+
* color: 'string',
|
|
26
|
+
* name: 'string',
|
|
27
|
+
* opt_uint8: 'Int32'
|
|
28
|
+
* }
|
|
29
|
+
* Then, we call the addMetadataInfo method with the following attributeTypesMap:
|
|
30
|
+
* {
|
|
31
|
+
* // The same attributes
|
|
32
|
+
* color: 'string',
|
|
33
|
+
* name: 'string',
|
|
34
|
+
* opt_uint8: 'Int32',
|
|
35
|
+
* // New attributes
|
|
36
|
+
* opt_uint64: 'string',
|
|
37
|
+
* opt_float32: 'double',
|
|
38
|
+
* }
|
|
39
|
+
* The method creates and stores objects for opt_uint64, opt_float32 attributes.
|
|
40
|
+
*/
|
|
41
|
+
addMetadataInfo(attributeTypesMap) {
|
|
42
|
+
if (!Object.keys(attributeTypesMap).length) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const attributeTypes = {
|
|
46
|
+
OBJECTID: AttributeType.OBJECT_ID_TYPE,
|
|
47
|
+
...attributeTypesMap
|
|
48
|
+
};
|
|
49
|
+
let isUpdated = false;
|
|
50
|
+
let attributeIndex = this._attributeStorageInfo.length;
|
|
51
|
+
for (const key in attributeTypes) {
|
|
52
|
+
/*
|
|
53
|
+
We will append a new attribute only in case it has not been added to the attribute storage info yet.
|
|
54
|
+
*/
|
|
55
|
+
const elementFound = this._attributeStorageInfo.find((element) => element.name === key);
|
|
56
|
+
if (!elementFound) {
|
|
57
|
+
const attributeType = attributeTypes[key];
|
|
58
|
+
const storageAttribute = this.createStorageAttribute(attributeIndex, key, attributeType);
|
|
59
|
+
const fieldAttributeType = this.getFieldAttributeType(attributeType);
|
|
60
|
+
const fieldAttribute = this.createFieldAttribute(key, fieldAttributeType);
|
|
61
|
+
this._attributeStorageInfo.push(storageAttribute);
|
|
62
|
+
this._fields.push(fieldAttribute);
|
|
63
|
+
attributeIndex += 1;
|
|
64
|
+
isUpdated = true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (isUpdated) {
|
|
68
|
+
/*
|
|
69
|
+
The attributeStorageInfo is updated. So, popupInfo should be recreated.
|
|
70
|
+
Use attributeStorageInfo as a source of attribute names to create the popupInfo.
|
|
71
|
+
*/
|
|
72
|
+
const attributeNames = [];
|
|
73
|
+
for (const info of this._attributeStorageInfo) {
|
|
74
|
+
attributeNames.push(info.name);
|
|
75
|
+
}
|
|
76
|
+
this._popupInfo = this.createPopupInfo(attributeNames);
|
|
77
|
+
}
|
|
98
78
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Set AttributeMetadataInfo from object
|
|
81
|
+
* @param object - object with AttributeMetadataInfo props
|
|
82
|
+
*/
|
|
83
|
+
fromObject(object) {
|
|
84
|
+
this._attributeStorageInfo = object.attributeStorageInfo;
|
|
85
|
+
this._fields = object.fields;
|
|
86
|
+
this._popupInfo = object.popupInfo;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Generates storage attribute for map segmentation.
|
|
90
|
+
* @param attributeIndex - order index of attribute (f_0, f_1 ...).
|
|
91
|
+
* @param key - attribute key from propertyTable.
|
|
92
|
+
* @param attributeType - attribute type.
|
|
93
|
+
* @return Updated storageAttribute.
|
|
94
|
+
*/
|
|
95
|
+
createStorageAttribute(attributeIndex, key, attributeType) {
|
|
96
|
+
const storageAttribute = {
|
|
97
|
+
key: `f_${attributeIndex}`,
|
|
98
|
+
name: key,
|
|
99
|
+
ordering: ['attributeValues'],
|
|
100
|
+
header: [{ property: 'count', valueType: 'UInt32' }],
|
|
101
|
+
attributeValues: { valueType: 'Int32', valuesPerElement: 1 }
|
|
102
|
+
};
|
|
103
|
+
switch (attributeType) {
|
|
104
|
+
case AttributeType.OBJECT_ID_TYPE:
|
|
105
|
+
this.setupIdAttribute(storageAttribute);
|
|
106
|
+
break;
|
|
107
|
+
case AttributeType.STRING_TYPE:
|
|
108
|
+
this.setupStringAttribute(storageAttribute);
|
|
109
|
+
break;
|
|
110
|
+
case AttributeType.DOUBLE_TYPE:
|
|
111
|
+
this.setupDoubleAttribute(storageAttribute);
|
|
112
|
+
break;
|
|
113
|
+
case AttributeType.SHORT_INT_TYPE:
|
|
114
|
+
break;
|
|
115
|
+
default:
|
|
116
|
+
this.setupStringAttribute(storageAttribute);
|
|
117
|
+
}
|
|
118
|
+
return storageAttribute;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Finds and returns attribute type based on key form propertyTable.
|
|
122
|
+
* @param attributeType
|
|
123
|
+
*/
|
|
124
|
+
getFieldAttributeType(attributeType) {
|
|
125
|
+
switch (attributeType) {
|
|
126
|
+
case AttributeType.OBJECT_ID_TYPE:
|
|
127
|
+
return 'esriFieldTypeOID';
|
|
128
|
+
case AttributeType.STRING_TYPE:
|
|
129
|
+
return 'esriFieldTypeString';
|
|
130
|
+
case AttributeType.SHORT_INT_TYPE:
|
|
131
|
+
return 'esriFieldTypeInteger';
|
|
132
|
+
case AttributeType.DOUBLE_TYPE:
|
|
133
|
+
return 'esriFieldTypeDouble';
|
|
134
|
+
default:
|
|
135
|
+
return 'esriFieldTypeString';
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Sets up Id attribute for map segmentation.
|
|
140
|
+
* @param storageAttribute - attribute for map segmentation .
|
|
141
|
+
*/
|
|
142
|
+
setupIdAttribute(storageAttribute) {
|
|
143
|
+
storageAttribute.attributeValues = {
|
|
144
|
+
valueType: 'Oid32',
|
|
145
|
+
valuesPerElement: 1
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Sets up storage attribute as string.
|
|
150
|
+
* @param storageAttribute - attribute for map segmentation.
|
|
151
|
+
*/
|
|
152
|
+
setupStringAttribute(storageAttribute) {
|
|
153
|
+
// @ts-expect-error
|
|
154
|
+
storageAttribute.ordering.unshift('attributeByteCounts');
|
|
155
|
+
storageAttribute.header.push({ property: 'attributeValuesByteCount', valueType: 'UInt32' });
|
|
156
|
+
storageAttribute.attributeValues = {
|
|
157
|
+
valueType: 'String',
|
|
158
|
+
encoding: 'UTF-8',
|
|
159
|
+
valuesPerElement: 1
|
|
160
|
+
};
|
|
161
|
+
storageAttribute.attributeByteCounts = {
|
|
162
|
+
valueType: 'UInt32',
|
|
163
|
+
valuesPerElement: 1
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Sets up double attribute for map segmentation.
|
|
168
|
+
* @param storageAttribute - attribute for map segmentation .
|
|
169
|
+
*/
|
|
170
|
+
setupDoubleAttribute(storageAttribute) {
|
|
171
|
+
storageAttribute.attributeValues = {
|
|
172
|
+
valueType: 'Float64',
|
|
173
|
+
valuesPerElement: 1
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Sets up field attribute for map segmentation.
|
|
178
|
+
* @param key - attribute for map segmentation.
|
|
179
|
+
* @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').
|
|
180
|
+
*/
|
|
181
|
+
createFieldAttribute(key, fieldAttributeType) {
|
|
182
|
+
return {
|
|
183
|
+
name: key,
|
|
184
|
+
type: fieldAttributeType,
|
|
185
|
+
alias: key
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Generates popup info to show metadata on the map.
|
|
190
|
+
* @param propertyNames - array of property names including OBJECTID.
|
|
191
|
+
* @return data for correct rendering of popup.
|
|
192
|
+
*/
|
|
193
|
+
createPopupInfo(propertyNames) {
|
|
194
|
+
const title = '{OBJECTID}';
|
|
195
|
+
const mediaInfos = [];
|
|
196
|
+
const fieldInfos = [];
|
|
197
|
+
const popupElements = [];
|
|
198
|
+
const expressionInfos = [];
|
|
199
|
+
for (const propertyName of propertyNames) {
|
|
200
|
+
fieldInfos.push({
|
|
201
|
+
fieldName: propertyName,
|
|
202
|
+
visible: true,
|
|
203
|
+
isEditable: false,
|
|
204
|
+
label: propertyName
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
popupElements.push({
|
|
208
|
+
fieldInfos,
|
|
209
|
+
type: 'fields'
|
|
210
|
+
});
|
|
211
|
+
return {
|
|
212
|
+
title,
|
|
213
|
+
mediaInfos,
|
|
214
|
+
popupElements,
|
|
215
|
+
fieldInfos,
|
|
216
|
+
expressionInfos
|
|
217
|
+
};
|
|
148
218
|
}
|
|
149
|
-
popupElements.push({
|
|
150
|
-
fieldInfos,
|
|
151
|
-
type: 'fields'
|
|
152
|
-
});
|
|
153
|
-
return {
|
|
154
|
-
title,
|
|
155
|
-
mediaInfos,
|
|
156
|
-
popupElements,
|
|
157
|
-
fieldInfos,
|
|
158
|
-
expressionInfos
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
219
|
}
|
|
162
|
-
//# sourceMappingURL=attribute-metadata-info.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GLTFAccessorPostprocessed, GLTFMeshPrimitivePostprocessed } from '@loaders.gl/gltf';
|
|
2
2
|
import type { NumericArray } from '@loaders.gl/loader-utils';
|
|
3
|
-
import { TextureImageProperties } from
|
|
3
|
+
import { TextureImageProperties } from "../types.js";
|
|
4
4
|
import { Tiles3DTileContent } from '@loaders.gl/3d-tiles';
|
|
5
5
|
/**
|
|
6
6
|
* Get featureTexture by a metadata class.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-ids-extensions.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/batch-ids-extensions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"batch-ids-extensions.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/batch-ids-extensions.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,yBAAyB,EAAE,8BAA8B,EAAC,MAAM,kBAAkB,CAAC;AAC3F,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAU3D,OAAO,EAAC,sBAAsB,EAAC,oBAAiB;AAGhD,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAExD;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,kBAAkB,EAC/B,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM,GAAG,IAAI,CAcf;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE;IACV,CAAC,GAAG,EAAE,MAAM,GAAG,yBAAyB,CAAC;CAC1C,EACD,SAAS,EAAE,8BAA8B,EACzC,MAAM,EAAE,CAAC,sBAAsB,GAAG,IAAI,CAAC,EAAE,EACzC,cAAc,EAAE,MAAM,GAAG,IAAI,GAC5B,YAAY,CAuBd"}
|