@ifc-lite/viewer 1.17.0 → 1.17.1
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/.turbo/turbo-build.log +11 -15
- package/.turbo/turbo-typecheck.log +41 -1
- package/CHANGELOG.md +10 -0
- package/dist/assets/{Arrow.dom-CcoDLP6E.js → Arrow.dom-DuPUrOxJ.js} +1 -1
- package/dist/assets/{basketViewActivator-FtbS__bG.js → basketViewActivator-DetjPnvt.js} +1 -1
- package/dist/assets/{browser-CXd3z0DO.js → browser-BQdwnOUt.js} +1 -1
- package/dist/assets/geometry.worker-Bjm-ukng.js +1 -0
- package/dist/assets/ifc-lite_bg-DD0A7Yow.wasm +0 -0
- package/dist/assets/{index-DqNiuQep.js → index-B3X21yXA.js} +4 -4
- package/dist/assets/{index-D99fzcwI.js → index-BybGZJTW.js} +13456 -13364
- package/dist/assets/{native-bridge-DjDj2M6p.js → native-bridge-CN0ZMR2t.js} +1 -1
- package/dist/assets/{wasm-bridge-CDTF4ZQc.js → wasm-bridge-D0bALkma.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +11 -11
- package/src/components/viewer/PropertiesPanel.tsx +6 -7
- package/src/components/viewer/hierarchy/treeDataBuilder.test.ts +70 -0
- package/src/components/viewer/hierarchy/treeDataBuilder.ts +35 -10
- package/src/components/viewer/hierarchy/types.ts +24 -2
- package/src/sdk/adapters/visibility-adapter.ts +7 -49
- package/src/store/basketVisibleSet.test.ts +73 -3
- package/src/store/basketVisibleSet.ts +46 -75
- package/src/utils/serverDataModel.test.ts +90 -0
- package/src/utils/serverDataModel.ts +22 -34
- package/src/utils/spatialHierarchy.test.ts +38 -0
- package/src/utils/spatialHierarchy.ts +13 -23
- package/dist/assets/ifc-lite-TI3u_Zyw.js +0 -7
- package/dist/assets/ifc-lite_bg-DeZrXTKQ.wasm +0 -0
- package/dist/assets/workerHelpers-G7llXNMi.js +0 -36
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
IfcTypeEnum,
|
|
7
|
+
isSpaceLikeSpatialTypeName,
|
|
8
|
+
isSpatialStructureTypeName,
|
|
9
|
+
isStoreyLikeSpatialTypeName,
|
|
10
|
+
type SpatialNode,
|
|
11
|
+
type SpatialHierarchy,
|
|
12
|
+
} from '@ifc-lite/data';
|
|
6
13
|
import type { IfcDataStore } from '@ifc-lite/parser';
|
|
7
14
|
import type { EntityRef } from './types.js';
|
|
8
15
|
import { entityRefToString, stringToEntityRef } from './types.js';
|
|
@@ -85,9 +92,6 @@ export function invalidateVisibleBasketCache(): void {
|
|
|
85
92
|
_visibleCache = null;
|
|
86
93
|
}
|
|
87
94
|
|
|
88
|
-
const STOREY_TYPE = 'IfcBuildingStorey';
|
|
89
|
-
const SPATIAL_CONTAINER_TYPES = new Set(['IfcProject', 'IfcSite', 'IfcBuilding']);
|
|
90
|
-
|
|
91
95
|
function dedupeRefs(refs: EntityRef[]): EntityRef[] {
|
|
92
96
|
const out: EntityRef[] = [];
|
|
93
97
|
const seen = new Set<string>();
|
|
@@ -135,34 +139,7 @@ function findSpatialNode(root: SpatialNode, expressId: number): SpatialNode | nu
|
|
|
135
139
|
}
|
|
136
140
|
|
|
137
141
|
function getContainerElementIds(dataStore: IfcDataStore, containerExpressId: number): number[] {
|
|
138
|
-
|
|
139
|
-
if (!hierarchy?.project) return [];
|
|
140
|
-
|
|
141
|
-
const startNode = findSpatialNode(hierarchy.project, containerExpressId);
|
|
142
|
-
if (!startNode) return [];
|
|
143
|
-
|
|
144
|
-
const elementIds: number[] = [];
|
|
145
|
-
const seen = new Set<number>();
|
|
146
|
-
const stack: SpatialNode[] = [startNode];
|
|
147
|
-
|
|
148
|
-
while (stack.length > 0) {
|
|
149
|
-
const current = stack.pop()!;
|
|
150
|
-
if (current.type === IfcTypeEnum.IfcBuildingStorey) {
|
|
151
|
-
const storeyElements = hierarchy.byStorey.get(current.expressId) as number[] | undefined;
|
|
152
|
-
if (storeyElements) {
|
|
153
|
-
for (const id of storeyElements) {
|
|
154
|
-
if (seen.has(id)) continue;
|
|
155
|
-
seen.add(id);
|
|
156
|
-
elementIds.push(id);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
for (const child of current.children || []) {
|
|
161
|
-
stack.push(child);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return elementIds;
|
|
142
|
+
return collectSpatialSubtreeElementsWithIfcSpace(dataStore.spatialHierarchy, containerExpressId) ?? [];
|
|
166
143
|
}
|
|
167
144
|
|
|
168
145
|
function expandRefToElements(state: ViewerStateSnapshot, ref: EntityRef): EntityRef[] {
|
|
@@ -170,16 +147,12 @@ function expandRefToElements(state: ViewerStateSnapshot, ref: EntityRef): Entity
|
|
|
170
147
|
if (!dataStore) return [ref];
|
|
171
148
|
|
|
172
149
|
const entityType = dataStore.entities.getTypeName(ref.expressId) || '';
|
|
173
|
-
if (entityType
|
|
174
|
-
const localIds = dataStore.spatialHierarchy?.byStorey.get(ref.expressId) as number[] | undefined;
|
|
175
|
-
if (!localIds || localIds.length === 0) return [];
|
|
176
|
-
return localIds.map((expressId) => ({ modelId: ref.modelId, expressId }));
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (SPATIAL_CONTAINER_TYPES.has(entityType)) {
|
|
150
|
+
if (isSpatialStructureTypeName(entityType) && !isSpaceLikeSpatialTypeName(entityType)) {
|
|
180
151
|
const localIds = getContainerElementIds(dataStore, ref.expressId);
|
|
181
|
-
|
|
182
|
-
|
|
152
|
+
const ids = localIds.includes(ref.expressId)
|
|
153
|
+
? localIds
|
|
154
|
+
: [ref.expressId, ...localIds];
|
|
155
|
+
return ids.map((expressId) => ({ modelId: ref.modelId, expressId }));
|
|
183
156
|
}
|
|
184
157
|
|
|
185
158
|
return [ref];
|
|
@@ -286,21 +259,6 @@ function getExpandedSelectionRefs(state: ViewerStateSnapshot): EntityRef[] {
|
|
|
286
259
|
return dedupeRefs(baseRefs.flatMap((ref) => expandRefToElements(state, ref)));
|
|
287
260
|
}
|
|
288
261
|
|
|
289
|
-
/**
|
|
290
|
-
* Collect all descendant IfcSpace expressIds from a spatial node.
|
|
291
|
-
*/
|
|
292
|
-
function collectDescendantSpaceIds(node: SpatialNode): number[] {
|
|
293
|
-
const spaceIds: number[] = [];
|
|
294
|
-
for (const child of node.children || []) {
|
|
295
|
-
if (child.type === IfcTypeEnum.IfcSpace) {
|
|
296
|
-
spaceIds.push(child.expressId);
|
|
297
|
-
}
|
|
298
|
-
// Recurse into all children (spaces can nest under other spatial nodes)
|
|
299
|
-
spaceIds.push(...collectDescendantSpaceIds(child));
|
|
300
|
-
}
|
|
301
|
-
return spaceIds;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
262
|
/**
|
|
305
263
|
* Collect all element IDs for an IfcBuildingStorey, including elements
|
|
306
264
|
* contained in descendant IfcSpace nodes and the space geometry itself.
|
|
@@ -309,26 +267,39 @@ export function collectIfcBuildingStoreyElementsWithIfcSpace(
|
|
|
309
267
|
hierarchy: SpatialHierarchy,
|
|
310
268
|
storeyId: number
|
|
311
269
|
): number[] | null {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
270
|
+
if (!hierarchy.byStorey.has(storeyId)) return null;
|
|
271
|
+
return collectSpatialSubtreeElementsWithIfcSpace(hierarchy, storeyId);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export function collectSpatialSubtreeElementsWithIfcSpace(
|
|
275
|
+
hierarchy: SpatialHierarchy | undefined,
|
|
276
|
+
expressId: number
|
|
277
|
+
): number[] | null {
|
|
278
|
+
if (!hierarchy?.project) return null;
|
|
279
|
+
|
|
280
|
+
const startNode = findSpatialNode(hierarchy.project, expressId);
|
|
281
|
+
if (!startNode) return null;
|
|
282
|
+
|
|
283
|
+
const combined: number[] = [];
|
|
284
|
+
const seen = new Set<number>();
|
|
285
|
+
const stack: SpatialNode[] = [startNode];
|
|
286
|
+
|
|
287
|
+
while (stack.length > 0) {
|
|
288
|
+
const current = stack.pop()!;
|
|
289
|
+
if (current.type === IfcTypeEnum.IfcSpace && !seen.has(current.expressId)) {
|
|
290
|
+
seen.add(current.expressId);
|
|
291
|
+
combined.push(current.expressId);
|
|
292
|
+
}
|
|
293
|
+
for (const elementId of current.elements || []) {
|
|
294
|
+
if (seen.has(elementId)) continue;
|
|
295
|
+
seen.add(elementId);
|
|
296
|
+
combined.push(elementId);
|
|
297
|
+
}
|
|
298
|
+
for (const child of current.children || []) {
|
|
299
|
+
stack.push(child);
|
|
330
300
|
}
|
|
331
301
|
}
|
|
302
|
+
|
|
332
303
|
return combined;
|
|
333
304
|
}
|
|
334
305
|
|
|
@@ -508,7 +479,7 @@ export function getHierarchyBasketEntityRefsFromStore(): EntityRef[] {
|
|
|
508
479
|
if (selectionRefs.length > 0) {
|
|
509
480
|
const hasContainer = selectionRefs.some((ref) => {
|
|
510
481
|
const typeName = getEntityTypeName(state, ref);
|
|
511
|
-
return typeName
|
|
482
|
+
return isStoreyLikeSpatialTypeName(typeName) || (isSpatialStructureTypeName(typeName) && !isSpaceLikeSpatialTypeName(typeName));
|
|
512
483
|
});
|
|
513
484
|
if (hasContainer || getSelectionBaseRefs(state).length > 0) {
|
|
514
485
|
return selectionRefs;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import assert from 'node:assert/strict';
|
|
6
|
+
import { describe, it } from 'node:test';
|
|
7
|
+
import type { DataModel } from '@ifc-lite/server-client';
|
|
8
|
+
import { IfcTypeEnum } from '@ifc-lite/data';
|
|
9
|
+
import { convertServerDataModel, type ServerParseResult } from './serverDataModel';
|
|
10
|
+
|
|
11
|
+
const parseResult: ServerParseResult = {
|
|
12
|
+
cache_key: 'test',
|
|
13
|
+
metadata: {
|
|
14
|
+
schema_version: 'IFC4X3',
|
|
15
|
+
},
|
|
16
|
+
stats: {
|
|
17
|
+
total_time_ms: 1,
|
|
18
|
+
parse_time_ms: 1,
|
|
19
|
+
geometry_time_ms: 0,
|
|
20
|
+
total_vertices: 0,
|
|
21
|
+
total_triangles: 0,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
describe('convertServerDataModel', () => {
|
|
26
|
+
it('preserves IFC4.3 facility-part hierarchies from server spatial data', () => {
|
|
27
|
+
const dataModel: DataModel = {
|
|
28
|
+
entities: new Map([
|
|
29
|
+
[1, { entity_id: 1, type_name: 'IFCPROJECT', global_id: '0', name: 'Infra Project', has_geometry: false }],
|
|
30
|
+
[2, { entity_id: 2, type_name: 'IFCBRIDGE', global_id: '1', name: 'Bridge A', has_geometry: false }],
|
|
31
|
+
[3, { entity_id: 3, type_name: 'IFCBRIDGEPART', global_id: '2', name: 'Deck', has_geometry: false }],
|
|
32
|
+
[4, { entity_id: 4, type_name: 'IFCWALL', global_id: '3', name: 'Barrier', has_geometry: true }],
|
|
33
|
+
]),
|
|
34
|
+
propertySets: new Map(),
|
|
35
|
+
quantitySets: new Map(),
|
|
36
|
+
relationships: [
|
|
37
|
+
{ rel_type: 'IFCRELAGGREGATES', relating_id: 1, related_id: 2 },
|
|
38
|
+
{ rel_type: 'IFCRELAGGREGATES', relating_id: 2, related_id: 3 },
|
|
39
|
+
{ rel_type: 'IFCRELCONTAINEDINSPATIALSTRUCTURE', relating_id: 3, related_id: 4 },
|
|
40
|
+
],
|
|
41
|
+
spatialHierarchy: {
|
|
42
|
+
nodes: [
|
|
43
|
+
{
|
|
44
|
+
entity_id: 1,
|
|
45
|
+
parent_id: 0,
|
|
46
|
+
level: 0,
|
|
47
|
+
path: 'Infra Project',
|
|
48
|
+
type_name: 'IFCPROJECT',
|
|
49
|
+
name: 'Infra Project',
|
|
50
|
+
children_ids: [2],
|
|
51
|
+
element_ids: [],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
entity_id: 2,
|
|
55
|
+
parent_id: 1,
|
|
56
|
+
level: 1,
|
|
57
|
+
path: 'Infra Project/Bridge A',
|
|
58
|
+
type_name: 'IFCBRIDGE',
|
|
59
|
+
name: 'Bridge A',
|
|
60
|
+
children_ids: [3],
|
|
61
|
+
element_ids: [],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
entity_id: 3,
|
|
65
|
+
parent_id: 2,
|
|
66
|
+
level: 2,
|
|
67
|
+
path: 'Infra Project/Bridge A/Deck',
|
|
68
|
+
type_name: 'IFCBRIDGEPART',
|
|
69
|
+
name: 'Deck',
|
|
70
|
+
children_ids: [],
|
|
71
|
+
element_ids: [4],
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
project_id: 1,
|
|
75
|
+
element_to_storey: new Map(),
|
|
76
|
+
element_to_building: new Map([[4, 2]]),
|
|
77
|
+
element_to_site: new Map(),
|
|
78
|
+
element_to_space: new Map(),
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const dataStore = convertServerDataModel(dataModel, parseResult, { size: 1 }, []);
|
|
83
|
+
|
|
84
|
+
assert.equal(dataStore.spatialHierarchy?.project.children[0].type, IfcTypeEnum.IfcBridge);
|
|
85
|
+
assert.equal(dataStore.spatialHierarchy?.project.children[0].children[0].type, IfcTypeEnum.IfcBridgePart);
|
|
86
|
+
assert.deepEqual(dataStore.spatialHierarchy?.project.children[0].children[0].elements, [4]);
|
|
87
|
+
assert.deepEqual(dataStore.spatialHierarchy?.getPath(4).map((node) => node.expressId), [1, 2, 3]);
|
|
88
|
+
assert.deepEqual(dataStore.spatialHierarchy?.byBuilding.get(2), []);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -21,6 +21,8 @@ import {
|
|
|
21
21
|
EntityFlags,
|
|
22
22
|
PropertyValueType,
|
|
23
23
|
QuantityType,
|
|
24
|
+
isBuildingLikeSpatialType,
|
|
25
|
+
isStoreyLikeSpatialType,
|
|
24
26
|
type SpatialHierarchy,
|
|
25
27
|
type SpatialNode,
|
|
26
28
|
type EntityTable,
|
|
@@ -190,17 +192,17 @@ function buildSpatialHierarchy(
|
|
|
190
192
|
|
|
191
193
|
// Build lookup maps from spatial hierarchy data
|
|
192
194
|
for (const node of dataModel.spatialHierarchy.nodes) {
|
|
193
|
-
const
|
|
194
|
-
if (
|
|
195
|
+
const typeEnum = IfcTypeEnumFromString(node.type_name);
|
|
196
|
+
if (isStoreyLikeSpatialType(typeEnum)) {
|
|
195
197
|
byStorey.set(node.entity_id, node.element_ids);
|
|
196
198
|
if (node.elevation !== undefined) {
|
|
197
199
|
storeyElevations.set(node.entity_id, node.elevation);
|
|
198
200
|
}
|
|
199
|
-
} else if (
|
|
201
|
+
} else if (isBuildingLikeSpatialType(typeEnum)) {
|
|
200
202
|
byBuilding.set(node.entity_id, node.element_ids);
|
|
201
|
-
} else if (
|
|
203
|
+
} else if (typeEnum === IfcTypeEnum.IfcSite) {
|
|
202
204
|
bySite.set(node.entity_id, node.element_ids);
|
|
203
|
-
} else if (
|
|
205
|
+
} else if (typeEnum === IfcTypeEnum.IfcSpace) {
|
|
204
206
|
bySpace.set(node.entity_id, node.element_ids);
|
|
205
207
|
}
|
|
206
208
|
}
|
|
@@ -241,6 +243,20 @@ function buildSpatialHierarchy(
|
|
|
241
243
|
// Build project node tree
|
|
242
244
|
const projectNode = buildSpatialNodeTree(dataModel.spatialHierarchy.project_id, nodesMap);
|
|
243
245
|
|
|
246
|
+
const findPath = (node: SpatialNode, targetId: number, path: SpatialNode[] = []): SpatialNode[] => {
|
|
247
|
+
const nextPath = [...path, node];
|
|
248
|
+
if (node.elements.includes(targetId)) {
|
|
249
|
+
return nextPath;
|
|
250
|
+
}
|
|
251
|
+
for (const child of node.children) {
|
|
252
|
+
const childPath = findPath(child, targetId, nextPath);
|
|
253
|
+
if (childPath.length > 0) {
|
|
254
|
+
return childPath;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return [];
|
|
258
|
+
};
|
|
259
|
+
|
|
244
260
|
return {
|
|
245
261
|
project: projectNode,
|
|
246
262
|
byStorey,
|
|
@@ -265,35 +281,7 @@ function buildSpatialHierarchy(
|
|
|
265
281
|
return dataModel.spatialHierarchy.element_to_space.get(elementId) || null;
|
|
266
282
|
},
|
|
267
283
|
getPath: (elementId: number) => {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
// Find which spatial node contains this element
|
|
271
|
-
let containingNodeId: number | undefined;
|
|
272
|
-
for (const [spatialId, elements] of byStorey) {
|
|
273
|
-
if (elements.includes(elementId)) {
|
|
274
|
-
containingNodeId = spatialId;
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
if (!containingNodeId) {
|
|
279
|
-
for (const [spatialId, elements] of bySpace) {
|
|
280
|
-
if (elements.includes(elementId)) {
|
|
281
|
-
containingNodeId = spatialId;
|
|
282
|
-
break;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// Build path from containing node up to project
|
|
288
|
-
let currentId: number | undefined = containingNodeId;
|
|
289
|
-
while (currentId) {
|
|
290
|
-
const node = nodesMap.get(currentId);
|
|
291
|
-
if (!node) break;
|
|
292
|
-
path.unshift(buildSpatialNodeTree(currentId, nodesMap));
|
|
293
|
-
currentId = node.parent_id || undefined;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
return path;
|
|
284
|
+
return findPath(projectNode, elementId);
|
|
297
285
|
},
|
|
298
286
|
};
|
|
299
287
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import assert from 'node:assert/strict';
|
|
6
|
+
import { describe, it } from 'node:test';
|
|
7
|
+
import {
|
|
8
|
+
EntityTableBuilder,
|
|
9
|
+
IfcTypeEnum,
|
|
10
|
+
RelationshipGraphBuilder,
|
|
11
|
+
RelationshipType,
|
|
12
|
+
StringTable,
|
|
13
|
+
} from '@ifc-lite/data';
|
|
14
|
+
import { rebuildSpatialHierarchy } from './spatialHierarchy';
|
|
15
|
+
|
|
16
|
+
describe('rebuildSpatialHierarchy', () => {
|
|
17
|
+
it('preserves IFC4.3 facility-part trees during cache rebuilds', () => {
|
|
18
|
+
const strings = new StringTable();
|
|
19
|
+
const entities = new EntityTableBuilder(4, strings);
|
|
20
|
+
entities.add(1, 'IFCPROJECT', '0', 'Infra Project', '', '');
|
|
21
|
+
entities.add(2, 'IFCBRIDGE', '1', 'Bridge A', '', '');
|
|
22
|
+
entities.add(3, 'IFCBRIDGEPART', '2', 'Deck', '', '');
|
|
23
|
+
entities.add(4, 'IFCWALL', '3', 'Barrier', '', '', true);
|
|
24
|
+
|
|
25
|
+
const relationships = new RelationshipGraphBuilder();
|
|
26
|
+
relationships.addEdge(1, 2, RelationshipType.Aggregates, 10);
|
|
27
|
+
relationships.addEdge(2, 3, RelationshipType.Aggregates, 11);
|
|
28
|
+
relationships.addEdge(3, 4, RelationshipType.ContainsElements, 12);
|
|
29
|
+
|
|
30
|
+
const hierarchy = rebuildSpatialHierarchy(entities.build(), relationships.build());
|
|
31
|
+
assert.ok(hierarchy);
|
|
32
|
+
assert.equal(hierarchy.project.children[0].type, IfcTypeEnum.IfcBridge);
|
|
33
|
+
assert.equal(hierarchy.project.children[0].children[0].type, IfcTypeEnum.IfcBridgePart);
|
|
34
|
+
assert.deepEqual(hierarchy.project.children[0].children[0].elements, [4]);
|
|
35
|
+
assert.equal(hierarchy.elementToStorey.get(4), undefined);
|
|
36
|
+
assert.deepEqual(hierarchy.getPath(4).map((node) => node.expressId), [1, 2, 3]);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -11,21 +11,15 @@
|
|
|
11
11
|
import {
|
|
12
12
|
IfcTypeEnum,
|
|
13
13
|
RelationshipType,
|
|
14
|
+
isBuildingLikeSpatialType,
|
|
15
|
+
isSpatialStructureType,
|
|
16
|
+
isStoreyLikeSpatialType,
|
|
14
17
|
type SpatialHierarchy,
|
|
15
18
|
type SpatialNode,
|
|
16
19
|
type EntityTable,
|
|
17
20
|
type RelationshipGraph,
|
|
18
21
|
} from '@ifc-lite/data';
|
|
19
22
|
|
|
20
|
-
// Spatial structure types that form the IFC containment hierarchy
|
|
21
|
-
const SPATIAL_TYPES = new Set([
|
|
22
|
-
IfcTypeEnum.IfcProject,
|
|
23
|
-
IfcTypeEnum.IfcSite,
|
|
24
|
-
IfcTypeEnum.IfcBuilding,
|
|
25
|
-
IfcTypeEnum.IfcBuildingStorey,
|
|
26
|
-
IfcTypeEnum.IfcSpace,
|
|
27
|
-
]);
|
|
28
|
-
|
|
29
23
|
/**
|
|
30
24
|
* Rebuild spatial hierarchy from cache data (entities + relationships)
|
|
31
25
|
* OPTIMIZED: Uses index maps for O(1) lookups instead of O(n) linear searches
|
|
@@ -77,7 +71,7 @@ export function rebuildSpatialHierarchy(
|
|
|
77
71
|
// Filter out spatial structure elements - O(1) per element now!
|
|
78
72
|
const containedElements = rawContainedElements.filter((id) => {
|
|
79
73
|
const elemType = entityTypeMap.get(id);
|
|
80
|
-
return elemType !== undefined && !
|
|
74
|
+
return elemType !== undefined && !isSpatialStructureType(elemType);
|
|
81
75
|
});
|
|
82
76
|
|
|
83
77
|
// Get aggregated children via IfcRelAggregates
|
|
@@ -91,15 +85,15 @@ export function rebuildSpatialHierarchy(
|
|
|
91
85
|
const childNodes: SpatialNode[] = [];
|
|
92
86
|
for (const childId of aggregatedChildren) {
|
|
93
87
|
const childType = entityTypeMap.get(childId);
|
|
94
|
-
if (childType &&
|
|
88
|
+
if (childType && isSpatialStructureType(childType) && childType !== IfcTypeEnum.IfcProject) {
|
|
95
89
|
childNodes.push(buildNode(childId));
|
|
96
90
|
}
|
|
97
91
|
}
|
|
98
92
|
|
|
99
93
|
// Add elements to appropriate maps
|
|
100
|
-
if (typeEnum
|
|
94
|
+
if (isStoreyLikeSpatialType(typeEnum)) {
|
|
101
95
|
byStorey.set(expressId, containedElements);
|
|
102
|
-
} else if (typeEnum
|
|
96
|
+
} else if (isBuildingLikeSpatialType(typeEnum)) {
|
|
103
97
|
byBuilding.set(expressId, containedElements);
|
|
104
98
|
} else if (typeEnum === IfcTypeEnum.IfcSite) {
|
|
105
99
|
bySite.set(expressId, containedElements);
|
|
@@ -107,6 +101,12 @@ export function rebuildSpatialHierarchy(
|
|
|
107
101
|
bySpace.set(expressId, containedElements);
|
|
108
102
|
}
|
|
109
103
|
|
|
104
|
+
if (isStoreyLikeSpatialType(typeEnum)) {
|
|
105
|
+
for (const elementId of containedElements) {
|
|
106
|
+
elementToStorey.set(elementId, expressId);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
110
|
return {
|
|
111
111
|
expressId,
|
|
112
112
|
type: typeEnum,
|
|
@@ -118,13 +118,6 @@ export function rebuildSpatialHierarchy(
|
|
|
118
118
|
|
|
119
119
|
const projectNode = buildNode(projectId);
|
|
120
120
|
|
|
121
|
-
// Build reverse lookup map: elementId -> storeyId
|
|
122
|
-
for (const [storeyId, elementIds] of byStorey) {
|
|
123
|
-
for (const elementId of elementIds) {
|
|
124
|
-
elementToStorey.set(elementId, storeyId);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
121
|
// Pre-build space lookup for O(1) getContainingSpace
|
|
129
122
|
const elementToSpace = new Map<number, number>();
|
|
130
123
|
for (const [spaceId, elementIds] of bySpace) {
|
|
@@ -159,9 +152,6 @@ export function rebuildSpatialHierarchy(
|
|
|
159
152
|
|
|
160
153
|
getPath(elementId: number): SpatialNode[] {
|
|
161
154
|
const path: SpatialNode[] = [];
|
|
162
|
-
|
|
163
|
-
// DFS to find element in spatial tree
|
|
164
|
-
// Elements can be in SpatialNode.elements (e.g., IfcSpace) even if not in elementToStorey
|
|
165
155
|
const findPath = (node: SpatialNode, targetId: number): boolean => {
|
|
166
156
|
path.push(node);
|
|
167
157
|
if (node.elements.includes(targetId)) {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{s as Y}from"./workerHelpers-G7llXNMi.js";let _;function s(r){F===f.length&&f.push(f.length+1);const t=F;return F=f[t],f[t]=r,t}const W=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>r.dtor(r.a,r.b));function Z(r){r<132||(f[r]=F,F=r)}function z(r,t){return r=r>>>0,J().subarray(r/4,r/4+t)}function H(r,t){return r=r>>>0,K().subarray(r/4,r/4+t)}let y=null;function g(){return(y===null||y.buffer!==_.memory.buffer)&&(y=new DataView(_.memory.buffer)),y}let m=null;function J(){return(m===null||m.buffer!==_.memory.buffer)&&(m=new Float32Array(_.memory.buffer)),m}function d(r,t){return r=r>>>0,$(r,t)}let h=null;function K(){return(h===null||h.buffer!==_.memory.buffer)&&(h=new Uint32Array(_.memory.buffer)),h}let R=null;function S(){return(R===null||R.buffer!==_.memory.buffer)&&(R=new Uint8Array(_.memory.buffer)),R}function o(r){return f[r]}function w(r,t){try{return r.apply(this,t)}catch(e){_.__wbindgen_export(s(e))}}let f=new Array(128).fill(void 0);f.push(void 0,null,!0,!1);let F=f.length;function p(r){return r==null}function E(r,t,e,n){const i={a:r,b:t,cnt:1,dtor:e},a=(...c)=>{i.cnt++;const b=i.a;i.a=0;try{return n(b,i.b,...c)}finally{i.a=b,a._wbg_cb_unref()}};return a._wbg_cb_unref=()=>{--i.cnt===0&&(i.dtor(i.a,i.b),i.a=0,W.unregister(i))},W.register(a,i,i),a}function U(r,t,e){if(e===void 0){const b=v.encode(r),l=t(b.length,1)>>>0;return S().subarray(l,l+b.length).set(b),k=b.length,l}let n=r.length,i=t(n,1)>>>0;const a=S();let c=0;for(;c<n;c++){const b=r.charCodeAt(c);if(b>127)break;a[i+c]=b}if(c!==n){c!==0&&(r=r.slice(c)),i=e(i,n,n=c+r.length*3,1)>>>0;const b=S().subarray(i+c,i+n),l=v.encodeInto(r,b);c+=l.written,i=e(i,n,c,1)>>>0}return k=c,i}function u(r){const t=o(r);return Z(r),t}let x=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):void 0;x&&x.decode();const Q=2146435072;let L=0;function $(r,t){return L+=t,L>=Q&&(x=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),x.decode(),L=t),x.decode(S().slice(r,r+t))}const v=typeof TextEncoder<"u"?new TextEncoder:void 0;v&&(v.encodeInto=function(r,t){const e=v.encode(r);return t.set(e),{read:r.length,written:e.length}});let k=0;function B(r,t,e){_.__wasm_bindgen_func_elem_959(r,t,s(e))}function ee(r,t){_.__wasm_bindgen_func_elem_498(r,t)}function te(r,t,e,n){_.__wasm_bindgen_func_elem_1230(r,t,s(e),s(n))}typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>_.__wbg_georeferencejs_free(r>>>0,1));const C=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>_.__wbg_gpugeometry_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>_.__wbg_gpuinstancedgeometry_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>_.__wbg_gpuinstancedgeometrycollection_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>_.__wbg_gpuinstancedgeometryref_free(r>>>0,1));const P=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>_.__wbg_gpumeshmetadata_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>_.__wbg_ifcapi_free(r>>>0,1));const N=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>_.__wbg_instancedata_free(r>>>0,1)),q=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>_.__wbg_instancedgeometry_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>_.__wbg_instancedmeshcollection_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>_.__wbg_meshcollection_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>_.__wbg_meshcollectionwithrtc_free(r>>>0,1));const G=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>_.__wbg_meshdatajs_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>_.__wbg_rtcoffsetjs_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>_.__wbg_symboliccircle_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>_.__wbg_symbolicpolyline_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>_.__wbg_symbolicrepresentationcollection_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>_.__wbg_zerocopymesh_free(r>>>0,1));const V=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>_.__wbg_wbg_rayon_poolbuilder_free(r>>>0,1));class A{static __wrap(t){t=t>>>0;const e=Object.create(A.prototype);return e.__wbg_ptr=t,C.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,C.unregister(this),t}free(){const t=this.__destroy_into_raw();_.__wbg_gpugeometry_free(t,0)}get meshCount(){return _.gpugeometry_meshCount(this.__wbg_ptr)>>>0}get indicesLen(){return _.gpugeometry_indicesLen(this.__wbg_ptr)>>>0}get indicesPtr(){return _.gpugeometry_indicesPtr(this.__wbg_ptr)>>>0}get rtcOffsetX(){return _.gpugeometry_rtcOffsetX(this.__wbg_ptr)}get rtcOffsetY(){return _.gpugeometry_rtcOffsetY(this.__wbg_ptr)}get rtcOffsetZ(){return _.gpugeometry_rtcOffsetZ(this.__wbg_ptr)}get hasRtcOffset(){return _.gpugeometry_hasRtcOffset(this.__wbg_ptr)!==0}set_rtc_offset(t,e,n){_.gpugeometry_set_rtc_offset(this.__wbg_ptr,t,e,n)}get vertexDataLen(){return _.gpugeometry_vertexDataLen(this.__wbg_ptr)>>>0}get vertexDataPtr(){return _.gpugeometry_vertexDataPtr(this.__wbg_ptr)>>>0}getIfcTypeName(t){try{const i=_.__wbindgen_add_to_stack_pointer(-16);_.gpugeometry_getIfcTypeName(i,this.__wbg_ptr,t);var e=g().getInt32(i+4*0,!0),n=g().getInt32(i+4*1,!0);let a;return e!==0&&(a=d(e,n).slice(),_.__wbindgen_export2(e,n*1,1)),a}finally{_.__wbindgen_add_to_stack_pointer(16)}}getMeshMetadata(t){const e=_.gpugeometry_getMeshMetadata(this.__wbg_ptr,t);return e===0?void 0:I.__wrap(e)}get totalVertexCount(){return _.gpugeometry_totalVertexCount(this.__wbg_ptr)>>>0}get indicesByteLength(){return _.gpugeometry_indicesByteLength(this.__wbg_ptr)>>>0}get totalTriangleCount(){return _.gpugeometry_totalTriangleCount(this.__wbg_ptr)>>>0}get vertexDataByteLength(){return _.gpugeometry_vertexDataByteLength(this.__wbg_ptr)>>>0}constructor(){const t=_.gpugeometry_new();return this.__wbg_ptr=t>>>0,C.register(this,this.__wbg_ptr,this),this}get isEmpty(){return _.gpugeometry_isEmpty(this.__wbg_ptr)!==0}}Symbol.dispose&&(A.prototype[Symbol.dispose]=A.prototype.free);class I{static __wrap(t){t=t>>>0;const e=Object.create(I.prototype);return e.__wbg_ptr=t,P.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,P.unregister(this),t}free(){const t=this.__destroy_into_raw();_.__wbg_gpumeshmetadata_free(t,0)}get expressId(){return _.gpumeshmetadata_expressId(this.__wbg_ptr)>>>0}get indexCount(){return _.gpumeshmetadata_indexCount(this.__wbg_ptr)>>>0}get ifcTypeIdx(){return _.gpumeshmetadata_ifcTypeIdx(this.__wbg_ptr)}get indexOffset(){return _.gpumeshmetadata_indexOffset(this.__wbg_ptr)>>>0}get vertexCount(){return _.gpumeshmetadata_vertexCount(this.__wbg_ptr)>>>0}get vertexOffset(){return _.gpumeshmetadata_vertexOffset(this.__wbg_ptr)>>>0}get color(){try{const i=_.__wbindgen_add_to_stack_pointer(-16);_.gpumeshmetadata_color(i,this.__wbg_ptr);var t=g().getInt32(i+4*0,!0),e=g().getInt32(i+4*1,!0),n=z(t,e).slice();return _.__wbindgen_export2(t,e*4,4),n}finally{_.__wbindgen_add_to_stack_pointer(16)}}}Symbol.dispose&&(I.prototype[Symbol.dispose]=I.prototype.free);class j{static __wrap(t){t=t>>>0;const e=Object.create(j.prototype);return e.__wbg_ptr=t,N.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,N.unregister(this),t}free(){const t=this.__destroy_into_raw();_.__wbg_instancedata_free(t,0)}get expressId(){return _.instancedata_expressId(this.__wbg_ptr)>>>0}get color(){try{const i=_.__wbindgen_add_to_stack_pointer(-16);_.instancedata_color(i,this.__wbg_ptr);var t=g().getInt32(i+4*0,!0),e=g().getInt32(i+4*1,!0),n=z(t,e).slice();return _.__wbindgen_export2(t,e*4,4),n}finally{_.__wbindgen_add_to_stack_pointer(16)}}get transform(){const t=_.instancedata_transform(this.__wbg_ptr);return u(t)}}Symbol.dispose&&(j.prototype[Symbol.dispose]=j.prototype.free);class O{static __wrap(t){t=t>>>0;const e=Object.create(O.prototype);return e.__wbg_ptr=t,q.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,q.unregister(this),t}free(){const t=this.__destroy_into_raw();_.__wbg_instancedgeometry_free(t,0)}get geometryId(){const t=_.gpuinstancedgeometry_geometryId(this.__wbg_ptr);return BigInt.asUintN(64,t)}get_instance(t){const e=_.instancedgeometry_get_instance(this.__wbg_ptr,t);return e===0?void 0:j.__wrap(e)}get instance_count(){return _.instancedgeometry_instance_count(this.__wbg_ptr)>>>0}get indices(){const t=_.instancedgeometry_indices(this.__wbg_ptr);return u(t)}get normals(){const t=_.instancedgeometry_normals(this.__wbg_ptr);return u(t)}get positions(){const t=_.instancedgeometry_positions(this.__wbg_ptr);return u(t)}}Symbol.dispose&&(O.prototype[Symbol.dispose]=O.prototype.free);class T{static __wrap(t){t=t>>>0;const e=Object.create(T.prototype);return e.__wbg_ptr=t,G.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,G.unregister(this),t}free(){const t=this.__destroy_into_raw();_.__wbg_meshdatajs_free(t,0)}get expressId(){return _.meshdatajs_expressId(this.__wbg_ptr)>>>0}get vertexCount(){return _.meshdatajs_vertexCount(this.__wbg_ptr)>>>0}get triangleCount(){return _.meshdatajs_triangleCount(this.__wbg_ptr)>>>0}get color(){try{const i=_.__wbindgen_add_to_stack_pointer(-16);_.meshdatajs_color(i,this.__wbg_ptr);var t=g().getInt32(i+4*0,!0),e=g().getInt32(i+4*1,!0),n=z(t,e).slice();return _.__wbindgen_export2(t,e*4,4),n}finally{_.__wbindgen_add_to_stack_pointer(16)}}get indices(){const t=_.meshdatajs_indices(this.__wbg_ptr);return u(t)}get normals(){const t=_.meshdatajs_normals(this.__wbg_ptr);return u(t)}get ifcType(){let t,e;try{const a=_.__wbindgen_add_to_stack_pointer(-16);_.meshdatajs_ifcType(a,this.__wbg_ptr);var n=g().getInt32(a+4*0,!0),i=g().getInt32(a+4*1,!0);return t=n,e=i,d(n,i)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export2(t,e,1)}}get positions(){const t=_.meshdatajs_positions(this.__wbg_ptr);return u(t)}}Symbol.dispose&&(T.prototype[Symbol.dispose]=T.prototype.free);class M{static __wrap(t){t=t>>>0;const e=Object.create(M.prototype);return e.__wbg_ptr=t,V.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,V.unregister(this),t}free(){const t=this.__destroy_into_raw();_.__wbg_wbg_rayon_poolbuilder_free(t,0)}numThreads(){return _.wbg_rayon_poolbuilder_numThreads(this.__wbg_ptr)>>>0}build(){_.wbg_rayon_poolbuilder_build(this.__wbg_ptr)}receiver(){return _.wbg_rayon_poolbuilder_receiver(this.__wbg_ptr)>>>0}}Symbol.dispose&&(M.prototype[Symbol.dispose]=M.prototype.free);function se(r){_.wbg_rayon_start_worker(r)}const ne=new Set(["basic","cors","default"]);async function re(r,t){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,t)}catch(n){if(r.ok&&ne.has(r.type)&&r.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const e=await r.arrayBuffer();return await WebAssembly.instantiate(e,t)}else{const e=await WebAssembly.instantiate(r,t);return e instanceof WebAssembly.Instance?{instance:e,module:r}:e}}function _e(r){const t={};return t.wbg={},t.wbg.__wbg_Error_52673b7de5a0ca89=function(e,n){const i=Error(d(e,n));return s(i)},t.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd=function(e){return typeof o(e)=="function"},t.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269=function(e){return o(e)===void 0},t.wbg.__wbg___wbindgen_memory_a342e963fbcabd68=function(){const e=_.memory;return s(e)},t.wbg.__wbg___wbindgen_module_967adef62ea6cbf8=function(){const e=X.__wbindgen_wasm_module;return s(e)},t.wbg.__wbg___wbindgen_number_get_9619185a74197f95=function(e,n){const i=o(n),a=typeof i=="number"?i:void 0;g().setFloat64(e+8*1,p(a)?0:a,!0),g().setInt32(e+4*0,!p(a),!0)},t.wbg.__wbg___wbindgen_rethrow_78714972834ecdf1=function(e){throw u(e)},t.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e=function(e,n){throw new Error(d(e,n))},t.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7=function(e){o(e)._wbg_cb_unref()},t.wbg.__wbg_async_bba5a2ac54b734df=function(e){return o(e).async},t.wbg.__wbg_buffer_063cd102cc769a1c=function(e){const n=o(e).buffer;return s(n)},t.wbg.__wbg_call_3020136f7a2d6e44=function(){return w(function(e,n,i){const a=o(e).call(o(n),o(i));return s(a)},arguments)},t.wbg.__wbg_call_abb4ff46ce38be40=function(){return w(function(e,n){const i=o(e).call(o(n));return s(i)},arguments)},t.wbg.__wbg_call_c8baa5c5e72d274e=function(){return w(function(e,n,i,a){const c=o(e).call(o(n),o(i),o(a));return s(c)},arguments)},t.wbg.__wbg_clearTimeout_5a54f8841c30079a=function(e){const n=clearTimeout(u(e));return s(n)},t.wbg.__wbg_data_8bf4ae669a78a688=function(e){const n=o(e).data;return s(n)},t.wbg.__wbg_debug_9d0c87ddda3dc485=function(e){console.debug(o(e))},t.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,n){let i,a;try{i=e,a=n,console.error(d(e,n))}finally{_.__wbindgen_export2(i,a,1)}},t.wbg.__wbg_get_af9dab7e9603ea93=function(){return w(function(e,n){const i=Reflect.get(o(e),o(n));return s(i)},arguments)},t.wbg.__wbg_gpugeometry_new=function(e){const n=A.__wrap(e);return s(n)},t.wbg.__wbg_instancedgeometry_new=function(e){const n=O.__wrap(e);return s(n)},t.wbg.__wbg_instanceof_Window_b5cf7783caa68180=function(e){let n;try{n=o(e)instanceof Window}catch{n=!1}return n},t.wbg.__wbg_length_86ce4877baf913bb=function(e){return o(e).length},t.wbg.__wbg_length_d45040a40c570362=function(e){return o(e).length},t.wbg.__wbg_meshdatajs_new=function(e){const n=T.__wrap(e);return s(n)},t.wbg.__wbg_new_1ba21ce319a06297=function(){const e=new Object;return s(e)},t.wbg.__wbg_new_25f239778d6112b9=function(){const e=new Array;return s(e)},t.wbg.__wbg_new_53cb1e86c1ef5d2a=function(){return w(function(e,n){const i=new Worker(d(e,n));return s(i)},arguments)},t.wbg.__wbg_new_8a6f238a6ece86ea=function(){const e=new Error;return s(e)},t.wbg.__wbg_new_de1e660b88fc921f=function(e){const n=new Int32Array(o(e));return s(n)},t.wbg.__wbg_new_ff12d2b041fb48f1=function(e,n){try{var i={a:e,b:n},a=(b,l)=>{const D=i.a;i.a=0;try{return te(D,i.b,b,l)}finally{i.a=D}};const c=new Promise(a);return s(c)}finally{i.a=i.b=0}},t.wbg.__wbg_new_from_slice_41e2764a343e3cb1=function(e,n){const i=new Float32Array(z(e,n));return s(i)},t.wbg.__wbg_new_from_slice_db0691b69e9d3891=function(e,n){const i=new Uint32Array(H(e,n));return s(i)},t.wbg.__wbg_new_no_args_cb138f77cf6151ee=function(e,n){const i=new Function(d(e,n));return s(i)},t.wbg.__wbg_of_7779827fa663eec8=function(e,n,i){const a=Array.of(o(e),o(n),o(i));return s(a)},t.wbg.__wbg_postMessage_07504dbe15265d5c=function(){return w(function(e,n){o(e).postMessage(o(n))},arguments)},t.wbg.__wbg_prototypesetcall_96cc7097487b926d=function(e,n,i){Float32Array.prototype.set.call(z(e,n),o(i))},t.wbg.__wbg_push_7d9be8f38fc13975=function(e,n){return o(e).push(o(n))},t.wbg.__wbg_queueMicrotask_9b549dfce8865860=function(e){const n=o(e).queueMicrotask;return s(n)},t.wbg.__wbg_queueMicrotask_fca69f5bfad613a5=function(e){queueMicrotask(o(e))},t.wbg.__wbg_resolve_fd5bfbaa4ce36e1e=function(e){const n=Promise.resolve(o(e));return s(n)},t.wbg.__wbg_setTimeout_db2dbaeefb6f39c7=function(){return w(function(e,n){const i=setTimeout(o(e),n);return s(i)},arguments)},t.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,i){o(e)[u(n)]=u(i)},t.wbg.__wbg_set_781438a03c0c3c81=function(){return w(function(e,n,i){return Reflect.set(o(e),o(n),o(i))},arguments)},t.wbg.__wbg_set_7df433eea03a5c14=function(e,n,i){o(e)[n>>>0]=u(i)},t.wbg.__wbg_set_onmessage_deb94985de696ac7=function(e,n){o(e).onmessage=o(n)},t.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,n){const i=o(n).stack,a=U(i,_.__wbindgen_export3,_.__wbindgen_export4),c=k;g().setInt32(e+4*1,c,!0),g().setInt32(e+4*0,a,!0)},t.wbg.__wbg_startWorkers_2ca11761e08ff5d5=function(e,n,i){const a=Y(u(e),u(n),M.__wrap(i));return s(a)},t.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335=function(){const e=typeof global>"u"?null:global;return p(e)?0:s(e)},t.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1=function(){const e=typeof globalThis>"u"?null:globalThis;return p(e)?0:s(e)},t.wbg.__wbg_static_accessor_SELF_08f5a74c69739274=function(){const e=typeof self>"u"?null:self;return p(e)?0:s(e)},t.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024=function(){const e=typeof window>"u"?null:window;return p(e)?0:s(e)},t.wbg.__wbg_then_4f95312d68691235=function(e,n){const i=o(e).then(o(n));return s(i)},t.wbg.__wbg_value_4cd497eeadba94bd=function(e){const n=o(e).value;return s(n)},t.wbg.__wbg_waitAsync_8afec80ffd213eca=function(e,n,i){const a=Atomics.waitAsync(o(e),n>>>0,i);return s(a)},t.wbg.__wbg_waitAsync_c186cb97ffacd552=function(){const e=Atomics.waitAsync;return s(e)},t.wbg.__wbg_warn_6e567d0d926ff881=function(e){console.warn(o(e))},t.wbg.__wbindgen_cast_188ff5bafa3120b4=function(e,n){const i=E(e,n,_.__wasm_bindgen_func_elem_497,ee);return s(i)},t.wbg.__wbindgen_cast_2241b6af4c4b2941=function(e,n){const i=d(e,n);return s(i)},t.wbg.__wbindgen_cast_4625c577ab2ec9ee=function(e){const n=BigInt.asUintN(64,e);return s(n)},t.wbg.__wbindgen_cast_72f2309ca88b7133=function(e,n){const i=E(e,n,_.__wasm_bindgen_func_elem_958,B);return s(i)},t.wbg.__wbindgen_cast_96f117460864886d=function(e,n){const i=E(e,n,_.__wasm_bindgen_func_elem_958,B);return s(i)},t.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(e){return s(e)},t.wbg.__wbindgen_link_203404ece0e9bab9=function(e){const n=`onmessage = function (ev) {
|
|
2
|
-
let [ia, index, value] = ev.data;
|
|
3
|
-
ia = new Int32Array(ia.buffer);
|
|
4
|
-
let result = Atomics.wait(ia, index, value);
|
|
5
|
-
postMessage(result);
|
|
6
|
-
};
|
|
7
|
-
`,i=typeof URL.createObjectURL>"u"?"data:application/javascript,"+encodeURIComponent(n):URL.createObjectURL(new Blob([n],{type:"text/javascript"})),a=U(i,_.__wbindgen_export3,_.__wbindgen_export4),c=k;g().setInt32(e+4*1,c,!0),g().setInt32(e+4*0,a,!0)},t.wbg.__wbindgen_object_clone_ref=function(e){const n=o(e);return s(n)},t.wbg.__wbindgen_object_drop_ref=function(e){u(e)},t.wbg.memory=r||new WebAssembly.Memory({initial:20,maximum:65536,shared:!0}),t}function ie(r,t,e){if(_=r.exports,X.__wbindgen_wasm_module=t,y=null,m=null,h=null,R=null,typeof e<"u"&&(typeof e!="number"||e===0||e%65536!==0))throw"invalid stack size";return _.__wbindgen_start(e),_}async function X(r,t){if(_!==void 0)return _;let e;typeof r<"u"&&(Object.getPrototypeOf(r)===Object.prototype?{module_or_path:r,memory:t,thread_stack_size:e}=r:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof r>"u"&&(r=new URL("/assets/ifc-lite_bg-DeZrXTKQ.wasm",import.meta.url));const n=_e(t);(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:i,module:a}=await re(await r,n);return ie(i,a,e)}export{A as GpuGeometry,I as GpuMeshMetadata,j as InstanceData,O as InstancedGeometry,T as MeshDataJs,X as default,M as wbg_rayon_PoolBuilder,se as wbg_rayon_start_worker};
|
|
Binary file
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
let a;
|
|
2
|
-
let __tla = (async ()=>{
|
|
3
|
-
function o(r, t) {
|
|
4
|
-
return new Promise((e)=>{
|
|
5
|
-
r.addEventListener("message", function s({ data: n }) {
|
|
6
|
-
n?.type === t && (r.removeEventListener("message", s), e(n));
|
|
7
|
-
});
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
typeof self < "u" && o(self, "wasm_bindgen_worker_init").then(async ({ init: r, receiver: t })=>{
|
|
11
|
-
const e = await import("./ifc-lite-TI3u_Zyw.js");
|
|
12
|
-
await e.default(r), postMessage({
|
|
13
|
-
type: "wasm_bindgen_worker_ready"
|
|
14
|
-
}), e.wbg_rayon_start_worker(t);
|
|
15
|
-
});
|
|
16
|
-
a = async function(r, t, e) {
|
|
17
|
-
if (e.numThreads() === 0) throw new Error("num_threads must be > 0.");
|
|
18
|
-
const s = {
|
|
19
|
-
type: "wasm_bindgen_worker_init",
|
|
20
|
-
init: {
|
|
21
|
-
module_or_path: r,
|
|
22
|
-
memory: t
|
|
23
|
-
},
|
|
24
|
-
receiver: e.receiver()
|
|
25
|
-
};
|
|
26
|
-
await Promise.all(Array.from({
|
|
27
|
-
length: e.numThreads()
|
|
28
|
-
}, async ()=>{
|
|
29
|
-
const n = new Worker(self.location.href, {
|
|
30
|
-
type: "module"
|
|
31
|
-
});
|
|
32
|
-
return n.postMessage(s), await o(n, "wasm_bindgen_worker_ready"), n;
|
|
33
|
-
})), e.build();
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
export { a as s, __tla };
|