@loaders.gl/tile-converter 3.1.8 → 3.2.0-alpha.3
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 +28 -0
- package/dist/3d-tiles-attributes-worker.d.ts.map +1 -0
- package/dist/3d-tiles-attributes-worker.js +4 -0
- package/dist/3d-tiles-attributes-worker.js.map +7 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +82 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.js +268 -0
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +84 -0
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -0
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +278 -0
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +13 -0
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts.map +1 -0
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +23 -0
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts +9 -0
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts.map +1 -0
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +52 -0
- package/dist/3d-tiles-converter/json-templates/tileset.d.ts +15 -0
- package/dist/3d-tiles-converter/json-templates/tileset.d.ts.map +1 -0
- package/dist/3d-tiles-converter/json-templates/tileset.js +43 -0
- package/dist/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +5 -0
- package/dist/converter-cli.d.ts +2 -0
- package/dist/converter-cli.d.ts.map +1 -0
- package/dist/converter-cli.js +232 -0
- package/dist/converter.min.js +68 -68
- package/dist/deps-installer/deps-installer.d.ts +14 -0
- package/dist/deps-installer/deps-installer.d.ts.map +1 -0
- package/dist/deps-installer/deps-installer.js +31 -0
- package/dist/dist.min.js +1151 -1264
- package/dist/es5/3d-tiles-attributes-worker.js +29 -0
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +104 -44
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +34 -43
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/converter-cli.js +306 -0
- package/dist/es5/converter-cli.js.map +1 -0
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +29 -0
- package/dist/es5/i3s-attributes-worker.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +19 -11
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +2 -2
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +271 -182
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +71 -0
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/node-pages.js +47 -99
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +311 -245
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/index.js +0 -16
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/utils/compress-util.js +14 -17
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/file-utils.js +39 -14
- package/dist/es5/lib/utils/file-utils.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/lib/utils/queue.js +61 -0
- package/dist/es5/lib/utils/queue.js.map +1 -0
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
- package/dist/es5/lib/utils/write-queue.js +225 -0
- package/dist/es5/lib/utils/write-queue.js.map +1 -0
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +37 -0
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/es5/workers/i3s-attributes-worker.js +40 -0
- package/dist/es5/workers/i3s-attributes-worker.js.map +1 -0
- package/dist/esm/3d-tiles-attributes-worker.js +16 -0
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +32 -5
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +23 -23
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/converter-cli.js +230 -0
- package/dist/esm/converter-cli.js.map +1 -0
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +16 -0
- package/dist/esm/i3s-attributes-worker.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js +19 -11
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +2 -2
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +121 -62
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +54 -0
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/node-pages.js +12 -4
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +155 -50
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/utils/compress-util.js +6 -8
- package/dist/esm/lib/utils/compress-util.js.map +1 -1
- package/dist/esm/lib/utils/file-utils.js +11 -1
- package/dist/esm/lib/utils/file-utils.js.map +1 -1
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/esm/lib/utils/queue.js +19 -0
- package/dist/esm/lib/utils/queue.js.map +1 -0
- package/dist/esm/lib/utils/statistic-utills.js.map +1 -1
- package/dist/esm/lib/utils/write-queue.js +88 -0
- package/dist/esm/lib/utils/write-queue.js.map +1 -0
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/esm/pgm-loader.js.map +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js +5 -0
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/esm/workers/i3s-attributes-worker.js +4 -0
- package/dist/esm/workers/i3s-attributes-worker.js.map +1 -0
- package/dist/i3s-attributes-worker.d.ts +33 -0
- package/dist/i3s-attributes-worker.d.ts.map +1 -0
- package/dist/i3s-attributes-worker.js +10 -0
- package/dist/i3s-attributes-worker.js.map +7 -0
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +41 -0
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/coordinate-converter.js +122 -0
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts +9 -0
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/create-scene-server-path.js +28 -0
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +8 -0
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/geometry-attributes.js +177 -0
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +29 -0
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/geometry-converter.js +901 -0
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +9 -0
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/gltf-attributes.js +56 -0
- package/dist/i3s-converter/helpers/node-debug.d.ts +8 -0
- package/dist/i3s-converter/helpers/node-debug.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/node-debug.js +114 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts +117 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/node-pages.js +208 -0
- package/dist/i3s-converter/i3s-converter.d.ts +323 -0
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -0
- package/dist/i3s-converter/i3s-converter.js +1074 -0
- package/dist/i3s-converter/json-templates/layers.d.ts +95 -0
- package/dist/i3s-converter/json-templates/layers.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/layers.js +199 -0
- package/dist/i3s-converter/json-templates/metadata.d.ts +22 -0
- package/dist/i3s-converter/json-templates/metadata.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/metadata.js +25 -0
- package/dist/i3s-converter/json-templates/node.d.ts +61 -0
- package/dist/i3s-converter/json-templates/node.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/node.js +89 -0
- package/dist/i3s-converter/json-templates/scene-server.d.ts +28 -0
- package/dist/i3s-converter/json-templates/scene-server.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/scene-server.js +31 -0
- package/dist/i3s-converter/json-templates/shared-resources.d.ts +14 -0
- package/dist/i3s-converter/json-templates/shared-resources.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/shared-resources.js +129 -0
- package/dist/i3s-converter/json-templates/store.d.ts +95 -0
- package/dist/i3s-converter/json-templates/store.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/store.js +103 -0
- package/dist/i3s-converter/types.d.ts +114 -0
- package/dist/i3s-converter/types.d.ts.map +1 -0
- package/dist/i3s-converter/types.js +2 -0
- package/dist/i3s-server/app.d.ts +3 -0
- package/dist/i3s-server/app.d.ts.map +1 -0
- package/dist/i3s-server/app.js +14 -0
- package/dist/i3s-server/controllers/index-controller.d.ts +2 -0
- package/dist/i3s-server/controllers/index-controller.d.ts.map +1 -0
- package/dist/i3s-server/controllers/index-controller.js +23 -0
- package/dist/i3s-server/routes/index.d.ts +3 -0
- package/dist/i3s-server/routes/index.d.ts.map +1 -0
- package/dist/i3s-server/routes/index.js +16 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/lib/utils/compress-util.d.ts +45 -0
- package/dist/lib/utils/compress-util.d.ts.map +1 -0
- package/dist/lib/utils/compress-util.js +257 -0
- package/dist/{esm/lib → lib}/utils/file-utils.d.ts +6 -14
- package/dist/lib/utils/file-utils.d.ts.map +1 -0
- package/dist/lib/utils/file-utils.js +81 -0
- package/dist/lib/utils/lod-conversion-utils.d.ts +41 -0
- package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -0
- package/dist/lib/utils/lod-conversion-utils.js +76 -0
- package/dist/lib/utils/queue.d.ts +7 -0
- package/dist/lib/utils/queue.d.ts.map +1 -0
- package/dist/lib/utils/queue.js +18 -0
- package/dist/lib/utils/statistic-utills.d.ts +3 -0
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -0
- package/dist/lib/utils/statistic-utills.js +64 -0
- package/dist/lib/utils/write-queue.d.ts +22 -0
- package/dist/lib/utils/write-queue.d.ts.map +1 -0
- package/dist/lib/utils/write-queue.js +62 -0
- package/dist/pgm-loader.d.ts +6 -0
- package/dist/pgm-loader.d.ts.map +1 -0
- package/dist/pgm-loader.js +23 -0
- package/dist/workers/3d-tiles-attributes-worker.d.ts +2 -0
- package/dist/workers/3d-tiles-attributes-worker.d.ts.map +1 -0
- package/dist/workers/3d-tiles-attributes-worker.js +9 -0
- package/dist/workers/i3s-attributes-worker.d.ts +2 -0
- package/dist/workers/i3s-attributes-worker.d.ts.map +1 -0
- package/dist/workers/i3s-attributes-worker.js +5 -0
- package/package.json +19 -18
- package/src/3d-tiles-attributes-worker.ts +43 -0
- package/src/3d-tiles-converter/3d-tiles-converter.ts +49 -6
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +21 -18
- package/src/converter-cli.ts +310 -0
- package/src/deps-installer/{deps-installer.js → deps-installer.ts} +11 -1
- package/src/i3s-attributes-worker.ts +46 -0
- package/src/i3s-converter/helpers/coordinate-converter.ts +29 -24
- package/src/i3s-converter/helpers/geometry-attributes.ts +4 -3
- package/src/i3s-converter/helpers/{geometry-converter.js → geometry-converter.ts} +425 -179
- package/src/i3s-converter/helpers/gltf-attributes.ts +68 -0
- package/src/i3s-converter/helpers/node-pages.ts +25 -17
- package/src/i3s-converter/i3s-converter.ts +154 -87
- package/src/i3s-converter/types.ts +90 -8
- package/src/index.ts +0 -4
- package/src/lib/utils/{compress-util.js → compress-util.ts} +105 -18
- package/src/lib/utils/file-utils.ts +84 -0
- package/src/lib/utils/{lod-conversion-utils.js → lod-conversion-utils.ts} +27 -5
- package/src/lib/utils/queue.ts +17 -0
- package/src/lib/utils/{statistic-utills.js → statistic-utills.ts} +0 -0
- package/src/lib/utils/write-queue.ts +75 -0
- package/src/workers/3d-tiles-attributes-worker.ts +6 -0
- package/src/workers/i3s-attributes-worker.ts +6 -0
- package/dist/es5/deps-installer/deps-installer.d.ts +0 -10
- package/dist/es5/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/dist/es5/lib/utils/compress-util.d.ts +0 -53
- package/dist/es5/lib/utils/file-utils.d.ts +0 -43
- package/dist/es5/lib/utils/lod-conversion-utils.d.ts +0 -32
- package/dist/esm/deps-installer/deps-installer.d.ts +0 -10
- package/dist/esm/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/dist/esm/lib/utils/compress-util.d.ts +0 -53
- package/dist/esm/lib/utils/lod-conversion-utils.d.ts +0 -32
- package/src/deps-installer/deps-installer.d.ts +0 -10
- package/src/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/src/lib/utils/compress-util.d.ts +0 -53
- package/src/lib/utils/file-utils.d.ts +0 -43
- package/src/lib/utils/file-utils.js +0 -38
- package/src/lib/utils/lod-conversion-utils.d.ts +0 -32
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { B3DMContent } from '@loaders.gl/3d-tiles';
|
|
2
|
+
import type { B3DMAttributesData } from '../../i3s-attributes-worker';
|
|
3
|
+
/**
|
|
4
|
+
* Prepare attributes for conversion to avoid binary data breaking in worker thread.
|
|
5
|
+
* @param tileContent
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare function prepareDataForAttributesConversion(tileContent: B3DMContent): B3DMAttributesData;
|
|
9
|
+
//# sourceMappingURL=gltf-attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/gltf-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAsBpE;;;;GAIG;AACH,wBAAgB,kCAAkC,CAAC,WAAW,EAAE,WAAW,GAAG,kBAAkB,CAsC/F"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareDataForAttributesConversion = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Keep only values for B3DM attributes to pass data to worker thread.
|
|
6
|
+
* @param attributes
|
|
7
|
+
*/
|
|
8
|
+
function getB3DMAttributesWithoutBufferView(attributes) {
|
|
9
|
+
const attributesWithoutBufferView = {};
|
|
10
|
+
for (const attributeName in attributes) {
|
|
11
|
+
attributesWithoutBufferView[attributeName] = {
|
|
12
|
+
value: attributes[attributeName].value
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return attributesWithoutBufferView;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Prepare attributes for conversion to avoid binary data breaking in worker thread.
|
|
19
|
+
* @param tileContent
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
function prepareDataForAttributesConversion(tileContent) {
|
|
23
|
+
const gltfMaterials = tileContent.gltf?.materials?.map((material) => ({ id: material.id }));
|
|
24
|
+
let nodes = tileContent.gltf?.scene?.nodes ||
|
|
25
|
+
tileContent.gltf?.scenes?.[0]?.nodes ||
|
|
26
|
+
tileContent.gltf?.nodes ||
|
|
27
|
+
[];
|
|
28
|
+
const prepearedNodes = nodes.map((node) => {
|
|
29
|
+
if (!node.mesh) {
|
|
30
|
+
return node;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
...node,
|
|
34
|
+
mesh: {
|
|
35
|
+
...node.mesh,
|
|
36
|
+
primitives: node.mesh?.primitives.map((primitive) => ({
|
|
37
|
+
...primitive,
|
|
38
|
+
indices: { value: primitive?.indices?.value },
|
|
39
|
+
attributes: getB3DMAttributesWithoutBufferView(primitive.attributes),
|
|
40
|
+
material: {
|
|
41
|
+
id: primitive?.material?.id
|
|
42
|
+
}
|
|
43
|
+
}))
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
const cartographicOrigin = tileContent.cartographicOrigin;
|
|
48
|
+
const cartesianModelMatrix = tileContent.cartesianModelMatrix;
|
|
49
|
+
return {
|
|
50
|
+
gltfMaterials,
|
|
51
|
+
nodes: prepearedNodes,
|
|
52
|
+
cartographicOrigin,
|
|
53
|
+
cartesianModelMatrix
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
exports.prepareDataForAttributesConversion = prepareDataForAttributesConversion;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Node3DIndexDocument } from '@loaders.gl/i3s';
|
|
2
|
+
/**
|
|
3
|
+
* Do validation of bounding volumes for particular node.
|
|
4
|
+
* Generates special warnings if there are some issues.
|
|
5
|
+
* @param node
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateNodeBoundingVolumes(node: Node3DIndexDocument): string[];
|
|
8
|
+
//# sourceMappingURL=node-debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-debug.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-debug.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAM,mBAAmB,EAAM,MAAM,iBAAiB,CAAC;AASnE;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,EAAE,CAW/E"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateNodeBoundingVolumes = void 0;
|
|
4
|
+
const culling_1 = require("@math.gl/culling");
|
|
5
|
+
const engine_1 = require("@luma.gl/engine");
|
|
6
|
+
const core_1 = require("@math.gl/core");
|
|
7
|
+
const geospatial_1 = require("@math.gl/geospatial");
|
|
8
|
+
// TODO Unite Tile validation logic in i3s-17-and-debug with this code.
|
|
9
|
+
/**
|
|
10
|
+
* Do validation of bounding volumes for particular node.
|
|
11
|
+
* Generates special warnings if there are some issues.
|
|
12
|
+
* @param node
|
|
13
|
+
*/
|
|
14
|
+
function validateNodeBoundingVolumes(node) {
|
|
15
|
+
if (!node?.parentNode?.obb || !node?.parentNode?.mbs) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const tileWarnings = [];
|
|
19
|
+
validateObb(tileWarnings, node);
|
|
20
|
+
validateMbs(tileWarnings, node);
|
|
21
|
+
return tileWarnings;
|
|
22
|
+
}
|
|
23
|
+
exports.validateNodeBoundingVolumes = validateNodeBoundingVolumes;
|
|
24
|
+
/**
|
|
25
|
+
* Check if child Obb fit into parent Obb.
|
|
26
|
+
* @param tileWarnings
|
|
27
|
+
* @param node
|
|
28
|
+
*/
|
|
29
|
+
function validateObb(tileWarnings, node) {
|
|
30
|
+
// @ts-expect-error
|
|
31
|
+
const parentObb = createBoundingBoxFromTileObb(node.parentNode.obb);
|
|
32
|
+
const tileVertices = getTileObbVertices(node);
|
|
33
|
+
const isTileObbInsideParentObb = isAllVerticesInsideBoundingVolume(parentObb, tileVertices);
|
|
34
|
+
if (isTileObbInsideParentObb) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const title = `OBB of Tile (${node.id}) doesn't fit into Parent (${node.parentNode?.id}) tile OBB`;
|
|
38
|
+
tileWarnings.push(title);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Check if child Mbs fit into parent Mbs.
|
|
42
|
+
* @param tileWarnings
|
|
43
|
+
* @param node
|
|
44
|
+
*/
|
|
45
|
+
function validateMbs(tileWarnings, node) {
|
|
46
|
+
// @ts-expect-error
|
|
47
|
+
const tileMbs = createBoundingSphereFromTileMbs(node.mbs);
|
|
48
|
+
// @ts-expect-error
|
|
49
|
+
const parentMbs = createBoundingSphereFromTileMbs(node.parentNode.mbs);
|
|
50
|
+
const distanceBetweenCenters = tileMbs.center.distanceTo(parentMbs.center);
|
|
51
|
+
if (distanceBetweenCenters + tileMbs.radius > parentMbs.radius) {
|
|
52
|
+
const title = `MBS of Tile (${node.id}) doesn't fit into Parent (${node.parentNode?.id}) tile MBS`;
|
|
53
|
+
tileWarnings.push(title);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Generates bounding sphere from mbs
|
|
58
|
+
* @param mbs
|
|
59
|
+
*/
|
|
60
|
+
function createBoundingSphereFromTileMbs(mbs) {
|
|
61
|
+
return new culling_1.BoundingSphere([mbs[0], mbs[1], mbs[2]], mbs[3]);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Generates oriented bounding box from tile obb
|
|
65
|
+
* @param obb
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
function createBoundingBoxFromTileObb(obb) {
|
|
69
|
+
const { center, halfSize, quaternion } = obb;
|
|
70
|
+
return new culling_1.OrientedBoundingBox().fromCenterHalfSizeQuaternion(center, halfSize, quaternion);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get vertices fromnode obb
|
|
74
|
+
* TODO check if Obb generates properly
|
|
75
|
+
* @param node
|
|
76
|
+
*/
|
|
77
|
+
function getTileObbVertices(node) {
|
|
78
|
+
const geometry = new engine_1.CubeGeometry();
|
|
79
|
+
// @ts-expect-error
|
|
80
|
+
const halfSize = node.obb.halfSize;
|
|
81
|
+
const attributes = geometry.getAttributes();
|
|
82
|
+
const positions = new Float32Array(attributes.POSITION.value);
|
|
83
|
+
// @ts-expect-error
|
|
84
|
+
const obbCenterCartesian = geospatial_1.Ellipsoid.WGS84.cartographicToCartesian(node.obb.center);
|
|
85
|
+
let vertices = [];
|
|
86
|
+
for (let i = 0; i < positions.length; i += 3) {
|
|
87
|
+
const positionsVector = new core_1.Vector3((positions[i] *= halfSize[0]), (positions[i + 1] *= halfSize[1]), (positions[i + 2] *= halfSize[2]));
|
|
88
|
+
const rotatedPositions = positionsVector
|
|
89
|
+
// @ts-expect-error
|
|
90
|
+
.transformByQuaternion(node.obb.quaternion)
|
|
91
|
+
.add(obbCenterCartesian);
|
|
92
|
+
// @ts-expect-error
|
|
93
|
+
vertices = vertices.concat(rotatedPositions);
|
|
94
|
+
}
|
|
95
|
+
return vertices;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Check if all vertices inside bounding volume
|
|
99
|
+
* @param boundingVolume
|
|
100
|
+
* @param positions
|
|
101
|
+
*/
|
|
102
|
+
function isAllVerticesInsideBoundingVolume(boundingVolume, positions) {
|
|
103
|
+
let isVerticesInsideObb = true;
|
|
104
|
+
for (let index = 0; index < positions.length / 3; index += 3) {
|
|
105
|
+
const point = [positions[index], positions[index + 1], positions[index + 2]];
|
|
106
|
+
const cartographicPoint = geospatial_1.Ellipsoid.WGS84.cartesianToCartographic(point);
|
|
107
|
+
const distance = boundingVolume.distanceTo(cartographicPoint);
|
|
108
|
+
if (distance > 0) {
|
|
109
|
+
isVerticesInsideObb = false;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return isVerticesInsideObb;
|
|
114
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { WriteQueueItem } from '../../lib/utils/write-queue';
|
|
2
|
+
import { NodeInPage } from '@loaders.gl/i3s';
|
|
3
|
+
import WriteQueue from '../../lib/utils/write-queue';
|
|
4
|
+
/**
|
|
5
|
+
* class NodePages - wrapper of nodePages array
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import {writeFile} from './helpers/write-file';
|
|
9
|
+
*
|
|
10
|
+
* // create an instance of the class
|
|
11
|
+
* const nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE);
|
|
12
|
+
* ...
|
|
13
|
+
* // push root node
|
|
14
|
+
* const parentId = nodePages.push({
|
|
15
|
+
lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,
|
|
16
|
+
obb: coordinates.obb,
|
|
17
|
+
children: []
|
|
18
|
+
});
|
|
19
|
+
* ...
|
|
20
|
+
* // push node with parent relation
|
|
21
|
+
* const nodeInPage = {
|
|
22
|
+
lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,
|
|
23
|
+
obb: coordinates.obb,
|
|
24
|
+
children: [],
|
|
25
|
+
mesh: {
|
|
26
|
+
geometry: {
|
|
27
|
+
definition: 0
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
* const nodeId = this.nodePages.push(nodeInPage, parentId);
|
|
32
|
+
* ...
|
|
33
|
+
* // save all the nodePages in the end of pushing all the nodes
|
|
34
|
+
* await this.nodePages.save(layers0path);
|
|
35
|
+
*/
|
|
36
|
+
export default class NodePages {
|
|
37
|
+
readonly nodesPerPage: number;
|
|
38
|
+
nodesCounter: number;
|
|
39
|
+
writeFile: Function;
|
|
40
|
+
readonly nodePages: {
|
|
41
|
+
nodes: NodeInPage[];
|
|
42
|
+
}[];
|
|
43
|
+
/**
|
|
44
|
+
* @constructs
|
|
45
|
+
* Create a nodePages instance.
|
|
46
|
+
* @param writeFileFunc - function to save one nodePage into a file
|
|
47
|
+
* @param nodesPerPage - length limit for one nodePage. An additional nodePage is created when this limit is met
|
|
48
|
+
*/
|
|
49
|
+
constructor(writeFileFunc: any, nodesPerPage: any);
|
|
50
|
+
/**
|
|
51
|
+
* Setup function to save node pages
|
|
52
|
+
* @param func - function which should be used to save node pages
|
|
53
|
+
*/
|
|
54
|
+
useWriteFunction(func: Function): void;
|
|
55
|
+
/**
|
|
56
|
+
* Get the node by its end-to-end index
|
|
57
|
+
* @param id - end-to-end index of the node
|
|
58
|
+
* @return the node object
|
|
59
|
+
*/
|
|
60
|
+
getNodeById(id: number): NodeInPage;
|
|
61
|
+
/**
|
|
62
|
+
* Update material in node.mesh object by node id
|
|
63
|
+
* @param id - end-to-end index of the node
|
|
64
|
+
* @param materialId - id from scene layer materialDefinitions
|
|
65
|
+
*/
|
|
66
|
+
updateMaterialByNodeId(id: number, materialId: number): void;
|
|
67
|
+
/**
|
|
68
|
+
* Update vertexCount in node.mesh.geometry object by node id
|
|
69
|
+
* @param id - end-to-end index of the node
|
|
70
|
+
* @param vertexCount - vertex count for particular node
|
|
71
|
+
*/
|
|
72
|
+
updateVertexCountByNodeId(id: number, vertexCount: number): void;
|
|
73
|
+
/**
|
|
74
|
+
* Update resource in node.mesh.attribute object by node id
|
|
75
|
+
* @param id - end-to-end index of the node
|
|
76
|
+
*/
|
|
77
|
+
updateNodeAttributeByNodeId(id: number): void;
|
|
78
|
+
/**
|
|
79
|
+
* Update featureCount in node.mesh.geometry object by node id
|
|
80
|
+
* @param id - end-to-end index of the node
|
|
81
|
+
* @param featureCount - features count of the node
|
|
82
|
+
*/
|
|
83
|
+
updateFeatureCountByNodeId(id: number, featureCount: number): void;
|
|
84
|
+
/**
|
|
85
|
+
* Update texelCountHint in node.mesh.material object by node id
|
|
86
|
+
* @param id - end-to-end index of the node
|
|
87
|
+
* @param texelCountHint - texelCountHint of particular node
|
|
88
|
+
*/
|
|
89
|
+
updateTexelCountHintByNodeId(id: number, texelCountHint: number): void;
|
|
90
|
+
/**
|
|
91
|
+
* Add a child id into the parent node.children array
|
|
92
|
+
* @param parentId - end-to-end parent node index
|
|
93
|
+
* @param childId - end-to-end child node index
|
|
94
|
+
*/
|
|
95
|
+
addChildRelation(parentId: number | undefined, childId: number): void;
|
|
96
|
+
/**
|
|
97
|
+
* Update resource index in node.mesh object
|
|
98
|
+
* @param node - node object
|
|
99
|
+
*/
|
|
100
|
+
updateResourceInMesh(node: NodeInPage): void;
|
|
101
|
+
/**
|
|
102
|
+
* Put new node in nodePages array
|
|
103
|
+
* @param node - node object
|
|
104
|
+
* @param parentId - index of parent node
|
|
105
|
+
* @return
|
|
106
|
+
*/
|
|
107
|
+
push(node: NodeInPage, parentId?: number): number;
|
|
108
|
+
/**
|
|
109
|
+
* Save all the node pages
|
|
110
|
+
* Run this method when all nodes is pushed in nodePages
|
|
111
|
+
* @param layers0Path - path of layer
|
|
112
|
+
* @param writeQueue - write queue that controlls files write concurrency
|
|
113
|
+
* @param slpk
|
|
114
|
+
*/
|
|
115
|
+
save(layers0Path: string, writeQueue: WriteQueue<WriteQueueItem>, slpk?: boolean): Promise<void>;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=node-pages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-pages.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAKhE,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,UAAU,MAAM,6BAA6B,CAAC;AAGrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE;QAAC,KAAK,EAAE,UAAU,EAAE,CAAA;KAAC,EAAE,CAAC;IAE5C;;;;;OAKG;gBACS,aAAa,KAAA,EAAE,YAAY,KAAA;IASvC;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAItC;;;;OAIG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU;IAMnC;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAW5D;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAQhE;;;OAGG;IACH,2BAA2B,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAQ7C;;;;OAIG;IACH,0BAA0B,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAQlE;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI;IAQtE;;;;OAIG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAQrE;;;OAGG;IACH,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAM5C;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAajD;;;;;;OAMG;IACG,IAAI,CACR,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,UAAU,CAAC,cAAc,CAAC,EACtC,IAAI,GAAE,OAAe,GACpB,OAAO,CAAC,IAAI,CAAC;CA6BjB"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const json_map_transform_1 = __importDefault(require("json-map-transform"));
|
|
8
|
+
const metadata_1 = require("../json-templates/metadata");
|
|
9
|
+
// @ts-nocheck
|
|
10
|
+
/**
|
|
11
|
+
* class NodePages - wrapper of nodePages array
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* import {writeFile} from './helpers/write-file';
|
|
15
|
+
*
|
|
16
|
+
* // create an instance of the class
|
|
17
|
+
* const nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE);
|
|
18
|
+
* ...
|
|
19
|
+
* // push root node
|
|
20
|
+
* const parentId = nodePages.push({
|
|
21
|
+
lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,
|
|
22
|
+
obb: coordinates.obb,
|
|
23
|
+
children: []
|
|
24
|
+
});
|
|
25
|
+
* ...
|
|
26
|
+
* // push node with parent relation
|
|
27
|
+
* const nodeInPage = {
|
|
28
|
+
lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,
|
|
29
|
+
obb: coordinates.obb,
|
|
30
|
+
children: [],
|
|
31
|
+
mesh: {
|
|
32
|
+
geometry: {
|
|
33
|
+
definition: 0
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
* const nodeId = this.nodePages.push(nodeInPage, parentId);
|
|
38
|
+
* ...
|
|
39
|
+
* // save all the nodePages in the end of pushing all the nodes
|
|
40
|
+
* await this.nodePages.save(layers0path);
|
|
41
|
+
*/
|
|
42
|
+
class NodePages {
|
|
43
|
+
/**
|
|
44
|
+
* @constructs
|
|
45
|
+
* Create a nodePages instance.
|
|
46
|
+
* @param writeFileFunc - function to save one nodePage into a file
|
|
47
|
+
* @param nodesPerPage - length limit for one nodePage. An additional nodePage is created when this limit is met
|
|
48
|
+
*/
|
|
49
|
+
constructor(writeFileFunc, nodesPerPage) {
|
|
50
|
+
this.nodesPerPage = nodesPerPage;
|
|
51
|
+
this.nodesCounter = 0;
|
|
52
|
+
// @ts-expect-error
|
|
53
|
+
this.nodePages = [{}];
|
|
54
|
+
this.nodePages[0].nodes = [];
|
|
55
|
+
this.writeFile = writeFileFunc;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Setup function to save node pages
|
|
59
|
+
* @param func - function which should be used to save node pages
|
|
60
|
+
*/
|
|
61
|
+
useWriteFunction(func) {
|
|
62
|
+
this.writeFile = func;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get the node by its end-to-end index
|
|
66
|
+
* @param id - end-to-end index of the node
|
|
67
|
+
* @return the node object
|
|
68
|
+
*/
|
|
69
|
+
getNodeById(id) {
|
|
70
|
+
const pageIndex = Math.floor(id / this.nodesPerPage);
|
|
71
|
+
const nodeIndex = id % this.nodesPerPage;
|
|
72
|
+
return this.nodePages[pageIndex].nodes[nodeIndex];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Update material in node.mesh object by node id
|
|
76
|
+
* @param id - end-to-end index of the node
|
|
77
|
+
* @param materialId - id from scene layer materialDefinitions
|
|
78
|
+
*/
|
|
79
|
+
updateMaterialByNodeId(id, materialId) {
|
|
80
|
+
const node = this.getNodeById(id);
|
|
81
|
+
if (!node.mesh) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
node.mesh.material = {
|
|
85
|
+
definition: materialId,
|
|
86
|
+
resource: node.index
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Update vertexCount in node.mesh.geometry object by node id
|
|
91
|
+
* @param id - end-to-end index of the node
|
|
92
|
+
* @param vertexCount - vertex count for particular node
|
|
93
|
+
*/
|
|
94
|
+
updateVertexCountByNodeId(id, vertexCount) {
|
|
95
|
+
const node = this.getNodeById(id);
|
|
96
|
+
if (!node.mesh) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
node.mesh.geometry.vertexCount = vertexCount;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Update resource in node.mesh.attribute object by node id
|
|
103
|
+
* @param id - end-to-end index of the node
|
|
104
|
+
*/
|
|
105
|
+
updateNodeAttributeByNodeId(id) {
|
|
106
|
+
const node = this.getNodeById(id);
|
|
107
|
+
if (!node.mesh) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
node.mesh.attribute.resource = node.index;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Update featureCount in node.mesh.geometry object by node id
|
|
114
|
+
* @param id - end-to-end index of the node
|
|
115
|
+
* @param featureCount - features count of the node
|
|
116
|
+
*/
|
|
117
|
+
updateFeatureCountByNodeId(id, featureCount) {
|
|
118
|
+
const node = this.getNodeById(id);
|
|
119
|
+
if (!node.mesh) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
node.mesh.geometry.featureCount = featureCount;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Update texelCountHint in node.mesh.material object by node id
|
|
126
|
+
* @param id - end-to-end index of the node
|
|
127
|
+
* @param texelCountHint - texelCountHint of particular node
|
|
128
|
+
*/
|
|
129
|
+
updateTexelCountHintByNodeId(id, texelCountHint) {
|
|
130
|
+
const node = this.getNodeById(id);
|
|
131
|
+
if (!node.mesh || !node.mesh.material) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
node.mesh.material.texelCountHint = texelCountHint;
|
|
135
|
+
}
|
|
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
|
+
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
|
+
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
|
+
writeQueue.enqueue({ writePromise: this.writeFile(nodePagePath, nodePageStr) });
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
exports.default = NodePages;
|