@loaders.gl/tile-converter 4.2.0-alpha.5 → 4.2.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +42 -22
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +4 -0
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js +3 -28
- package/dist/converter-cli.js +4 -2
- package/dist/converter.min.cjs +95 -95
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/deps-installer/deps-installer.js +6 -1
- package/dist/i3s-converter/helpers/attribute-metadata-info.js +4 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +2 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js +2 -2
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.js +4 -2
- package/dist/i3s-converter/helpers/geometry-attributes.js +6 -5
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +15 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +52 -12
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +12 -14
- package/dist/i3s-converter/helpers/node-index-document.d.ts +8 -1
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.js +18 -11
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +27 -26
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/progress.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/progress.js +23 -18
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts +8 -1
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js +12 -3
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +190 -66
- package/dist/i3s-converter/json-templates/node.js +1 -1
- package/dist/i3s-server/bin/i3s-server.min.cjs +69 -69
- package/dist/i3s-server/bin/www.js +6 -4
- package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -1
- package/dist/i3s-server/controllers/slpk-controller.js +3 -1
- package/dist/i3s-server/routes/index.js +11 -8
- package/dist/i3s-server/routes/slpk-router.d.ts.map +1 -1
- package/dist/i3s-server/routes/slpk-router.js +24 -18
- package/dist/i3s-server/utils/server-utils.d.ts.map +1 -1
- package/dist/i3s-server/utils/server-utils.js +8 -5
- package/dist/index.cjs +419 -211
- package/dist/index.cjs.map +3 -3
- package/dist/lib/utils/cli-utils.d.ts.map +1 -1
- package/dist/lib/utils/cli-utils.js +2 -0
- package/dist/lib/utils/conversion-dump.d.ts +9 -1
- package/dist/lib/utils/conversion-dump.d.ts.map +1 -1
- package/dist/lib/utils/conversion-dump.js +44 -21
- package/dist/lib/utils/file-utils.d.ts +1 -1
- package/dist/lib/utils/file-utils.d.ts.map +1 -1
- package/dist/lib/utils/file-utils.js +10 -12
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
- package/dist/lib/utils/statistic-utills.js +5 -7
- package/dist/lib/utils/write-queue.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.js +7 -3
- package/dist/pgm-loader.js +1 -1
- package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -1
- package/dist/slpk-extractor/slpk-extractor.js +2 -1
- package/dist/slpk-extractor-cli.d.ts.map +1 -1
- package/dist/slpk-extractor-cli.js +16 -8
- package/dist/slpk-extractor.min.cjs +1 -1
- package/package.json +23 -22
- package/src/3d-tiles-converter/3d-tiles-converter.ts +21 -10
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +1 -0
- package/src/3d-tiles-converter/helpers/load-i3s.ts +3 -27
- package/src/converter-cli.ts +4 -2
- package/src/deps-installer/deps-installer.ts +7 -0
- package/src/i3s-converter/helpers/attribute-metadata-info.ts +1 -1
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +3 -1
- package/src/i3s-converter/helpers/coordinate-converter.ts +2 -2
- package/src/i3s-converter/helpers/feature-attributes.ts +5 -2
- package/src/i3s-converter/helpers/geometry-attributes.ts +6 -5
- package/src/i3s-converter/helpers/geometry-converter.ts +118 -72
- package/src/i3s-converter/helpers/gltf-attributes.ts +12 -13
- package/src/i3s-converter/helpers/node-index-document.ts +18 -10
- package/src/i3s-converter/helpers/node-pages.ts +27 -29
- package/src/i3s-converter/helpers/preprocess-3d-tiles.ts +1 -0
- package/src/i3s-converter/helpers/progress.ts +1 -0
- package/src/i3s-converter/helpers/tileset-traversal.ts +22 -13
- package/src/i3s-converter/i3s-converter.ts +173 -114
- package/src/i3s-converter/json-templates/node.ts +1 -1
- package/src/i3s-server/bin/www.ts +6 -4
- package/src/i3s-server/controllers/slpk-controller.ts +4 -2
- package/src/i3s-server/routes/index.ts +10 -7
- package/src/i3s-server/routes/slpk-router.ts +22 -16
- package/src/i3s-server/utils/server-utils.ts +6 -4
- package/src/lib/utils/cli-utils.ts +2 -0
- package/src/lib/utils/conversion-dump.ts +35 -20
- package/src/lib/utils/file-utils.ts +11 -11
- package/src/lib/utils/statistic-utills.ts +5 -6
- package/src/lib/utils/write-queue.ts +2 -2
- package/src/slpk-extractor/slpk-extractor.ts +2 -1
- package/src/slpk-extractor-cli.ts +16 -8
- package/src/lib/utils/statistic-utills.d.ts +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps-installer.d.ts","sourceRoot":"","sources":["../../src/deps-installer/deps-installer.ts"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,qBAAa,aAAa;IACxB;;;;;;OAMG;
|
|
1
|
+
{"version":3,"file":"deps-installer.d.ts","sourceRoot":"","sources":["../../src/deps-installer/deps-installer.ts"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,qBAAa,aAAa;IACxB;;;;;;OAMG;IAEG,OAAO,CAAC,IAAI,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,CAAC;YAsEjC,cAAc;YAiBd,cAAc;CAS7B"}
|
|
@@ -6,7 +6,7 @@ import { ChildProcessProxy } from '@loaders.gl/worker-utils';
|
|
|
6
6
|
import { DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS } from '@loaders.gl/draco';
|
|
7
7
|
import { BASIS_EXTERNAL_LIBRARIES } from '@loaders.gl/textures';
|
|
8
8
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
9
|
-
const VERSION = typeof "4.2.0-alpha.
|
|
9
|
+
const VERSION = typeof "4.2.0-alpha.5" !== 'undefined' ? "4.2.0-alpha.5" : 'latest';
|
|
10
10
|
const PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';
|
|
11
11
|
/**
|
|
12
12
|
* Install external dependencies for converter:
|
|
@@ -22,6 +22,7 @@ export class DepsInstaller {
|
|
|
22
22
|
* This path is '' by default and is not used by tile-converter.
|
|
23
23
|
* It is used in tests to prevent rewriting actual workers during tests running
|
|
24
24
|
*/
|
|
25
|
+
// eslint-disable-next-line max-statements
|
|
25
26
|
async install(path = '') {
|
|
26
27
|
console.log('Installing "EGM2008-5" model...'); // eslint-disable-line no-console
|
|
27
28
|
const fileMap = await load(PGM_LINK, ZipLoader, {});
|
|
@@ -51,6 +52,7 @@ export class DepsInstaller {
|
|
|
51
52
|
console.log('Installing "Basis encoder" library'); // eslint-disable-line no-console
|
|
52
53
|
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.ENCODER, 'libs');
|
|
53
54
|
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.ENCODER_WASM, 'libs');
|
|
55
|
+
// eslint-disable-next-line no-console
|
|
54
56
|
console.log('Installing "join-images" npm package');
|
|
55
57
|
const childProcess = new ChildProcessProxy();
|
|
56
58
|
const nodeDir = dirname(process.execPath);
|
|
@@ -67,6 +69,9 @@ export class DepsInstaller {
|
|
|
67
69
|
}
|
|
68
70
|
async installFromNpm(module, name, extraPath = '') {
|
|
69
71
|
const fileResponse = await fetchFile(`https://unpkg.com/@loaders.gl/${module}@${VERSION}/dist/${extraPath}/${name}`);
|
|
72
|
+
if (fileResponse.status < 200 || fileResponse.status >= 300) {
|
|
73
|
+
throw new Error(`Failed to load resource ${name}`);
|
|
74
|
+
}
|
|
70
75
|
const fileData = await fileResponse.arrayBuffer();
|
|
71
76
|
if (!fileData) {
|
|
72
77
|
return;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { AttributeType } from "../types.js";
|
|
2
2
|
export class AttributeMetadataInfo {
|
|
3
|
+
_attributeStorageInfo;
|
|
4
|
+
_fields;
|
|
5
|
+
_popupInfo;
|
|
3
6
|
constructor() {
|
|
4
7
|
this._attributeStorageInfo = [];
|
|
5
8
|
this._fields = [];
|
|
@@ -67,7 +70,7 @@ export class AttributeMetadataInfo {
|
|
|
67
70
|
Use attributeStorageInfo as a source of attribute names to create the popupInfo.
|
|
68
71
|
*/
|
|
69
72
|
const attributeNames = [];
|
|
70
|
-
for (
|
|
73
|
+
for (const info of this._attributeStorageInfo) {
|
|
71
74
|
attributeNames.push(info.name);
|
|
72
75
|
}
|
|
73
76
|
this._popupInfo = this.createPopupInfo(attributeNames);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-ids-extensions.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/batch-ids-extensions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"batch-ids-extensions.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/batch-ids-extensions.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,yBAAyB,EAAE,8BAA8B,EAAC,MAAM,kBAAkB,CAAC;AAC3F,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAU3D,OAAO,EAAC,sBAAsB,EAAC,oBAAiB;AAGhD,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAExD;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,kBAAkB,EAC/B,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM,GAAG,IAAI,CAcf;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE;IACV,CAAC,GAAG,EAAE,MAAM,GAAG,yBAAyB,CAAC;CAC1C,EACD,SAAS,EAAE,8BAA8B,EACzC,MAAM,EAAE,CAAC,sBAAsB,GAAG,IAAI,CAAC,EAAE,EACzC,cAAc,EAAE,MAAM,GAAG,IAAI,GAC5B,YAAY,CAuBd"}
|
|
@@ -54,7 +54,7 @@ export function handleBatchIdsExtensions(attributes, primitive, images, featureT
|
|
|
54
54
|
* @returns an array of attribute values
|
|
55
55
|
*/
|
|
56
56
|
function handleExtMeshFeaturesExtension(attributes, extMeshFeatures) {
|
|
57
|
-
for (
|
|
57
|
+
for (const ids of extMeshFeatures.featureIds) {
|
|
58
58
|
if (typeof ids.propertyTable !== 'undefined') {
|
|
59
59
|
// propertyTable is an index that can be 0
|
|
60
60
|
// return the first featureID set that corresponts to property table.
|
|
@@ -158,6 +158,7 @@ function generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, image
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
else {
|
|
161
|
+
// eslint-disable-next-line no-console
|
|
161
162
|
console.warn(`Can't get batch Ids from ${image?.mimeType || ''} compressed texture`);
|
|
162
163
|
}
|
|
163
164
|
return batchIds;
|
|
@@ -45,8 +45,8 @@ export function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeigh
|
|
|
45
45
|
const positionVectors = convertPositionsToVectors(cartesianPositions);
|
|
46
46
|
const geometryObb = makeOrientedBoundingBoxFromPoints(positionVectors);
|
|
47
47
|
const geometryMbs = makeBoundingSphereFromPoints(positionVectors);
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const mbsCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new Vector3());
|
|
49
|
+
const obbCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new Vector3());
|
|
50
50
|
mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
|
|
51
51
|
obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
|
|
52
52
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/feature-attributes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"feature-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/feature-attributes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EACV,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AAM1B;;;;;;;;;;;;GAYG;AACH,wBAAgB,gCAAgC,CAC9C,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,aAAa,EAAE,gBAAgB,GAC9B,gBAAgB,CAQlB;AAuBD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAAE,EACpB,aAAa,EAAE,gBAAgB,GAC9B,OAAO,CAUT;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,CAO3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,qCAAqC,CACnD,aAAa,EAAE,gBAAgB,GAC9B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAS3B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,aAC/B,iBAAiB,iBACZ,MAAM,KACpB,OAAO,MAAM,EAAE,SAAS,CAAC,GAAG,IA2B9B,CAAC"}
|
|
@@ -100,7 +100,7 @@ export const getAttributeTypesMapFromSchema = (gltfJson, metadataClass) => {
|
|
|
100
100
|
const attributeTypesMap = {};
|
|
101
101
|
const extFeatureMetadataSchemaClass = gltfJson.extensions?.[EXT_FEATURE_METADATA]?.schema?.classes?.[metadataClass];
|
|
102
102
|
if (extFeatureMetadataSchemaClass) {
|
|
103
|
-
for (
|
|
103
|
+
for (const propertyName in extFeatureMetadataSchemaClass.properties) {
|
|
104
104
|
const property = extFeatureMetadataSchemaClass.properties[propertyName];
|
|
105
105
|
const attributeProperty = getAttributeTypeFromExtFeatureMetadata(property);
|
|
106
106
|
attributeTypesMap[propertyName] = attributeProperty;
|
|
@@ -109,7 +109,7 @@ export const getAttributeTypesMapFromSchema = (gltfJson, metadataClass) => {
|
|
|
109
109
|
}
|
|
110
110
|
const extStructuralMetadataSchemaClass = gltfJson.extensions?.[EXT_STRUCTURAL_METADATA]?.schema?.classes?.[metadataClass];
|
|
111
111
|
if (extStructuralMetadataSchemaClass) {
|
|
112
|
-
for (
|
|
112
|
+
for (const propertyName in extStructuralMetadataSchemaClass.properties) {
|
|
113
113
|
const property = extStructuralMetadataSchemaClass.properties[propertyName];
|
|
114
114
|
const attributeProperty = getAttributeTypeFromExtStructuralMetadata(property);
|
|
115
115
|
attributeTypesMap[propertyName] = attributeProperty;
|
|
@@ -124,6 +124,7 @@ export const getAttributeTypesMapFromSchema = (gltfJson, metadataClass) => {
|
|
|
124
124
|
* @param property - schema of the class property for Ext_feature_metadata
|
|
125
125
|
* @returns attribute's type
|
|
126
126
|
*/
|
|
127
|
+
// eslint-disable-next-line complexity
|
|
127
128
|
const getAttributeTypeFromExtFeatureMetadata = (property) => {
|
|
128
129
|
let attributeType;
|
|
129
130
|
switch (property.type) {
|
|
@@ -159,6 +160,7 @@ const getAttributeTypeFromExtFeatureMetadata = (property) => {
|
|
|
159
160
|
* @param property - schema of the class property for Ext_structural_metadata
|
|
160
161
|
* @returns attribute's type
|
|
161
162
|
*/
|
|
163
|
+
// eslint-disable-next-line complexity
|
|
162
164
|
const getAttributeTypeFromExtStructuralMetadata = (property) => {
|
|
163
165
|
let attributeType;
|
|
164
166
|
if (property.array) {
|
|
@@ -83,14 +83,15 @@ function getFrequentValue(values) {
|
|
|
83
83
|
* @param attributes
|
|
84
84
|
* @returns sorted list of attribute objects.
|
|
85
85
|
*/
|
|
86
|
+
// eslint-disable-next-line max-statements
|
|
86
87
|
function makeAttributeObjects(attributes) {
|
|
87
88
|
const { featureIds, positions, normals, colors, uvRegions, texCoords, faceRange = new Uint32Array(0) } = attributes;
|
|
88
89
|
const groupedData = [];
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
const positionsList = new Float32Array(positions);
|
|
91
|
+
const normalsList = new Float32Array(normals);
|
|
92
|
+
const colorsList = new Uint8Array(colors);
|
|
93
|
+
const texCoordsList = new Float32Array(texCoords);
|
|
94
|
+
const uvRegionsList = new Uint16Array(uvRegions);
|
|
94
95
|
let positionsOffset = 0;
|
|
95
96
|
let normalsOffset = 0;
|
|
96
97
|
let colorsOffset = 0;
|
|
@@ -24,7 +24,21 @@ import { BoundingSphere, OrientedBoundingBox } from '@math.gl/culling';
|
|
|
24
24
|
* @param metadataClass `- user selected feature metadata class name`
|
|
25
25
|
* @returns Array of node resources to create one or more i3s nodes
|
|
26
26
|
*/
|
|
27
|
-
export default function convertB3dmToI3sGeometry(tileContent
|
|
27
|
+
export default function convertB3dmToI3sGeometry({ tileContent, tileTransform, tileBoundingVolume, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, libraries, metadataClass }: {
|
|
28
|
+
tileContent: Tiles3DTileContent;
|
|
29
|
+
tileTransform: Matrix4;
|
|
30
|
+
tileBoundingVolume: OrientedBoundingBox | BoundingSphere;
|
|
31
|
+
addNodeToNodePage: () => Promise<number>;
|
|
32
|
+
propertyTable: FeatureTableJson | null;
|
|
33
|
+
featuresHashArray: string[];
|
|
34
|
+
attributeStorageInfo: AttributeStorageInfo[] | undefined;
|
|
35
|
+
draco: boolean;
|
|
36
|
+
generateBoundingVolumes: boolean;
|
|
37
|
+
shouldMergeMaterials: boolean;
|
|
38
|
+
geoidHeightModel: Geoid;
|
|
39
|
+
libraries: Record<string, string>;
|
|
40
|
+
metadataClass?: string;
|
|
41
|
+
}): Promise<I3SConvertedResources[] | null>;
|
|
28
42
|
/**
|
|
29
43
|
* Convert attributes from the gltf nodes tree to i3s plain geometry
|
|
30
44
|
* @param attributesData - geometry attributes from gltf
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry-converter.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/geometry-converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geometry-converter.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/geometry-converter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAgB/E,OAAO,EAAU,OAAO,EAAU,MAAM,eAAe,CAAC;AAUxD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EAGvB,oBAAiB;AAClB,OAAO,EACL,oBAAoB,EAIrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAWrC,OAAO,KAA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,kBAAkB,GAAG,IAAI,EACtC,aAAa,CAAC,EAAE,MAAM,GACrB,gBAAgB,GAAG,IAAI,CA+BzB"}
|
|
@@ -49,7 +49,7 @@ let scratchVector = new Vector3();
|
|
|
49
49
|
* @param metadataClass `- user selected feature metadata class name`
|
|
50
50
|
* @returns Array of node resources to create one or more i3s nodes
|
|
51
51
|
*/
|
|
52
|
-
export default async function convertB3dmToI3sGeometry(tileContent, tileTransform, tileBoundingVolume, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, libraries, metadataClass) {
|
|
52
|
+
export default async function convertB3dmToI3sGeometry({ tileContent, tileTransform, tileBoundingVolume, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, libraries, metadataClass }) {
|
|
53
53
|
const useCartesianPositions = generateBoundingVolumes;
|
|
54
54
|
const materialAndTextureList = await convertMaterials(tileContent.gltf?.materials, shouldMergeMaterials);
|
|
55
55
|
const dataForAttributesConversion = prepareDataForAttributesConversion(tileContent, tileTransform, tileBoundingVolume);
|
|
@@ -74,7 +74,7 @@ export default async function convertB3dmToI3sGeometry(tileContent, tileTransfor
|
|
|
74
74
|
}
|
|
75
75
|
const convertedAttributes = convertedAttributesMap.get(originarMaterialId);
|
|
76
76
|
if (!convertedAttributes) {
|
|
77
|
-
continue;
|
|
77
|
+
continue; // eslint-disable-line no-continue
|
|
78
78
|
}
|
|
79
79
|
const { material, texture } = materialAndTexture;
|
|
80
80
|
const nodeId = await addNodeToNodePage();
|
|
@@ -148,6 +148,7 @@ async function _makeNodeResources({ convertedAttributes, material, texture, tile
|
|
|
148
148
|
const typedFeatureIds = generateBigUint64Array(featureIds);
|
|
149
149
|
header.set([vertexCount, featureCount], 0);
|
|
150
150
|
const fileBuffer = new Uint8Array(concatenateArrayBuffers(header.buffer, positions.buffer, normals.buffer, texture ? texCoords.buffer : new ArrayBuffer(0), colors.buffer, uvRegions, typedFeatureIds.buffer, faceRange.buffer));
|
|
151
|
+
// prettier-ignore
|
|
151
152
|
const compressedGeometry = draco
|
|
152
153
|
? generateCompressedGeometry(vertexCount, convertedAttributes, {
|
|
153
154
|
positions,
|
|
@@ -205,11 +206,19 @@ export async function convertAttributes(attributesData, materialAndTextureList,
|
|
|
205
206
|
attributesMap.set(mergedMaterial.originalMaterialId, attributes);
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
|
-
convertNodes(
|
|
209
|
+
convertNodes({
|
|
210
|
+
nodes,
|
|
211
|
+
images,
|
|
212
|
+
cartographicOrigin,
|
|
213
|
+
cartesianModelMatrix,
|
|
214
|
+
attributesMap,
|
|
215
|
+
useCartesianPositions,
|
|
216
|
+
featureTexture
|
|
217
|
+
});
|
|
209
218
|
for (const attrKey of attributesMap.keys()) {
|
|
210
219
|
const attributes = attributesMap.get(attrKey);
|
|
211
220
|
if (!attributes) {
|
|
212
|
-
continue;
|
|
221
|
+
continue; // eslint-disable-line no-continue
|
|
213
222
|
}
|
|
214
223
|
if (attributes.positions.length === 0) {
|
|
215
224
|
attributesMap.delete(attrKey);
|
|
@@ -236,10 +245,19 @@ export async function convertAttributes(attributesData, materialAndTextureList,
|
|
|
236
245
|
* @param featureTexture - feature texture key
|
|
237
246
|
* @returns {void}
|
|
238
247
|
*/
|
|
239
|
-
function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), featureTexture) {
|
|
248
|
+
function convertNodes({ nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), featureTexture }) {
|
|
240
249
|
if (nodes) {
|
|
241
250
|
for (const node of nodes) {
|
|
242
|
-
convertNode(
|
|
251
|
+
convertNode({
|
|
252
|
+
node,
|
|
253
|
+
images,
|
|
254
|
+
cartographicOrigin,
|
|
255
|
+
cartesianModelMatrix,
|
|
256
|
+
attributesMap,
|
|
257
|
+
useCartesianPositions,
|
|
258
|
+
matrix,
|
|
259
|
+
featureTexture
|
|
260
|
+
});
|
|
243
261
|
}
|
|
244
262
|
}
|
|
245
263
|
}
|
|
@@ -279,13 +297,31 @@ function getCompositeTransformationMatrix(node, matrix) {
|
|
|
279
297
|
* @param matrix - transformation matrix - cumulative transformation matrix formed from all parent node matrices
|
|
280
298
|
* @param featureTexture - feature texture key
|
|
281
299
|
*/
|
|
282
|
-
function convertNode(node, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), featureTexture) {
|
|
300
|
+
function convertNode({ node, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), featureTexture }) {
|
|
283
301
|
const transformationMatrix = getCompositeTransformationMatrix(node, matrix);
|
|
284
302
|
const mesh = node.mesh;
|
|
285
303
|
if (mesh) {
|
|
286
|
-
convertMesh(
|
|
304
|
+
convertMesh({
|
|
305
|
+
mesh,
|
|
306
|
+
images,
|
|
307
|
+
cartographicOrigin,
|
|
308
|
+
cartesianModelMatrix,
|
|
309
|
+
attributesMap,
|
|
310
|
+
useCartesianPositions,
|
|
311
|
+
matrix: transformationMatrix,
|
|
312
|
+
featureTexture
|
|
313
|
+
});
|
|
287
314
|
}
|
|
288
|
-
convertNodes(
|
|
315
|
+
convertNodes({
|
|
316
|
+
nodes: node.children || [],
|
|
317
|
+
images,
|
|
318
|
+
cartographicOrigin,
|
|
319
|
+
cartesianModelMatrix,
|
|
320
|
+
attributesMap,
|
|
321
|
+
useCartesianPositions,
|
|
322
|
+
matrix: transformationMatrix,
|
|
323
|
+
featureTexture
|
|
324
|
+
});
|
|
289
325
|
}
|
|
290
326
|
/**
|
|
291
327
|
* Convert all primitives of the mesh
|
|
@@ -302,7 +338,7 @@ function convertNode(node, images, cartographicOrigin, cartesianModelMatrix, att
|
|
|
302
338
|
* @param matrix - transformation matrix - cumulative transformation matrix formed from all parent node matrices
|
|
303
339
|
* @param featureTexture - feature texture key
|
|
304
340
|
*/
|
|
305
|
-
function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions = false, matrix
|
|
341
|
+
function convertMesh({ mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions = false, matrix, featureTexture }) {
|
|
306
342
|
for (const primitive of mesh.primitives) {
|
|
307
343
|
let outputAttributes = null;
|
|
308
344
|
let materialUvRegion;
|
|
@@ -321,7 +357,7 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
|
|
|
321
357
|
primitive.mode === GL.TRIANGLE_STRIP, `Primitive - unsupported mode ${primitive.mode}`);
|
|
322
358
|
const attributes = primitive.attributes;
|
|
323
359
|
if (!outputAttributes) {
|
|
324
|
-
continue;
|
|
360
|
+
continue; // eslint-disable-line no-continue
|
|
325
361
|
}
|
|
326
362
|
const indices = normalizeIndices(primitive);
|
|
327
363
|
outputAttributes.positions = concatenateTypedArrays(outputAttributes.positions, transformVertexArray({
|
|
@@ -581,6 +617,7 @@ async function convertMaterials(sourceMaterials = [], shouldMergeMaterials) {
|
|
|
581
617
|
* @param materials materials array
|
|
582
618
|
* @returns merged materials array
|
|
583
619
|
*/
|
|
620
|
+
// eslint-disable-next-line max-statements, complexity
|
|
584
621
|
async function mergeAllMaterials(materials) {
|
|
585
622
|
const result = [];
|
|
586
623
|
while (materials.length > 0) {
|
|
@@ -654,6 +691,7 @@ async function mergeMaterials(material1, material2) {
|
|
|
654
691
|
.toBuffer();
|
|
655
692
|
}
|
|
656
693
|
catch (error) {
|
|
694
|
+
// eslint-disable-next-line no-console
|
|
657
695
|
console.log('Join images into a texture atlas has failed. Consider usage `--split-nodes` option. (See documentation https://loaders.gl/modules/tile-converter/docs/cli-reference/tile-converter)');
|
|
658
696
|
throw error;
|
|
659
697
|
}
|
|
@@ -695,7 +733,7 @@ function convertMaterial(sourceMaterial) {
|
|
|
695
733
|
};
|
|
696
734
|
}
|
|
697
735
|
sourceMaterial.id = Number.isFinite(sourceMaterial.id) ? sourceMaterial.id : uuidv4();
|
|
698
|
-
|
|
736
|
+
const mergedMaterials = [{ originalMaterialId: sourceMaterial.id }];
|
|
699
737
|
if (!texture) {
|
|
700
738
|
// Should use default baseColorFactor if it is not present in source material
|
|
701
739
|
// https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-pbrmetallicroughness
|
|
@@ -996,10 +1034,12 @@ function generateAttributeBuffer(type, value) {
|
|
|
996
1034
|
function getAttributeType(key, attributeStorageInfo) {
|
|
997
1035
|
const attribute = attributeStorageInfo.find((attr) => attr.name === key);
|
|
998
1036
|
if (!attribute) {
|
|
1037
|
+
// eslint-disable-next-line no-console
|
|
999
1038
|
console.error(`attribute is null, key=${key}, attributeStorageInfo=${JSON.stringify(attributeStorageInfo, null, 2)}`);
|
|
1000
1039
|
return '';
|
|
1001
1040
|
}
|
|
1002
1041
|
if (!attribute.attributeValues) {
|
|
1042
|
+
// eslint-disable-next-line no-console
|
|
1003
1043
|
console.error(`attributeValues is null, attribute=${attribute}`);
|
|
1004
1044
|
return '';
|
|
1005
1045
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/gltf-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAC,OAAO,EAAc,OAAO,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAC,kBAAkB,EAAC,oBAAiB;AAE5C;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAChD,WAAW,EAAE,kBAAkB,EAC/B,aAAa,EAAE,OAAO,EACtB,cAAc,EAAE,mBAAmB,GAAG,cAAc,GACnD,kBAAkB,
|
|
1
|
+
{"version":3,"file":"gltf-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/gltf-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAC,OAAO,EAAc,OAAO,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAC,kBAAkB,EAAC,oBAAiB;AAE5C;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAChD,WAAW,EAAE,kBAAkB,EAC/B,aAAa,EAAE,OAAO,EACtB,cAAc,EAAE,mBAAmB,GAAG,cAAc,GACnD,kBAAkB,CAwCpB;AAqBD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,kBAAkB,EAC/B,aAAa,EAAE,OAAO,EACtB,cAAc,EAAE,mBAAmB,GAAG,cAAc,GACnD;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,kBAAkB,EAAE,OAAO,CAAA;CAAC,CAkCrD"}
|
|
@@ -9,7 +9,7 @@ import { Ellipsoid } from '@math.gl/geospatial';
|
|
|
9
9
|
* @returns 3DTiles content data, prepared for conversion
|
|
10
10
|
*/
|
|
11
11
|
export function prepareDataForAttributesConversion(tileContent, tileTransform, boundingVolume) {
|
|
12
|
-
|
|
12
|
+
const nodes = tileContent.gltf?.scene?.nodes ||
|
|
13
13
|
tileContent.gltf?.scenes?.[0]?.nodes ||
|
|
14
14
|
tileContent.gltf?.nodes ||
|
|
15
15
|
[];
|
|
@@ -18,19 +18,17 @@ export function prepareDataForAttributesConversion(tileContent, tileTransform, b
|
|
|
18
18
|
if (imageObject?.image?.compressed) {
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
}
|
|
21
|
+
const data = imageObject?.image?.data;
|
|
22
|
+
const dataCopy = new Uint8Array(data.length);
|
|
23
|
+
dataCopy.set(data);
|
|
24
|
+
return {
|
|
25
|
+
data: dataCopy,
|
|
26
|
+
compressed: false,
|
|
27
|
+
height: imageObject.image.height,
|
|
28
|
+
width: imageObject.image.width,
|
|
29
|
+
components: imageObject.image.components,
|
|
30
|
+
mimeType: imageObject.mimeType
|
|
31
|
+
};
|
|
34
32
|
}) || [];
|
|
35
33
|
prepareNodes(nodes);
|
|
36
34
|
const { cartographicOrigin, modelMatrix: cartesianModelMatrix } = calculateTransformProps(tileContent, tileTransform, boundingVolume);
|
|
@@ -81,7 +81,14 @@ export declare class NodeIndexDocument {
|
|
|
81
81
|
* @param converter - I3SConverter instance
|
|
82
82
|
* @returns NodeIndexDocument instance
|
|
83
83
|
*/
|
|
84
|
-
static createNode(parentNode
|
|
84
|
+
static createNode({ parentNode, boundingVolumes, lodSelection, nodeInPage, resources, converter }: {
|
|
85
|
+
parentNode: NodeIndexDocument;
|
|
86
|
+
boundingVolumes: BoundingVolumes;
|
|
87
|
+
lodSelection: LodSelection[];
|
|
88
|
+
nodeInPage: NodeInPage;
|
|
89
|
+
resources: I3SConvertedResources;
|
|
90
|
+
converter: I3SConverter;
|
|
91
|
+
}): Promise<NodeIndexDocument>;
|
|
85
92
|
/**
|
|
86
93
|
* Form 3DNodeIndexDocument data for the root node
|
|
87
94
|
* @param boundingVolumes - mbs and obb data about node's bounding volume
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-index-document.d.ts","sourceRoot":"","sources":["../../../src/i3s-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+
{"version":3,"file":"node-index-document.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-index-document.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,UAAU,EAEX,MAAM,iBAAiB,CAAC;AAIzB,OAAO,YAAY,4BAAyB;AAE5C,OAAO,EAAC,qBAAqB,EAAC,oBAAiB;AAC/C,OAAO,EAAC,YAAY,EAAC,2CAAwC;AAE7D;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B,cAAc;IACP,EAAE,EAAE,MAAM,CAAC;IAClB,uBAAuB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACxB,+BAA+B;IACxB,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAAQ;IAC/C,eAAe;IACR,QAAQ,EAAE,iBAAiB,EAAE,CAAM;IAC1C,yBAAyB;IACzB,OAAO,CAAC,SAAS,CAAe;IAEhC;;;OAGG;IACH,OAAO,CAAC,UAAU,CAAkB;IACpC,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;;;OAIG;gBACS,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY;IAM/C;;;;OAIG;IACU,OAAO,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAS3E;;;OAGG;IACU,WAAW,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BxE;;OAEG;IACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAmC1C,+CAA+C;IAClC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAMlC,wBAAwB;IACxB,OAAO,CAAC,QAAQ;IAOhB;;;OAGG;YACW,KAAK;IAyBnB;;;OAGG;YACW,IAAI;IAalB;;OAEG;IACH,OAAO,CAAC,KAAK;IAIb;;;;;OAKG;WACU,cAAc,CACzB,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,iBAAiB,CAAC;IAM7B;;;;;;;;;OASG;WACU,UAAU,CAAC,EACtB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,UAAU,EACV,SAAS,EACT,SAAS,EACV,EAAE;QACD,UAAU,EAAE,iBAAiB,CAAC;QAC9B,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,EAAE,CAAC;QAC7B,UAAU,EAAE,UAAU,CAAC;QACvB,SAAS,EAAE,qBAAqB,CAAC;QACjC,SAAS,EAAE,YAAY,CAAC;KACzB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAY9B;;;;OAIG;IACH,MAAM,CAAC,2BAA2B,CAAC,eAAe,EAAE,eAAe,GAAG,mBAAmB;IAqBzF;;;;;;;;;;OAUG;WAEU,uBAAuB,CAClC,UAAU,EAAE,iBAAiB,EAC7B,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAAE,EAC5B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,qBAAqB,GAAG,YAAY,GAC9C,OAAO,CAAC,mBAAmB,CAAC;CAyDhC"}
|
|
@@ -10,6 +10,21 @@ import { NODE as nodeTemplate } from "../json-templates/node.js";
|
|
|
10
10
|
* on disk: the data is written on disk in a file. The file can be rewritten when new childrend or neighbors have to be added
|
|
11
11
|
*/
|
|
12
12
|
export class NodeIndexDocument {
|
|
13
|
+
/** Node id */
|
|
14
|
+
id;
|
|
15
|
+
/** Id in node pages */
|
|
16
|
+
inPageId;
|
|
17
|
+
/** 3DNodeIndexDocument data */
|
|
18
|
+
data = null;
|
|
19
|
+
/** children */
|
|
20
|
+
children = [];
|
|
21
|
+
/** converter instance */
|
|
22
|
+
converter;
|
|
23
|
+
/**
|
|
24
|
+
* Finalized property. It means that all child nodes are saved and their data
|
|
25
|
+
* is unloaded
|
|
26
|
+
*/
|
|
27
|
+
_finalized = false;
|
|
13
28
|
get finalized() {
|
|
14
29
|
return this._finalized;
|
|
15
30
|
}
|
|
@@ -19,15 +34,6 @@ export class NodeIndexDocument {
|
|
|
19
34
|
* @param converter - converter instance
|
|
20
35
|
*/
|
|
21
36
|
constructor(id, converter) {
|
|
22
|
-
/** 3DNodeIndexDocument data */
|
|
23
|
-
this.data = null;
|
|
24
|
-
/** children */
|
|
25
|
-
this.children = [];
|
|
26
|
-
/**
|
|
27
|
-
* Finalized property. It means that all child nodes are saved and their data
|
|
28
|
-
* is unloaded
|
|
29
|
-
*/
|
|
30
|
-
this._finalized = false;
|
|
31
37
|
this.inPageId = id;
|
|
32
38
|
this.id = id === 0 ? 'root' : id.toString();
|
|
33
39
|
this.converter = converter;
|
|
@@ -64,7 +70,7 @@ export class NodeIndexDocument {
|
|
|
64
70
|
this.children = this.children.concat(childNodes);
|
|
65
71
|
let data = this.data;
|
|
66
72
|
if (this.converter.options.instantNodeWriting) {
|
|
67
|
-
data =
|
|
73
|
+
data = await this.load();
|
|
68
74
|
}
|
|
69
75
|
if (data) {
|
|
70
76
|
data.children = data.children ?? [];
|
|
@@ -179,7 +185,7 @@ export class NodeIndexDocument {
|
|
|
179
185
|
* @param converter - I3SConverter instance
|
|
180
186
|
* @returns NodeIndexDocument instance
|
|
181
187
|
*/
|
|
182
|
-
static async createNode(parentNode, boundingVolumes, lodSelection, nodeInPage, resources, converter) {
|
|
188
|
+
static async createNode({ parentNode, boundingVolumes, lodSelection, nodeInPage, resources, converter }) {
|
|
183
189
|
const data = await NodeIndexDocument.createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources);
|
|
184
190
|
const node = await new NodeIndexDocument(nodeInPage.index, converter).addData(data);
|
|
185
191
|
return node;
|
|
@@ -220,6 +226,7 @@ export class NodeIndexDocument {
|
|
|
220
226
|
* @param resources.attributes - feature attributes
|
|
221
227
|
* @return 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object
|
|
222
228
|
*/
|
|
229
|
+
// eslint-disable-next-line complexity
|
|
223
230
|
static async createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources) {
|
|
224
231
|
const nodeId = nodeInPage.index;
|
|
225
232
|
const parentNodeData = await parentNode.load();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-pages.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-pages.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAE3C,OAAO,YAAY,4BAAyB;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,CAAC,GAAG,IAAI,OAAA,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAC/C,SAAS,EAAE,YAAY,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE;QAAC,KAAK,EAAE,UAAU,EAAE,CAAA;KAAC,EAAE,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAK;IAE5B;;;;;OAKG;gBACS,aAAa,KAAA,EAAE,YAAY,KAAA,EAAE,SAAS,EAAE,YAAY;IAWhE;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,OAAA,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,IAAI;IAIjE;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;;;OAIG;YACW,YAAY;
|
|
1
|
+
{"version":3,"file":"node-pages.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-pages.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAE3C,OAAO,YAAY,4BAAyB;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS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,IAAI;IAMnD;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU;IAMhE;;;;OAIG;IACH,MAAM,CAAC,sBAAsB,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAUzE;;;;OAIG;IACH,MAAM,CAAC,yBAAyB,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAO7E;;;OAGG;IACH,MAAM,CAAC,2BAA2B,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAO1D;;;;OAIG;IACH,MAAM,CAAC,0BAA0B,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAO/E;;;;OAIG;IACH,MAAM,CAAC,4BAA4B,CAAC,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI;CAMpF"}
|
|
@@ -35,6 +35,12 @@ import { isFileExists, openJson } from "../../lib/utils/file-utils.js";
|
|
|
35
35
|
* await this.nodePages.save(layers0path);
|
|
36
36
|
*/
|
|
37
37
|
export default class NodePages {
|
|
38
|
+
nodesPerPage;
|
|
39
|
+
nodesCounter;
|
|
40
|
+
writeFile;
|
|
41
|
+
converter;
|
|
42
|
+
nodePages;
|
|
43
|
+
length = 0;
|
|
38
44
|
/**
|
|
39
45
|
* @constructs
|
|
40
46
|
* Create a nodePages instance.
|
|
@@ -42,7 +48,6 @@ export default class NodePages {
|
|
|
42
48
|
* @param nodesPerPage - length limit for one nodePage. An additional nodePage is created when this limit is met
|
|
43
49
|
*/
|
|
44
50
|
constructor(writeFileFunc, nodesPerPage, converter) {
|
|
45
|
-
this.length = 0;
|
|
46
51
|
this.nodesPerPage = nodesPerPage;
|
|
47
52
|
this.nodesCounter = 0;
|
|
48
53
|
// @ts-expect-error
|
|
@@ -89,9 +94,7 @@ export default class NodePages {
|
|
|
89
94
|
console.log(`load ${fullName}.`); // eslint-disable-line
|
|
90
95
|
return (await openJson(filePath, fileName));
|
|
91
96
|
}
|
|
92
|
-
|
|
93
|
-
return { nodes: [] };
|
|
94
|
-
}
|
|
97
|
+
return { nodes: [] };
|
|
95
98
|
}
|
|
96
99
|
/**
|
|
97
100
|
* Get nodepage id by node id
|
|
@@ -165,29 +168,27 @@ export default class NodePages {
|
|
|
165
168
|
if (!this.converter.options.instantNodeWriting) {
|
|
166
169
|
return;
|
|
167
170
|
}
|
|
171
|
+
const nodePageIndex = this.getPageIndexByNodeId(node.index);
|
|
172
|
+
const nodePage = await this.getPageByNodeId(node.index);
|
|
173
|
+
const { filePath, fileName } = this.getNodePageFileName(nodePageIndex);
|
|
174
|
+
const nodeToUpdate = await this.getNodeById(node.index, nodePage);
|
|
175
|
+
if (nodeToUpdate) {
|
|
176
|
+
NodePages.updateAll(nodeToUpdate, node);
|
|
177
|
+
}
|
|
168
178
|
else {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
archiveKey: `nodePages/${nodePageIndex.toString()}.json.gz`,
|
|
183
|
-
writePromise: () => this.writeFile(filePath, nodePageStr, fileName, true, this.converter.compressList)
|
|
184
|
-
}, true);
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
await this.converter.writeQueue.enqueue({
|
|
188
|
-
writePromise: () => this.writeFile(filePath, nodePageStr)
|
|
189
|
-
}, true);
|
|
190
|
-
}
|
|
179
|
+
nodePage.nodes.push(node);
|
|
180
|
+
}
|
|
181
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
182
|
+
if (this.converter.options.slpk) {
|
|
183
|
+
await this.converter.writeQueue.enqueue({
|
|
184
|
+
archiveKey: `nodePages/${nodePageIndex.toString()}.json.gz`,
|
|
185
|
+
writePromise: () => this.writeFile(filePath, nodePageStr, fileName, true, this.converter.compressList)
|
|
186
|
+
}, true);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
await this.converter.writeQueue.enqueue({
|
|
190
|
+
writePromise: () => this.writeFile(filePath, nodePageStr)
|
|
191
|
+
}, true);
|
|
191
192
|
}
|
|
192
193
|
}
|
|
193
194
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preprocess-3d-tiles.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/preprocess-3d-tiles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"preprocess-3d-tiles.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/preprocess-3d-tiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAC,uBAAuB,EAAE,cAAc,EAAC,oBAAiB;AAWjE;;;GAGG;AACH,eAAO,MAAM,oBAAoB,2BAQhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,gBAChB,kBAAkB,GAAG,IAAI,KACrC,QAAQ,cAAc,CAuBxB,CAAC;AAwDF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,YAAa,cAAc,WAAW,cAAc,KAAG,IAUtF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/progress.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,qBAAa,QAAQ;IACnB,oFAAoF;IACpF,OAAO,CAAC,WAAW,CAAa;IAChC,kCAAkC;IAClC,OAAO,CAAC,UAAU,CAAa;IAC/B,qDAAqD;IACrD,OAAO,CAAC,SAAS,CAAa;IAC9B,qDAAqD;IACrD,OAAO,CAAC,QAAQ,CAAa;IAC7B,uDAAuD;IACvD,OAAO,CAAC,uBAAuB,CAAa;IAC5C,yDAAyD;IACzD,OAAO,CAAC,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