@loaders.gl/tile-converter 3.3.0-alpha.3 → 3.3.0-alpha.4
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.js +1 -1
- 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/converter.min.js +21 -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 +21 -1
- package/dist/dist.min.js +660 -1016
- package/dist/es5/3d-tiles-attributes-worker.js +1 -1
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +115 -101
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +70 -6
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +1 -1
- package/dist/es5/i3s-attributes-worker.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +4 -0
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +153 -0
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +40 -44
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +55 -36
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-pages.js +10 -2
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +364 -435
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +59 -44
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +21 -2
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -1
- package/dist/esm/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +4 -0
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +138 -0
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +19 -21
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +55 -36
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-pages.js +9 -2
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +93 -183
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/i3s-attributes-worker.d.ts +5 -1
- package/dist/i3s-attributes-worker.d.ts.map +1 -1
- package/dist/i3s-attributes-worker.js +3 -3
- package/dist/i3s-attributes-worker.js.map +2 -2
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +2 -3
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +3 -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 +32 -0
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.js +162 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +5 -4
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +29 -27
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +50 -30
- package/dist/i3s-converter/helpers/node-pages.d.ts +4 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +9 -2
- package/dist/i3s-converter/i3s-converter.d.ts +24 -48
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +88 -186
- package/dist/i3s-converter/types.d.ts +4 -0
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/3d-tiles-converter/3d-tiles-converter.ts +71 -55
- package/src/deps-installer/deps-installer.ts +29 -2
- package/src/i3s-attributes-worker.ts +5 -1
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +13 -6
- package/src/i3s-converter/helpers/coordinate-converter.ts +2 -2
- package/src/i3s-converter/helpers/feature-attributes.ts +182 -0
- package/src/i3s-converter/helpers/geometry-converter.ts +45 -36
- package/src/i3s-converter/helpers/gltf-attributes.ts +54 -33
- package/src/i3s-converter/helpers/node-pages.ts +10 -2
- package/src/i3s-converter/i3s-converter.ts +125 -210
- package/src/i3s-converter/types.ts +4 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { Image, MeshPrimitive } from 'modules/gltf/src/lib/types/gltf-postprocessed-schema';
|
|
1
|
+
import { GLTFAccessorPostprocessed, GLTFImagePostprocessed, GLTFMeshPrimitivePostprocessed } from '@loaders.gl/gltf';
|
|
3
2
|
/**
|
|
4
3
|
* Getting batchIds from 3DTilesNext extensions.
|
|
5
4
|
* @param attributes
|
|
@@ -8,5 +7,5 @@ import type { Image, MeshPrimitive } from 'modules/gltf/src/lib/types/gltf-postp
|
|
|
8
7
|
*/
|
|
9
8
|
export declare function handleBatchIdsExtensions(attributes: {
|
|
10
9
|
[key: string]: GLTFAccessorPostprocessed;
|
|
11
|
-
}, primitive:
|
|
10
|
+
}, primitive: GLTFMeshPrimitivePostprocessed, images: GLTFImagePostprocessed[]): number[];
|
|
12
11
|
//# sourceMappingURL=batch-ids-extensions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-ids-extensions.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/batch-ids-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"batch-ids-extensions.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/batch-ids-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,8BAA8B,EAC/B,MAAM,kBAAkB,CAAC;AAS1B;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE;IACV,CAAC,GAAG,EAAE,MAAM,GAAG,yBAAyB,CAAC;CAC1C,EACD,SAAS,EAAE,8BAA8B,EACzC,MAAM,EAAE,sBAAsB,EAAE,GAC/B,MAAM,EAAE,CAwBV"}
|
|
@@ -98,6 +98,9 @@ function generateImplicitFeatureIds(featuresCount, constant = 0, divisor = 0) {
|
|
|
98
98
|
* @param featureIdTextures
|
|
99
99
|
*/
|
|
100
100
|
function generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, images) {
|
|
101
|
+
if (!images?.length) {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
101
104
|
const CHANNELS_MAP = {
|
|
102
105
|
r: 0,
|
|
103
106
|
g: 1,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BoundingVolumes, FullExtent, Mbs, Obb } from '@loaders.gl/i3s';
|
|
2
2
|
import { Vector3 } from '@math.gl/core';
|
|
3
3
|
import { OrientedBoundingBox, BoundingSphere } from '@math.gl/culling';
|
|
4
|
-
import
|
|
4
|
+
import { Tile3D } from '@loaders.gl/tiles';
|
|
5
5
|
import { Geoid } from '@math.gl/geoid';
|
|
6
6
|
/**
|
|
7
7
|
* Create bounding volumes object from tile and geoid height model.
|
|
@@ -9,7 +9,7 @@ import { Geoid } from '@math.gl/geoid';
|
|
|
9
9
|
* @param geoidHeightModel
|
|
10
10
|
* @returns - Bounding volumes object
|
|
11
11
|
*/
|
|
12
|
-
export declare function createBoundingVolumes(tile:
|
|
12
|
+
export declare function createBoundingVolumes(tile: Tile3D, geoidHeightModel: Geoid): BoundingVolumes;
|
|
13
13
|
/**
|
|
14
14
|
* Generates bounding volumes from geometry positions
|
|
15
15
|
* @param cartesianPositions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinate-converter.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/coordinate-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAE3E,OAAO,EAAsB,OAAO,EAAC,MAAM,eAAe,CAAC;AAE3D,OAAO,EACL,mBAAmB,EAGnB,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"coordinate-converter.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/coordinate-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAE3E,OAAO,EAAsB,OAAO,EAAC,MAAM,eAAe,CAAC;AAE3D,OAAO,EACL,mBAAmB,EAGnB,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAErC;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,GAAG,eAAe,CAiC5F;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAC/C,kBAAkB,EAAE,YAAY,EAChC,gBAAgB,EAAE,KAAK,GACtB;IAAC,GAAG,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAC,CAoBtB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,YAAY,GAAG,OAAO,EAAE,CAW5E;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,cAAc,EAAE,mBAAmB,GAAG,cAAc,GACnD,UAAU,CA0BZ;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAK9C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FeatureTableJson } from '@loaders.gl/3d-tiles';
|
|
2
|
+
import { Attribute, AttributeStorageInfo, ESRIField, Field, PopupInfo } from '@loaders.gl/i3s';
|
|
2
3
|
/**
|
|
3
4
|
* Takes attributes from property table based on featureIds.
|
|
4
5
|
* If there is no property value for particular featureId (index) the property will be null.
|
|
@@ -21,4 +22,35 @@ export declare function flattenPropertyTableByFeatureIds(featureIds: number[], p
|
|
|
21
22
|
* @returns
|
|
22
23
|
*/
|
|
23
24
|
export declare function checkPropertiesLength(featureIds: number[], propertyTable: FeatureTableJson): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Get the attribute type for attributeStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md
|
|
27
|
+
* @param key - attribute's key
|
|
28
|
+
* @param attribute - attribute's type in propertyTable
|
|
29
|
+
*/
|
|
30
|
+
export declare function getAttributeType(key: string, attribute: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Generate storage attribute for map segmentation.
|
|
33
|
+
* @param attributeIndex - order index of attribute (f_0, f_1 ...).
|
|
34
|
+
* @param key - attribute key from propertyTable.
|
|
35
|
+
* @param attributeType - attribute type.
|
|
36
|
+
* @return Updated storageAttribute.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createdStorageAttribute(attributeIndex: number, key: string, attributeType: Attribute): AttributeStorageInfo;
|
|
39
|
+
/**
|
|
40
|
+
* Find and return attribute type based on key form propertyTable.
|
|
41
|
+
* @param attributeType
|
|
42
|
+
*/
|
|
43
|
+
export declare function getFieldAttributeType(attributeType: Attribute): ESRIField;
|
|
44
|
+
/**
|
|
45
|
+
* Setup field attribute for map segmentation.
|
|
46
|
+
* @param key - attribute for map segmentation.
|
|
47
|
+
* @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').
|
|
48
|
+
*/
|
|
49
|
+
export declare function createFieldAttribute(key: string, fieldAttributeType: ESRIField): Field;
|
|
50
|
+
/**
|
|
51
|
+
* Generate popup info to show metadata on the map.
|
|
52
|
+
* @param propertyTable - table data with OBJECTID.
|
|
53
|
+
* @return data for correct rendering of popup.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createPopupInfo(propertyTable: FeatureTableJson): PopupInfo;
|
|
24
56
|
//# sourceMappingURL=feature-attributes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/feature-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"feature-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/feature-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,KAAK,EAEL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;GAYG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,MAAM,EAAE,EACpB,aAAa,EAAE,gBAAgB,GAC9B,gBAAgB,CAQlB;AAkBD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAAE,EACpB,aAAa,EAAE,gBAAgB,GAC9B,OAAO,CAUT;AAUD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAUvE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,SAAS,GACvB,oBAAoB,CA0BtB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,SAAS,GAAG,SAAS,CAazE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,SAAS,GAAG,KAAK,CAMtF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,gBAAgB,GAAG,SAAS,CA8B1E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkPropertiesLength = exports.flattenPropertyTableByFeatureIds = void 0;
|
|
3
|
+
exports.createPopupInfo = exports.createFieldAttribute = exports.getFieldAttributeType = exports.createdStorageAttribute = exports.getAttributeType = exports.checkPropertiesLength = exports.flattenPropertyTableByFeatureIds = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Takes attributes from property table based on featureIds.
|
|
6
6
|
* If there is no property value for particular featureId (index) the property will be null.
|
|
@@ -53,3 +53,164 @@ function checkPropertiesLength(featureIds, propertyTable) {
|
|
|
53
53
|
return needFlatten;
|
|
54
54
|
}
|
|
55
55
|
exports.checkPropertiesLength = checkPropertiesLength;
|
|
56
|
+
/** String data type name for feature attributes */
|
|
57
|
+
const STRING_TYPE = 'string';
|
|
58
|
+
/** Integer data type name for feature attributes */
|
|
59
|
+
const SHORT_INT_TYPE = 'Int32';
|
|
60
|
+
/** Double data type name for feature attributes */
|
|
61
|
+
const DOUBLE_TYPE = 'double';
|
|
62
|
+
/** Type of attribute that is linked with feature ids */
|
|
63
|
+
const OBJECT_ID_TYPE = 'OBJECTID';
|
|
64
|
+
/**
|
|
65
|
+
* Get the attribute type for attributeStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md
|
|
66
|
+
* @param key - attribute's key
|
|
67
|
+
* @param attribute - attribute's type in propertyTable
|
|
68
|
+
*/
|
|
69
|
+
function getAttributeType(key, attribute) {
|
|
70
|
+
if (key === OBJECT_ID_TYPE) {
|
|
71
|
+
return OBJECT_ID_TYPE;
|
|
72
|
+
}
|
|
73
|
+
if (typeof attribute === STRING_TYPE) {
|
|
74
|
+
return STRING_TYPE;
|
|
75
|
+
}
|
|
76
|
+
else if (typeof attribute === 'number') {
|
|
77
|
+
return Number.isInteger(attribute) ? SHORT_INT_TYPE : DOUBLE_TYPE;
|
|
78
|
+
}
|
|
79
|
+
return STRING_TYPE;
|
|
80
|
+
}
|
|
81
|
+
exports.getAttributeType = getAttributeType;
|
|
82
|
+
/**
|
|
83
|
+
* Generate storage attribute for map segmentation.
|
|
84
|
+
* @param attributeIndex - order index of attribute (f_0, f_1 ...).
|
|
85
|
+
* @param key - attribute key from propertyTable.
|
|
86
|
+
* @param attributeType - attribute type.
|
|
87
|
+
* @return Updated storageAttribute.
|
|
88
|
+
*/
|
|
89
|
+
function createdStorageAttribute(attributeIndex, key, attributeType) {
|
|
90
|
+
const storageAttribute = {
|
|
91
|
+
key: `f_${attributeIndex}`,
|
|
92
|
+
name: key,
|
|
93
|
+
ordering: ['attributeValues'],
|
|
94
|
+
header: [{ property: 'count', valueType: 'UInt32' }],
|
|
95
|
+
attributeValues: { valueType: 'Int32', valuesPerElement: 1 }
|
|
96
|
+
};
|
|
97
|
+
switch (attributeType) {
|
|
98
|
+
case OBJECT_ID_TYPE:
|
|
99
|
+
setupIdAttribute(storageAttribute);
|
|
100
|
+
break;
|
|
101
|
+
case STRING_TYPE:
|
|
102
|
+
setupStringAttribute(storageAttribute);
|
|
103
|
+
break;
|
|
104
|
+
case DOUBLE_TYPE:
|
|
105
|
+
setupDoubleAttribute(storageAttribute);
|
|
106
|
+
break;
|
|
107
|
+
case SHORT_INT_TYPE:
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
setupStringAttribute(storageAttribute);
|
|
111
|
+
}
|
|
112
|
+
return storageAttribute;
|
|
113
|
+
}
|
|
114
|
+
exports.createdStorageAttribute = createdStorageAttribute;
|
|
115
|
+
/**
|
|
116
|
+
* Find and return attribute type based on key form propertyTable.
|
|
117
|
+
* @param attributeType
|
|
118
|
+
*/
|
|
119
|
+
function getFieldAttributeType(attributeType) {
|
|
120
|
+
switch (attributeType) {
|
|
121
|
+
case OBJECT_ID_TYPE:
|
|
122
|
+
return 'esriFieldTypeOID';
|
|
123
|
+
case STRING_TYPE:
|
|
124
|
+
return 'esriFieldTypeString';
|
|
125
|
+
case SHORT_INT_TYPE:
|
|
126
|
+
return 'esriFieldTypeInteger';
|
|
127
|
+
case DOUBLE_TYPE:
|
|
128
|
+
return 'esriFieldTypeDouble';
|
|
129
|
+
default:
|
|
130
|
+
return 'esriFieldTypeString';
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.getFieldAttributeType = getFieldAttributeType;
|
|
134
|
+
/**
|
|
135
|
+
* Setup field attribute for map segmentation.
|
|
136
|
+
* @param key - attribute for map segmentation.
|
|
137
|
+
* @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').
|
|
138
|
+
*/
|
|
139
|
+
function createFieldAttribute(key, fieldAttributeType) {
|
|
140
|
+
return {
|
|
141
|
+
name: key,
|
|
142
|
+
type: fieldAttributeType,
|
|
143
|
+
alias: key
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
exports.createFieldAttribute = createFieldAttribute;
|
|
147
|
+
/**
|
|
148
|
+
* Generate popup info to show metadata on the map.
|
|
149
|
+
* @param propertyTable - table data with OBJECTID.
|
|
150
|
+
* @return data for correct rendering of popup.
|
|
151
|
+
*/
|
|
152
|
+
function createPopupInfo(propertyTable) {
|
|
153
|
+
const title = '{OBJECTID}';
|
|
154
|
+
const mediaInfos = [];
|
|
155
|
+
const fieldInfos = [];
|
|
156
|
+
const popupElements = [];
|
|
157
|
+
const expressionInfos = [];
|
|
158
|
+
for (const key in propertyTable) {
|
|
159
|
+
fieldInfos.push({
|
|
160
|
+
fieldName: key,
|
|
161
|
+
visible: true,
|
|
162
|
+
isEditable: false,
|
|
163
|
+
label: key
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
popupElements.push({
|
|
167
|
+
fieldInfos,
|
|
168
|
+
type: 'fields'
|
|
169
|
+
});
|
|
170
|
+
return {
|
|
171
|
+
title,
|
|
172
|
+
mediaInfos,
|
|
173
|
+
popupElements,
|
|
174
|
+
fieldInfos,
|
|
175
|
+
expressionInfos
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
exports.createPopupInfo = createPopupInfo;
|
|
179
|
+
/**
|
|
180
|
+
* Setup storage attribute as string.
|
|
181
|
+
* @param storageAttribute - attribute for map segmentation.
|
|
182
|
+
*/
|
|
183
|
+
function setupStringAttribute(storageAttribute) {
|
|
184
|
+
// @ts-expect-error
|
|
185
|
+
storageAttribute.ordering.unshift('attributeByteCounts');
|
|
186
|
+
storageAttribute.header.push({ property: 'attributeValuesByteCount', valueType: 'UInt32' });
|
|
187
|
+
storageAttribute.attributeValues = {
|
|
188
|
+
valueType: 'String',
|
|
189
|
+
encoding: 'UTF-8',
|
|
190
|
+
valuesPerElement: 1
|
|
191
|
+
};
|
|
192
|
+
storageAttribute.attributeByteCounts = {
|
|
193
|
+
valueType: 'UInt32',
|
|
194
|
+
valuesPerElement: 1
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Setup Id attribute for map segmentation.
|
|
199
|
+
* @param storageAttribute - attribute for map segmentation .
|
|
200
|
+
*/
|
|
201
|
+
function setupIdAttribute(storageAttribute) {
|
|
202
|
+
storageAttribute.attributeValues = {
|
|
203
|
+
valueType: 'Oid32',
|
|
204
|
+
valuesPerElement: 1
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Setup double attribute for map segmentation.
|
|
209
|
+
* @param storageAttribute - attribute for map segmentation .
|
|
210
|
+
*/
|
|
211
|
+
function setupDoubleAttribute(storageAttribute) {
|
|
212
|
+
storageAttribute.attributeValues = {
|
|
213
|
+
valueType: 'Float64',
|
|
214
|
+
valuesPerElement: 1
|
|
215
|
+
};
|
|
216
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { B3DMContent, FeatureTableJson } from '@loaders.gl/3d-tiles';
|
|
2
|
-
import { Tile3D } from '@loaders.gl/tiles';
|
|
3
2
|
import { ConvertedAttributes, I3SConvertedResources } from '../types';
|
|
4
3
|
import { AttributeStorageInfo } from '@loaders.gl/i3s';
|
|
5
4
|
import { Geoid } from '@math.gl/geoid';
|
|
5
|
+
/** Usage of worker here brings more overhead than advantage */
|
|
6
6
|
import { B3DMAttributesData } from '../../i3s-attributes-worker';
|
|
7
7
|
/**
|
|
8
8
|
* Convert binary data from b3dm file to i3s resources
|
|
9
9
|
*
|
|
10
10
|
* @param tileContent - 3d tile content
|
|
11
|
-
* @param
|
|
11
|
+
* @param addNodeToNodePage - function to add new node to node pages
|
|
12
12
|
* @param featuresHashArray - hash array of features that is needed to not to mix up same features in parent and child nodes
|
|
13
13
|
* @param attributeStorageInfo - attributes metadata from 3DSceneLayer json
|
|
14
14
|
* @param draco - is converter should create draco compressed geometry
|
|
@@ -16,7 +16,7 @@ import { B3DMAttributesData } from '../../i3s-attributes-worker';
|
|
|
16
16
|
* @param geoidHeightModel - model to convert elevation from elipsoidal to geoid
|
|
17
17
|
* @returns Array of node resources to create one or more i3s nodes
|
|
18
18
|
*/
|
|
19
|
-
export default function convertB3dmToI3sGeometry(tileContent: B3DMContent,
|
|
19
|
+
export default function convertB3dmToI3sGeometry(tileContent: B3DMContent, addNodeToNodePage: () => number, propertyTable: FeatureTableJson | null, featuresHashArray: string[], attributeStorageInfo: AttributeStorageInfo[] | undefined, draco: boolean, generateBoundingVolumes: boolean, geoidHeightModel: Geoid, workerSource: {
|
|
20
20
|
[key: string]: string;
|
|
21
21
|
}): Promise<I3SConvertedResources[] | null>;
|
|
22
22
|
/**
|
|
@@ -31,6 +31,7 @@ export declare function convertAttributes(attributesData: B3DMAttributesData, us
|
|
|
31
31
|
* Find property table in tile
|
|
32
32
|
* For example it can be batchTable for b3dm files or property table in gLTF extension.
|
|
33
33
|
* @param sourceTile
|
|
34
|
+
* @return batch table from b3dm / feature properties from EXT_FEATURE_METADATA
|
|
34
35
|
*/
|
|
35
|
-
export declare function getPropertyTable(
|
|
36
|
+
export declare function getPropertyTable(tileContent: B3DMContent): FeatureTableJson | null;
|
|
36
37
|
//# sourceMappingURL=geometry-converter.d.ts.map
|
|
@@ -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":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAqBxE,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EAGtB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,oBAAoB,EAIrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AACrC,+DAA+D;AAC/D,OAAO,EAAC,kBAAkB,EAAsC,MAAM,6BAA6B,CAAC;AA6BpG;;;;;;;;;;;GAWG;AACH,wBAA8B,wBAAwB,CACpD,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,MAAM,MAAM,EAC/B,aAAa,EAAE,gBAAgB,GAAG,IAAI,EACtC,iBAAiB,EAAE,MAAM,EAAE,EAC3B,oBAAoB,EAAE,oBAAoB,EAAE,GAAG,SAAS,EACxD,KAAK,EAAE,OAAO,EACd,uBAAuB,EAAE,OAAO,EAChC,gBAAgB,EAAE,KAAK,EACvB,YAAY,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,GACpC,OAAO,CAAC,qBAAqB,EAAE,GAAG,IAAI,CAAC,CAmEzC;AAwID;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,cAAc,EAAE,kBAAkB,EAClC,qBAAqB,EAAE,OAAO,GAC7B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CA2C3C;AA47BD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,gBAAgB,GAAG,IAAI,CAoBlF"}
|
|
@@ -38,7 +38,7 @@ let scratchVector = new core_1.Vector3();
|
|
|
38
38
|
* Convert binary data from b3dm file to i3s resources
|
|
39
39
|
*
|
|
40
40
|
* @param tileContent - 3d tile content
|
|
41
|
-
* @param
|
|
41
|
+
* @param addNodeToNodePage - function to add new node to node pages
|
|
42
42
|
* @param featuresHashArray - hash array of features that is needed to not to mix up same features in parent and child nodes
|
|
43
43
|
* @param attributeStorageInfo - attributes metadata from 3DSceneLayer json
|
|
44
44
|
* @param draco - is converter should create draco compressed geometry
|
|
@@ -46,19 +46,19 @@ let scratchVector = new core_1.Vector3();
|
|
|
46
46
|
* @param geoidHeightModel - model to convert elevation from elipsoidal to geoid
|
|
47
47
|
* @returns Array of node resources to create one or more i3s nodes
|
|
48
48
|
*/
|
|
49
|
-
async function convertB3dmToI3sGeometry(tileContent,
|
|
49
|
+
async function convertB3dmToI3sGeometry(tileContent, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, geoidHeightModel, workerSource) {
|
|
50
50
|
const useCartesianPositions = generateBoundingVolumes;
|
|
51
51
|
const materialAndTextureList = convertMaterials(tileContent.gltf?.materials);
|
|
52
52
|
const dataForAttributesConversion = (0, gltf_attributes_1.prepareDataForAttributesConversion)(tileContent);
|
|
53
53
|
const convertedAttributesMap = await convertAttributes(dataForAttributesConversion, useCartesianPositions);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
/** Usage of worker here brings more overhead than advantage */
|
|
55
|
+
// const convertedAttributesMap: Map<string, ConvertedAttributes> =
|
|
56
|
+
// await transformI3SAttributesOnWorker(dataForAttributesConversion, {
|
|
57
|
+
// reuseWorkers: true,
|
|
58
|
+
// _nodeWorkers: true,
|
|
59
|
+
// useCartesianPositions,
|
|
60
|
+
// source: workerSource.I3SAttributes
|
|
61
|
+
// });
|
|
62
62
|
if (generateBoundingVolumes) {
|
|
63
63
|
_generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel);
|
|
64
64
|
}
|
|
@@ -68,7 +68,6 @@ async function convertB3dmToI3sGeometry(tileContent, nodeId, propertyTable, feat
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
const result = [];
|
|
71
|
-
let nodesCounter = nodeId;
|
|
72
71
|
let { materials = [] } = tileContent.gltf || { materials: [] };
|
|
73
72
|
if (!materials?.length) {
|
|
74
73
|
materials.push({ id: 'default' });
|
|
@@ -83,19 +82,19 @@ async function convertB3dmToI3sGeometry(tileContent, nodeId, propertyTable, feat
|
|
|
83
82
|
continue;
|
|
84
83
|
}
|
|
85
84
|
const { material, texture } = materialAndTextureList[i];
|
|
85
|
+
const nodeId = addNodeToNodePage();
|
|
86
86
|
result.push(await _makeNodeResources({
|
|
87
87
|
convertedAttributes,
|
|
88
88
|
material,
|
|
89
89
|
texture,
|
|
90
90
|
tileContent,
|
|
91
|
-
nodeId
|
|
91
|
+
nodeId,
|
|
92
92
|
featuresHashArray,
|
|
93
93
|
propertyTable,
|
|
94
94
|
attributeStorageInfo,
|
|
95
95
|
draco,
|
|
96
96
|
workerSource
|
|
97
97
|
}));
|
|
98
|
-
nodesCounter++;
|
|
99
98
|
}
|
|
100
99
|
if (!result.length) {
|
|
101
100
|
return null;
|
|
@@ -162,6 +161,7 @@ async function _makeNodeResources({ convertedAttributes, material, texture, tile
|
|
|
162
161
|
attributes = convertPropertyTableToAttributeBuffers(featureIds, propertyTable, attributeStorageInfo);
|
|
163
162
|
}
|
|
164
163
|
return {
|
|
164
|
+
nodeId,
|
|
165
165
|
geometry: fileBuffer,
|
|
166
166
|
compressedGeometry,
|
|
167
167
|
texture,
|
|
@@ -181,7 +181,7 @@ async function _makeNodeResources({ convertedAttributes, material, texture, tile
|
|
|
181
181
|
* @returns map of converted geometry attributes
|
|
182
182
|
*/
|
|
183
183
|
async function convertAttributes(attributesData, useCartesianPositions) {
|
|
184
|
-
const { gltfMaterials, nodes, cartographicOrigin, cartesianModelMatrix } = attributesData;
|
|
184
|
+
const { gltfMaterials, nodes, images, cartographicOrigin, cartesianModelMatrix } = attributesData;
|
|
185
185
|
const attributesMap = new Map();
|
|
186
186
|
for (const material of gltfMaterials || [{ id: 'default' }]) {
|
|
187
187
|
attributesMap.set(material.id, {
|
|
@@ -194,7 +194,7 @@ async function convertAttributes(attributesData, useCartesianPositions) {
|
|
|
194
194
|
boundingVolumes: null
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
|
-
convertNodes(nodes, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions);
|
|
197
|
+
convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions);
|
|
198
198
|
for (const attrKey of attributesMap.keys()) {
|
|
199
199
|
const attributes = attributesMap.get(attrKey);
|
|
200
200
|
if (!attributes) {
|
|
@@ -216,6 +216,7 @@ exports.convertAttributes = convertAttributes;
|
|
|
216
216
|
* Gltf has hierarchical structure of nodes. This function converts nodes starting from those which are in gltf scene object.
|
|
217
217
|
* The goal is applying tranformation matrix for all children. Functions "convertNodes" and "convertNode" work together recursively.
|
|
218
218
|
* @param nodes - gltf nodes array
|
|
219
|
+
* @param images - gltf images array
|
|
219
220
|
* @param tileContent - 3d tile content
|
|
220
221
|
* @param attributesMap - for recursive concatenation of attributes
|
|
221
222
|
* @param useCartesianPositions - convert positions to absolute cartesian coordinates instead of cartographic offsets.
|
|
@@ -223,10 +224,10 @@ exports.convertAttributes = convertAttributes;
|
|
|
223
224
|
* @param matrix - transformation matrix - cumulative transformation matrix formed from all parent node matrices
|
|
224
225
|
* @returns {void}
|
|
225
226
|
*/
|
|
226
|
-
function convertNodes(nodes, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new core_1.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
|
|
227
|
+
function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new core_1.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
|
|
227
228
|
if (nodes) {
|
|
228
229
|
for (const node of nodes) {
|
|
229
|
-
convertNode(node, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix);
|
|
230
|
+
convertNode(node, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix);
|
|
230
231
|
}
|
|
231
232
|
}
|
|
232
233
|
}
|
|
@@ -256,6 +257,7 @@ function getCompositeTransformationMatrix(node, matrix) {
|
|
|
256
257
|
/**
|
|
257
258
|
* Convert all primitives of node and all children nodes
|
|
258
259
|
* @param node - gltf node
|
|
260
|
+
* @param images - gltf images array
|
|
259
261
|
* @param {Object} tileContent - 3d tile content
|
|
260
262
|
* @param {Map} attributesMap Map<{positions: Float32Array, normals: Float32Array, texCoords: Float32Array, colors: Uint8Array, featureIndices: Array}> - for recursive concatenation of
|
|
261
263
|
* attributes
|
|
@@ -263,14 +265,13 @@ function getCompositeTransformationMatrix(node, matrix) {
|
|
|
263
265
|
* Cartesian coordinates will be required for creating bounding voulmest from geometry positions
|
|
264
266
|
* @param {Matrix4} matrix - transformation matrix - cumulative transformation matrix formed from all parent node matrices
|
|
265
267
|
*/
|
|
266
|
-
function convertNode(node, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new core_1.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
|
|
268
|
+
function convertNode(node, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new core_1.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
|
|
267
269
|
const transformationMatrix = getCompositeTransformationMatrix(node, matrix);
|
|
268
270
|
const mesh = node.mesh;
|
|
269
|
-
const images = node.images;
|
|
270
271
|
if (mesh) {
|
|
271
272
|
convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
|
|
272
273
|
}
|
|
273
|
-
convertNodes(node.children || [], cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
|
|
274
|
+
convertNodes(node.children || [], images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
|
|
274
275
|
}
|
|
275
276
|
/**
|
|
276
277
|
* Convert all primitives of node and all children nodes
|
|
@@ -925,13 +926,14 @@ function generateFeatureIndexAttribute(featureIndex, faceRange) {
|
|
|
925
926
|
* Find property table in tile
|
|
926
927
|
* For example it can be batchTable for b3dm files or property table in gLTF extension.
|
|
927
928
|
* @param sourceTile
|
|
929
|
+
* @return batch table from b3dm / feature properties from EXT_FEATURE_METADATA
|
|
928
930
|
*/
|
|
929
|
-
function getPropertyTable(
|
|
930
|
-
const batchTableJson =
|
|
931
|
+
function getPropertyTable(tileContent) {
|
|
932
|
+
const batchTableJson = tileContent?.batchTableJson;
|
|
931
933
|
if (batchTableJson) {
|
|
932
934
|
return batchTableJson;
|
|
933
935
|
}
|
|
934
|
-
const { extensionName, extension } = getPropertyTableExtension(
|
|
936
|
+
const { extensionName, extension } = getPropertyTableExtension(tileContent);
|
|
935
937
|
switch (extensionName) {
|
|
936
938
|
case EXT_MESH_FEATURES: {
|
|
937
939
|
console.warn('The I3S converter does not yet support the EXT_mesh_features extension');
|
|
@@ -949,20 +951,20 @@ exports.getPropertyTable = getPropertyTable;
|
|
|
949
951
|
* Check extensions which can be with property table inside.
|
|
950
952
|
* @param sourceTile
|
|
951
953
|
*/
|
|
952
|
-
function getPropertyTableExtension(
|
|
954
|
+
function getPropertyTableExtension(tileContent) {
|
|
953
955
|
const extensionsWithPropertyTables = [EXT_FEATURE_METADATA, EXT_MESH_FEATURES];
|
|
954
|
-
const extensionsUsed =
|
|
956
|
+
const extensionsUsed = tileContent?.gltf?.extensionsUsed;
|
|
955
957
|
if (!extensionsUsed) {
|
|
956
958
|
return { extensionName: null, extension: null };
|
|
957
959
|
}
|
|
958
960
|
let extensionName = '';
|
|
959
|
-
for (const extensionItem of
|
|
961
|
+
for (const extensionItem of tileContent?.gltf?.extensionsUsed || []) {
|
|
960
962
|
if (extensionsWithPropertyTables.includes(extensionItem)) {
|
|
961
963
|
extensionName = extensionItem;
|
|
962
964
|
break;
|
|
963
965
|
}
|
|
964
966
|
}
|
|
965
|
-
const extension =
|
|
967
|
+
const extension = tileContent?.gltf?.extensions?.[extensionName];
|
|
966
968
|
return { extensionName, extension };
|
|
967
969
|
}
|
|
968
970
|
/**
|
|
@@ -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,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,
|
|
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,CA2C/F"}
|
|
@@ -27,43 +27,63 @@ function prepareDataForAttributesConversion(tileContent) {
|
|
|
27
27
|
[];
|
|
28
28
|
const images = tileContent.gltf?.images?.map((imageObject) => {
|
|
29
29
|
// Need data only for uncompressed images because we can't get batchIds from compressed textures.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
width: imageObject.image.width,
|
|
36
|
-
components: imageObject.image.components,
|
|
37
|
-
mimeType: imageObject.mimeType
|
|
38
|
-
};
|
|
39
|
-
}) || [];
|
|
40
|
-
const prepearedNodes = nodes.map((node) => {
|
|
41
|
-
if (!node.mesh) {
|
|
42
|
-
return node;
|
|
30
|
+
if (imageObject?.image?.compressed) {
|
|
31
|
+
return {
|
|
32
|
+
data: null,
|
|
33
|
+
compressed: true
|
|
34
|
+
};
|
|
43
35
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
36
|
+
else {
|
|
37
|
+
const data = imageObject?.image?.data;
|
|
38
|
+
const dataCopy = new Uint8Array(data.length);
|
|
39
|
+
dataCopy.set(data);
|
|
40
|
+
return {
|
|
41
|
+
data: dataCopy,
|
|
42
|
+
compressed: false,
|
|
43
|
+
height: imageObject.image.height,
|
|
44
|
+
width: imageObject.image.width,
|
|
45
|
+
components: imageObject.image.components,
|
|
46
|
+
mimeType: imageObject.mimeType
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}) || [];
|
|
50
|
+
prepareNodes(nodes);
|
|
60
51
|
const cartographicOrigin = tileContent.cartographicOrigin;
|
|
61
52
|
const cartesianModelMatrix = tileContent.cartesianModelMatrix;
|
|
62
53
|
return {
|
|
63
54
|
gltfMaterials,
|
|
64
|
-
nodes
|
|
55
|
+
nodes,
|
|
56
|
+
images,
|
|
65
57
|
cartographicOrigin,
|
|
66
58
|
cartesianModelMatrix
|
|
67
59
|
};
|
|
68
60
|
}
|
|
69
61
|
exports.prepareDataForAttributesConversion = prepareDataForAttributesConversion;
|
|
62
|
+
/**
|
|
63
|
+
* Traverse all nodes to replace all sensible data with copy to avoid data corruption in worker.
|
|
64
|
+
* @param nodes
|
|
65
|
+
*/
|
|
66
|
+
function prepareNodes(nodes) {
|
|
67
|
+
for (let index = 0; index < nodes.length; index++) {
|
|
68
|
+
const node = nodes[index];
|
|
69
|
+
if (node.mesh) {
|
|
70
|
+
nodes[index] = {
|
|
71
|
+
...node,
|
|
72
|
+
mesh: {
|
|
73
|
+
...node.mesh,
|
|
74
|
+
primitives: node.mesh?.primitives.map((primitive) => ({
|
|
75
|
+
...primitive,
|
|
76
|
+
indices: { value: primitive?.indices?.value },
|
|
77
|
+
attributes: getB3DMAttributesWithoutBufferView(primitive.attributes),
|
|
78
|
+
material: {
|
|
79
|
+
id: primitive?.material?.id
|
|
80
|
+
}
|
|
81
|
+
}))
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (node.children) {
|
|
86
|
+
prepareNodes(node.children);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -58,6 +58,10 @@ export default class NodePages {
|
|
|
58
58
|
* @return the node object
|
|
59
59
|
*/
|
|
60
60
|
getNodeById(id: number): NodeInPage;
|
|
61
|
+
/**
|
|
62
|
+
* Update all fields in the node excluding id
|
|
63
|
+
*/
|
|
64
|
+
updateAll(id: number, data: NodeInPage): void;
|
|
61
65
|
/**
|
|
62
66
|
* Update material in node.mesh object by node id
|
|
63
67
|
* @param id - end-to-end index of the node
|
|
@@ -1 +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"}
|
|
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;;OAEG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;IAK7C;;;;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"}
|