@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
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const json_map_transform_1 = __importDefault(require("json-map-transform"));
|
|
8
8
|
const metadata_1 = require("../json-templates/metadata");
|
|
9
|
-
|
|
9
|
+
const file_utils_1 = require("../../lib/utils/file-utils");
|
|
10
10
|
/**
|
|
11
11
|
* class NodePages - wrapper of nodePages array
|
|
12
12
|
*
|
|
@@ -17,7 +17,7 @@ const metadata_1 = require("../json-templates/metadata");
|
|
|
17
17
|
* const nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE);
|
|
18
18
|
* ...
|
|
19
19
|
* // push root node
|
|
20
|
-
* const
|
|
20
|
+
* const parent = await nodePages.push({
|
|
21
21
|
lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,
|
|
22
22
|
obb: coordinates.obb,
|
|
23
23
|
children: []
|
|
@@ -34,7 +34,7 @@ const metadata_1 = require("../json-templates/metadata");
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
* const
|
|
37
|
+
* const node = await this.nodePages.push(nodeInPage, parent.index);
|
|
38
38
|
* ...
|
|
39
39
|
* // save all the nodePages in the end of pushing all the nodes
|
|
40
40
|
* await this.nodePages.save(layers0path);
|
|
@@ -46,13 +46,16 @@ class NodePages {
|
|
|
46
46
|
* @param writeFileFunc - function to save one nodePage into a file
|
|
47
47
|
* @param nodesPerPage - length limit for one nodePage. An additional nodePage is created when this limit is met
|
|
48
48
|
*/
|
|
49
|
-
constructor(writeFileFunc, nodesPerPage) {
|
|
49
|
+
constructor(writeFileFunc, nodesPerPage, converter) {
|
|
50
|
+
this.length = 0;
|
|
50
51
|
this.nodesPerPage = nodesPerPage;
|
|
51
52
|
this.nodesCounter = 0;
|
|
52
53
|
// @ts-expect-error
|
|
53
54
|
this.nodePages = [{}];
|
|
54
55
|
this.nodePages[0].nodes = [];
|
|
55
56
|
this.writeFile = writeFileFunc;
|
|
57
|
+
this.converter = converter;
|
|
58
|
+
this.length = 0;
|
|
56
59
|
}
|
|
57
60
|
/**
|
|
58
61
|
* Setup function to save node pages
|
|
@@ -61,23 +64,203 @@ class NodePages {
|
|
|
61
64
|
useWriteFunction(func) {
|
|
62
65
|
this.writeFile = func;
|
|
63
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Get file path and file name of the node page with the particular id
|
|
69
|
+
* @param nodePageId - node page id
|
|
70
|
+
* @returns file path and file name
|
|
71
|
+
*/
|
|
72
|
+
getNodePageFileName(nodePageId) {
|
|
73
|
+
let filePath;
|
|
74
|
+
let fileName;
|
|
75
|
+
if (this.converter.options.slpk) {
|
|
76
|
+
filePath = (0, path_1.join)(this.converter.layers0Path, 'nodepages');
|
|
77
|
+
fileName = `${nodePageId.toString()}.json`;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
filePath = (0, path_1.join)(this.converter.layers0Path, 'nodepages', nodePageId.toString());
|
|
81
|
+
fileName = 'index.json';
|
|
82
|
+
}
|
|
83
|
+
return { filePath, fileName };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Load node page from a file on the disk
|
|
87
|
+
* @param nodePageId - node page id
|
|
88
|
+
* @returns - node page data
|
|
89
|
+
*/
|
|
90
|
+
async loadNodePage(nodePageId) {
|
|
91
|
+
const { filePath, fileName } = this.getNodePageFileName(nodePageId);
|
|
92
|
+
const fullName = (0, path_1.join)(filePath, fileName);
|
|
93
|
+
if (await (0, file_utils_1.isFileExists)(fullName)) {
|
|
94
|
+
console.log(`load ${fullName}.`); // eslint-disable-line
|
|
95
|
+
return (await (0, file_utils_1.openJson)(filePath, fileName));
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
return { nodes: [] };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get nodepage id by node id
|
|
103
|
+
* @param id node id
|
|
104
|
+
* @returns node page id
|
|
105
|
+
*/
|
|
106
|
+
getPageIndexByNodeId(id) {
|
|
107
|
+
return Math.floor(id / this.nodesPerPage);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get node page data by node id
|
|
111
|
+
* @param id node id
|
|
112
|
+
* @returns node page data
|
|
113
|
+
*/
|
|
114
|
+
async getPageByNodeId(id) {
|
|
115
|
+
const pageIndex = this.getPageIndexByNodeId(id);
|
|
116
|
+
if (this.converter.options.instantNodeWriting) {
|
|
117
|
+
return await this.loadNodePage(pageIndex);
|
|
118
|
+
}
|
|
119
|
+
return this.nodePages[pageIndex];
|
|
120
|
+
}
|
|
64
121
|
/**
|
|
65
122
|
* Get the node by its end-to-end index
|
|
66
123
|
* @param id - end-to-end index of the node
|
|
67
124
|
* @return the node object
|
|
68
125
|
*/
|
|
69
|
-
getNodeById(id) {
|
|
70
|
-
const pageIndex = Math.floor(id / this.nodesPerPage);
|
|
126
|
+
async getNodeById(id, nodePage) {
|
|
71
127
|
const nodeIndex = id % this.nodesPerPage;
|
|
72
|
-
|
|
128
|
+
nodePage = nodePage || (await this.getPageByNodeId(id));
|
|
129
|
+
return nodePage.nodes[nodeIndex];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Add a child id into the parent node.children array
|
|
133
|
+
* @param parentId - end-to-end parent node index
|
|
134
|
+
* @param childId - end-to-end child node index
|
|
135
|
+
*/
|
|
136
|
+
async addChildRelation(parentId, childId) {
|
|
137
|
+
if (parentId === null || parentId === undefined) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const parentNode = await this.getNodeById(parentId);
|
|
141
|
+
parentNode.children?.push(childId);
|
|
142
|
+
await this.saveNode(parentNode);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Put new node in nodePages array
|
|
146
|
+
* @param node - node object
|
|
147
|
+
* @param parentId - index of parent node
|
|
148
|
+
* @return
|
|
149
|
+
*/
|
|
150
|
+
async push(node, parentId) {
|
|
151
|
+
node.index = this.nodesCounter++;
|
|
152
|
+
if (!this.converter.options.instantNodeWriting) {
|
|
153
|
+
let currentNodePage = this.nodePages[this.nodePages.length - 1];
|
|
154
|
+
if (currentNodePage.nodes.length === this.nodesPerPage) {
|
|
155
|
+
currentNodePage = { nodes: [] };
|
|
156
|
+
this.nodePages.push(currentNodePage);
|
|
157
|
+
}
|
|
158
|
+
currentNodePage.nodes.push(node);
|
|
159
|
+
}
|
|
160
|
+
await this.addChildRelation(parentId, node.index);
|
|
161
|
+
NodePages.updateResourceInMesh(node);
|
|
162
|
+
await this.saveNode(node);
|
|
163
|
+
return node;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Save node to the file on the disk
|
|
167
|
+
* @param node - node data
|
|
168
|
+
*/
|
|
169
|
+
async saveNode(node) {
|
|
170
|
+
if (!this.converter.options.instantNodeWriting) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
const nodePageIndex = this.getPageIndexByNodeId(node.index);
|
|
175
|
+
const nodePage = await this.getPageByNodeId(node.index);
|
|
176
|
+
const { filePath, fileName } = this.getNodePageFileName(nodePageIndex);
|
|
177
|
+
const nodeToUpdate = await this.getNodeById(node.index, nodePage);
|
|
178
|
+
if (nodeToUpdate) {
|
|
179
|
+
NodePages.updateAll(nodeToUpdate, node);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
nodePage.nodes.push(node);
|
|
183
|
+
}
|
|
184
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
185
|
+
if (this.converter.options.slpk) {
|
|
186
|
+
await this.converter.writeQueue.enqueue({
|
|
187
|
+
archiveKey: `nodePages/${nodePageIndex.toString()}.json.gz`,
|
|
188
|
+
writePromise: () => this.writeFile(filePath, nodePageStr, fileName, true, this.converter.compressList)
|
|
189
|
+
}, true);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
await this.converter.writeQueue.enqueue({
|
|
193
|
+
writePromise: () => this.writeFile(filePath, nodePageStr)
|
|
194
|
+
}, true);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Save metadata file (for slpk only)
|
|
200
|
+
*/
|
|
201
|
+
async saveMetadata() {
|
|
202
|
+
const metadata = (0, json_map_transform_1.default)({ nodeCount: this.nodesCounter }, (0, metadata_1.METADATA)());
|
|
203
|
+
const compress = false;
|
|
204
|
+
await this.converter.writeQueue.enqueue({
|
|
205
|
+
archiveKey: 'metadata.json',
|
|
206
|
+
writePromise: () => this.writeFile(this.converter.layers0Path, JSON.stringify(metadata), 'metadata.json', compress)
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Save all the node pages
|
|
211
|
+
* Run this method when all nodes is pushed in nodePages
|
|
212
|
+
*/
|
|
213
|
+
async save() {
|
|
214
|
+
if (this.converter.options.instantNodeWriting) {
|
|
215
|
+
await this.saveMetadata();
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (this.converter.options.slpk) {
|
|
219
|
+
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
220
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
221
|
+
const slpkPath = (0, path_1.join)(this.converter.layers0Path, 'nodepages');
|
|
222
|
+
await this.converter.writeQueue.enqueue({
|
|
223
|
+
archiveKey: `nodePages/${index.toString()}.json.gz`,
|
|
224
|
+
writePromise: () => this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`)
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
await this.saveMetadata();
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
231
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
232
|
+
const nodePagePath = (0, path_1.join)(this.converter.layers0Path, 'nodepages', index.toString());
|
|
233
|
+
await this.converter.writeQueue.enqueue({
|
|
234
|
+
writePromise: () => this.writeFile(nodePagePath, nodePageStr)
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Update resource index in node.mesh object
|
|
241
|
+
* @param node - node object
|
|
242
|
+
*/
|
|
243
|
+
static updateResourceInMesh(node) {
|
|
244
|
+
if (node.mesh && isFinite(node.index)) {
|
|
245
|
+
node.mesh.geometry.resource = node.index;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Update all fields in the node excluding id
|
|
250
|
+
* @param node - node object
|
|
251
|
+
* @param data - NodeInPage data to replace original data
|
|
252
|
+
*/
|
|
253
|
+
static updateAll(node, data) {
|
|
254
|
+
Object.assign(node, data, { index: node.index });
|
|
255
|
+
NodePages.updateResourceInMesh(node);
|
|
256
|
+
return node;
|
|
73
257
|
}
|
|
74
258
|
/**
|
|
75
259
|
* Update material in node.mesh object by node id
|
|
76
260
|
* @param id - end-to-end index of the node
|
|
77
261
|
* @param materialId - id from scene layer materialDefinitions
|
|
78
262
|
*/
|
|
79
|
-
updateMaterialByNodeId(
|
|
80
|
-
const node = this.getNodeById(id);
|
|
263
|
+
static updateMaterialByNodeId(node, materialId) {
|
|
81
264
|
if (!node.mesh) {
|
|
82
265
|
return;
|
|
83
266
|
}
|
|
@@ -91,8 +274,7 @@ class NodePages {
|
|
|
91
274
|
* @param id - end-to-end index of the node
|
|
92
275
|
* @param vertexCount - vertex count for particular node
|
|
93
276
|
*/
|
|
94
|
-
updateVertexCountByNodeId(
|
|
95
|
-
const node = this.getNodeById(id);
|
|
277
|
+
static updateVertexCountByNodeId(node, vertexCount) {
|
|
96
278
|
if (!node.mesh) {
|
|
97
279
|
return;
|
|
98
280
|
}
|
|
@@ -100,22 +282,20 @@ class NodePages {
|
|
|
100
282
|
}
|
|
101
283
|
/**
|
|
102
284
|
* Update resource in node.mesh.attribute object by node id
|
|
103
|
-
* @param
|
|
285
|
+
* @param node - node object
|
|
104
286
|
*/
|
|
105
|
-
updateNodeAttributeByNodeId(
|
|
106
|
-
|
|
107
|
-
if (!node.mesh) {
|
|
287
|
+
static updateNodeAttributeByNodeId(node) {
|
|
288
|
+
if (!node.mesh || !node.index) {
|
|
108
289
|
return;
|
|
109
290
|
}
|
|
110
291
|
node.mesh.attribute.resource = node.index;
|
|
111
292
|
}
|
|
112
293
|
/**
|
|
113
294
|
* Update featureCount in node.mesh.geometry object by node id
|
|
114
|
-
* @param
|
|
295
|
+
* @param node - node object
|
|
115
296
|
* @param featureCount - features count of the node
|
|
116
297
|
*/
|
|
117
|
-
updateFeatureCountByNodeId(
|
|
118
|
-
const node = this.getNodeById(id);
|
|
298
|
+
static updateFeatureCountByNodeId(node, featureCount) {
|
|
119
299
|
if (!node.mesh) {
|
|
120
300
|
return;
|
|
121
301
|
}
|
|
@@ -123,86 +303,14 @@ class NodePages {
|
|
|
123
303
|
}
|
|
124
304
|
/**
|
|
125
305
|
* Update texelCountHint in node.mesh.material object by node id
|
|
126
|
-
* @param
|
|
306
|
+
* @param node - node object
|
|
127
307
|
* @param texelCountHint - texelCountHint of particular node
|
|
128
308
|
*/
|
|
129
|
-
updateTexelCountHintByNodeId(
|
|
130
|
-
const node = this.getNodeById(id);
|
|
309
|
+
static updateTexelCountHintByNodeId(node, texelCountHint) {
|
|
131
310
|
if (!node.mesh || !node.mesh.material) {
|
|
132
311
|
return;
|
|
133
312
|
}
|
|
134
313
|
node.mesh.material.texelCountHint = texelCountHint;
|
|
135
314
|
}
|
|
136
|
-
/**
|
|
137
|
-
* Add a child id into the parent node.children array
|
|
138
|
-
* @param parentId - end-to-end parent node index
|
|
139
|
-
* @param childId - end-to-end child node index
|
|
140
|
-
*/
|
|
141
|
-
addChildRelation(parentId, childId) {
|
|
142
|
-
if (parentId === null || parentId === undefined) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
const parentNode = this.getNodeById(parentId);
|
|
146
|
-
parentNode.children?.push(childId);
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Update resource index in node.mesh object
|
|
150
|
-
* @param node - node object
|
|
151
|
-
*/
|
|
152
|
-
updateResourceInMesh(node) {
|
|
153
|
-
if (node.mesh) {
|
|
154
|
-
node.mesh.geometry.resource = node.index;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Put new node in nodePages array
|
|
159
|
-
* @param node - node object
|
|
160
|
-
* @param parentId - index of parent node
|
|
161
|
-
* @return
|
|
162
|
-
*/
|
|
163
|
-
push(node, parentId) {
|
|
164
|
-
let currentNodePage = this.nodePages[this.nodePages.length - 1];
|
|
165
|
-
if (currentNodePage.nodes.length === this.nodesPerPage) {
|
|
166
|
-
currentNodePage = { nodes: [] };
|
|
167
|
-
this.nodePages.push(currentNodePage);
|
|
168
|
-
}
|
|
169
|
-
node.index = this.nodesCounter++;
|
|
170
|
-
currentNodePage.nodes.push(node);
|
|
171
|
-
this.addChildRelation(parentId, node.index);
|
|
172
|
-
this.updateResourceInMesh(node);
|
|
173
|
-
return node.index;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Save all the node pages
|
|
177
|
-
* Run this method when all nodes is pushed in nodePages
|
|
178
|
-
* @param layers0Path - path of layer
|
|
179
|
-
* @param writeQueue - write queue that controlls files write concurrency
|
|
180
|
-
* @param slpk
|
|
181
|
-
*/
|
|
182
|
-
async save(layers0Path, writeQueue, slpk = false) {
|
|
183
|
-
if (slpk) {
|
|
184
|
-
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
185
|
-
const nodePageStr = JSON.stringify(nodePage);
|
|
186
|
-
const slpkPath = (0, path_1.join)(layers0Path, 'nodepages');
|
|
187
|
-
await writeQueue.enqueue({
|
|
188
|
-
archiveKey: `nodePages/${index.toString()}.json.gz`,
|
|
189
|
-
writePromise: this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`)
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
const metadata = (0, json_map_transform_1.default)({ nodeCount: this.nodesCounter }, (0, metadata_1.METADATA)());
|
|
193
|
-
const compress = false;
|
|
194
|
-
await writeQueue.enqueue({
|
|
195
|
-
archiveKey: 'metadata.json',
|
|
196
|
-
writePromise: this.writeFile(layers0Path, JSON.stringify(metadata), 'metadata.json', compress)
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
201
|
-
const nodePageStr = JSON.stringify(nodePage);
|
|
202
|
-
const nodePagePath = (0, path_1.join)(layers0Path, 'nodepages', index.toString());
|
|
203
|
-
await writeQueue.enqueue({ writePromise: this.writeFile(nodePagePath, nodePageStr) });
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
315
|
}
|
|
208
316
|
exports.default = NodePages;
|
|
@@ -13,8 +13,13 @@ export default class I3SConverter {
|
|
|
13
13
|
nodePages: NodePages;
|
|
14
14
|
options: any;
|
|
15
15
|
layers0Path: string;
|
|
16
|
-
materialMap: Map<
|
|
16
|
+
materialMap: Map<string, number>;
|
|
17
17
|
materialDefinitions: I3SMaterialDefinition[];
|
|
18
|
+
geometryMap: Map<string, number>;
|
|
19
|
+
geometryConfigs: {
|
|
20
|
+
hasTexture: boolean;
|
|
21
|
+
hasUvRegions: boolean;
|
|
22
|
+
}[];
|
|
18
23
|
vertexCounter: number;
|
|
19
24
|
layers0: SceneLayer3D | null;
|
|
20
25
|
featuresHashArray: string[];
|
|
@@ -36,6 +41,7 @@ export default class I3SConverter {
|
|
|
36
41
|
[key: string]: string;
|
|
37
42
|
};
|
|
38
43
|
writeQueue: WriteQueue<WriteQueueItem>;
|
|
44
|
+
compressList: string[] | null;
|
|
39
45
|
constructor();
|
|
40
46
|
/**
|
|
41
47
|
* Convert a 3d tileset
|
|
@@ -50,6 +56,9 @@ export default class I3SConverter {
|
|
|
50
56
|
* @param options.token Token for Cesium ION tilesets authentication
|
|
51
57
|
* @param options.draco Generate I3S 1.7 draco compressed geometries
|
|
52
58
|
* @param options.validate -enable validation
|
|
59
|
+
* @param options.generateTextures - generate alternative type of textures (to have non-compressed jpeg/png and compressed ktx2)
|
|
60
|
+
* @param options.generateBoundingVolumes - generate bounding volumes from vertices coordinates instead of source tiles bounding volumes
|
|
61
|
+
* @param options.instantNodeWriting - Keep created 3DNodeIndexDocument files on disk instead of memory. This option reduce memory usage but decelerates conversion speed
|
|
53
62
|
*/
|
|
54
63
|
convert(options: {
|
|
55
64
|
inputUrl: string;
|
|
@@ -61,9 +70,11 @@ export default class I3SConverter {
|
|
|
61
70
|
slpk?: boolean;
|
|
62
71
|
token?: string;
|
|
63
72
|
draco?: boolean;
|
|
73
|
+
mergeMaterials?: boolean;
|
|
64
74
|
validate?: boolean;
|
|
65
75
|
generateTextures?: boolean;
|
|
66
76
|
generateBoundingVolumes?: boolean;
|
|
77
|
+
instantNodeWriting?: boolean;
|
|
67
78
|
}): Promise<any>;
|
|
68
79
|
/**
|
|
69
80
|
* Convert and save the layer and embedded tiles
|
|
@@ -76,28 +87,16 @@ export default class I3SConverter {
|
|
|
76
87
|
* @param tilesetName - Name of layer
|
|
77
88
|
*/
|
|
78
89
|
private _formLayers0;
|
|
79
|
-
/**
|
|
80
|
-
* Convert and save the layer and embedded tiles
|
|
81
|
-
* @param boundingVolumes - mbs and obb data about node's bounding volume
|
|
82
|
-
* @return 3DNodeIndexDocument data https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md
|
|
83
|
-
*/
|
|
84
|
-
private _formRootNodeIndexDocument;
|
|
85
90
|
/**
|
|
86
91
|
* Form object of 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md
|
|
87
|
-
* @param
|
|
92
|
+
* @param rootNode - 3DNodeIndexDocument of root node https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md
|
|
88
93
|
* @param sourceRootTile - Source (3DTile) tile data
|
|
89
|
-
* @param parentId - node id in node pages
|
|
90
|
-
* @param boundingVolumes - mbs and obb data about node's bounding volume
|
|
91
94
|
*/
|
|
92
95
|
private _convertNodesTree;
|
|
93
96
|
/**
|
|
94
97
|
* Write 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md in file
|
|
95
98
|
*/
|
|
96
99
|
private _writeLayers0;
|
|
97
|
-
/**
|
|
98
|
-
* Write 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md in file
|
|
99
|
-
*/
|
|
100
|
-
private _writeNodeIndexDocument;
|
|
101
100
|
/**
|
|
102
101
|
* Pack files into *.slpk archive
|
|
103
102
|
* @param tilesetPath - Path to save file
|
|
@@ -106,58 +105,52 @@ export default class I3SConverter {
|
|
|
106
105
|
/**
|
|
107
106
|
* Add child nodes recursively and write them to files
|
|
108
107
|
* @param data - arguments
|
|
108
|
+
* @param data.parentNode - 3DNodeIndexDocument of parent node
|
|
109
109
|
* @param data.sourceTiles - array of source child nodes
|
|
110
|
-
* @param data.parentNode - 3DNodeIndexDocument of parent node for processing child nodes
|
|
111
|
-
* @param data.parentId - id of parent node in node pages
|
|
112
110
|
* @param data.level - level of node (distanse to root node in the tree)
|
|
113
111
|
*/
|
|
114
112
|
private _addChildrenWithNeighborsAndWriteFile;
|
|
115
113
|
/**
|
|
116
|
-
*
|
|
117
|
-
* @param
|
|
118
|
-
* @param data.
|
|
119
|
-
* @param
|
|
120
|
-
* @param
|
|
121
|
-
* @param data.parentId - id of parent node in node pages
|
|
122
|
-
* @param data.level - level of node (distanse to root node in the tree)
|
|
114
|
+
* Convert nested subtree of 3DTiles dataset
|
|
115
|
+
* @param param0
|
|
116
|
+
* @param data.parentNode - 3DNodeIndexDocument of parent node
|
|
117
|
+
* @param param0.sourceTile - source 3DTile data
|
|
118
|
+
* @param param0.level - tree level
|
|
123
119
|
*/
|
|
124
|
-
private
|
|
120
|
+
private convertNestedTileset;
|
|
125
121
|
/**
|
|
126
|
-
*
|
|
127
|
-
* @param
|
|
128
|
-
* @param
|
|
122
|
+
* Convert 3DTiles tile to I3S node
|
|
123
|
+
* @param param0
|
|
124
|
+
* @param param0.parentNode - 3DNodeIndexDocument of parent node
|
|
125
|
+
* @param param0.sourceTile - source 3DTile data
|
|
126
|
+
* @param param0.level - tree level
|
|
129
127
|
*/
|
|
130
|
-
private
|
|
128
|
+
private convertNode;
|
|
131
129
|
/**
|
|
132
|
-
*
|
|
133
|
-
* @param
|
|
134
|
-
* @param
|
|
135
|
-
* @param
|
|
136
|
-
* @param level - level
|
|
130
|
+
* Add child nodes recursively and write them to files
|
|
131
|
+
* @param param0 - arguments
|
|
132
|
+
* @param param0.parentNode - 3DNodeIndexDocument of parent node
|
|
133
|
+
* @param param0.sourceTile - source 3DTile data
|
|
134
|
+
* @param param0.level - tree level
|
|
137
135
|
*/
|
|
138
|
-
private
|
|
136
|
+
private _addChildren;
|
|
139
137
|
/**
|
|
140
|
-
* Convert
|
|
141
|
-
*
|
|
142
|
-
* @param
|
|
143
|
-
* @
|
|
138
|
+
* Convert tile to one or more I3S nodes
|
|
139
|
+
* @param parentNode - 3DNodeIndexDocument of parent node
|
|
140
|
+
* @param sourceTile - source 3DTile data
|
|
141
|
+
* @param level - tree level
|
|
144
142
|
*/
|
|
145
|
-
private
|
|
143
|
+
private _createNode;
|
|
146
144
|
/**
|
|
147
145
|
* Convert tile to one or more I3S nodes
|
|
148
146
|
* @param sourceTile - source tile (3DTile)
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* result.sharedResources - shared resource data object
|
|
153
|
-
* result.meshMaterial - PBR-like material object
|
|
154
|
-
* result.vertexCount - number of vertices in geometry
|
|
155
|
-
* result.attributes - feature attributes
|
|
156
|
-
* result.featureCount - number of features
|
|
147
|
+
* @param parentId - id of parent node in node pages
|
|
148
|
+
* @param propertyTable - batch table from b3dm / feature properties from EXT_FEATURE_METADATA
|
|
149
|
+
* @returns - converted node resources
|
|
157
150
|
*/
|
|
158
151
|
private _convertResources;
|
|
159
152
|
/**
|
|
160
|
-
*
|
|
153
|
+
* Update node object (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/node.cmn.md)
|
|
161
154
|
* in node pages (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/nodePage.cmn.md)
|
|
162
155
|
* @param maxScreenThresholdSQ - Level of Details (LOD) metric
|
|
163
156
|
* @param boundingVolumes - Bounding volumes
|
|
@@ -168,21 +161,10 @@ export default class I3SConverter {
|
|
|
168
161
|
* @param resources.texture - texture image
|
|
169
162
|
* @param resources.vertexCount - number of vertices in geometry
|
|
170
163
|
* @param resources.featureCount - number of features
|
|
164
|
+
* @param resources.geometry - Uint8Array with geometry attributes
|
|
171
165
|
* @return the node object in node pages
|
|
172
166
|
*/
|
|
173
|
-
private
|
|
174
|
-
/**
|
|
175
|
-
* Create a new node page object in node pages
|
|
176
|
-
* @param parentNode - 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object of the parent node
|
|
177
|
-
* @param boundingVolumes - Bounding volumes
|
|
178
|
-
* @param lodSelection - Level of Details (LOD) metrics
|
|
179
|
-
* @param nodeInPage - corresponding node object in a node page
|
|
180
|
-
* @param resources - the node resources data
|
|
181
|
-
* @param resources.texture - texture image
|
|
182
|
-
* @param resources.attributes - feature attributes
|
|
183
|
-
* @return 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object
|
|
184
|
-
*/
|
|
185
|
-
private _createNodeIndexDocument;
|
|
167
|
+
private _updateNodeInNodePages;
|
|
186
168
|
/**
|
|
187
169
|
* Write node resources in files
|
|
188
170
|
* @param resources - source tile (3DTile)
|
|
@@ -245,56 +227,18 @@ export default class I3SConverter {
|
|
|
245
227
|
*/
|
|
246
228
|
private _findOrCreateMaterial;
|
|
247
229
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
* @param
|
|
251
|
-
* @param
|
|
252
|
-
* @
|
|
253
|
-
*/
|
|
254
|
-
private _createdStorageAttribute;
|
|
255
|
-
/**
|
|
256
|
-
* Get the attribute type for attributeStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md
|
|
257
|
-
* @param key - attribute's key
|
|
258
|
-
* @param attribute - attribute's type in batchTable
|
|
259
|
-
*/
|
|
260
|
-
private getAttributeType;
|
|
261
|
-
/**
|
|
262
|
-
* Setup storage attribute as string.
|
|
263
|
-
* @param storageAttribute - attribute for map segmentation.
|
|
264
|
-
*/
|
|
265
|
-
private _setupStringAttribute;
|
|
266
|
-
/**
|
|
267
|
-
* Setup Id attribute for map segmentation.
|
|
268
|
-
* @param storageAttribute - attribute for map segmentation .
|
|
269
|
-
*/
|
|
270
|
-
private _setupIdAttribute;
|
|
271
|
-
/**
|
|
272
|
-
* Setup double attribute for map segmentation.
|
|
273
|
-
* @param storageAttribute - attribute for map segmentation .
|
|
274
|
-
*/
|
|
275
|
-
private _setupDoubleAttribute;
|
|
276
|
-
/**
|
|
277
|
-
* Setup field attribute for map segmentation.
|
|
278
|
-
* @param key - attribute for map segmentation.
|
|
279
|
-
* @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').
|
|
280
|
-
*/
|
|
281
|
-
private _createFieldAttribute;
|
|
282
|
-
/**
|
|
283
|
-
* Do conversion of 3DTiles batch table to I3s node attributes.
|
|
284
|
-
* @param batchTable - Table with layer meta data.
|
|
285
|
-
*/
|
|
286
|
-
private _convertBatchTableInfoToNodeAttributes;
|
|
287
|
-
/**
|
|
288
|
-
* Find and return attribute type based on key form Batch table.
|
|
289
|
-
* @param attributeType
|
|
230
|
+
* Get unique geometry configuration index
|
|
231
|
+
* In the end of conversion configurations will be transformed to geometryDefinitions array
|
|
232
|
+
* @param hasTexture
|
|
233
|
+
* @param hasUvRegions
|
|
234
|
+
* @returns
|
|
290
235
|
*/
|
|
291
|
-
private
|
|
236
|
+
private findOrCreateGeometryDefinition;
|
|
292
237
|
/**
|
|
293
|
-
*
|
|
294
|
-
* @param
|
|
295
|
-
* @return data for correct rendering of popup.
|
|
238
|
+
* Do conversion of 3DTiles property table to I3s node attributes.
|
|
239
|
+
* @param propertyTable - Table with layer meta data.
|
|
296
240
|
*/
|
|
297
|
-
private
|
|
241
|
+
private _convertPropertyTableToNodeAttributes;
|
|
298
242
|
/**
|
|
299
243
|
* Print statistics in the end of conversion
|
|
300
244
|
* @param params - output files data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-converter.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/i3s-converter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"i3s-converter.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/i3s-converter.ts"],"names":[],"mappings":"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"}
|