@loaders.gl/tile-converter 3.2.12 → 3.3.0-alpha.10
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-attributes-worker.d.ts +3 -3
- package/dist/3d-tiles-attributes-worker.d.ts.map +1 -1
- package/dist/3d-tiles-attributes-worker.js +2 -3
- package/dist/3d-tiles-attributes-worker.js.map +3 -3
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +8 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +57 -43
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +5 -5
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +21 -17
- package/dist/converter-cli.js +43 -8
- package/dist/converter.min.js +24 -21
- package/dist/deps-installer/deps-installer.d.ts +5 -1
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/deps-installer/deps-installer.js +29 -1
- package/dist/dist.min.js +58405 -61237
- package/dist/es5/3d-tiles-attributes-worker.js +4 -7
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +125 -210
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +53 -85
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -8
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js +0 -5
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js +0 -6
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +1 -1
- package/dist/es5/bundle.js +0 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/constants.js.map +1 -1
- package/dist/es5/converter-cli.js +50 -60
- package/dist/es5/converter-cli.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +73 -28
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +3 -6
- package/dist/es5/i3s-attributes-worker.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +124 -0
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +2 -19
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +0 -11
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +184 -0
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +60 -51
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +516 -356
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +57 -43
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-debug.js +4 -23
- package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-index-document.js +507 -0
- package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/node-pages.js +462 -208
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +722 -1153
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/geometry-definitions.js +107 -0
- package/dist/es5/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/layers.js +2 -107
- package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/metadata.js +0 -2
- package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/node.js +2 -12
- package/dist/es5/i3s-converter/json-templates/node.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/scene-server.js +0 -2
- package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/shared-resources.js +9 -32
- package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/store.js.map +1 -1
- package/dist/es5/i3s-converter/types.js.map +1 -1
- package/dist/es5/i3s-server/app.js +0 -5
- package/dist/es5/i3s-server/app.js.map +1 -1
- package/dist/es5/i3s-server/controllers/index-controller.js +0 -16
- package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/es5/i3s-server/routes/index.js +1 -10
- package/dist/es5/i3s-server/routes/index.js.map +1 -1
- package/dist/es5/index.js +0 -3
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/utils/compress-util.js +19 -74
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/file-utils.js +103 -47
- package/dist/es5/lib/utils/file-utils.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js +0 -7
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/lib/utils/queue.js +0 -14
- package/dist/es5/lib/utils/queue.js.map +1 -1
- package/dist/es5/lib/utils/statistic-utills.js +1 -46
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
- package/dist/es5/lib/utils/write-queue.js +41 -82
- package/dist/es5/lib/utils/write-queue.js.map +1 -1
- package/dist/es5/pgm-loader.js +1 -8
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +2 -9
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/workers/i3s-attributes-worker.js +2 -10
- package/dist/es5/workers/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +4 -2
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +60 -77
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +29 -50
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +1 -0
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js +1 -4
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/esm/3d-tiles-converter/json-templates/tileset.js +0 -3
- package/dist/esm/3d-tiles-converter/json-templates/tileset.js.map +1 -1
- package/dist/esm/bundle.js +1 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/converter-cli.js +46 -40
- package/dist/esm/converter-cli.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +30 -4
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +3 -1
- package/dist/esm/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +113 -0
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js +5 -6
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js +1 -0
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +158 -0
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +39 -33
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +295 -196
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +59 -34
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-debug.js +3 -13
- package/dist/esm/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-index-document.js +197 -0
- package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/node-pages.js +161 -87
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +216 -491
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/geometry-definitions.js +89 -0
- package/dist/esm/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/layers.js +2 -95
- package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/node.js +0 -4
- package/dist/esm/i3s-converter/json-templates/node.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/shared-resources.js +3 -15
- package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/store.js.map +1 -1
- package/dist/esm/i3s-converter/types.js.map +1 -1
- package/dist/esm/i3s-server/app.js +0 -5
- package/dist/esm/i3s-server/app.js.map +1 -1
- package/dist/esm/i3s-server/controllers/index-controller.js +0 -5
- package/dist/esm/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/esm/i3s-server/routes/index.js +0 -3
- package/dist/esm/i3s-server/routes/index.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/utils/compress-util.js +19 -12
- package/dist/esm/lib/utils/compress-util.js.map +1 -1
- package/dist/esm/lib/utils/file-utils.js +54 -11
- package/dist/esm/lib/utils/file-utils.js.map +1 -1
- package/dist/esm/lib/utils/lod-conversion-utils.js +2 -6
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/esm/lib/utils/queue.js +0 -4
- package/dist/esm/lib/utils/queue.js.map +1 -1
- package/dist/esm/lib/utils/statistic-utills.js +0 -11
- package/dist/esm/lib/utils/statistic-utills.js.map +1 -1
- package/dist/esm/lib/utils/write-queue.js +27 -38
- package/dist/esm/lib/utils/write-queue.js.map +1 -1
- package/dist/esm/pgm-loader.js +3 -1
- package/dist/esm/pgm-loader.js.map +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js +4 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/workers/i3s-attributes-worker.js +4 -1
- package/dist/esm/workers/i3s-attributes-worker.js.map +1 -1
- package/dist/i3s-attributes-worker.d.ts +7 -3
- package/dist/i3s-attributes-worker.d.ts.map +1 -1
- package/dist/i3s-attributes-worker.js +2 -3
- package/dist/i3s-attributes-worker.js.map +3 -3
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +11 -0
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +141 -0
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +2 -2
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.d.ts +56 -0
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/feature-attributes.js +216 -0
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js +42 -17
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +18 -6
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +349 -99
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +53 -21
- package/dist/i3s-converter/helpers/node-index-document.d.ts +91 -0
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/node-index-document.js +242 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts +81 -42
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +200 -92
- package/dist/i3s-converter/i3s-converter.d.ts +52 -108
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +218 -403
- package/dist/i3s-converter/json-templates/geometry-definitions.d.ts +7 -0
- package/dist/i3s-converter/json-templates/geometry-definitions.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/geometry-definitions.js +87 -0
- package/dist/i3s-converter/json-templates/layers.d.ts +1 -30
- package/dist/i3s-converter/json-templates/layers.d.ts.map +1 -1
- package/dist/i3s-converter/json-templates/layers.js +2 -86
- package/dist/i3s-converter/json-templates/shared-resources.js +3 -3
- package/dist/i3s-converter/types.d.ts +38 -8
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/dist/lib/utils/file-utils.d.ts +17 -1
- package/dist/lib/utils/file-utils.d.ts.map +1 -1
- package/dist/lib/utils/file-utils.js +64 -7
- package/dist/lib/utils/write-queue.d.ts +19 -3
- package/dist/lib/utils/write-queue.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.js +21 -16
- package/dist/pgm-loader.d.ts.map +1 -1
- package/dist/pgm-loader.js +2 -1
- package/dist/workers/3d-tiles-attributes-worker.js +1 -1
- package/dist/workers/i3s-attributes-worker.js +1 -1
- package/package.json +18 -16
- package/src/3d-tiles-attributes-worker.ts +1 -1
- package/src/3d-tiles-converter/3d-tiles-converter.ts +71 -55
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +25 -18
- package/src/converter-cli.ts +54 -8
- package/src/deps-installer/deps-installer.ts +38 -2
- package/src/i3s-attributes-worker.ts +5 -1
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +206 -0
- package/src/i3s-converter/helpers/coordinate-converter.ts +2 -2
- package/src/i3s-converter/helpers/feature-attributes.ts +247 -0
- package/src/i3s-converter/helpers/geometry-attributes.ts +46 -18
- package/src/i3s-converter/helpers/geometry-converter.ts +423 -111
- package/src/i3s-converter/helpers/gltf-attributes.ts +59 -24
- package/src/i3s-converter/helpers/node-index-document.ts +306 -0
- package/src/i3s-converter/helpers/node-pages.ts +222 -109
- package/src/i3s-converter/i3s-converter.ts +264 -487
- package/src/i3s-converter/json-templates/geometry-definitions.ts +83 -0
- package/src/i3s-converter/json-templates/layers.ts +2 -91
- package/src/i3s-converter/json-templates/shared-resources.ts +3 -3
- package/src/i3s-converter/types.ts +33 -2
- package/src/lib/utils/file-utils.ts +62 -7
- package/src/lib/utils/write-queue.ts +42 -19
- package/src/pgm-loader.ts +2 -2
- package/src/workers/3d-tiles-attributes-worker.ts +1 -1
- package/src/workers/i3s-attributes-worker.ts +2 -1
|
@@ -1,21 +1,47 @@
|
|
|
1
|
-
import { load } from '@loaders.gl/core';
|
|
1
|
+
import { load, fetchFile } from '@loaders.gl/core';
|
|
2
2
|
import { ZipLoader } from '@loaders.gl/zip';
|
|
3
3
|
import { writeFile } from '../lib/utils/file-utils';
|
|
4
4
|
import { join } from 'path';
|
|
5
|
+
import { ChildProcessProxy } from '@loaders.gl/worker-utils';
|
|
6
|
+
|
|
7
|
+
const VERSION = typeof "3.3.0-alpha.10" !== 'undefined' ? "3.3.0-alpha.10" : 'beta';
|
|
5
8
|
const PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';
|
|
9
|
+
|
|
6
10
|
export class DepsInstaller {
|
|
7
|
-
async install(
|
|
11
|
+
async install() {
|
|
12
|
+
let path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
13
|
+
let workersPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
8
14
|
console.log('Installing "EGM2008-5" model...');
|
|
9
15
|
const fileMap = await load(PGM_LINK, ZipLoader, {});
|
|
10
16
|
let depsPath = process.cwd();
|
|
11
|
-
|
|
12
17
|
if (path) {
|
|
13
18
|
depsPath = join(depsPath, path);
|
|
14
19
|
}
|
|
15
|
-
|
|
16
20
|
await writeFile(depsPath, new Uint8Array(fileMap['geoids/egm2008-5.pgm']), 'egm2008-5.pgm');
|
|
21
|
+
console.log('Installing "I3S Content Loader worker"');
|
|
22
|
+
await this.installWorker('i3s', 'i3s-content-nodejs-worker.js', workersPath);
|
|
23
|
+
console.log('Installing "Draco Loader worker"');
|
|
24
|
+
await this.installWorker('draco', 'draco-nodejs-worker.js', workersPath);
|
|
25
|
+
console.log('Installing "Basis Loader worker"');
|
|
26
|
+
await this.installWorker('textures', 'basis-nodejs-worker.js', workersPath);
|
|
27
|
+
console.log('Installing "join-images" npm package');
|
|
28
|
+
const childProcess = new ChildProcessProxy();
|
|
29
|
+
await childProcess.start({
|
|
30
|
+
command: 'npm',
|
|
31
|
+
arguments: ['install', 'sharp', 'join-images'],
|
|
32
|
+
wait: 0
|
|
33
|
+
});
|
|
17
34
|
console.log('All dependencies were installed succesfully.');
|
|
18
35
|
}
|
|
19
36
|
|
|
37
|
+
async installWorker(module, name, extraPath) {
|
|
38
|
+
const fileResponse = await fetchFile("https://unpkg.com/@loaders.gl/".concat(module, "@").concat(VERSION, "/dist/").concat(name));
|
|
39
|
+
const fileData = await fileResponse.arrayBuffer();
|
|
40
|
+
if (!fileData) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const path = join(process.cwd(), extraPath, 'modules', module, 'dist');
|
|
44
|
+
await writeFile(path, fileData, name);
|
|
45
|
+
}
|
|
20
46
|
}
|
|
21
47
|
//# sourceMappingURL=deps-installer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"deps-installer.js","names":["load","fetchFile","ZipLoader","writeFile","join","ChildProcessProxy","VERSION","PGM_LINK","DepsInstaller","install","path","workersPath","console","log","fileMap","depsPath","process","cwd","Uint8Array","installWorker","childProcess","start","command","arguments","wait","module","name","extraPath","fileResponse","fileData","arrayBuffer"],"sources":["../../../src/deps-installer/deps-installer.ts"],"sourcesContent":["import {load, fetchFile} from '@loaders.gl/core';\nimport {ZipLoader} from '@loaders.gl/zip';\nimport {writeFile} from '../lib/utils/file-utils';\nimport {join} from 'path';\nimport {ChildProcessProxy} from '@loaders.gl/worker-utils';\n\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n\nconst PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';\n\n/**\n * Install external dependencies for converter:\n * * PGM file (implemented);\n * * Draco library (not implemented);\n * * 7z archiver (not implemented);\n */\nexport class DepsInstaller {\n /**\n * Run instalation\n * @param path destination folder\n * @param workersPath destination folder for workers.\n * This path is '' by default and is not used by tile-converter.\n * It is used in tests to prevent rewriting actual workers during tests running\n */\n async install(path: string = '', workersPath: string = ''): Promise<void> {\n console.log('Installing \"EGM2008-5\" model...'); // eslint-disable-line no-console\n const fileMap = await load(PGM_LINK, ZipLoader, {});\n\n let depsPath = process.cwd();\n if (path) {\n depsPath = join(depsPath, path);\n }\n\n await writeFile(depsPath, new Uint8Array(fileMap['geoids/egm2008-5.pgm']), 'egm2008-5.pgm');\n\n console.log('Installing \"I3S Content Loader worker\"'); // eslint-disable-line no-console\n await this.installWorker('i3s', 'i3s-content-nodejs-worker.js', workersPath);\n\n console.log('Installing \"Draco Loader worker\"'); // eslint-disable-line no-console\n await this.installWorker('draco', 'draco-nodejs-worker.js', workersPath);\n\n console.log('Installing \"Basis Loader worker\"'); // eslint-disable-line no-console\n await this.installWorker('textures', 'basis-nodejs-worker.js', workersPath);\n\n console.log('Installing \"join-images\" npm package');\n const childProcess = new ChildProcessProxy();\n await childProcess.start({\n command: 'npm',\n arguments: ['install', 'sharp', 'join-images'],\n wait: 0\n });\n\n console.log('All dependencies were installed succesfully.'); // eslint-disable-line no-console\n }\n\n private async installWorker(module: string, name: string, extraPath: string) {\n const fileResponse = await fetchFile(\n `https://unpkg.com/@loaders.gl/${module}@${VERSION}/dist/${name}`\n );\n const fileData = await fileResponse.arrayBuffer();\n if (!fileData) {\n return;\n }\n const path = join(process.cwd(), extraPath, 'modules', module, 'dist');\n await writeFile(path, fileData, name);\n }\n}\n"],"mappings":"AAAA,SAAQA,IAAI,EAAEC,SAAS,QAAO,kBAAkB;AAChD,SAAQC,SAAS,QAAO,iBAAiB;AACzC,SAAQC,SAAS,QAAO,yBAAyB;AACjD,SAAQC,IAAI,QAAO,MAAM;AACzB,SAAQC,iBAAiB,QAAO,0BAA0B;;AAG1D,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,MAAM;AAEzE,MAAMC,QAAQ,GAAG,+EAA+E;;AAQhG,OAAO,MAAMC,aAAa,CAAC;EAQzB,MAAMC,OAAO,GAA6D;IAAA,IAA5DC,IAAY,uEAAG,EAAE;IAAA,IAAEC,WAAmB,uEAAG,EAAE;IACvDC,OAAO,CAACC,GAAG,CAAC,iCAAiC,CAAC;IAC9C,MAAMC,OAAO,GAAG,MAAMd,IAAI,CAACO,QAAQ,EAAEL,SAAS,EAAE,CAAC,CAAC,CAAC;IAEnD,IAAIa,QAAQ,GAAGC,OAAO,CAACC,GAAG,EAAE;IAC5B,IAAIP,IAA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tE,MAAMtB,SAAS,CAACO,IAAI,EAAEmB,QAAQ,EAAEH,IAAI,CAAC;EACvC;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { processOnWorker } from '@loaders.gl/worker-utils';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const VERSION = typeof "3.3.0-alpha.10" !== 'undefined' ? "3.3.0-alpha.10" : 'latest';
|
|
3
4
|
export const I3SAttributesWorker = {
|
|
4
5
|
id: 'i3s-attributes',
|
|
5
6
|
name: 'I3S Attributes Worker',
|
|
@@ -9,6 +10,7 @@ export const I3SAttributesWorker = {
|
|
|
9
10
|
useCartesianPositions: false
|
|
10
11
|
}
|
|
11
12
|
};
|
|
13
|
+
|
|
12
14
|
export function transformI3SAttributesOnWorker(attributesData, options) {
|
|
13
15
|
return processOnWorker(I3SAttributesWorker, attributesData, options);
|
|
14
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"i3s-attributes-worker.js","names":["processOnWorker","VERSION","I3SAttributesWorker","id","name","module","version","options","useCartesianPositions","transformI3SAttributesOnWorker","attributesData","_typecheckI3SAttributesWorker"],"sources":["../../src/i3s-attributes-worker.ts"],"sourcesContent":["import type {WorkerObject} from '@loaders.gl/worker-utils';\nimport type {ConvertedAttributes} from './i3s-converter/types';\nimport type {Matrix4, Vector3} from '@math.gl/core';\nimport type {GLTFImagePostprocessed, GLTFNodePostprocessed} from '@loaders.gl/gltf';\n\nimport {processOnWorker} from '@loaders.gl/worker-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type I3SAttributesWorkerOptions = {\n _nodeWorkers: boolean;\n reuseWorkers: boolean;\n useCartesianPositions: boolean;\n source: string;\n};\n\nexport type B3DMAttributesData = {\n gltfMaterials?: {id: string}[];\n nodes: GLTFNodePostprocessed[];\n images: GLTFImagePostprocessed[];\n cartographicOrigin: Vector3;\n cartesianModelMatrix: Matrix4;\n};\n\n/**\n * I3S Attributes Worker to handle B3DM object\n */\nexport const I3SAttributesWorker = {\n id: 'i3s-attributes',\n name: 'I3S Attributes Worker',\n module: 'tile-converter',\n version: VERSION,\n options: {\n useCartesianPositions: false\n }\n};\n\n/**\n * Performs I3S attributes transformation\n */\nexport function transformI3SAttributesOnWorker(\n attributesData: B3DMAttributesData,\n options: I3SAttributesWorkerOptions\n): Promise<Map<string, ConvertedAttributes>> {\n return processOnWorker(I3SAttributesWorker, attributesData, options);\n}\n\nexport const _typecheckI3SAttributesWorker: WorkerObject = I3SAttributesWorker;\n"],"mappings":"AAKA,SAAQA,eAAe,QAAO,0BAA0B;;AAIxD,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAoB3E,OAAO,MAAMC,mBAAmB,GAAG;EACjCC,EAAE,EAAE,gBAAgB;EACpBC,IAAI,EAAE,uBAAuB;EAC7BC,MAAM,EAAE,gBAAgB;EACxBC,OAAO,EAAEL,OAAO;EAChBM,OAAO,EAAE;IACPC,qBAAqB,EAAE;EACzB;AACF,CAAC;;AAKD,OAAO,SAASC,8BAA8B,CAC5CC,cAAkC,EAClCH,OAAmC,EACQ;EAC3C,OAAOP,eAAe,CAACE,mBAAmB,EAAEQ,cAAc,EAAEH,OAAO,CAAC;AACtE;AAEA,OAAO,MAAMI,6BAA2C,GAAGT,mBAAmB"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
const EXT_MESH_FEATURES = 'EXT_mesh_features';
|
|
2
|
+
const EXT_FEATURE_METADATA = 'EXT_feature_metadata';
|
|
3
|
+
|
|
4
|
+
export function handleBatchIdsExtensions(attributes, primitive, images) {
|
|
5
|
+
const extensions = primitive === null || primitive === void 0 ? void 0 : primitive.extensions;
|
|
6
|
+
if (!extensions) {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
for (const [extensionName, extensionData] of Object.entries(extensions || {})) {
|
|
10
|
+
switch (extensionName) {
|
|
11
|
+
case EXT_FEATURE_METADATA:
|
|
12
|
+
return handleExtFeatureMetadataExtension(attributes, extensionData, images);
|
|
13
|
+
case EXT_MESH_FEATURES:
|
|
14
|
+
console.warn('EXT_mesh_features extension is not supported yet');
|
|
15
|
+
return [];
|
|
16
|
+
default:
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function handleExtFeatureMetadataExtension(attributes, extFeatureMetadata, images) {
|
|
24
|
+
var _extFeatureMetadata$f, _featureIdAttribute$f, _featureIdAttribute$f2, _featureIdAttribute$f3;
|
|
25
|
+
const featureIdAttribute = extFeatureMetadata === null || extFeatureMetadata === void 0 ? void 0 : (_extFeatureMetadata$f = extFeatureMetadata.featureIdAttributes) === null || _extFeatureMetadata$f === void 0 ? void 0 : _extFeatureMetadata$f[0];
|
|
26
|
+
if (featureIdAttribute !== null && featureIdAttribute !== void 0 && (_featureIdAttribute$f = featureIdAttribute.featureIds) !== null && _featureIdAttribute$f !== void 0 && _featureIdAttribute$f.attribute) {
|
|
27
|
+
const batchIdsAttribute = attributes[featureIdAttribute.featureIds.attribute];
|
|
28
|
+
return batchIdsAttribute.value;
|
|
29
|
+
}
|
|
30
|
+
if (featureIdAttribute !== null && featureIdAttribute !== void 0 && (_featureIdAttribute$f2 = featureIdAttribute.featureIds) !== null && _featureIdAttribute$f2 !== void 0 && _featureIdAttribute$f2.hasOwnProperty('constant') && featureIdAttribute !== null && featureIdAttribute !== void 0 && (_featureIdAttribute$f3 = featureIdAttribute.featureIds) !== null && _featureIdAttribute$f3 !== void 0 && _featureIdAttribute$f3.hasOwnProperty('divisor')) {
|
|
31
|
+
var _attributes$POSITIONS;
|
|
32
|
+
const featuresCount = (attributes === null || attributes === void 0 ? void 0 : (_attributes$POSITIONS = attributes.POSITIONS) === null || _attributes$POSITIONS === void 0 ? void 0 : _attributes$POSITIONS.value.length) / 3 || 0;
|
|
33
|
+
return generateImplicitFeatureIds(featuresCount, featureIdAttribute.featureIds.constant, featureIdAttribute.featureIds.divisor);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const featureIdTexture = (extFeatureMetadata === null || extFeatureMetadata === void 0 ? void 0 : extFeatureMetadata.featureIdTextures) && (extFeatureMetadata === null || extFeatureMetadata === void 0 ? void 0 : extFeatureMetadata.featureIdTextures[0]);
|
|
37
|
+
if (featureIdTexture) {
|
|
38
|
+
var _featureIdTexture$fea, _featureIdTexture$fea2;
|
|
39
|
+
const textureAttributeIndex = (featureIdTexture === null || featureIdTexture === void 0 ? void 0 : (_featureIdTexture$fea = featureIdTexture.featureIds) === null || _featureIdTexture$fea === void 0 ? void 0 : (_featureIdTexture$fea2 = _featureIdTexture$fea.texture) === null || _featureIdTexture$fea2 === void 0 ? void 0 : _featureIdTexture$fea2.texCoord) || 0;
|
|
40
|
+
const textCoordAttribute = "TEXCOORD_".concat(textureAttributeIndex);
|
|
41
|
+
const textureCoordinates = attributes[textCoordAttribute].value;
|
|
42
|
+
return generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, images);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const featureTexture = (extFeatureMetadata === null || extFeatureMetadata === void 0 ? void 0 : extFeatureMetadata.featureTextures) && (extFeatureMetadata === null || extFeatureMetadata === void 0 ? void 0 : extFeatureMetadata.featureTextures[0]);
|
|
46
|
+
|
|
47
|
+
if (featureTexture) {
|
|
48
|
+
console.warn("EXT_feature_metadata doesn't yet support featureTextures in primitive");
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function generateImplicitFeatureIds(featuresCount) {
|
|
55
|
+
let constant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
56
|
+
let divisor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
57
|
+
let featureIds = [];
|
|
58
|
+
if (divisor > 0) {
|
|
59
|
+
let currentValue = constant;
|
|
60
|
+
let devisorCounter = divisor;
|
|
61
|
+
for (let index = 0; index < featuresCount; index++) {
|
|
62
|
+
featureIds.push(currentValue);
|
|
63
|
+
devisorCounter -= 1;
|
|
64
|
+
if (devisorCounter === 0) {
|
|
65
|
+
currentValue++;
|
|
66
|
+
devisorCounter = divisor;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
featureIds = Array(featuresCount).fill(constant, 0, featuresCount);
|
|
71
|
+
}
|
|
72
|
+
return featureIds;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, images) {
|
|
76
|
+
var _featureIdTexture$fea3, _featureIdTexture$fea4, _featureIdTexture$fea5;
|
|
77
|
+
if (!(images !== null && images !== void 0 && images.length)) {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
const CHANNELS_MAP = {
|
|
81
|
+
r: 0,
|
|
82
|
+
g: 1,
|
|
83
|
+
b: 2,
|
|
84
|
+
a: 3
|
|
85
|
+
};
|
|
86
|
+
const textureIndex = featureIdTexture === null || featureIdTexture === void 0 ? void 0 : (_featureIdTexture$fea3 = featureIdTexture.featureIds) === null || _featureIdTexture$fea3 === void 0 ? void 0 : (_featureIdTexture$fea4 = _featureIdTexture$fea3.texture) === null || _featureIdTexture$fea4 === void 0 ? void 0 : _featureIdTexture$fea4.index;
|
|
87
|
+
const featureChannel = featureIdTexture === null || featureIdTexture === void 0 ? void 0 : (_featureIdTexture$fea5 = featureIdTexture.featureIds) === null || _featureIdTexture$fea5 === void 0 ? void 0 : _featureIdTexture$fea5.channels;
|
|
88
|
+
if (!featureChannel || textureIndex === undefined) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
const image = images[textureIndex];
|
|
92
|
+
const batchIds = [];
|
|
93
|
+
const channels = CHANNELS_MAP[featureChannel];
|
|
94
|
+
if (!image.compressed) {
|
|
95
|
+
for (let index = 0; index < textureCoordinates.length; index += 2) {
|
|
96
|
+
const u = textureCoordinates[index];
|
|
97
|
+
const v = textureCoordinates[index + 1];
|
|
98
|
+
const tx = Math.min(emod(u) * image.width | 0, image.width - 1);
|
|
99
|
+
const ty = Math.min(emod(v) * image.height | 0, image.height - 1);
|
|
100
|
+
const offset = (ty * image.width + tx) * image.components + channels;
|
|
101
|
+
const batchId = new Uint8Array(image.data)[offset];
|
|
102
|
+
batchIds.push(batchId);
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
console.warn("Can't get batch Ids from ".concat(image.mimeType, " compressed texture"));
|
|
106
|
+
}
|
|
107
|
+
return batchIds;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function emod(n) {
|
|
111
|
+
return (n % 1 + 1) % 1;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=batch-ids-extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-ids-extensions.js","names":["EXT_MESH_FEATURES","EXT_FEATURE_METADATA","handleBatchIdsExtensions","attributes","primitive","images","extensions","extensionName","extensionData","Object","entries","handleExtFeatureMetadataExtension","console","warn","extFeatureMetadata","featureIdAttribute","featureIdAttributes","featureIds","attribute","batchIdsAttribute","value","hasOwnProperty","featuresCount","POSITIONS","length","generateImplicitFeatureIds","constant","divisor","featureIdTexture","featureIdTextures","textureAttributeIndex","texture","texCoord","textCoordAttribute","textureCoordinates","generateBatchIdsFromTexture","featureTexture","featureTextures","currentValue","devisorCounter","index","push","Array","fill","CHANNELS_MAP","r","g","b","a","textureIndex","featureChannel","channels","undefined","image","batchIds","compressed","u","v","tx","Math","min","emod","width","ty","height","offset","components","batchId","Uint8Array","data","mimeType","n"],"sources":["../../../../src/i3s-converter/helpers/batch-ids-extensions.ts"],"sourcesContent":["import {\n GLTFAccessorPostprocessed,\n GLTFImagePostprocessed,\n GLTFMeshPrimitivePostprocessed\n} from '@loaders.gl/gltf';\nimport type {\n GLTF_EXT_feature_metadata_attribute,\n GLTF_EXT_feature_metadata_primitive\n} from 'modules/gltf/src/lib/types/gltf-json-schema';\n\nconst EXT_MESH_FEATURES = 'EXT_mesh_features';\nconst EXT_FEATURE_METADATA = 'EXT_feature_metadata';\n\n/**\n * Getting batchIds from 3DTilesNext extensions.\n * @param attributes - gltf accessors\n * @param primitive - gltf primitive data\n * @param images - gltf texture images\n */\nexport function handleBatchIdsExtensions(\n attributes: {\n [key: string]: GLTFAccessorPostprocessed;\n },\n primitive: GLTFMeshPrimitivePostprocessed,\n images: GLTFImagePostprocessed[]\n): number[] {\n const extensions = primitive?.extensions;\n\n if (!extensions) {\n return [];\n }\n\n for (const [extensionName, extensionData] of Object.entries(extensions || {})) {\n switch (extensionName) {\n case EXT_FEATURE_METADATA:\n return handleExtFeatureMetadataExtension(\n attributes,\n extensionData as GLTF_EXT_feature_metadata_primitive,\n images\n );\n case EXT_MESH_FEATURES:\n console.warn('EXT_mesh_features extension is not supported yet');\n return [];\n default:\n return [];\n }\n }\n\n return [];\n}\n\n/**\n * Get batchIds from EXT_feature_metadata extension.\n * Docs - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata\n * @param attributes\n * @param extFeatureMetadata\n * @param textures\n */\nfunction handleExtFeatureMetadataExtension(\n attributes: {\n [key: string]: GLTFAccessorPostprocessed;\n },\n extFeatureMetadata: GLTF_EXT_feature_metadata_primitive,\n images: GLTFImagePostprocessed[]\n): number[] {\n // Take only first extension object to get batchIds attribute name.\n const featureIdAttribute = extFeatureMetadata?.featureIdAttributes?.[0];\n\n if (featureIdAttribute?.featureIds?.attribute) {\n const batchIdsAttribute = attributes[featureIdAttribute.featureIds.attribute];\n return batchIdsAttribute.value;\n }\n\n if (\n featureIdAttribute?.featureIds?.hasOwnProperty('constant') &&\n featureIdAttribute?.featureIds?.hasOwnProperty('divisor')\n ) {\n const featuresCount = attributes?.POSITIONS?.value.length / 3 || 0;\n return generateImplicitFeatureIds(\n featuresCount,\n featureIdAttribute.featureIds.constant,\n featureIdAttribute.featureIds.divisor\n );\n }\n\n // Take only first extension object to get batchIds attribute name.\n const featureIdTexture =\n extFeatureMetadata?.featureIdTextures && extFeatureMetadata?.featureIdTextures[0];\n\n if (featureIdTexture) {\n const textureAttributeIndex = featureIdTexture?.featureIds?.texture?.texCoord || 0;\n const textCoordAttribute = `TEXCOORD_${textureAttributeIndex}`;\n const textureCoordinates = attributes[textCoordAttribute].value;\n return generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, images);\n }\n\n // Take only first extension texture to get batchIds from the root EXT_feature_metadata object.\n const featureTexture =\n extFeatureMetadata?.featureTextures && extFeatureMetadata?.featureTextures[0];\n\n /**\n * TODO need to get batchIds from root extension\n */\n if (featureTexture) {\n console.warn(\"EXT_feature_metadata doesn't yet support featureTextures in primitive\");\n return [];\n }\n\n return [];\n}\n\n/**\n * Generates implicit feature ids\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#implicit-feature-ids\n * @param featuresCount\n * @param constant\n * @param devisor\n */\nfunction generateImplicitFeatureIds(\n featuresCount: number,\n constant: number = 0,\n divisor: number = 0\n): number[] {\n let featureIds: number[] = [];\n\n if (divisor > 0) {\n let currentValue = constant;\n let devisorCounter = divisor;\n\n for (let index = 0; index < featuresCount; index++) {\n featureIds.push(currentValue);\n\n devisorCounter -= 1;\n\n if (devisorCounter === 0) {\n currentValue++;\n devisorCounter = divisor;\n }\n }\n } else {\n featureIds = Array<number>(featuresCount).fill(constant, 0, featuresCount);\n }\n\n return featureIds;\n}\n\n/**\n * Get batchIds from texture.\n * @param primitive\n * @param featureIdTextures\n */\nfunction generateBatchIdsFromTexture(\n featureIdTexture: GLTF_EXT_feature_metadata_attribute,\n textureCoordinates: Float32Array,\n images: GLTFImagePostprocessed[]\n) {\n if (!images?.length) {\n return [];\n }\n\n const CHANNELS_MAP = {\n r: 0,\n g: 1,\n b: 2,\n a: 3\n };\n\n const textureIndex = featureIdTexture?.featureIds?.texture?.index;\n const featureChannel = featureIdTexture?.featureIds?.channels;\n\n if (!featureChannel || textureIndex === undefined) {\n return [];\n }\n\n const image = images[textureIndex];\n const batchIds: number[] = [];\n const channels = CHANNELS_MAP[featureChannel];\n\n if (!image.compressed) {\n for (let index = 0; index < textureCoordinates.length; index += 2) {\n const u = textureCoordinates[index];\n const v = textureCoordinates[index + 1];\n\n const tx = Math.min((emod(u) * image.width) | 0, image.width - 1);\n const ty = Math.min((emod(v) * image.height) | 0, image.height - 1);\n\n const offset = (ty * image.width + tx) * image.components + channels;\n const batchId = new Uint8Array(image.data)[offset];\n\n batchIds.push(batchId);\n }\n } else {\n console.warn(`Can't get batch Ids from ${image.mimeType} compressed texture`);\n }\n\n return batchIds;\n}\n\n/**\n * Handle UVs if they are out of range [0,1].\n * @param n\n * @param m\n */\nfunction emod(n: number): number {\n return ((n % 1) + 1) % 1;\n}\n"],"mappings":"AAUA,MAAMA,iBAAiB,GAAG,mBAAmB;AAC7C,MAAMC,oBAAoB,GAAG,sBAAsB;;AAQnD,OAAO,SAASC,wBAAwB,CACtCC,UAEC,EACDC,SAAyC,EACzCC,MAAgC,EACtB;EACV,MAAMC,UAAU,GAAGF,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEE,UAAU;EAExC,IAAI,CAACA,UAAU,EAAE;IACf,OAAO,EAAE;EACX;EAEA,KAAK,MAAM,CAACC,aAAa,EAAEC,aAAa,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACJ,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE;IAC7E,QAAQC,aAAa;MACnB,KAAKN,oBAAoB;QACvB,OAAOU,iCAAiC,CACtCR,UAAU,EACVK,aAAa,EACbH,MAAM,CACP;MACH,KAAKL,iBAAiB;QACpBY,OAAO,CAACC,IAAI,CAAC,kDAAkD,CAAC;QAChE,OAAO,EAAE;MACX;QACE,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AAGJ,IAAI,CAACC,GAAG,CAAEC,IAAI,CAACJ,CAAC,CAAC,GAAGJ,KAAK,CAACW,MAAM,GAAI,CAAC,EAAEX,KAAK,CAACW,MAAM,GAAG,CAAC,CAAC;MAEnE,MAAMC,MAAM,GAAG,CAACF,EAAE,GAAGV,KAAK,CAACS,KAAK,GAAGJ,EAAE,IAAIL,KAAK,CAACa,UAAU,GAAGf,QAAQ;MACpE,MAAMgB,OAAO,GAAG,IAAIC,UAAU,CAACf,KAAK,CAACgB,IAAI,CAAC,CAACJ,MAAM,CAAC;MAElDX,QAAQ,CAACb,IAAI,CAAC0B,OAAO,CAAC;IACxB;EACF,CAAC,MAAM;IACLvD,OAAO,CAACC,IAAI,oCAA6BwC,KAAK,CAACiB,QAAQ,yBAAsB;EAC/E;EAEA,OAAOhB,QAAQ;AACjB;;AAOA,SAASO,IAAI,CAACU,CAAS,EAAU;EAC/B,OAAO,CAAEA,CAAC,GAAG,CAAC,GAAI,CAAC,IAAI,CAAC;AAC1B"}
|
|
@@ -8,7 +8,6 @@ export function createBoundingVolumes(tile, geoidHeightModel) {
|
|
|
8
8
|
const boundingVolume = tile.boundingVolume;
|
|
9
9
|
const cartographicCenter = Ellipsoid.WGS84.cartesianToCartographic(boundingVolume.center, new Vector3());
|
|
10
10
|
cartographicCenter[2] = cartographicCenter[2] - geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
|
|
11
|
-
|
|
12
11
|
if (boundingVolume instanceof OrientedBoundingBox) {
|
|
13
12
|
halfSize = boundingVolume.halfSize;
|
|
14
13
|
radius = new Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
|
|
@@ -18,7 +17,6 @@ export function createBoundingVolumes(tile, geoidHeightModel) {
|
|
|
18
17
|
halfSize = [radius, radius, radius];
|
|
19
18
|
quaternion = new Quaternion().fromMatrix3(new Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]])).normalize();
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
return {
|
|
23
21
|
mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],
|
|
24
22
|
obb: {
|
|
@@ -28,6 +26,7 @@ export function createBoundingVolumes(tile, geoidHeightModel) {
|
|
|
28
26
|
}
|
|
29
27
|
};
|
|
30
28
|
}
|
|
29
|
+
|
|
31
30
|
export function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel) {
|
|
32
31
|
const positionVectors = convertPositionsToVectors(cartesianPositions);
|
|
33
32
|
const geometryObb = makeOrientedBoundingBoxFromPoints(positionVectors);
|
|
@@ -45,29 +44,28 @@ export function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeigh
|
|
|
45
44
|
}
|
|
46
45
|
};
|
|
47
46
|
}
|
|
47
|
+
|
|
48
48
|
export function convertPositionsToVectors(positions) {
|
|
49
49
|
const result = [];
|
|
50
|
-
|
|
51
50
|
for (let i = 0; i < positions.length; i += 3) {
|
|
52
51
|
const positionVector = new Vector3([positions[i], positions[i + 1], positions[i + 2]]);
|
|
53
52
|
result.push(positionVector);
|
|
54
53
|
}
|
|
55
|
-
|
|
56
54
|
return result;
|
|
57
55
|
}
|
|
56
|
+
|
|
58
57
|
export function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
|
|
59
58
|
let sphere;
|
|
60
|
-
|
|
61
59
|
if (boundingVolume instanceof BoundingSphere) {
|
|
62
60
|
sphere = boundingVolume;
|
|
63
61
|
} else {
|
|
64
62
|
sphere = boundingVolume.getBoundingSphere();
|
|
65
63
|
}
|
|
66
|
-
|
|
67
64
|
const center = sphere.center;
|
|
68
65
|
const radius = sphere.radius;
|
|
69
66
|
const vertexMax = Ellipsoid.WGS84.cartesianToCartographic(new Vector3(center[0] + radius, center[1] + radius, center[2] + radius), new Vector3());
|
|
70
67
|
const vertexMin = Ellipsoid.WGS84.cartesianToCartographic(new Vector3(center[0] - radius, center[1] - radius, center[2] - radius), new Vector3());
|
|
68
|
+
|
|
71
69
|
return {
|
|
72
70
|
xmin: Math.min(vertexMin[0], vertexMax[0]),
|
|
73
71
|
xmax: Math.max(vertexMin[0], vertexMax[0]),
|
|
@@ -77,6 +75,7 @@ export function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
|
|
|
77
75
|
zmax: Math.max(vertexMin[2], vertexMax[2])
|
|
78
76
|
};
|
|
79
77
|
}
|
|
78
|
+
|
|
80
79
|
export function createObbFromMbs(mbs) {
|
|
81
80
|
const radius = mbs[3];
|
|
82
81
|
const center = new Vector3(mbs[0], mbs[1], mbs[2]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/i3s-converter/helpers/coordinate-converter.ts"],"names":["Matrix3","Quaternion","Vector3","Ellipsoid","OrientedBoundingBox","makeOrientedBoundingBoxFromPoints","makeBoundingSphereFromPoints","BoundingSphere","createBoundingVolumes","tile","geoidHeightModel","radius","halfSize","quaternion","boundingVolume","cartographicCenter","WGS84","cartesianToCartographic","center","getHeight","len","fromMatrix3","normalize","mbs","obb","createBoundingVolumesFromGeometry","cartesianPositions","positionVectors","convertPositionsToVectors","geometryObb","geometryMbs","mbsCenter","obbCenter","positions","result","i","length","positionVector","push","convertBoundingVolumeToI3SFullExtent","sphere","getBoundingSphere","vertexMax","vertexMin","xmin","Math","min","xmax","max","ymin","ymax","zmin","zmax","createObbFromMbs","halfAxex"],"mappings":"AAEA,SAAQA,OAAR,EAAiBC,UAAjB,EAA6BC,OAA7B,QAA2C,eAA3C;AACA,SAAQC,SAAR,QAAwB,qBAAxB;AACA,SACEC,mBADF,EAEEC,iCAFF,EAGEC,4BAHF,EAIEC,cAJF,QAKO,kBALP;AAeA,OAAO,SAASC,qBAAT,CAA+BC,IAA/B,EAAiDC,gBAAjD,EAA2F;AAChG,MAAIC,MAAJ;AACA,MAAIC,QAAJ;AACA,MAAIC,UAAJ;AAEA,QAAMC,cAAc,GAAGL,IAAI,CAACK,cAA5B;AACA,QAAMC,kBAAkB,GAAGZ,SAAS,CAACa,KAAV,CAAgBC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EAAkBA,MAAlB,EAA0B,CAA1B,EAA6B,CAA7B,EAAgC,CAAhC,EAAmCA,MAAnC,CAAZ,CAAjB;AACA,SAAO,IAAIP,mBAAJ,CAAwBc,MAAxB,EAAgCoC,QAAhC,CAAP;AACD","sourcesContent":["import type {BoundingVolumes, FullExtent, Mbs, Obb} from '@loaders.gl/i3s';\n\nimport {Matrix3, Quaternion, Vector3} from '@math.gl/core';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {\n OrientedBoundingBox,\n makeOrientedBoundingBoxFromPoints,\n makeBoundingSphereFromPoints,\n BoundingSphere\n} from '@math.gl/culling';\nimport TileHeader from '@loaders.gl/tiles/src/tileset/tile-3d';\nimport {Geoid} from '@math.gl/geoid';\n\n/**\n * Create bounding volumes object from tile and geoid height model.\n * @param tile\n * @param geoidHeightModel\n * @returns - Bounding volumes object\n */\nexport function createBoundingVolumes(tile: TileHeader, geoidHeightModel: Geoid): BoundingVolumes {\n let radius;\n let halfSize;\n let quaternion;\n\n const boundingVolume = tile.boundingVolume;\n const cartographicCenter = Ellipsoid.WGS84.cartesianToCartographic(\n boundingVolume.center,\n new Vector3()\n );\n cartographicCenter[2] =\n cartographicCenter[2] -\n geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);\n if (boundingVolume instanceof OrientedBoundingBox) {\n halfSize = boundingVolume.halfSize;\n radius = new Vector3(halfSize[0], halfSize[1], halfSize[2]).len();\n quaternion = boundingVolume.quaternion;\n } else {\n radius = tile.boundingVolume.radius;\n halfSize = [radius, radius, radius];\n quaternion = new Quaternion()\n .fromMatrix3(new Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]]))\n .normalize();\n }\n\n return {\n mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],\n obb: {\n center: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2]],\n halfSize,\n quaternion\n }\n };\n}\n\n/**\n * Generates bounding volumes from geometry positions\n * @param cartesianPositions\n * @param geoidHeightModel\n */\nexport function createBoundingVolumesFromGeometry(\n cartesianPositions: Float32Array,\n geoidHeightModel: Geoid\n): {mbs: Mbs; obb: Obb} {\n const positionVectors = convertPositionsToVectors(cartesianPositions);\n\n const geometryObb = makeOrientedBoundingBoxFromPoints(positionVectors);\n const geometryMbs = makeBoundingSphereFromPoints(positionVectors);\n\n let mbsCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new Vector3());\n let obbCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new Vector3());\n\n mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);\n obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);\n\n return {\n mbs: [mbsCenter[0], mbsCenter[1], mbsCenter[2], geometryMbs.radius],\n obb: {\n center: obbCenter,\n halfSize: geometryObb.halfSize,\n quaternion: geometryObb.quaternion\n }\n };\n}\n\n/**\n * Create array of posisitons where each vertex is vector\n * @param {array} positions\n * @returns {Vector3[]}\n */\nexport function convertPositionsToVectors(positions: Float32Array): Vector3[] {\n const result: Vector3[] = [];\n\n for (let i = 0; i < positions.length; i += 3) {\n // TODO: (perf) new Vector3 is not optimal but required in `makeOrientedBoundingBoxFromPoints`.\n // modify `makeOrientedBoundingBoxFromPoints` to use scratch vectors\n const positionVector = new Vector3([positions[i], positions[i + 1], positions[i + 2]]);\n result.push(positionVector);\n }\n\n return result;\n}\n\n/**\n * Convert common coordinate to fullExtent https://github.com/Esri/i3s-spec/blob/master/docs/1.8/fullExtent.cmn.md\n * @param\n * @param boundingVolume\n * @returns - fullExtent object\n */\nexport function convertBoundingVolumeToI3SFullExtent(\n boundingVolume: OrientedBoundingBox | BoundingSphere\n): FullExtent {\n let sphere: BoundingSphere;\n if (boundingVolume instanceof BoundingSphere) {\n sphere = boundingVolume;\n } else {\n sphere = boundingVolume.getBoundingSphere();\n }\n const center: Vector3 = sphere.center;\n const radius: number = sphere.radius;\n const vertexMax = Ellipsoid.WGS84.cartesianToCartographic(\n new Vector3(center[0] + radius, center[1] + radius, center[2] + radius),\n new Vector3()\n );\n const vertexMin = Ellipsoid.WGS84.cartesianToCartographic(\n new Vector3(center[0] - radius, center[1] - radius, center[2] - radius),\n new Vector3()\n );\n\n // Converter sometimes returns min values that are bigger then max,\n // so we should check and take bigger value from max and smaller for nim\n return {\n xmin: Math.min(vertexMin[0], vertexMax[0]),\n xmax: Math.max(vertexMin[0], vertexMax[0]),\n ymin: Math.min(vertexMin[1], vertexMax[1]),\n ymax: Math.max(vertexMin[1], vertexMax[1]),\n zmin: Math.min(vertexMin[2], vertexMax[2]),\n zmax: Math.max(vertexMin[2], vertexMax[2])\n };\n}\n\n/**\n * Creates oriented boundinb box from mbs.\n * @param mbs - Minimum Bounding Sphere\n * @returns - Oriented BOunding Box\n */\nexport function createObbFromMbs(mbs: Mbs): Obb {\n const radius = mbs[3];\n const center = new Vector3(mbs[0], mbs[1], mbs[2]);\n const halfAxex = new Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);\n return new OrientedBoundingBox(center, halfAxex);\n}\n"],"file":"coordinate-converter.js"}
|
|
1
|
+
{"version":3,"file":"coordinate-converter.js","names":["Matrix3","Quaternion","Vector3","Ellipsoid","OrientedBoundingBox","makeOrientedBoundingBoxFromPoints","makeBoundingSphereFromPoints","BoundingSphere","createBoundingVolumes","tile","geoidHeightModel","radius","halfSize","quaternion","boundingVolume","cartographicCenter","WGS84","cartesianToCartographic","center","getHeight","len","fromMatrix3","normalize","mbs","obb","createBoundingVolumesFromGeometry","cartesianPositions","positionVectors","convertPositionsToVectors","geometryObb","geometryMbs","mbsCenter","obbCenter","positions","result","i","length","positionVector","push","convertBoundingVolumeToI3SFullExtent","sphere","getBoundingSphere","vertexMax","vertexMin","xmin","Math","min","xmax","max","ymin","ymax","zmin","zmax","createObbFromMbs","halfAxex"],"sources":["../../../../src/i3s-converter/helpers/coordinate-converter.ts"],"sourcesContent":["import type {BoundingVolumes, FullExtent, Mbs, Obb} from '@loaders.gl/i3s';\n\nimport {Matrix3, Quaternion, Vector3} from '@math.gl/core';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {\n OrientedBoundingBox,\n makeOrientedBoundingBoxFromPoints,\n makeBoundingSphereFromPoints,\n BoundingSphere\n} from '@math.gl/culling';\nimport {Tile3D} from '@loaders.gl/tiles';\nimport {Geoid} from '@math.gl/geoid';\n\n/**\n * Create bounding volumes object from tile and geoid height model.\n * @param tile\n * @param geoidHeightModel\n * @returns - Bounding volumes object\n */\nexport function createBoundingVolumes(tile: Tile3D, geoidHeightModel: Geoid): BoundingVolumes {\n let radius;\n let halfSize;\n let quaternion;\n\n const boundingVolume = tile.boundingVolume;\n const cartographicCenter = Ellipsoid.WGS84.cartesianToCartographic(\n boundingVolume.center,\n new Vector3()\n );\n cartographicCenter[2] =\n cartographicCenter[2] -\n geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);\n if (boundingVolume instanceof OrientedBoundingBox) {\n halfSize = boundingVolume.halfSize;\n radius = new Vector3(halfSize[0], halfSize[1], halfSize[2]).len();\n quaternion = boundingVolume.quaternion;\n } else {\n radius = tile.boundingVolume.radius;\n halfSize = [radius, radius, radius];\n quaternion = new Quaternion()\n .fromMatrix3(new Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]]))\n .normalize();\n }\n\n return {\n mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],\n obb: {\n center: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2]],\n halfSize,\n quaternion\n }\n };\n}\n\n/**\n * Generates bounding volumes from geometry positions\n * @param cartesianPositions\n * @param geoidHeightModel\n */\nexport function createBoundingVolumesFromGeometry(\n cartesianPositions: Float32Array,\n geoidHeightModel: Geoid\n): {mbs: Mbs; obb: Obb} {\n const positionVectors = convertPositionsToVectors(cartesianPositions);\n\n const geometryObb = makeOrientedBoundingBoxFromPoints(positionVectors);\n const geometryMbs = makeBoundingSphereFromPoints(positionVectors);\n\n let mbsCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new Vector3());\n let obbCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new Vector3());\n\n mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);\n obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);\n\n return {\n mbs: [mbsCenter[0], mbsCenter[1], mbsCenter[2], geometryMbs.radius],\n obb: {\n center: obbCenter,\n halfSize: geometryObb.halfSize,\n quaternion: geometryObb.quaternion\n }\n };\n}\n\n/**\n * Create array of posisitons where each vertex is vector\n * @param {array} positions\n * @returns {Vector3[]}\n */\nexport function convertPositionsToVectors(positions: Float32Array): Vector3[] {\n const result: Vector3[] = [];\n\n for (let i = 0; i < positions.length; i += 3) {\n // TODO: (perf) new Vector3 is not optimal but required in `makeOrientedBoundingBoxFromPoints`.\n // modify `makeOrientedBoundingBoxFromPoints` to use scratch vectors\n const positionVector = new Vector3([positions[i], positions[i + 1], positions[i + 2]]);\n result.push(positionVector);\n }\n\n return result;\n}\n\n/**\n * Convert common coordinate to fullExtent https://github.com/Esri/i3s-spec/blob/master/docs/1.8/fullExtent.cmn.md\n * @param\n * @param boundingVolume\n * @returns - fullExtent object\n */\nexport function convertBoundingVolumeToI3SFullExtent(\n boundingVolume: OrientedBoundingBox | BoundingSphere\n): FullExtent {\n let sphere: BoundingSphere;\n if (boundingVolume instanceof BoundingSphere) {\n sphere = boundingVolume;\n } else {\n sphere = boundingVolume.getBoundingSphere();\n }\n const center: Vector3 = sphere.center;\n const radius: number = sphere.radius;\n const vertexMax = Ellipsoid.WGS84.cartesianToCartographic(\n new Vector3(center[0] + radius, center[1] + radius, center[2] + radius),\n new Vector3()\n );\n const vertexMin = Ellipsoid.WGS84.cartesianToCartographic(\n new Vector3(center[0] - radius, center[1] - radius, center[2] - radius),\n new Vector3()\n );\n\n // Converter sometimes returns min values that are bigger then max,\n // so we should check and take bigger value from max and smaller for nim\n return {\n xmin: Math.min(vertexMin[0], vertexMax[0]),\n xmax: Math.max(vertexMin[0], vertexMax[0]),\n ymin: Math.min(vertexMin[1], vertexMax[1]),\n ymax: Math.max(vertexMin[1], vertexMax[1]),\n zmin: Math.min(vertexMin[2], vertexMax[2]),\n zmax: Math.max(vertexMin[2], vertexMax[2])\n };\n}\n\n/**\n * Creates oriented boundinb box from mbs.\n * @param mbs - Minimum Bounding Sphere\n * @returns - Oriented BOunding Box\n */\nexport function createObbFromMbs(mbs: Mbs): Obb {\n const radius = mbs[3];\n const center = new Vector3(mbs[0], mbs[1], mbs[2]);\n const halfAxex = new Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);\n return new OrientedBoundingBox(center, halfAxex);\n}\n"],"mappings":"AAEA,SAAQA,OAAO,EAAEC,UAAU,EAAEC,OAAO,QAAO,eAAe;AAC1D,SAAQC,SAAS,QAAO,qBAAqB;AAC7C,SACEC,mBAAmB,EACnBC,iCAAiC,EACjCC,4BAA4B,EAC5BC,cAAc,QACT,kBAAkB;AAUzB,OAAO,SAASC,qBAAqB,CAACC,IAAY,EAAEC,gBAAuB,EAAmB;EAC5F,IAAIC,MAAM;EACV,IAAIC,QAAQ;EACZ,IAAIC,UAAU;EAEd,MAAMC,cAAc,GAAGL,IAAI,CAACK,cAAc;EAC1C,MAAMC,kBAAkB,GAAGZ,SAAS,CAACa,KAAK,CAACC,uBAAuB,CAChEH,cAAc,CAACI,MAAM,EACrB,IAAIhB,OAAO,EAAE,CACd;EACDa,kBAAkB,CAAC,CAAC,CAAC,GACnBA,kBAAkB,CAAC,CAAC,CAAC,GACrBL,gBAAgB,CAACS,SAAS,CAACJ,kBAAkB,CAAC,CAAC,CAAC,EAAEA,kBAAkB,CAAC,CAAC,CAAC,CAAC;EAC1E,IAAID,cAAc,YAAYV,mBAAmB,EAAE;IACjDQ,QAAQ,GAAGE,cAAc,CAACF,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AC,CAAC,EAAED,SAAS,CAAC,CAAC,CAAC,CAAC;IAC1CS,IAAI,EAAEN,IAAI,CAACC,GAAG,CAACH,SAAS,CAAC,CAAC,CAAC,EAAED,SAAS,CAAC,CAAC,CAAC,CAAC;IAC1CU,IAAI,EAAEP,IAAI,CAACG,GAAG,CAACL,SAAS,CAAC,CAAC,CAAC,EAAED,SAAS,CAAC,CAAC,CAAC;EAC3C,CAAC;AACH;;AAOA,OAAO,SAASW,gBAAgB,CAAC9B,GAAQ,EAAO;EAC9C,MAAMZ,MAAM,GAAGY,GAAG,CAAC,CAAC,CAAC;EACrB,MAAML,MAAM,GAAG,IAAIhB,OAAO,CAACqB,GAAG,CAAC,CAAC,CAAC,EAAEA,GAAG,CAAC,CAAC,CAAC,EAAEA,GAAG,CAAC,CAAC,CAAC,CAAC;EAClD,MAAM+B,QAAQ,GAAG,IAAItD,OAAO,CAAC,CAACW,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAEA,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAEA,MAAM,CAAC,CAAC;EACxE,OAAO,IAAIP,mBAAmB,CAACc,MAAM,EAAEoC,QAAQ,CAAC;AAClD"}
|
|
@@ -3,6 +3,7 @@ import transform from 'json-map-transform';
|
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import { SCENE_SERVER as sceneServerTemplate } from '../json-templates/scene-server';
|
|
5
5
|
import { writeFile } from '../../lib/utils/file-utils';
|
|
6
|
+
|
|
6
7
|
export async function createSceneServerPath(layerName, layers0, rootPath) {
|
|
7
8
|
const sceneServerData = {
|
|
8
9
|
serviceItemId: uuidv4().replace(/-/gi, ''),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"create-scene-server-path.js","names":["v4","uuidv4","transform","join","SCENE_SERVER","sceneServerTemplate","writeFile","createSceneServerPath","layerName","layers0","rootPath","sceneServerData","serviceItemId","replace","sceneServer","nodePagePath","JSON","stringify"],"sources":["../../../../src/i3s-converter/helpers/create-scene-server-path.ts"],"sourcesContent":["import type {SceneLayer3D} from '@loaders.gl/i3s';\nimport {v4 as uuidv4} from 'uuid';\nimport transform from 'json-map-transform';\nimport {join} from 'path';\n\nimport {SCENE_SERVER as sceneServerTemplate} from '../json-templates/scene-server';\nimport {writeFile} from '../../lib/utils/file-utils';\n\n/**\n * Form and save sceneServer meta data into a file\n * @param layerName - layer name to display\n * @param layers0 - layer object embedded into sceneServer meta data\n * @param rootPath - root path of new converted tileset\n */\nexport async function createSceneServerPath(\n layerName: string,\n layers0: SceneLayer3D,\n rootPath: string\n): Promise<void> {\n const sceneServerData = {\n serviceItemId: uuidv4().replace(/-/gi, ''),\n layerName,\n layers0\n };\n\n const sceneServer = transform(sceneServerData, sceneServerTemplate());\n const nodePagePath = join(rootPath, 'SceneServer');\n await writeFile(nodePagePath, JSON.stringify(sceneServer));\n}\n"],"mappings":"AACA,SAAQA,EAAE,IAAIC,MAAM,QAAO,MAAM;AACjC,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,SAAQC,IAAI,QAAO,MAAM;AAEzB,SAAQC,YAAY,IAAIC,mBAAmB,QAAO,gCAAgC;AAClF,SAAQC,SAAS,QAAO,4BAA4B;;AAQpD,OAAO,eAAeC,qBAAqB,CACzCC,SAAiB,EACjBC,OAAqB,EACrBC,QAAgB,EACD;EACf,MAAMC,eAAe,GAAG;IACtBC,aAAa,EAAEX,MAAM,EAAE,CAACY,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;IAC1CL,SAAS;IACTC;EACF,CAAC;EAED,MAAMK,WAAW,GAAGZ,SAAS,CAACS,eAAe,EAAEN,mBAAmB,EAAE,CAAC;EACrE,MAAMU,YAAY,GAAGZ,IAAI,CAACO,QAAQ,EAAE,aAAa,CAAC;EAClD,MAAMJ,SAAS,CAACS,YAAY,EAAEC,IAAI,CAACC,SAAS,CAACH,WAAW,CAAC,CAAC;AAC5D"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
|
|
2
|
+
export function flattenPropertyTableByFeatureIds(featureIds, propertyTable) {
|
|
3
|
+
const resultPropertyTable = {};
|
|
4
|
+
for (const propertyName in propertyTable) {
|
|
5
|
+
const properties = propertyTable[propertyName];
|
|
6
|
+
resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIds);
|
|
7
|
+
}
|
|
8
|
+
return resultPropertyTable;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getPropertiesByFeatureIds(properties, featureIds) {
|
|
12
|
+
const resultProperties = [];
|
|
13
|
+
for (const featureId of featureIds) {
|
|
14
|
+
const property = properties[featureId] || null;
|
|
15
|
+
resultProperties.push(property);
|
|
16
|
+
}
|
|
17
|
+
return resultProperties;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function checkPropertiesLength(featureIds, propertyTable) {
|
|
21
|
+
let needFlatten = false;
|
|
22
|
+
for (const attribute of Object.values(propertyTable)) {
|
|
23
|
+
if (featureIds.length !== attribute.length) {
|
|
24
|
+
needFlatten = true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return needFlatten;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const STRING_TYPE = 'string';
|
|
31
|
+
const SHORT_INT_TYPE = 'Int32';
|
|
32
|
+
const DOUBLE_TYPE = 'double';
|
|
33
|
+
const OBJECT_ID_TYPE = 'OBJECTID';
|
|
34
|
+
export function getAttributeType(key, attribute) {
|
|
35
|
+
if (key === OBJECT_ID_TYPE) {
|
|
36
|
+
return OBJECT_ID_TYPE;
|
|
37
|
+
}
|
|
38
|
+
if (typeof attribute === STRING_TYPE) {
|
|
39
|
+
return STRING_TYPE;
|
|
40
|
+
} else if (typeof attribute === 'number') {
|
|
41
|
+
return Number.isInteger(attribute) ? SHORT_INT_TYPE : DOUBLE_TYPE;
|
|
42
|
+
}
|
|
43
|
+
return STRING_TYPE;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function createdStorageAttribute(attributeIndex, key, attributeType) {
|
|
47
|
+
const storageAttribute = {
|
|
48
|
+
key: "f_".concat(attributeIndex),
|
|
49
|
+
name: key,
|
|
50
|
+
ordering: ['attributeValues'],
|
|
51
|
+
header: [{
|
|
52
|
+
property: 'count',
|
|
53
|
+
valueType: 'UInt32'
|
|
54
|
+
}],
|
|
55
|
+
attributeValues: {
|
|
56
|
+
valueType: 'Int32',
|
|
57
|
+
valuesPerElement: 1
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
switch (attributeType) {
|
|
61
|
+
case OBJECT_ID_TYPE:
|
|
62
|
+
setupIdAttribute(storageAttribute);
|
|
63
|
+
break;
|
|
64
|
+
case STRING_TYPE:
|
|
65
|
+
setupStringAttribute(storageAttribute);
|
|
66
|
+
break;
|
|
67
|
+
case DOUBLE_TYPE:
|
|
68
|
+
setupDoubleAttribute(storageAttribute);
|
|
69
|
+
break;
|
|
70
|
+
case SHORT_INT_TYPE:
|
|
71
|
+
break;
|
|
72
|
+
default:
|
|
73
|
+
setupStringAttribute(storageAttribute);
|
|
74
|
+
}
|
|
75
|
+
return storageAttribute;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function getFieldAttributeType(attributeType) {
|
|
79
|
+
switch (attributeType) {
|
|
80
|
+
case OBJECT_ID_TYPE:
|
|
81
|
+
return 'esriFieldTypeOID';
|
|
82
|
+
case STRING_TYPE:
|
|
83
|
+
return 'esriFieldTypeString';
|
|
84
|
+
case SHORT_INT_TYPE:
|
|
85
|
+
return 'esriFieldTypeInteger';
|
|
86
|
+
case DOUBLE_TYPE:
|
|
87
|
+
return 'esriFieldTypeDouble';
|
|
88
|
+
default:
|
|
89
|
+
return 'esriFieldTypeString';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function createFieldAttribute(key, fieldAttributeType) {
|
|
94
|
+
return {
|
|
95
|
+
name: key,
|
|
96
|
+
type: fieldAttributeType,
|
|
97
|
+
alias: key
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function createPopupInfo(propertyTable) {
|
|
102
|
+
const title = '{OBJECTID}';
|
|
103
|
+
const mediaInfos = [];
|
|
104
|
+
const fieldInfos = [];
|
|
105
|
+
const popupElements = [];
|
|
106
|
+
const expressionInfos = [];
|
|
107
|
+
for (const key in propertyTable) {
|
|
108
|
+
fieldInfos.push({
|
|
109
|
+
fieldName: key,
|
|
110
|
+
visible: true,
|
|
111
|
+
isEditable: false,
|
|
112
|
+
label: key
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
popupElements.push({
|
|
116
|
+
fieldInfos,
|
|
117
|
+
type: 'fields'
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
title,
|
|
121
|
+
mediaInfos,
|
|
122
|
+
popupElements,
|
|
123
|
+
fieldInfos,
|
|
124
|
+
expressionInfos
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function setupStringAttribute(storageAttribute) {
|
|
129
|
+
storageAttribute.ordering.unshift('attributeByteCounts');
|
|
130
|
+
storageAttribute.header.push({
|
|
131
|
+
property: 'attributeValuesByteCount',
|
|
132
|
+
valueType: 'UInt32'
|
|
133
|
+
});
|
|
134
|
+
storageAttribute.attributeValues = {
|
|
135
|
+
valueType: 'String',
|
|
136
|
+
encoding: 'UTF-8',
|
|
137
|
+
valuesPerElement: 1
|
|
138
|
+
};
|
|
139
|
+
storageAttribute.attributeByteCounts = {
|
|
140
|
+
valueType: 'UInt32',
|
|
141
|
+
valuesPerElement: 1
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function setupIdAttribute(storageAttribute) {
|
|
146
|
+
storageAttribute.attributeValues = {
|
|
147
|
+
valueType: 'Oid32',
|
|
148
|
+
valuesPerElement: 1
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function setupDoubleAttribute(storageAttribute) {
|
|
153
|
+
storageAttribute.attributeValues = {
|
|
154
|
+
valueType: 'Float64',
|
|
155
|
+
valuesPerElement: 1
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=feature-attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-attributes.js","names":["flattenPropertyTableByFeatureIds","featureIds","propertyTable","resultPropertyTable","propertyName","properties","getPropertiesByFeatureIds","resultProperties","featureId","property","push","checkPropertiesLength","needFlatten","attribute","Object","values","length","STRING_TYPE","SHORT_INT_TYPE","DOUBLE_TYPE","OBJECT_ID_TYPE","getAttributeType","key","Number","isInteger","createdStorageAttribute","attributeIndex","attributeType","storageAttribute","name","ordering","header","valueType","attributeValues","valuesPerElement","setupIdAttribute","setupStringAttribute","setupDoubleAttribute","getFieldAttributeType","createFieldAttribute","fieldAttributeType","type","alias","createPopupInfo","title","mediaInfos","fieldInfos","popupElements","expressionInfos","fieldName","visible","isEditable","label","unshift","encoding","attributeByteCounts"],"sources":["../../../../src/i3s-converter/helpers/feature-attributes.ts"],"sourcesContent":["import type {FeatureTableJson} from '@loaders.gl/3d-tiles';\nimport {\n Attribute,\n AttributeStorageInfo,\n ESRIField,\n Field,\n FieldInfo,\n PopupInfo\n} from '@loaders.gl/i3s';\n\n/**\n * Takes attributes from property table based on featureIds.\n * If there is no property value for particular featureId (index) the property will be null.\n * Example:\n * Initial data:\n * OBJECTID: [0, 1, 5]\n * component: ['Windows', 'Frames', 'Wall', 'Roof', 'Skylight']\n * Result:\n * OBJECTID: [0, 1, 5]\n * component: ['Windows', 'Frames', 'null']\n * @param featureIds\n * @param propertyTable\n */\nexport function flattenPropertyTableByFeatureIds(\n featureIds: number[],\n propertyTable: FeatureTableJson\n): FeatureTableJson {\n const resultPropertyTable: FeatureTableJson = {};\n for (const propertyName in propertyTable) {\n const properties = propertyTable[propertyName];\n resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIds);\n }\n\n return resultPropertyTable;\n}\n\n/**\n * Getting properties by featureId index\n * @param properties\n * @param featureIds\n */\nfunction getPropertiesByFeatureIds(properties: any[], featureIds: number[]): any[] {\n const resultProperties: any = [];\n\n for (const featureId of featureIds) {\n const property = properties[featureId] || null;\n resultProperties.push(property);\n }\n\n return resultProperties;\n}\n\n/**\n * Check that all attributes in propertyTable have the same length as FeatureIds.\n * If there are differencies between lengths we should flatten property table based on exiesting featureIds.\n * @param featureIds\n * @param propertyTable\n * @returns\n */\nexport function checkPropertiesLength(\n featureIds: number[],\n propertyTable: FeatureTableJson\n): boolean {\n let needFlatten = false;\n\n for (const attribute of Object.values(propertyTable)) {\n if (featureIds.length !== attribute.length) {\n needFlatten = true;\n }\n }\n\n return needFlatten;\n}\n\n/** String data type name for feature attributes */\nconst STRING_TYPE = 'string';\n/** Integer data type name for feature attributes */\nconst SHORT_INT_TYPE = 'Int32';\n/** Double data type name for feature attributes */\nconst DOUBLE_TYPE = 'double';\n/** Type of attribute that is linked with feature ids */\nconst OBJECT_ID_TYPE = 'OBJECTID';\n/**\n * Get the attribute type for attributeStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param key - attribute's key\n * @param attribute - attribute's type in propertyTable\n */\nexport function getAttributeType(key: string, attribute: string): string {\n if (key === OBJECT_ID_TYPE) {\n return OBJECT_ID_TYPE;\n }\n if (typeof attribute === STRING_TYPE) {\n return STRING_TYPE;\n } else if (typeof attribute === 'number') {\n return Number.isInteger(attribute) ? SHORT_INT_TYPE : DOUBLE_TYPE;\n }\n return STRING_TYPE;\n}\n\n/**\n * Generate storage attribute for map segmentation.\n * @param attributeIndex - order index of attribute (f_0, f_1 ...).\n * @param key - attribute key from propertyTable.\n * @param attributeType - attribute type.\n * @return Updated storageAttribute.\n */\nexport function createdStorageAttribute(\n attributeIndex: number,\n key: string,\n attributeType: Attribute\n): AttributeStorageInfo {\n const storageAttribute = {\n key: `f_${attributeIndex}`,\n name: key,\n ordering: ['attributeValues'],\n header: [{property: 'count', valueType: 'UInt32'}],\n attributeValues: {valueType: 'Int32', valuesPerElement: 1}\n };\n\n switch (attributeType) {\n case OBJECT_ID_TYPE:\n setupIdAttribute(storageAttribute);\n break;\n case STRING_TYPE:\n setupStringAttribute(storageAttribute);\n break;\n case DOUBLE_TYPE:\n setupDoubleAttribute(storageAttribute);\n break;\n case SHORT_INT_TYPE:\n break;\n default:\n setupStringAttribute(storageAttribute);\n }\n\n return storageAttribute;\n}\n\n/**\n * Find and return attribute type based on key form propertyTable.\n * @param attributeType\n */\nexport function getFieldAttributeType(attributeType: Attribute): ESRIField {\n switch (attributeType) {\n case OBJECT_ID_TYPE:\n return 'esriFieldTypeOID';\n case STRING_TYPE:\n return 'esriFieldTypeString';\n case SHORT_INT_TYPE:\n return 'esriFieldTypeInteger';\n case DOUBLE_TYPE:\n return 'esriFieldTypeDouble';\n default:\n return 'esriFieldTypeString';\n }\n}\n\n/**\n * Setup field attribute for map segmentation.\n * @param key - attribute for map segmentation.\n * @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').\n */\nexport function createFieldAttribute(key: string, fieldAttributeType: ESRIField): Field {\n return {\n name: key,\n type: fieldAttributeType,\n alias: key\n };\n}\n\n/**\n * Generate popup info to show metadata on the map.\n * @param propertyTable - table data with OBJECTID.\n * @return data for correct rendering of popup.\n */\nexport function createPopupInfo(propertyTable: FeatureTableJson): PopupInfo {\n const title = '{OBJECTID}';\n const mediaInfos = [];\n const fieldInfos: FieldInfo[] = [];\n const popupElements: {\n fieldInfos: FieldInfo[];\n type: string;\n }[] = [];\n const expressionInfos = [];\n\n for (const key in propertyTable) {\n fieldInfos.push({\n fieldName: key,\n visible: true,\n isEditable: false,\n label: key\n });\n }\n popupElements.push({\n fieldInfos,\n type: 'fields'\n });\n\n return {\n title,\n mediaInfos,\n popupElements,\n fieldInfos,\n expressionInfos\n };\n}\n\n/**\n * Setup storage attribute as string.\n * @param storageAttribute - attribute for map segmentation.\n */\nfunction setupStringAttribute(storageAttribute: AttributeStorageInfo): void {\n // @ts-expect-error\n storageAttribute.ordering.unshift('attributeByteCounts');\n storageAttribute.header.push({property: 'attributeValuesByteCount', valueType: 'UInt32'});\n storageAttribute.attributeValues = {\n valueType: 'String',\n encoding: 'UTF-8',\n valuesPerElement: 1\n };\n storageAttribute.attributeByteCounts = {\n valueType: 'UInt32',\n valuesPerElement: 1\n };\n}\n\n/**\n * Setup Id attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\nfunction setupIdAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Oid32',\n valuesPerElement: 1\n };\n}\n\n/**\n * Setup double attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\nfunction setupDoubleAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Float64',\n valuesPerElement: 1\n };\n}\n"],"mappings":";AAuBA,OAAO,SAASA,gCAAgC,CAC9CC,UAAoB,EACpBC,aAA+B,EACb;EAClB,MAAMC,mBAAqC,GAAG,CAAC,CAAC;EAChD,KAAK,MAAMC,YAAY,IAAIF,aAAa,EAAE;IACxC,MAAMG,UAAU,GAAGH,aAAa,CAACE,YAAY,CAAC;IAC9CD,mBAAmB,CAACC,YAAY,CAAC,GAAGE,yBAAyB,CAACD,UAAU,EAAEJ,UAAU,CAAC;EACvF;EAEA,OAAOE,mBAAmB;AAC5B;;AAOA,SAASG,yBAAyB,CAACD,UAAiB,EAAEJ,UAAoB,EAAS;EACjF,MAAMM,gBAAqB,GAAG,EAAE;EAEhC,KAAK,MAAMC,SAAS,IAAIP,UAAU,EAAE;IAClC,MAAMQ,QAAQ,GAAGJ,UAAU,CAACG,SAAS,CAAC,IAAI,IAAI;IAC9CD,gBAAgB,CAACG,IAAI,CAACD,QAAQ,CAAC;EACjC;EAEA,OAAOF,gBAAgB;AACzB;;AASA,OAAO,SAASI,qBAAqB,CACnCV,UAAoB,EACpBC,aAA+B,EACtB;EACT,IAAIU,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