@loaders.gl/tile-converter 4.4.0-alpha.2 → 4.4.0-alpha.9
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/converter.min.cjs +89 -98
- package/dist/i3s-server/bin/i3s-server.min.cjs +78 -78
- package/package.json +16 -16
- package/src/3d-tiles-converter/3d-tiles-converter.ts +11 -7
- package/src/3d-tiles-converter/helpers/load-i3s.ts +5 -5
- package/src/converter-cli.ts +2 -2
- package/src/i3s-converter/helpers/geometry-converter.ts +17 -1
- package/src/i3s-converter/helpers/load-3d-tiles.ts +24 -9
- package/src/i3s-converter/i3s-converter.ts +25 -9
- package/src/i3s-server/controllers/slpk-controller.ts +2 -2
- package/src/lib/utils/compress-util.ts +1 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +0 -115
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +0 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +0 -388
- package/dist/3d-tiles-converter/helpers/3d-tiles-content-converter.d.ts +0 -88
- package/dist/3d-tiles-converter/helpers/3d-tiles-content-converter.d.ts.map +0 -1
- package/dist/3d-tiles-converter/helpers/3d-tiles-content-converter.js +0 -380
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +0 -13
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts.map +0 -1
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -19
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts +0 -37
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +0 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js +0 -98
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts +0 -10
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts.map +0 -1
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +0 -50
- package/dist/3d-tiles-converter/json-templates/tileset.d.ts +0 -15
- package/dist/3d-tiles-converter/json-templates/tileset.d.ts.map +0 -1
- package/dist/3d-tiles-converter/json-templates/tileset.js +0 -39
- package/dist/constants.d.ts +0 -3
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -2
- package/dist/converter-cli.d.ts +0 -2
- package/dist/converter-cli.d.ts.map +0 -1
- package/dist/converter-cli.js +0 -290
- package/dist/deps-installer/deps-installer.d.ts +0 -19
- package/dist/deps-installer/deps-installer.d.ts.map +0 -1
- package/dist/deps-installer/deps-installer.js +0 -95
- package/dist/i3s-converter/helpers/attribute-metadata-info.d.ts +0 -84
- package/dist/i3s-converter/helpers/attribute-metadata-info.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/attribute-metadata-info.js +0 -219
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +0 -26
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +0 -165
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +0 -39
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js +0 -118
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts +0 -9
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/create-scene-server-path.js +0 -21
- package/dist/i3s-converter/helpers/feature-attributes.d.ts +0 -54
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/feature-attributes.js +0 -193
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +0 -8
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js +0 -226
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +0 -60
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +0 -1309
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +0 -28
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +0 -122
- package/dist/i3s-converter/helpers/load-3d-tiles.d.ts +0 -33
- package/dist/i3s-converter/helpers/load-3d-tiles.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/load-3d-tiles.js +0 -121
- package/dist/i3s-converter/helpers/node-debug.d.ts +0 -8
- package/dist/i3s-converter/helpers/node-debug.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/node-debug.js +0 -116
- package/dist/i3s-converter/helpers/node-index-document.d.ts +0 -111
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/node-index-document.js +0 -269
- package/dist/i3s-converter/helpers/node-pages.d.ts +0 -156
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/node-pages.js +0 -285
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +0 -22
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +0 -104
- package/dist/i3s-converter/helpers/progress.d.ts +0 -90
- package/dist/i3s-converter/helpers/progress.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/progress.js +0 -148
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts +0 -32
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +0 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js +0 -34
- package/dist/i3s-converter/i3s-converter.d.ts +0 -312
- package/dist/i3s-converter/i3s-converter.d.ts.map +0 -1
- package/dist/i3s-converter/i3s-converter.js +0 -1191
- package/dist/i3s-converter/json-templates/geometry-definitions.d.ts +0 -7
- package/dist/i3s-converter/json-templates/geometry-definitions.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/geometry-definitions.js +0 -80
- package/dist/i3s-converter/json-templates/layers.d.ts +0 -70
- package/dist/i3s-converter/json-templates/layers.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/layers.js +0 -132
- package/dist/i3s-converter/json-templates/metadata.d.ts +0 -22
- package/dist/i3s-converter/json-templates/metadata.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/metadata.js +0 -21
- package/dist/i3s-converter/json-templates/node.d.ts +0 -61
- package/dist/i3s-converter/json-templates/node.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/node.js +0 -82
- package/dist/i3s-converter/json-templates/scene-server.d.ts +0 -28
- package/dist/i3s-converter/json-templates/scene-server.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/scene-server.js +0 -27
- package/dist/i3s-converter/json-templates/shared-resources.d.ts +0 -14
- package/dist/i3s-converter/json-templates/shared-resources.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/shared-resources.js +0 -122
- package/dist/i3s-converter/json-templates/store.d.ts +0 -95
- package/dist/i3s-converter/json-templates/store.d.ts.map +0 -1
- package/dist/i3s-converter/json-templates/store.js +0 -100
- package/dist/i3s-converter/types.d.ts +0 -226
- package/dist/i3s-converter/types.d.ts.map +0 -1
- package/dist/i3s-converter/types.js +0 -37
- package/dist/i3s-server/app.d.ts +0 -3
- package/dist/i3s-server/app.d.ts.map +0 -1
- package/dist/i3s-server/app.js +0 -31
- package/dist/i3s-server/bin/www.d.ts +0 -3
- package/dist/i3s-server/bin/www.d.ts.map +0 -1
- package/dist/i3s-server/bin/www.js +0 -46
- package/dist/i3s-server/controllers/slpk-controller.d.ts +0 -13
- package/dist/i3s-server/controllers/slpk-controller.d.ts.map +0 -1
- package/dist/i3s-server/controllers/slpk-controller.js +0 -32
- package/dist/i3s-server/routes/slpk-router.d.ts +0 -3
- package/dist/i3s-server/routes/slpk-router.d.ts.map +0 -1
- package/dist/i3s-server/routes/slpk-router.js +0 -40
- package/dist/i3s-server/utils/create-scene-server.d.ts +0 -17
- package/dist/i3s-server/utils/create-scene-server.d.ts.map +0 -1
- package/dist/i3s-server/utils/create-scene-server.js +0 -18
- package/dist/i3s-server/utils/server-utils.d.ts +0 -21
- package/dist/i3s-server/utils/server-utils.d.ts.map +0 -1
- package/dist/i3s-server/utils/server-utils.js +0 -60
- package/dist/index.cjs +0 -6228
- package/dist/index.cjs.map +0 -7
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/lib/json-schemas/conversion-dump-json-schema.d.ts +0 -463
- package/dist/lib/json-schemas/conversion-dump-json-schema.d.ts.map +0 -1
- package/dist/lib/json-schemas/conversion-dump-json-schema.js +0 -285
- package/dist/lib/utils/cli-utils.d.ts +0 -34
- package/dist/lib/utils/cli-utils.d.ts.map +0 -1
- package/dist/lib/utils/cli-utils.js +0 -76
- package/dist/lib/utils/compress-util.d.ts +0 -8
- package/dist/lib/utils/compress-util.d.ts.map +0 -1
- package/dist/lib/utils/compress-util.js +0 -25
- package/dist/lib/utils/conversion-dump.d.ts +0 -147
- package/dist/lib/utils/conversion-dump.d.ts.map +0 -1
- package/dist/lib/utils/conversion-dump.js +0 -257
- package/dist/lib/utils/file-utils.d.ts +0 -57
- package/dist/lib/utils/file-utils.d.ts.map +0 -1
- package/dist/lib/utils/file-utils.js +0 -140
- package/dist/lib/utils/geometry-utils.d.ts +0 -9
- package/dist/lib/utils/geometry-utils.d.ts.map +0 -1
- package/dist/lib/utils/geometry-utils.js +0 -14
- package/dist/lib/utils/lod-conversion-utils.d.ts +0 -42
- package/dist/lib/utils/lod-conversion-utils.d.ts.map +0 -1
- package/dist/lib/utils/lod-conversion-utils.js +0 -71
- package/dist/lib/utils/queue.d.ts +0 -7
- package/dist/lib/utils/queue.d.ts.map +0 -1
- package/dist/lib/utils/queue.js +0 -14
- package/dist/lib/utils/statistic-utils.d.ts +0 -20
- package/dist/lib/utils/statistic-utils.d.ts.map +0 -1
- package/dist/lib/utils/statistic-utils.js +0 -88
- package/dist/lib/utils/write-queue.d.ts +0 -44
- package/dist/lib/utils/write-queue.d.ts.map +0 -1
- package/dist/lib/utils/write-queue.js +0 -82
- package/dist/pgm-loader.d.ts +0 -28
- package/dist/pgm-loader.d.ts.map +0 -1
- package/dist/pgm-loader.js +0 -24
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { AttributeType } from "../types.js";
|
|
2
|
-
export class AttributeMetadataInfo {
|
|
3
|
-
_attributeStorageInfo;
|
|
4
|
-
_fields;
|
|
5
|
-
_popupInfo;
|
|
6
|
-
constructor() {
|
|
7
|
-
this._attributeStorageInfo = [];
|
|
8
|
-
this._fields = [];
|
|
9
|
-
}
|
|
10
|
-
get attributeStorageInfo() {
|
|
11
|
-
return this._attributeStorageInfo;
|
|
12
|
-
}
|
|
13
|
-
get fields() {
|
|
14
|
-
return this._fields;
|
|
15
|
-
}
|
|
16
|
-
get popupInfo() {
|
|
17
|
-
return this._popupInfo;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Creates and stores Attribute Storage Info, Fields and PopupInfo objects based on attribute's types.
|
|
21
|
-
* Appends objects that have not been stored yet.
|
|
22
|
-
* @param attributeTypesMap - set of attribute's types
|
|
23
|
-
* @example AttributeStorageInfo, Fields and PopupInfo already contain objects for the following attributes:
|
|
24
|
-
* {
|
|
25
|
-
* color: 'string',
|
|
26
|
-
* name: 'string',
|
|
27
|
-
* opt_uint8: 'Int32'
|
|
28
|
-
* }
|
|
29
|
-
* Then, we call the addMetadataInfo method with the following attributeTypesMap:
|
|
30
|
-
* {
|
|
31
|
-
* // The same attributes
|
|
32
|
-
* color: 'string',
|
|
33
|
-
* name: 'string',
|
|
34
|
-
* opt_uint8: 'Int32',
|
|
35
|
-
* // New attributes
|
|
36
|
-
* opt_uint64: 'string',
|
|
37
|
-
* opt_float32: 'double',
|
|
38
|
-
* }
|
|
39
|
-
* The method creates and stores objects for opt_uint64, opt_float32 attributes.
|
|
40
|
-
*/
|
|
41
|
-
addMetadataInfo(attributeTypesMap) {
|
|
42
|
-
if (!Object.keys(attributeTypesMap).length) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const attributeTypes = {
|
|
46
|
-
OBJECTID: AttributeType.OBJECT_ID_TYPE,
|
|
47
|
-
...attributeTypesMap
|
|
48
|
-
};
|
|
49
|
-
let isUpdated = false;
|
|
50
|
-
let attributeIndex = this._attributeStorageInfo.length;
|
|
51
|
-
for (const key in attributeTypes) {
|
|
52
|
-
/*
|
|
53
|
-
We will append a new attribute only in case it has not been added to the attribute storage info yet.
|
|
54
|
-
*/
|
|
55
|
-
const elementFound = this._attributeStorageInfo.find((element) => element.name === key);
|
|
56
|
-
if (!elementFound) {
|
|
57
|
-
const attributeType = attributeTypes[key];
|
|
58
|
-
const storageAttribute = this.createStorageAttribute(attributeIndex, key, attributeType);
|
|
59
|
-
const fieldAttributeType = this.getFieldAttributeType(attributeType);
|
|
60
|
-
const fieldAttribute = this.createFieldAttribute(key, fieldAttributeType);
|
|
61
|
-
this._attributeStorageInfo.push(storageAttribute);
|
|
62
|
-
this._fields.push(fieldAttribute);
|
|
63
|
-
attributeIndex += 1;
|
|
64
|
-
isUpdated = true;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (isUpdated) {
|
|
68
|
-
/*
|
|
69
|
-
The attributeStorageInfo is updated. So, popupInfo should be recreated.
|
|
70
|
-
Use attributeStorageInfo as a source of attribute names to create the popupInfo.
|
|
71
|
-
*/
|
|
72
|
-
const attributeNames = [];
|
|
73
|
-
for (const info of this._attributeStorageInfo) {
|
|
74
|
-
attributeNames.push(info.name);
|
|
75
|
-
}
|
|
76
|
-
this._popupInfo = this.createPopupInfo(attributeNames);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Set AttributeMetadataInfo from object
|
|
81
|
-
* @param object - object with AttributeMetadataInfo props
|
|
82
|
-
*/
|
|
83
|
-
fromObject(object) {
|
|
84
|
-
this._attributeStorageInfo = object.attributeStorageInfo;
|
|
85
|
-
this._fields = object.fields;
|
|
86
|
-
this._popupInfo = object.popupInfo;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Generates storage attribute for map segmentation.
|
|
90
|
-
* @param attributeIndex - order index of attribute (f_0, f_1 ...).
|
|
91
|
-
* @param key - attribute key from propertyTable.
|
|
92
|
-
* @param attributeType - attribute type.
|
|
93
|
-
* @return Updated storageAttribute.
|
|
94
|
-
*/
|
|
95
|
-
createStorageAttribute(attributeIndex, key, attributeType) {
|
|
96
|
-
const storageAttribute = {
|
|
97
|
-
key: `f_${attributeIndex}`,
|
|
98
|
-
name: key,
|
|
99
|
-
ordering: ['attributeValues'],
|
|
100
|
-
header: [{ property: 'count', valueType: 'UInt32' }],
|
|
101
|
-
attributeValues: { valueType: 'Int32', valuesPerElement: 1 }
|
|
102
|
-
};
|
|
103
|
-
switch (attributeType) {
|
|
104
|
-
case AttributeType.OBJECT_ID_TYPE:
|
|
105
|
-
this.setupIdAttribute(storageAttribute);
|
|
106
|
-
break;
|
|
107
|
-
case AttributeType.STRING_TYPE:
|
|
108
|
-
this.setupStringAttribute(storageAttribute);
|
|
109
|
-
break;
|
|
110
|
-
case AttributeType.DOUBLE_TYPE:
|
|
111
|
-
this.setupDoubleAttribute(storageAttribute);
|
|
112
|
-
break;
|
|
113
|
-
case AttributeType.SHORT_INT_TYPE:
|
|
114
|
-
break;
|
|
115
|
-
default:
|
|
116
|
-
this.setupStringAttribute(storageAttribute);
|
|
117
|
-
}
|
|
118
|
-
return storageAttribute;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Finds and returns attribute type based on key form propertyTable.
|
|
122
|
-
* @param attributeType
|
|
123
|
-
*/
|
|
124
|
-
getFieldAttributeType(attributeType) {
|
|
125
|
-
switch (attributeType) {
|
|
126
|
-
case AttributeType.OBJECT_ID_TYPE:
|
|
127
|
-
return 'esriFieldTypeOID';
|
|
128
|
-
case AttributeType.STRING_TYPE:
|
|
129
|
-
return 'esriFieldTypeString';
|
|
130
|
-
case AttributeType.SHORT_INT_TYPE:
|
|
131
|
-
return 'esriFieldTypeInteger';
|
|
132
|
-
case AttributeType.DOUBLE_TYPE:
|
|
133
|
-
return 'esriFieldTypeDouble';
|
|
134
|
-
default:
|
|
135
|
-
return 'esriFieldTypeString';
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Sets up Id attribute for map segmentation.
|
|
140
|
-
* @param storageAttribute - attribute for map segmentation .
|
|
141
|
-
*/
|
|
142
|
-
setupIdAttribute(storageAttribute) {
|
|
143
|
-
storageAttribute.attributeValues = {
|
|
144
|
-
valueType: 'Oid32',
|
|
145
|
-
valuesPerElement: 1
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Sets up storage attribute as string.
|
|
150
|
-
* @param storageAttribute - attribute for map segmentation.
|
|
151
|
-
*/
|
|
152
|
-
setupStringAttribute(storageAttribute) {
|
|
153
|
-
// @ts-expect-error
|
|
154
|
-
storageAttribute.ordering.unshift('attributeByteCounts');
|
|
155
|
-
storageAttribute.header.push({ property: 'attributeValuesByteCount', valueType: 'UInt32' });
|
|
156
|
-
storageAttribute.attributeValues = {
|
|
157
|
-
valueType: 'String',
|
|
158
|
-
encoding: 'UTF-8',
|
|
159
|
-
valuesPerElement: 1
|
|
160
|
-
};
|
|
161
|
-
storageAttribute.attributeByteCounts = {
|
|
162
|
-
valueType: 'UInt32',
|
|
163
|
-
valuesPerElement: 1
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Sets up double attribute for map segmentation.
|
|
168
|
-
* @param storageAttribute - attribute for map segmentation .
|
|
169
|
-
*/
|
|
170
|
-
setupDoubleAttribute(storageAttribute) {
|
|
171
|
-
storageAttribute.attributeValues = {
|
|
172
|
-
valueType: 'Float64',
|
|
173
|
-
valuesPerElement: 1
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Sets up field attribute for map segmentation.
|
|
178
|
-
* @param key - attribute for map segmentation.
|
|
179
|
-
* @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').
|
|
180
|
-
*/
|
|
181
|
-
createFieldAttribute(key, fieldAttributeType) {
|
|
182
|
-
return {
|
|
183
|
-
name: key,
|
|
184
|
-
type: fieldAttributeType,
|
|
185
|
-
alias: key
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Generates popup info to show metadata on the map.
|
|
190
|
-
* @param propertyNames - array of property names including OBJECTID.
|
|
191
|
-
* @return data for correct rendering of popup.
|
|
192
|
-
*/
|
|
193
|
-
createPopupInfo(propertyNames) {
|
|
194
|
-
const title = '{OBJECTID}';
|
|
195
|
-
const mediaInfos = [];
|
|
196
|
-
const fieldInfos = [];
|
|
197
|
-
const popupElements = [];
|
|
198
|
-
const expressionInfos = [];
|
|
199
|
-
for (const propertyName of propertyNames) {
|
|
200
|
-
fieldInfos.push({
|
|
201
|
-
fieldName: propertyName,
|
|
202
|
-
visible: true,
|
|
203
|
-
isEditable: false,
|
|
204
|
-
label: propertyName
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
popupElements.push({
|
|
208
|
-
fieldInfos,
|
|
209
|
-
type: 'fields'
|
|
210
|
-
});
|
|
211
|
-
return {
|
|
212
|
-
title,
|
|
213
|
-
mediaInfos,
|
|
214
|
-
popupElements,
|
|
215
|
-
fieldInfos,
|
|
216
|
-
expressionInfos
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { NumericArray } from '@loaders.gl/loader-utils';
|
|
2
|
-
import type { GLTFAccessorPostprocessed, GLTFMeshPrimitivePostprocessed } from '@loaders.gl/gltf';
|
|
3
|
-
import { Tiles3DTileContent } from '@loaders.gl/3d-tiles';
|
|
4
|
-
import { TextureImageProperties } from "../types.js";
|
|
5
|
-
/**
|
|
6
|
-
* Get featureTexture by a metadata class.
|
|
7
|
-
* Metadata classes come from a structural metadata extesion (EXT_feature_metadata or EXT_structural_metadata).
|
|
8
|
-
* The glTF might contain multiple texel-level metadata textures related to different classes. Having only one metadata class
|
|
9
|
-
* selected to convert to I3S, we have to pick only one texture to convert to per-vertex property.
|
|
10
|
-
* @param tileContent - 3d tile content
|
|
11
|
-
* @param metadataClass - user selected feature metadata class name
|
|
12
|
-
* @returns featureTexture key
|
|
13
|
-
*/
|
|
14
|
-
export declare function getTextureByMetadataClass(tileContent: Tiles3DTileContent, metadataClass?: string): string | null;
|
|
15
|
-
/**
|
|
16
|
-
* Getting batchIds from 3DTilesNext extensions.
|
|
17
|
-
* @param attributes - gltf accessors
|
|
18
|
-
* @param primitive - gltf primitive data
|
|
19
|
-
* @param images - gltf texture images
|
|
20
|
-
* @param featureTexture - feature texture key
|
|
21
|
-
* @return array of batch IDs
|
|
22
|
-
*/
|
|
23
|
-
export declare function handleBatchIdsExtensions(attributes: {
|
|
24
|
-
[key: string]: GLTFAccessorPostprocessed;
|
|
25
|
-
}, primitive: GLTFMeshPrimitivePostprocessed, images: (TextureImageProperties | null)[], featureTexture: string | null): NumericArray;
|
|
26
|
-
//# sourceMappingURL=batch-ids-extensions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch-ids-extensions.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/batch-ids-extensions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EACV,yBAAyB,EACzB,8BAA8B,EAK/B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAC,sBAAsB,EAAC,oBAAiB;AAEhD;;;;;;;;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"}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { EXT_MESH_FEATURES, EXT_FEATURE_METADATA } from '@loaders.gl/gltf';
|
|
2
|
-
import { emod } from '@loaders.gl/math';
|
|
3
|
-
/**
|
|
4
|
-
* Get featureTexture by a metadata class.
|
|
5
|
-
* Metadata classes come from a structural metadata extesion (EXT_feature_metadata or EXT_structural_metadata).
|
|
6
|
-
* The glTF might contain multiple texel-level metadata textures related to different classes. Having only one metadata class
|
|
7
|
-
* selected to convert to I3S, we have to pick only one texture to convert to per-vertex property.
|
|
8
|
-
* @param tileContent - 3d tile content
|
|
9
|
-
* @param metadataClass - user selected feature metadata class name
|
|
10
|
-
* @returns featureTexture key
|
|
11
|
-
*/
|
|
12
|
-
export function getTextureByMetadataClass(tileContent, metadataClass) {
|
|
13
|
-
const extFeatureMetadata = tileContent.gltf?.extensions?.[EXT_FEATURE_METADATA];
|
|
14
|
-
if (!extFeatureMetadata?.featureTextures) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
for (const textureKey in extFeatureMetadata.featureTextures) {
|
|
18
|
-
const texture = extFeatureMetadata.featureTextures[textureKey];
|
|
19
|
-
if (texture.class === metadataClass) {
|
|
20
|
-
return textureKey;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Getting batchIds from 3DTilesNext extensions.
|
|
27
|
-
* @param attributes - gltf accessors
|
|
28
|
-
* @param primitive - gltf primitive data
|
|
29
|
-
* @param images - gltf texture images
|
|
30
|
-
* @param featureTexture - feature texture key
|
|
31
|
-
* @return array of batch IDs
|
|
32
|
-
*/
|
|
33
|
-
export function handleBatchIdsExtensions(attributes, primitive, images, featureTexture) {
|
|
34
|
-
const extensions = primitive?.extensions;
|
|
35
|
-
if (!extensions) {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
for (const [extensionName, extensionData] of Object.entries(extensions || {})) {
|
|
39
|
-
switch (extensionName) {
|
|
40
|
-
case EXT_FEATURE_METADATA:
|
|
41
|
-
return handleExtFeatureMetadataExtension(attributes, extensionData, images, featureTexture);
|
|
42
|
-
case EXT_MESH_FEATURES:
|
|
43
|
-
return handleExtMeshFeaturesExtension(attributes, extensionData);
|
|
44
|
-
default:
|
|
45
|
-
return [];
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Getting batchIds from EXT_mesh_features extensions.
|
|
52
|
-
* @param attributes - gltf accessors
|
|
53
|
-
* @param extMeshFeatures - EXT_mesh_features extension
|
|
54
|
-
* @returns an array of attribute values
|
|
55
|
-
*/
|
|
56
|
-
function handleExtMeshFeaturesExtension(attributes, extMeshFeatures) {
|
|
57
|
-
for (const ids of extMeshFeatures.featureIds) {
|
|
58
|
-
if (typeof ids.propertyTable !== 'undefined') {
|
|
59
|
-
// propertyTable is an index that can be 0
|
|
60
|
-
// return the first featureID set that corresponts to property table.
|
|
61
|
-
return ids.data;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Get batchIds from EXT_feature_metadata extension.
|
|
68
|
-
* @see - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata
|
|
69
|
-
* @param attributes - glTF attributes
|
|
70
|
-
* @param extFeatureMetadata - primitive-level EXT_FEATURE_METADATA extension data
|
|
71
|
-
* @param textures - texture images
|
|
72
|
-
* @param featureTexture - feature texture key
|
|
73
|
-
*/
|
|
74
|
-
function handleExtFeatureMetadataExtension(attributes, extFeatureMetadata, images, featureTexture) {
|
|
75
|
-
// Take only first extension object to get batchIds attribute name.
|
|
76
|
-
const featureIdAttribute = extFeatureMetadata?.featureIdAttributes?.[0];
|
|
77
|
-
if (featureIdAttribute?.featureIds?.attribute) {
|
|
78
|
-
const batchIdsAttribute = attributes[featureIdAttribute.featureIds.attribute];
|
|
79
|
-
return batchIdsAttribute.value;
|
|
80
|
-
}
|
|
81
|
-
if (featureIdAttribute?.featureIds?.hasOwnProperty('constant') &&
|
|
82
|
-
featureIdAttribute?.featureIds?.hasOwnProperty('divisor')) {
|
|
83
|
-
const featuresCount = attributes?.POSITIONS?.value.length / 3 || 0;
|
|
84
|
-
return generateImplicitFeatureIds(featuresCount, featureIdAttribute.featureIds.constant, featureIdAttribute.featureIds.divisor);
|
|
85
|
-
}
|
|
86
|
-
// Take only first extension object to get batchIds attribute name.
|
|
87
|
-
const featureIdTexture = extFeatureMetadata?.featureIdTextures && extFeatureMetadata?.featureIdTextures[0];
|
|
88
|
-
if (featureIdTexture) {
|
|
89
|
-
const textureAttributeIndex = featureIdTexture?.featureIds?.texture?.texCoord || 0;
|
|
90
|
-
const textCoordAttribute = `TEXCOORD_${textureAttributeIndex}`;
|
|
91
|
-
const textureCoordinates = attributes[textCoordAttribute].value;
|
|
92
|
-
return generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, images);
|
|
93
|
-
}
|
|
94
|
-
if (featureTexture) {
|
|
95
|
-
const batchIdsAttribute = attributes[featureTexture];
|
|
96
|
-
return batchIdsAttribute.value;
|
|
97
|
-
}
|
|
98
|
-
return [];
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Generates implicit feature ids
|
|
102
|
-
* @see - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#implicit-feature-ids
|
|
103
|
-
* @param featuresCount
|
|
104
|
-
* @param constant
|
|
105
|
-
* @param devisor
|
|
106
|
-
*/
|
|
107
|
-
function generateImplicitFeatureIds(featuresCount, constant = 0, divisor = 0) {
|
|
108
|
-
let featureIds = [];
|
|
109
|
-
if (divisor > 0) {
|
|
110
|
-
let currentValue = constant;
|
|
111
|
-
let devisorCounter = divisor;
|
|
112
|
-
for (let index = 0; index < featuresCount; index++) {
|
|
113
|
-
featureIds.push(currentValue);
|
|
114
|
-
devisorCounter -= 1;
|
|
115
|
-
if (devisorCounter === 0) {
|
|
116
|
-
currentValue++;
|
|
117
|
-
devisorCounter = divisor;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
featureIds = Array(featuresCount).fill(constant, 0, featuresCount);
|
|
123
|
-
}
|
|
124
|
-
return featureIds;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Get batchIds from texture.
|
|
128
|
-
* @param primitive
|
|
129
|
-
* @param featureIdTextures
|
|
130
|
-
*/
|
|
131
|
-
function generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, images) {
|
|
132
|
-
if (!images?.length) {
|
|
133
|
-
return [];
|
|
134
|
-
}
|
|
135
|
-
const CHANNELS_MAP = {
|
|
136
|
-
r: 0,
|
|
137
|
-
g: 1,
|
|
138
|
-
b: 2,
|
|
139
|
-
a: 3
|
|
140
|
-
};
|
|
141
|
-
const textureIndex = featureIdTexture?.featureIds?.texture?.index;
|
|
142
|
-
const featureChannel = featureIdTexture?.featureIds?.channels;
|
|
143
|
-
if (!featureChannel || textureIndex === undefined) {
|
|
144
|
-
return [];
|
|
145
|
-
}
|
|
146
|
-
const image = images[textureIndex];
|
|
147
|
-
const batchIds = [];
|
|
148
|
-
const channels = CHANNELS_MAP[featureChannel];
|
|
149
|
-
if (image && image?.width && image?.height && image?.components) {
|
|
150
|
-
for (let index = 0; index < textureCoordinates.length; index += 2) {
|
|
151
|
-
const u = textureCoordinates[index];
|
|
152
|
-
const v = textureCoordinates[index + 1];
|
|
153
|
-
const tx = Math.min((emod(u) * image.width) | 0, image.width - 1);
|
|
154
|
-
const ty = Math.min((emod(v) * image.height) | 0, image.height - 1);
|
|
155
|
-
const offset = (ty * image.width + tx) * image.components + channels;
|
|
156
|
-
const batchId = new Uint8Array(image.data)[offset];
|
|
157
|
-
batchIds.push(batchId);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
// eslint-disable-next-line no-console
|
|
162
|
-
console.warn(`Can't get batch Ids from ${image?.mimeType || ''} compressed texture`);
|
|
163
|
-
}
|
|
164
|
-
return batchIds;
|
|
165
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { BoundingVolumes, FullExtent, Mbs, Obb } from '@loaders.gl/i3s';
|
|
2
|
-
import { Vector3 } from '@math.gl/core';
|
|
3
|
-
import { OrientedBoundingBox, BoundingSphere } from '@math.gl/culling';
|
|
4
|
-
import { Geoid } from '@math.gl/geoid';
|
|
5
|
-
/**
|
|
6
|
-
* Create bounding volumes object from tile and geoid height model.
|
|
7
|
-
* @param sourceBoundingVolume - initialized bounding volume of the source tile
|
|
8
|
-
* @param geoidHeightModel - instance of Geoid class that converts elevation from geoidal to ellipsoidal and back
|
|
9
|
-
* @returns - Bounding volumes object
|
|
10
|
-
*/
|
|
11
|
-
export declare function createBoundingVolumes(sourceBoundingVolume: OrientedBoundingBox | BoundingSphere, geoidHeightModel: Geoid | null): BoundingVolumes;
|
|
12
|
-
/**
|
|
13
|
-
* Generates bounding volumes from geometry positions
|
|
14
|
-
* @param cartesianPositions
|
|
15
|
-
* @param geoidHeightModel
|
|
16
|
-
*/
|
|
17
|
-
export declare function createBoundingVolumesFromGeometry(cartesianPositions: Float32Array, geoidHeightModel: Geoid | null): {
|
|
18
|
-
mbs: Mbs;
|
|
19
|
-
obb: Obb;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Create array of posisitons where each vertex is vector
|
|
23
|
-
* @param {array} positions
|
|
24
|
-
* @returns {Vector3[]}
|
|
25
|
-
*/
|
|
26
|
-
export declare function convertPositionsToVectors(positions: Float32Array): Vector3[];
|
|
27
|
-
/**
|
|
28
|
-
* Convert common coordinate to fullExtent https://github.com/Esri/i3s-spec/blob/master/docs/1.8/fullExtent.cmn.md
|
|
29
|
-
* @param boundingVolume
|
|
30
|
-
* @returns - fullExtent object
|
|
31
|
-
*/
|
|
32
|
-
export declare function convertBoundingVolumeToI3SFullExtent(boundingVolume: OrientedBoundingBox | BoundingSphere): FullExtent;
|
|
33
|
-
/**
|
|
34
|
-
* Creates oriented boundinb box from mbs.
|
|
35
|
-
* @param mbs - Minimum Bounding Sphere
|
|
36
|
-
* @returns - Oriented Bounding Box
|
|
37
|
-
*/
|
|
38
|
-
export declare function createObbFromMbs(mbs: Mbs): Obb;
|
|
39
|
-
//# sourceMappingURL=coordinate-converter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAErC;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,oBAAoB,EAAE,mBAAmB,GAAG,cAAc,EAC1D,gBAAgB,EAAE,KAAK,GAAG,IAAI,GAC7B,eAAe,CAoCjB;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAC/C,kBAAkB,EAAE,YAAY,EAChC,gBAAgB,EAAE,KAAK,GAAG,IAAI,GAC7B;IAAC,GAAG,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAC,CAsBtB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,YAAY,GAAG,OAAO,EAAE,CAW5E;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAClD,cAAc,EAAE,mBAAmB,GAAG,cAAc,GACnD,UAAU,CA4BZ;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAK9C"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { Matrix3, Quaternion, Vector3 } from '@math.gl/core';
|
|
2
|
-
import { Ellipsoid } from '@math.gl/geospatial';
|
|
3
|
-
import { OrientedBoundingBox, makeOrientedBoundingBoxFromPoints, makeBoundingSphereFromPoints, BoundingSphere } from '@math.gl/culling';
|
|
4
|
-
/**
|
|
5
|
-
* Create bounding volumes object from tile and geoid height model.
|
|
6
|
-
* @param sourceBoundingVolume - initialized bounding volume of the source tile
|
|
7
|
-
* @param geoidHeightModel - instance of Geoid class that converts elevation from geoidal to ellipsoidal and back
|
|
8
|
-
* @returns - Bounding volumes object
|
|
9
|
-
*/
|
|
10
|
-
export function createBoundingVolumes(sourceBoundingVolume, geoidHeightModel) {
|
|
11
|
-
let radius;
|
|
12
|
-
let halfSize;
|
|
13
|
-
let quaternion;
|
|
14
|
-
const cartographicCenter = Ellipsoid.WGS84.cartesianToCartographic(sourceBoundingVolume.center, new Vector3());
|
|
15
|
-
if (geoidHeightModel) {
|
|
16
|
-
cartographicCenter[2] =
|
|
17
|
-
cartographicCenter[2] -
|
|
18
|
-
geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
|
|
19
|
-
}
|
|
20
|
-
if (sourceBoundingVolume instanceof OrientedBoundingBox) {
|
|
21
|
-
halfSize = sourceBoundingVolume.halfSize;
|
|
22
|
-
radius = new Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
|
|
23
|
-
quaternion = sourceBoundingVolume.quaternion;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
radius = sourceBoundingVolume.radius;
|
|
27
|
-
halfSize = [radius, radius, radius];
|
|
28
|
-
quaternion = new Quaternion()
|
|
29
|
-
.fromMatrix3(new Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]]))
|
|
30
|
-
.normalize();
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],
|
|
34
|
-
obb: {
|
|
35
|
-
center: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2]],
|
|
36
|
-
halfSize,
|
|
37
|
-
quaternion
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Generates bounding volumes from geometry positions
|
|
43
|
-
* @param cartesianPositions
|
|
44
|
-
* @param geoidHeightModel
|
|
45
|
-
*/
|
|
46
|
-
export function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel) {
|
|
47
|
-
const positionVectors = convertPositionsToVectors(cartesianPositions);
|
|
48
|
-
const geometryObb = makeOrientedBoundingBoxFromPoints(positionVectors);
|
|
49
|
-
const geometryMbs = makeBoundingSphereFromPoints(positionVectors);
|
|
50
|
-
const mbsCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new Vector3());
|
|
51
|
-
const obbCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new Vector3());
|
|
52
|
-
if (geoidHeightModel) {
|
|
53
|
-
mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
|
|
54
|
-
obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
mbs: [mbsCenter[0], mbsCenter[1], mbsCenter[2], geometryMbs.radius],
|
|
58
|
-
obb: {
|
|
59
|
-
center: obbCenter,
|
|
60
|
-
halfSize: geometryObb.halfSize,
|
|
61
|
-
quaternion: geometryObb.quaternion
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Create array of posisitons where each vertex is vector
|
|
67
|
-
* @param {array} positions
|
|
68
|
-
* @returns {Vector3[]}
|
|
69
|
-
*/
|
|
70
|
-
export function convertPositionsToVectors(positions) {
|
|
71
|
-
const result = [];
|
|
72
|
-
for (let i = 0; i < positions.length; i += 3) {
|
|
73
|
-
// TODO: (perf) new Vector3 is not optimal but required in `makeOrientedBoundingBoxFromPoints`.
|
|
74
|
-
// modify `makeOrientedBoundingBoxFromPoints` to use scratch vectors
|
|
75
|
-
const positionVector = new Vector3([positions[i], positions[i + 1], positions[i + 2]]);
|
|
76
|
-
result.push(positionVector);
|
|
77
|
-
}
|
|
78
|
-
return result;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Convert common coordinate to fullExtent https://github.com/Esri/i3s-spec/blob/master/docs/1.8/fullExtent.cmn.md
|
|
82
|
-
* @param boundingVolume
|
|
83
|
-
* @returns - fullExtent object
|
|
84
|
-
*/
|
|
85
|
-
export function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
|
|
86
|
-
let sphere;
|
|
87
|
-
if (boundingVolume instanceof BoundingSphere) {
|
|
88
|
-
sphere = boundingVolume;
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
sphere = boundingVolume.getBoundingSphere();
|
|
92
|
-
}
|
|
93
|
-
const center = sphere.center;
|
|
94
|
-
const radius = sphere.radius;
|
|
95
|
-
const vertexMax = Ellipsoid.WGS84.cartesianToCartographic(new Vector3(center[0] + radius, center[1] + radius, center[2] + radius), new Vector3());
|
|
96
|
-
const vertexMin = Ellipsoid.WGS84.cartesianToCartographic(new Vector3(center[0] - radius, center[1] - radius, center[2] - radius), new Vector3());
|
|
97
|
-
// Converter sometimes returns min values that are bigger then max,
|
|
98
|
-
// so we should check and take bigger value from max and smaller for nim
|
|
99
|
-
return {
|
|
100
|
-
xmin: Math.min(vertexMin[0], vertexMax[0]),
|
|
101
|
-
xmax: Math.max(vertexMin[0], vertexMax[0]),
|
|
102
|
-
ymin: Math.min(vertexMin[1], vertexMax[1]),
|
|
103
|
-
ymax: Math.max(vertexMin[1], vertexMax[1]),
|
|
104
|
-
zmin: Math.min(vertexMin[2], vertexMax[2]),
|
|
105
|
-
zmax: Math.max(vertexMin[2], vertexMax[2])
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Creates oriented boundinb box from mbs.
|
|
110
|
-
* @param mbs - Minimum Bounding Sphere
|
|
111
|
-
* @returns - Oriented Bounding Box
|
|
112
|
-
*/
|
|
113
|
-
export function createObbFromMbs(mbs) {
|
|
114
|
-
const radius = mbs[3];
|
|
115
|
-
const center = new Vector3(mbs[0], mbs[1], mbs[2]);
|
|
116
|
-
const halfAxex = new Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);
|
|
117
|
-
return new OrientedBoundingBox(center, halfAxex);
|
|
118
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { SceneLayer3D } from '@loaders.gl/i3s';
|
|
2
|
-
/**
|
|
3
|
-
* Form and save sceneServer meta data into a file
|
|
4
|
-
* @param layerName - layer name to display
|
|
5
|
-
* @param layers0 - layer object embedded into sceneServer meta data
|
|
6
|
-
* @param rootPath - root path of new converted tileset
|
|
7
|
-
*/
|
|
8
|
-
export declare function createSceneServerPath(layerName: string, layers0: SceneLayer3D, rootPath: string): Promise<void>;
|
|
9
|
-
//# sourceMappingURL=create-scene-server-path.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-scene-server-path.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/create-scene-server-path.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAQlD;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
-
import transform from 'json-map-transform';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
import { SCENE_SERVER as sceneServerTemplate } from "../json-templates/scene-server.js";
|
|
5
|
-
import { writeFile } from "../../lib/utils/file-utils.js";
|
|
6
|
-
/**
|
|
7
|
-
* Form and save sceneServer meta data into a file
|
|
8
|
-
* @param layerName - layer name to display
|
|
9
|
-
* @param layers0 - layer object embedded into sceneServer meta data
|
|
10
|
-
* @param rootPath - root path of new converted tileset
|
|
11
|
-
*/
|
|
12
|
-
export async function createSceneServerPath(layerName, layers0, rootPath) {
|
|
13
|
-
const sceneServerData = {
|
|
14
|
-
serviceItemId: uuidv4().replace(/-/gi, ''),
|
|
15
|
-
layerName,
|
|
16
|
-
layers0
|
|
17
|
-
};
|
|
18
|
-
const sceneServer = transform(sceneServerData, sceneServerTemplate());
|
|
19
|
-
const nodePagePath = join(rootPath, 'SceneServer');
|
|
20
|
-
await writeFile(nodePagePath, JSON.stringify(sceneServer));
|
|
21
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { FeatureTableJson } from '@loaders.gl/3d-tiles';
|
|
2
|
-
import type { Attribute } from '@loaders.gl/i3s';
|
|
3
|
-
import type { GLTFPostprocessed } from '@loaders.gl/gltf';
|
|
4
|
-
/**
|
|
5
|
-
* Takes attributes from property table based on featureIdsMap.
|
|
6
|
-
* If there is no property value for particular featureId (index) the property will be null.
|
|
7
|
-
* Example:
|
|
8
|
-
* Initial data:
|
|
9
|
-
* OBJECTID: {0: 0, 3: 33, 4: 333}
|
|
10
|
-
* component: ['Windows', 'Frames', 'Wall', 'Roof', 'Skylight']
|
|
11
|
-
* Result:
|
|
12
|
-
* OBJECTID: [0, 33, 333]
|
|
13
|
-
* component: ['Windows', 'Roof', 'Skylight']
|
|
14
|
-
* @param featureIdsMap
|
|
15
|
-
* @param propertyTable
|
|
16
|
-
*/
|
|
17
|
-
export declare function flattenPropertyTableByFeatureIds(featureIdsMap: Record<string, number>, propertyTable: FeatureTableJson): FeatureTableJson;
|
|
18
|
-
/**
|
|
19
|
-
* Check that all attributes in propertyTable have the same length as FeatureIds.
|
|
20
|
-
* If there are differencies between lengths we should flatten property table based on exiesting featureIds.
|
|
21
|
-
* @param featureIds
|
|
22
|
-
* @param propertyTable
|
|
23
|
-
* @returns
|
|
24
|
-
*/
|
|
25
|
-
export declare function checkPropertiesLength(featureIds: number[], propertyTable: FeatureTableJson): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Get the attribute type for attributeStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md
|
|
28
|
-
* @param attribute - attribute taken from propertyTable
|
|
29
|
-
*/
|
|
30
|
-
export declare function getAttributeType(attribute: unknown): string;
|
|
31
|
-
/**
|
|
32
|
-
* Gets attribute's types based on the property table records.
|
|
33
|
-
* @param propertyTable - Table with layer meta data.
|
|
34
|
-
* @returns set of attribute types
|
|
35
|
-
* @example of returned object:
|
|
36
|
-
* {
|
|
37
|
-
* "opt_uint8": "Int32",
|
|
38
|
-
* "opt_uint64": "string"
|
|
39
|
-
* }
|
|
40
|
-
*/
|
|
41
|
-
export declare function getAttributeTypesMapFromPropertyTable(propertyTable: FeatureTableJson): Record<string, Attribute>;
|
|
42
|
-
/**
|
|
43
|
-
* Gets attribute's types from the extension schema selected by the class name 'metadataClass'.
|
|
44
|
-
* @param gltfJson - JSON part of GLB content
|
|
45
|
-
* @param metadataClass - name of the schema class
|
|
46
|
-
* @returns set of attribute's types
|
|
47
|
-
* @example of returned object:
|
|
48
|
-
* {
|
|
49
|
-
* "opt_uint8": "Int32",
|
|
50
|
-
* "opt_uint64": "string"
|
|
51
|
-
* }
|
|
52
|
-
*/
|
|
53
|
-
export declare const getAttributeTypesMapFromSchema: (gltfJson: GLTFPostprocessed, metadataClass: string) => Record<string, Attribute> | null;
|
|
54
|
-
//# sourceMappingURL=feature-attributes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IA2B9B,CAAC"}
|