@ifc-lite/ifcx 4.3.0 → 4.5.0

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.
Files changed (63) hide show
  1. package/README.md +12 -0
  2. package/dist/detect-format.d.ts +5 -0
  3. package/dist/detect-format.d.ts.map +1 -0
  4. package/dist/detect-format.js +33 -0
  5. package/dist/detect-format.js.map +1 -0
  6. package/dist/generated/imported-geometry-static.js +17116 -0
  7. package/dist/generated/imported-geometry.d.ts +2 -0
  8. package/dist/generated/imported-geometry.d.ts.map +1 -0
  9. package/dist/generated/imported-geometry.js +13 -0
  10. package/dist/generated/imported-geometry.js.map +1 -0
  11. package/dist/geometry-extractor.d.ts +2 -16
  12. package/dist/geometry-extractor.d.ts.map +1 -1
  13. package/dist/geometry-extractor.js +3 -299
  14. package/dist/geometry-extractor.js.map +1 -1
  15. package/dist/georeference.d.ts +17 -0
  16. package/dist/georeference.d.ts.map +1 -0
  17. package/dist/georeference.js +44 -0
  18. package/dist/georeference.js.map +1 -0
  19. package/dist/imported-graph-source.d.ts +13 -0
  20. package/dist/imported-graph-source.d.ts.map +1 -0
  21. package/dist/imported-graph-source.js +53 -0
  22. package/dist/imported-graph-source.js.map +1 -0
  23. package/dist/imported-graph.d.ts +13 -0
  24. package/dist/imported-graph.d.ts.map +1 -0
  25. package/dist/imported-graph.js +154 -0
  26. package/dist/imported-graph.js.map +1 -0
  27. package/dist/imported-kernel.d.ts +33 -0
  28. package/dist/imported-kernel.d.ts.map +1 -0
  29. package/dist/imported-kernel.js +172 -0
  30. package/dist/imported-kernel.js.map +1 -0
  31. package/dist/imported-scene.d.ts +7 -0
  32. package/dist/imported-scene.d.ts.map +1 -0
  33. package/dist/imported-scene.js +6 -0
  34. package/dist/imported-scene.js.map +1 -0
  35. package/dist/imported-snapshot.d.ts +3 -0
  36. package/dist/imported-snapshot.d.ts.map +1 -0
  37. package/dist/imported-snapshot.js +53 -0
  38. package/dist/imported-snapshot.js.map +1 -0
  39. package/dist/imported-source.d.ts +59 -0
  40. package/dist/imported-source.d.ts.map +1 -0
  41. package/dist/imported-source.js +96 -0
  42. package/dist/imported-source.js.map +1 -0
  43. package/dist/imported-wire.d.ts +35 -0
  44. package/dist/imported-wire.d.ts.map +1 -0
  45. package/dist/imported-wire.js +108 -0
  46. package/dist/imported-wire.js.map +1 -0
  47. package/dist/index.d.ts +3 -49
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +36 -51
  50. package/dist/index.js.map +1 -1
  51. package/dist/parse-result.d.ts +48 -0
  52. package/dist/parse-result.d.ts.map +1 -0
  53. package/dist/parse-result.js +5 -0
  54. package/dist/parse-result.js.map +1 -0
  55. package/dist/pointcloud-extractor.d.ts +14 -0
  56. package/dist/pointcloud-extractor.d.ts.map +1 -1
  57. package/dist/pointcloud-extractor.js +3 -176
  58. package/dist/pointcloud-extractor.js.map +1 -1
  59. package/package.json +6 -5
  60. package/dist/geometry-normals.d.ts +0 -29
  61. package/dist/geometry-normals.d.ts.map +0 -1
  62. package/dist/geometry-normals.js +0 -91
  63. package/dist/geometry-normals.js.map +0 -1
@@ -1,305 +1,9 @@
1
1
  /* This Source Code Form is subject to the terms of the Mozilla Public
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
- import { ATTR } from './types.js';
5
- import { IFCX_APPEARANCE, IFCX_IMAGE, createIfcxImageDecoder, decodeIfcxAppearance } from './appearance-wire.js';
6
- import { getNodeLineage, walkComposedFrames } from './traversal.js';
7
- import { computeNormalMatrix, computeNormals } from './geometry-normals.js';
8
- /**
9
- * Extract geometry from composed IFCX nodes.
10
- *
11
- * IFC5 geometry is pre-tessellated (unlike IFC4 parametric geometry),
12
- * so this is straightforward mesh extraction.
13
- *
14
- * Note: Meshes are often on child nodes (like "Body", "Axis") that don't
15
- * have their own bsi::ifc::class. We associate these with the closest
16
- * ancestor entity that has an expressId.
17
- *
18
- * Output geometry is converted to Y-up for the viewer.
19
- */
4
+ import { executeImportedGraph } from './imported-graph.js';
5
+ /** Synchronous no-setup adapter; Rust owns geometry planning and execution. */
20
6
  export function extractGeometry(composed, pathToId) {
21
- const meshes = [];
22
- const decodeImage = createIfcxImageDecoder();
23
- const contextByFrame = new WeakMap();
24
- const transformByFrame = new WeakMap();
25
- // A node reachable through multiple parents (e.g. storey→wall AND
26
- // space→wall containment edges, as our own exporter emits) is visited
27
- // once per traversal path, which used to duplicate its mesh — the
28
- // export round-trip multiplied triangle counts by the number of
29
- // incoming edges. Emit once per (node path, entity context, accumulated
30
- // transform, resolved presentation): two frames collapse only when
31
- // every lineage-derived output is identical, i.e. a true alias. A
32
- // shared type body reached from two instances (different expressIds),
33
- // genuine instancing (different transforms), or differently styled
34
- // ancestors (different resolved color) all still emit.
35
- const emitted = new Set();
36
- walkComposedFrames(composed, (frame) => {
37
- const inheritedContext = frame.parent ? contextByFrame.get(frame.parent) ?? null : null;
38
- const parentTransform = frame.parent ? transformByFrame.get(frame.parent) ?? null : null;
39
- const context = resolveContext(frame.node, inheritedContext, pathToId);
40
- // Canonicalize: an explicit identity usd::xformop and "no transform"
41
- // produce identical geometry and must dedupe against each other.
42
- const transform = canonicalizeTransform(combineTransforms(getNodeTransform(frame.node), parentTransform));
43
- const lineage = getNodeLineage(frame);
44
- contextByFrame.set(frame, context);
45
- transformByFrame.set(frame, transform);
46
- const mesh = frame.node.attributes.get(ATTR.MESH);
47
- if (mesh && context && !context.isTypeDefinition && !isInvisible(lineage)) {
48
- const color = resolvePresentation(lineage);
49
- const emitKey = [
50
- frame.node.path,
51
- context.expressId,
52
- transform ? transform.join(',') : 'identity',
53
- color ? color.join(',') : 'default',
54
- ].join('|');
55
- if (!emitted.has(emitKey)) {
56
- emitted.add(emitKey);
57
- const meshData = convertUsdMesh(mesh, context.expressId, context.ifcType, transform);
58
- const wire = frame.node.attributes.get(IFCX_APPEARANCE);
59
- if (wire !== undefined) {
60
- const appearance = decodeIfcxAppearance(wire, mesh.points.length);
61
- const pixels = decodeImage(appearance.image.ref, composed.get(appearance.image.ref)?.attributes.get(IFCX_IMAGE));
62
- meshData.uvs = new Float32Array(appearance.uvs);
63
- meshData.texture = { ...pixels, repeatS: appearance.repeatS, repeatT: appearance.repeatT };
64
- }
65
- if (color) {
66
- meshData.color = color;
67
- }
68
- meshes.push(meshData);
69
- }
70
- }
71
- });
72
- return meshes;
73
- }
74
- const IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
75
- /** Map an explicit identity matrix to null so it keys/behaves like "no transform". */
76
- function canonicalizeTransform(transform) {
77
- if (!transform)
78
- return null;
79
- for (let i = 0; i < 16; i++) {
80
- if (transform[i] !== IDENTITY_MATRIX[i])
81
- return transform;
82
- }
83
- return null;
84
- }
85
- function resolveContext(node, context, pathToId) {
86
- const ifcClass = node.attributes.get(ATTR.CLASS);
87
- const expressId = pathToId.get(node.path);
88
- if (expressId === undefined) {
89
- return context;
90
- }
91
- return {
92
- expressId,
93
- ifcType: ifcClass?.code,
94
- isTypeDefinition: (context?.isTypeDefinition ?? false) || isIfcTypeDefinition(node),
95
- };
96
- }
97
- /**
98
- * Convert USD mesh format to MeshData format.
99
- * Applies transform in Z-up space, then converts to Y-up for the viewer.
100
- */
101
- function convertUsdMesh(usd, expressId, ifcType, transform) {
102
- // The homogeneous denominator is validated per-vertex inside applyTransform
103
- // (a projective matrix can produce a bad w on points other than the first).
104
- // Process points: apply transform in Z-up space, then convert to Y-up
105
- const positions = new Float32Array(usd.points.length * 3);
106
- for (let i = 0; i < usd.points.length; i++) {
107
- const [x, y, z] = usd.points[i];
108
- // World position in Z-up space
109
- let wx, wy, wz;
110
- if (transform) {
111
- [wx, wy, wz] = applyTransform(x, y, z, transform);
112
- }
113
- else {
114
- wx = x;
115
- wy = y;
116
- wz = z;
117
- }
118
- // Convert from Z-up to Y-up: swap Y and Z
119
- // Z-up: X=right, Y=forward, Z=up
120
- // Y-up: X=right, Y=up, Z=back (negated for right-hand rule)
121
- positions[i * 3] = wx;
122
- positions[i * 3 + 1] = wz; // Y-up = Z from Z-up
123
- positions[i * 3 + 2] = -wy; // Z-back = -Y from Z-up
124
- }
125
- // Handle face vertex counts if present (for non-triangle faces)
126
- let indices;
127
- if (usd.faceVertexCounts && usd.faceVertexCounts.length > 0) {
128
- indices = triangulatePolygons(usd.faceVertexIndices, usd.faceVertexCounts);
129
- }
130
- else {
131
- // Already triangle indices
132
- indices = new Uint32Array(usd.faceVertexIndices);
133
- }
134
- // Compute or use provided normals
135
- const normals = usd.normals
136
- ? flattenNormals(usd.normals, transform)
137
- : computeNormals(positions, indices);
138
- return {
139
- expressId,
140
- ifcType,
141
- positions,
142
- indices,
143
- normals,
144
- color: [0.8, 0.8, 0.8, 1.0], // Default gray, will be overridden by presentation
145
- };
146
- }
147
- /**
148
- * Triangulate polygon faces into triangles.
149
- */
150
- function triangulatePolygons(faceVertexIndices, faceVertexCounts) {
151
- const triangles = [];
152
- let indexOffset = 0;
153
- for (const count of faceVertexCounts) {
154
- // Fan triangulation
155
- const v0 = faceVertexIndices[indexOffset];
156
- for (let i = 1; i < count - 1; i++) {
157
- triangles.push(v0);
158
- triangles.push(faceVertexIndices[indexOffset + i]);
159
- triangles.push(faceVertexIndices[indexOffset + i + 1]);
160
- }
161
- indexOffset += count;
162
- }
163
- return new Uint32Array(triangles);
164
- }
165
- /**
166
- * Get node-local transform matrix in Z-up space.
167
- */
168
- function getNodeTransform(node) {
169
- const xform = node.attributes.get(ATTR.TRANSFORM);
170
- return xform?.transform ? flattenMatrix(xform.transform) : null;
171
- }
172
- /**
173
- * Combine transforms using row-major, right-multiply order.
174
- * For point * matrix math: childWorld = point * child * parent * root.
175
- */
176
- function combineTransforms(nodeTransform, parentTransform) {
177
- if (!nodeTransform)
178
- return parentTransform;
179
- if (!parentTransform)
180
- return nodeTransform;
181
- return multiplyMatrices(nodeTransform, parentTransform);
182
- }
183
- /**
184
- * Flatten 2D matrix array to 1D Float32Array.
185
- */
186
- function flattenMatrix(m) {
187
- // USD uses row-major 4x4 matrices
188
- const result = new Float32Array(16);
189
- for (let row = 0; row < 4; row++) {
190
- for (let col = 0; col < 4; col++) {
191
- result[row * 4 + col] = m[row]?.[col] ?? (row === col ? 1 : 0);
192
- }
193
- }
194
- return result;
195
- }
196
- /**
197
- * Apply 4x4 transform matrix to a point.
198
- */
199
- function applyTransform(x, y, z, m) {
200
- // Row-major matrix multiplication with perspective divide. `w` is computed
201
- // per-vertex, so a projective/malformed usd::xformop can yield a zero or
202
- // non-finite denominator on *any* point — validate each, not just the first,
203
- // or the divide silently produces ±Infinity / NaN positions that poison the mesh.
204
- const w = m[3] * x + m[7] * y + m[11] * z + m[15];
205
- if (!Number.isFinite(w) || Math.abs(w) < 1e-12) {
206
- throw new Error('IFCx geometry: usd::xformop produces non-finite homogeneous w; matrix is malformed or singular');
207
- }
208
- return [
209
- (m[0] * x + m[4] * y + m[8] * z + m[12]) / w,
210
- (m[1] * x + m[5] * y + m[9] * z + m[13]) / w,
211
- (m[2] * x + m[6] * y + m[10] * z + m[14]) / w,
212
- ];
213
- }
214
- function isIfcTypeDefinition(node) {
215
- const customData = node.attributes.get('customdata');
216
- const originalStepInstance = customData?.originalStepInstance;
217
- if (typeof originalStepInstance !== 'string')
218
- return false;
219
- return /=[A-Za-z0-9_]*Type\(/i.test(originalStepInstance);
220
- }
221
- function isInvisible(lineage) {
222
- for (let i = lineage.length - 1; i >= 0; i--) {
223
- const current = lineage[i];
224
- const visibility = current.attributes.get(ATTR.VISIBILITY);
225
- if (typeof visibility?.visibility === 'string') {
226
- return visibility.visibility.toLowerCase() === 'invisible';
227
- }
228
- }
229
- return false;
230
- }
231
- /**
232
- * Resolve presentation attributes (color, opacity) from the lineage.
233
- * Returns null when no ancestor carries a diffuse color (caller keeps
234
- * the default). Resolved BEFORE mesh conversion so the dedupe key can
235
- * distinguish differently-styled traversal paths.
236
- */
237
- function resolvePresentation(lineage) {
238
- // Check this node and its ancestors for presentation attributes
239
- for (let i = lineage.length - 1; i >= 0; i--) {
240
- const current = lineage[i];
241
- const diffuse = current.attributes.get(ATTR.DIFFUSE_COLOR);
242
- const opacity = current.attributes.get(ATTR.OPACITY);
243
- if (diffuse) {
244
- const [r, g, b] = diffuse;
245
- const a = opacity ?? 1.0;
246
- return [r, g, b, a];
247
- }
248
- }
249
- return null;
250
- }
251
- /**
252
- * Flatten 2D normals array to 1D, transform, and convert to Y-up.
253
- */
254
- function flattenNormals(normals, transform) {
255
- const result = new Float32Array(normals.length * 3);
256
- const normalMatrix = transform ? computeNormalMatrix(transform) : null;
257
- for (let i = 0; i < normals.length; i++) {
258
- // Normal in Z-up space
259
- let [nx, ny, nz] = normals[i];
260
- if (normalMatrix) {
261
- // Transform by the inverse-transpose of the local-to-world linear
262
- // map (see computeNormalMatrix): using the map itself, as positions
263
- // do, only preserves perpendicularity to the surface when the map
264
- // is orthogonal (rotation/translation only) — a non-uniform-scale
265
- // or shearing usd::xformop rotates the normal off the surface.
266
- const tnx = nx * normalMatrix[0] + ny * normalMatrix[3] + nz * normalMatrix[6];
267
- const tny = nx * normalMatrix[1] + ny * normalMatrix[4] + nz * normalMatrix[7];
268
- const tnz = nx * normalMatrix[2] + ny * normalMatrix[5] + nz * normalMatrix[8];
269
- // Renormalize
270
- const len = Math.sqrt(tnx ** 2 + tny ** 2 + tnz ** 2);
271
- if (len > 0) {
272
- nx = tnx / len;
273
- ny = tny / len;
274
- nz = tnz / len;
275
- }
276
- else {
277
- nx = tnx;
278
- ny = tny;
279
- nz = tnz;
280
- }
281
- }
282
- // Convert from Z-up to Y-up (same as positions)
283
- result[i * 3] = nx;
284
- result[i * 3 + 1] = nz; // Y = Z
285
- result[i * 3 + 2] = -ny; // Z = -Y
286
- }
287
- return result;
288
- }
289
- /**
290
- * Multiply two 4x4 matrices (row-major).
291
- */
292
- function multiplyMatrices(a, b) {
293
- const result = new Float32Array(16);
294
- for (let row = 0; row < 4; row++) {
295
- for (let col = 0; col < 4; col++) {
296
- let sum = 0;
297
- for (let k = 0; k < 4; k++) {
298
- sum += a[row * 4 + k] * b[k * 4 + col];
299
- }
300
- result[row * 4 + col] = sum;
301
- }
302
- }
303
- return result;
7
+ return executeImportedGraph(composed, pathToId, 1).meshes;
304
8
  }
305
9
  //# sourceMappingURL=geometry-extractor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"geometry-extractor.js","sourceRoot":"","sources":["../src/geometry-extractor.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAa/D,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,sBAAsB,EAAE,oBAAoB,EAAmB,MAAM,sBAAsB,CAAC;AAClI,OAAO,EAAE,cAAc,EAAuB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAgB5E;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAmC,EACnC,QAA6B;IAE7B,MAAM,MAAM,GAAe,EAAE,CAAC;IAC9B,MAAM,WAAW,GAAG,sBAAsB,EAAE,CAAC;IAC7C,MAAM,cAAc,GAAG,IAAI,OAAO,EAA0C,CAAC;IAC7E,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAuC,CAAC;IAC5E,kEAAkE;IAClE,sEAAsE;IACtE,kEAAkE;IAClE,gEAAgE;IAChE,wEAAwE;IACxE,mEAAmE;IACnE,kEAAkE;IAClE,sEAAsE;IACtE,mEAAmE;IACnE,uDAAuD;IACvD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAElC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;QACrC,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IA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CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAK,SAAS;IACxC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAC,CAAe,EAAE,CAAe;IACxD,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC;IACpC,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;QACjC,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;YACjC,IAAI,GAAG,GAAG,CAAC,CAAC;YACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC3B,GAAG,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;YACzC,CAAC;YACD,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;QAC9B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"geometry-extractor.js","sourceRoot":"","sources":["../src/geometry-extractor.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAc/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAa3D,+EAA+E;AAC/E,MAAM,UAAU,eAAe,CAAC,QAAmC,EAAE,QAA6B;IAChG,OAAO,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { ComposedNode } from './types.js';
2
+ /** Canonical EXPRESS names on the wire; consumers map to their own georef types. */
3
+ export declare function extractGeoreference(composed: Map<string, ComposedNode>): {
4
+ IfcProjectedCRS: {
5
+ Name: string;
6
+ MapUnit: 'METRE';
7
+ };
8
+ IfcMapConversion: {
9
+ Eastings: number;
10
+ Northings: number;
11
+ OrthogonalHeight: number;
12
+ XAxisAbscissa: number;
13
+ XAxisOrdinate: number;
14
+ Scale: number;
15
+ };
16
+ } | undefined;
17
+ //# sourceMappingURL=georeference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"georeference.d.ts","sourceRoot":"","sources":["../src/georeference.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG;IACxE,eAAe,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IACpD,gBAAgB,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAC;QAChF,aAAa,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACjE,GAAG,SAAS,CAuBZ"}
@@ -0,0 +1,44 @@
1
+ /** Canonical EXPRESS names on the wire; consumers map to their own georef types. */
2
+ export function extractGeoreference(composed) {
3
+ let result;
4
+ for (const node of composed.values()) {
5
+ const value = node.attributes.get('ifclite::georeference::v1');
6
+ if (value === undefined)
7
+ continue;
8
+ const raw = object(value);
9
+ const crs = object(raw.IfcProjectedCRS);
10
+ const map = object(raw.IfcMapConversion);
11
+ if (typeof crs.Name !== 'string' || !/^EPSG:\d+$/.test(crs.Name) || crs.MapUnit !== 'METRE')
12
+ throw new Error('Invalid IFCX projected CRS.');
13
+ const Eastings = number(map.Eastings);
14
+ const Northings = number(map.Northings);
15
+ const OrthogonalHeight = number(map.OrthogonalHeight);
16
+ const XAxisAbscissa = number(map.XAxisAbscissa);
17
+ const XAxisOrdinate = number(map.XAxisOrdinate);
18
+ const Scale = number(map.Scale);
19
+ if (Scale <= 0 || Math.hypot(XAxisAbscissa, XAxisOrdinate) < 1e-12)
20
+ throw new Error('Invalid IFCX map conversion.');
21
+ const next = { IfcProjectedCRS: { Name: crs.Name, MapUnit: 'METRE' },
22
+ IfcMapConversion: { Eastings, Northings, OrthogonalHeight, XAxisAbscissa, XAxisOrdinate, Scale } };
23
+ const previous = result;
24
+ const coordinates = ['Eastings', 'Northings', 'OrthogonalHeight', 'XAxisAbscissa', 'XAxisOrdinate', 'Scale'];
25
+ if (previous && (previous.IfcProjectedCRS.Name !== next.IfcProjectedCRS.Name ||
26
+ coordinates.some(attribute => previous.IfcMapConversion[attribute] !== next.IfcMapConversion[attribute]))) {
27
+ throw new Error('IFCX contains conflicting model georeferences.');
28
+ }
29
+ // Composition can copy the same placement through inheritance (#6824).
30
+ result ??= next;
31
+ }
32
+ return result;
33
+ }
34
+ function object(value) {
35
+ if (!value || typeof value !== 'object' || Array.isArray(value))
36
+ throw new Error('Invalid IFCX georeference.');
37
+ return value;
38
+ }
39
+ function number(value) {
40
+ if (typeof value !== 'number' || !Number.isFinite(value))
41
+ throw new Error('Invalid IFCX georeference coordinate.');
42
+ return value;
43
+ }
44
+ //# sourceMappingURL=georeference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"georeference.js","sourceRoot":"","sources":["../src/georeference.ts"],"names":[],"mappings":"AAKA,oFAAoF;AACpF,MAAM,UAAU,mBAAmB,CAAC,QAAmC;IAKrE,IAAI,MAA8C,CAAC;IACnD,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;QAC/D,IAAI,KAAK,KAAK,SAAS;YAA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G,CAAC,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,CAAU,CAAC;QACtH,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,KAAK,IAAI,CAAC,eAAe,CAAC,IAAI;YACxE,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9G,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACpE,CAAC;QACD,uEAAuE;QACvE,MAAM,KAAK,IAAI,CAAC;IAClB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AACD,SAAS,MAAM,CAAC,KAAc;IAC5B,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC/G,OAAO,KAAgC,CAAC;AAC1C,CAAC;AACD,SAAS,MAAM,CAAC,KAAc;IAC5B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACnH,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type ComposedNode } from './types.js';
2
+ import { type TraversalFrame } from './traversal.js';
3
+ import { ImportWriter } from './imported-wire.js';
4
+ /** Snapshot ordered source edges. This enumerates source, never geometry work. */
5
+ export declare function sourceGraph(composed: Map<string, ComposedNode>): {
6
+ nodes: ComposedNode[];
7
+ indices: Map<ComposedNode, number>;
8
+ };
9
+ /** Only called when Rust requests this reached node's original attributes. */
10
+ export declare function writeNodeSource(writer: ImportWriter, node: ComposedNode, pathToId: Map<string, number>): void;
11
+ /** Existing format presentation authority; Rust chooses when it is reached. */
12
+ export declare function resolveImportedColor(frame: TraversalFrame): [number, number, number, number] | null;
13
+ //# sourceMappingURL=imported-graph-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imported-graph-source.d.ts","sourceRoot":"","sources":["../src/imported-graph-source.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,KAAK,YAAY,EAAqB,MAAM,YAAY,CAAC;AAExE,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC;;;EAS9D;AAED,8EAA8E;AAC9E,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAe7G;AAED,+EAA+E;AAC/E,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAQnG"}
@@ -0,0 +1,53 @@
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
+ import { ATTR } from './types.js';
5
+ import { POINTCLOUD_ATTR_KEYS } from '@ifc-lite/pointcloud';
6
+ import { getNodeLineage } from './traversal.js';
7
+ /** Snapshot ordered source edges. This enumerates source, never geometry work. */
8
+ export function sourceGraph(composed) {
9
+ const nodes = [...composed.values()];
10
+ const indices = new Map(nodes.map((node, index) => [node, index]));
11
+ for (let index = 0; index < nodes.length; index++) {
12
+ for (const child of nodes[index].children.values()) {
13
+ if (!indices.has(child)) {
14
+ indices.set(child, nodes.length);
15
+ nodes.push(child);
16
+ }
17
+ }
18
+ }
19
+ return { nodes, indices };
20
+ }
21
+ /** Only called when Rust requests this reached node's original attributes. */
22
+ export function writeNodeSource(writer, node, pathToId) {
23
+ const customData = node.attributes.get('customdata');
24
+ const original = customData?.originalStepInstance;
25
+ const visibility = node.attributes.get(ATTR.VISIBILITY)?.visibility;
26
+ const diffuse = node.attributes.get(ATTR.DIFFUSE_COLOR);
27
+ const opacity = node.attributes.get(ATTR.OPACITY);
28
+ const matrix = node.attributes.get(ATTR.TRANSFORM)?.transform;
29
+ writer.u32(pathToId.get(node.path) === undefined ? 0 : 1)
30
+ .optionalString(typeof original === 'string' ? original : undefined)
31
+ .optionalString(typeof visibility === 'string' ? visibility : undefined).u32(diffuse ? 1 : 0);
32
+ if (diffuse)
33
+ writer.values([diffuse[0], diffuse[1], diffuse[2]]);
34
+ writer.f64(opacity ?? 1).u32(matrix ? 1 : 0);
35
+ if (matrix)
36
+ writer.matrix(matrix);
37
+ writer.u32(node.attributes.get(ATTR.MESH) ? 1 : 0);
38
+ writer.u32([...POINTCLOUD_ATTR_KEYS].some(key => node.attributes.has(key)) ? 1 : 0);
39
+ }
40
+ /** Existing format presentation authority; Rust chooses when it is reached. */
41
+ export function resolveImportedColor(frame) {
42
+ const lineage = getNodeLineage(frame);
43
+ for (let i = lineage.length - 1; i >= 0; i--) {
44
+ const diffuse = lineage[i].attributes.get(ATTR.DIFFUSE_COLOR);
45
+ const opacity = lineage[i].attributes.get(ATTR.OPACITY);
46
+ if (diffuse) {
47
+ const [r, g, b] = diffuse;
48
+ return [r, g, b, opacity ?? 1];
49
+ }
50
+ }
51
+ return null;
52
+ }
53
+ //# sourceMappingURL=imported-graph-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imported-graph-source.js","sourceRoot":"","sources":["../src/imported-graph-source.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAC/D,OAAO,EAAE,IAAI,EAAwC,MAAM,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AAG,oBAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,oBAAoB,CAAC,KAAqB;IACxD,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACtC,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7C,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAyB,CAAC;QACtF,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAuB,CAAC;QAC9E,IAAI,OAAO,EAAE,CAAC;YAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC;YAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC;QAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type ComposedNode } from './types.js';
2
+ import type { MeshData } from './geometry-extractor.js';
3
+ import type { PointCloudExtraction } from './pointcloud-extractor.js';
4
+ /**
5
+ * The host supplies reached source/asset replies. Rust owns traversal, pass
6
+ * ordering, eligibility, occurrence identity, deduplication, numerical operations
7
+ * and completion. No host geometry walker or precomputed operation list exists.
8
+ */
9
+ export declare function executeImportedGraph(composed: Map<string, ComposedNode>, pathToId: Map<string, number>, mode: 1 | 2 | 3): {
10
+ meshes: MeshData[];
11
+ pointClouds: PointCloudExtraction[];
12
+ };
13
+ //# sourceMappingURL=imported-graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imported-graph.d.ts","sourceRoot":"","sources":["../src/imported-graph.ts"],"names":[],"mappings":"AAKA,OAAO,EAAQ,KAAK,YAAY,EAAgB,MAAM,YAAY,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAStE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC;;;EAqGvH"}