@ifc-lite/create 3.2.0 → 4.0.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 (149) hide show
  1. package/README.md +9 -0
  2. package/dist/in-store/auto-space-detect.d.ts +1 -1
  3. package/dist/in-store/auto-space-detect.js +1 -1
  4. package/dist/in-store/beam.d.ts +10 -1
  5. package/dist/in-store/beam.d.ts.map +1 -1
  6. package/dist/in-store/beam.js +14 -25
  7. package/dist/in-store/beam.js.map +1 -1
  8. package/dist/in-store/column.d.ts +10 -1
  9. package/dist/in-store/column.d.ts.map +1 -1
  10. package/dist/in-store/column.js +23 -22
  11. package/dist/in-store/column.js.map +1 -1
  12. package/dist/in-store/copy-frame.d.ts +52 -0
  13. package/dist/in-store/copy-frame.d.ts.map +1 -0
  14. package/dist/in-store/copy-frame.js +99 -0
  15. package/dist/in-store/copy-frame.js.map +1 -0
  16. package/dist/in-store/copy-product.d.ts +96 -0
  17. package/dist/in-store/copy-product.d.ts.map +1 -0
  18. package/dist/in-store/copy-product.js +318 -0
  19. package/dist/in-store/copy-product.js.map +1 -0
  20. package/dist/in-store/curtain-wall.d.ts +87 -0
  21. package/dist/in-store/curtain-wall.d.ts.map +1 -0
  22. package/dist/in-store/curtain-wall.js +237 -0
  23. package/dist/in-store/curtain-wall.js.map +1 -0
  24. package/dist/in-store/extract-grids.d.ts +46 -0
  25. package/dist/in-store/extract-grids.d.ts.map +1 -0
  26. package/dist/in-store/extract-grids.js +211 -0
  27. package/dist/in-store/extract-grids.js.map +1 -0
  28. package/dist/in-store/extract-walls.d.ts +12 -23
  29. package/dist/in-store/extract-walls.d.ts.map +1 -1
  30. package/dist/in-store/extract-walls.js +6 -69
  31. package/dist/in-store/extract-walls.js.map +1 -1
  32. package/dist/in-store/generate-spaces.d.ts +1 -1
  33. package/dist/in-store/grid.d.ts +118 -0
  34. package/dist/in-store/grid.d.ts.map +1 -0
  35. package/dist/in-store/grid.js +194 -0
  36. package/dist/in-store/grid.js.map +1 -0
  37. package/dist/in-store/host-geometry-frame.d.ts +44 -0
  38. package/dist/in-store/host-geometry-frame.d.ts.map +1 -0
  39. package/dist/in-store/host-geometry-frame.js +146 -0
  40. package/dist/in-store/host-geometry-frame.js.map +1 -0
  41. package/dist/in-store/hosted-element-edit.d.ts +29 -0
  42. package/dist/in-store/hosted-element-edit.d.ts.map +1 -0
  43. package/dist/in-store/hosted-element-edit.js +120 -0
  44. package/dist/in-store/hosted-element-edit.js.map +1 -0
  45. package/dist/in-store/hosted-element.d.ts +41 -0
  46. package/dist/in-store/hosted-element.d.ts.map +1 -0
  47. package/dist/in-store/hosted-element.js +124 -0
  48. package/dist/in-store/hosted-element.js.map +1 -0
  49. package/dist/in-store/hosted-fill-read.d.ts +56 -0
  50. package/dist/in-store/hosted-fill-read.d.ts.map +1 -0
  51. package/dist/in-store/hosted-fill-read.js +197 -0
  52. package/dist/in-store/hosted-fill-read.js.map +1 -0
  53. package/dist/in-store/hosted-global-id.d.ts +8 -0
  54. package/dist/in-store/hosted-global-id.d.ts.map +1 -0
  55. package/dist/in-store/hosted-global-id.js +53 -0
  56. package/dist/in-store/hosted-global-id.js.map +1 -0
  57. package/dist/in-store/hosted-placement-edit.d.ts +30 -0
  58. package/dist/in-store/hosted-placement-edit.d.ts.map +1 -0
  59. package/dist/in-store/hosted-placement-edit.js +123 -0
  60. package/dist/in-store/hosted-placement-edit.js.map +1 -0
  61. package/dist/in-store/hosted-scale-chain.d.ts +12 -0
  62. package/dist/in-store/hosted-scale-chain.d.ts.map +1 -0
  63. package/dist/in-store/hosted-scale-chain.js +74 -0
  64. package/dist/in-store/hosted-scale-chain.js.map +1 -0
  65. package/dist/in-store/hosted-shape-edit.d.ts +9 -0
  66. package/dist/in-store/hosted-shape-edit.d.ts.map +1 -0
  67. package/dist/in-store/hosted-shape-edit.js +79 -0
  68. package/dist/in-store/hosted-shape-edit.js.map +1 -0
  69. package/dist/in-store/index.d.ts +59 -0
  70. package/dist/in-store/index.d.ts.map +1 -0
  71. package/dist/in-store/index.js +64 -0
  72. package/dist/in-store/index.js.map +1 -0
  73. package/dist/in-store/member.d.ts +8 -2
  74. package/dist/in-store/member.d.ts.map +1 -1
  75. package/dist/in-store/member.js +12 -14
  76. package/dist/in-store/member.js.map +1 -1
  77. package/dist/in-store/placement-frame.d.ts +9 -4
  78. package/dist/in-store/placement-frame.d.ts.map +1 -1
  79. package/dist/in-store/placement-frame.js +20 -35
  80. package/dist/in-store/placement-frame.js.map +1 -1
  81. package/dist/in-store/profile.d.ts +141 -0
  82. package/dist/in-store/profile.d.ts.map +1 -0
  83. package/dist/in-store/profile.js +174 -0
  84. package/dist/in-store/profile.js.map +1 -0
  85. package/dist/in-store/railing.d.ts +65 -0
  86. package/dist/in-store/railing.d.ts.map +1 -0
  87. package/dist/in-store/railing.js +112 -0
  88. package/dist/in-store/railing.js.map +1 -0
  89. package/dist/in-store/rel-connects-path.d.ts +43 -0
  90. package/dist/in-store/rel-connects-path.d.ts.map +1 -0
  91. package/dist/in-store/rel-connects-path.js +65 -0
  92. package/dist/in-store/rel-connects-path.js.map +1 -0
  93. package/dist/in-store/resolve-host.d.ts +12 -1
  94. package/dist/in-store/resolve-host.d.ts.map +1 -1
  95. package/dist/in-store/resolve-host.js +169 -85
  96. package/dist/in-store/resolve-host.js.map +1 -1
  97. package/dist/in-store/resolve-source.d.ts.map +1 -1
  98. package/dist/in-store/resolve-source.js +39 -59
  99. package/dist/in-store/resolve-source.js.map +1 -1
  100. package/dist/in-store/schema-attributes.d.ts +5 -0
  101. package/dist/in-store/schema-attributes.d.ts.map +1 -1
  102. package/dist/in-store/schema-attributes.js +9 -2
  103. package/dist/in-store/schema-attributes.js.map +1 -1
  104. package/dist/in-store/space-footprints.d.ts +55 -0
  105. package/dist/in-store/space-footprints.d.ts.map +1 -0
  106. package/dist/in-store/space-footprints.js +260 -0
  107. package/dist/in-store/space-footprints.js.map +1 -0
  108. package/dist/in-store/space.d.ts.map +1 -1
  109. package/dist/in-store/space.js +15 -3
  110. package/dist/in-store/space.js.map +1 -1
  111. package/dist/in-store/spatial-children.d.ts +1 -1
  112. package/dist/in-store/spatial-children.js +1 -1
  113. package/dist/in-store/stair-edit.d.ts +24 -0
  114. package/dist/in-store/stair-edit.d.ts.map +1 -0
  115. package/dist/in-store/stair-edit.js +190 -0
  116. package/dist/in-store/stair-edit.js.map +1 -0
  117. package/dist/in-store/stair.d.ts +58 -0
  118. package/dist/in-store/stair.d.ts.map +1 -0
  119. package/dist/in-store/stair.js +156 -0
  120. package/dist/in-store/stair.js.map +1 -0
  121. package/dist/in-store/wall-join-apply.d.ts +74 -0
  122. package/dist/in-store/wall-join-apply.d.ts.map +1 -0
  123. package/dist/in-store/wall-join-apply.js +137 -0
  124. package/dist/in-store/wall-join-apply.js.map +1 -0
  125. package/dist/in-store/wall-join-edit.d.ts +70 -0
  126. package/dist/in-store/wall-join-edit.d.ts.map +1 -0
  127. package/dist/in-store/wall-join-edit.js +217 -0
  128. package/dist/in-store/wall-join-edit.js.map +1 -0
  129. package/dist/in-store/wall-join-read.d.ts +60 -0
  130. package/dist/in-store/wall-join-read.d.ts.map +1 -0
  131. package/dist/in-store/wall-join-read.js +230 -0
  132. package/dist/in-store/wall-join-read.js.map +1 -0
  133. package/dist/in-store/wall-join.d.ts +122 -0
  134. package/dist/in-store/wall-join.d.ts.map +1 -0
  135. package/dist/in-store/wall-join.js +231 -0
  136. package/dist/in-store/wall-join.js.map +1 -0
  137. package/dist/in-store/wall-opening-fit.d.ts +11 -0
  138. package/dist/in-store/wall-opening-fit.d.ts.map +1 -0
  139. package/dist/in-store/wall-opening-fit.js +27 -0
  140. package/dist/in-store/wall-opening-fit.js.map +1 -0
  141. package/dist/in-store/wall.d.ts +32 -0
  142. package/dist/in-store/wall.d.ts.map +1 -1
  143. package/dist/in-store/wall.js +77 -13
  144. package/dist/in-store/wall.js.map +1 -1
  145. package/dist/index.d.ts +1 -38
  146. package/dist/index.d.ts.map +1 -1
  147. package/dist/index.js +2 -40
  148. package/dist/index.js.map +1 -1
  149. package/package.json +6 -6
@@ -0,0 +1,146 @@
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
+ /** Package-private body frame reads: defaults belong only to omitted optional
5
+ * attributes, never to an explicit unreadable reference (#6232 / #6539). */
6
+ import { firstProjAxis } from '@ifc-lite/data';
7
+ /** Source extractors use numbers; overlay references use #id strings. */
8
+ export function refId(value) {
9
+ if (typeof value === 'number' && Number.isInteger(value) && value > 0)
10
+ return value;
11
+ if (typeof value === 'string' && /^#[1-9][0-9]*$/.test(value))
12
+ return Number(value.slice(1));
13
+ return null;
14
+ }
15
+ export function num(value) {
16
+ return typeof value === 'number' && Number.isFinite(value) ? value : null;
17
+ }
18
+ /** A 3D frame needs exactly three coordinates. A profile opts into two,
19
+ * embedded in XY; missing 3D coordinates must never be synthesized. */
20
+ export function vec3(value, dimension = 3) {
21
+ if (!Array.isArray(value) || value.length !== dimension)
22
+ return null;
23
+ const x = num(value[0]);
24
+ const y = num(value[1]);
25
+ const z = dimension === 3 ? num(value[2]) : 0;
26
+ return x === null || y === null || z === null ? null : [x, y, z];
27
+ }
28
+ export function pointOf(reader, ref, type = 'IFCCARTESIANPOINT', dimension = 3) {
29
+ const id = refId(ref);
30
+ const entity = id === null ? null : reader.entity(id);
31
+ return entity?.type.toUpperCase() === type ? vec3(entity.attributes[0], dimension) : null;
32
+ }
33
+ export function unit(v) {
34
+ const len = Math.hypot(v[0], v[1], v[2]);
35
+ return len > 1e-12 ? [v[0] / len, v[1] / len, v[2] / len] : null;
36
+ }
37
+ /** IfcAxis2Placement2D: Position is optional on a profile; Location is required. */
38
+ export function axis2d(reader, ref) {
39
+ if (ref === null || ref === undefined)
40
+ return { o: [0, 0], x: [1, 0] };
41
+ const id = refId(ref), placement = id === null ? null : reader.entity(id);
42
+ if (placement?.type.toUpperCase() !== 'IFCAXIS2PLACEMENT2D')
43
+ return null;
44
+ const o = pointOf(reader, placement.attributes[0], 'IFCCARTESIANPOINT', 2);
45
+ const refDirection = placement.attributes[1];
46
+ const dir = refDirection === null || refDirection === undefined ? [1, 0, 0] : pointOf(reader, refDirection, 'IFCDIRECTION', 2);
47
+ const x = dir ? unit([dir[0], dir[1], 0]) : null;
48
+ return o && x ? { o: [o[0], o[1]], x: [x[0], x[1]] } : null;
49
+ }
50
+ /** IfcAxis2Placement3D: only an omitted optional Position/Axis/RefDirection
51
+ * uses defaults. An explicit missing, zero or parallel axis is unreadable. */
52
+ export function axis3d(reader, ref) {
53
+ if (ref === null || ref === undefined)
54
+ return { o: [0, 0, 0], x: [1, 0, 0], y: [0, 1, 0], z: [0, 0, 1] };
55
+ const id = refId(ref), placement = id === null ? null : reader.entity(id);
56
+ if (placement?.type.toUpperCase() !== 'IFCAXIS2PLACEMENT3D')
57
+ return null;
58
+ const o = pointOf(reader, placement.attributes[0]);
59
+ const axis = placement.attributes[1], refDirection = placement.attributes[2];
60
+ const direction = axis === null || axis === undefined ? [0, 0, 1] : pointOf(reader, axis, 'IFCDIRECTION');
61
+ const z = direction ? unit(direction) : null;
62
+ if (!o || !z)
63
+ return null;
64
+ // An absent RefDirection uses the renderer's canonical fill (#5922).
65
+ const r = refDirection === null || refDirection === undefined ? firstProjAxis(z) : pointOf(reader, refDirection, 'IFCDIRECTION');
66
+ if (!r)
67
+ return null;
68
+ const dot = r[0] * z[0] + r[1] * z[1] + r[2] * z[2];
69
+ const x = unit([r[0] - dot * z[0], r[1] - dot * z[1], r[2] - dot * z[2]]);
70
+ if (!x)
71
+ return null;
72
+ const y = [z[1] * x[2] - z[2] * x[1], z[2] * x[0] - z[0] * x[2], z[0] * x[1] - z[1] * x[0]];
73
+ return { o, x, y, z };
74
+ }
75
+ export function applyFrame(f, p) {
76
+ return [
77
+ f.o[0] + f.x[0] * p[0] + f.y[0] * p[1] + f.z[0] * p[2],
78
+ f.o[1] + f.x[1] * p[0] + f.y[1] * p[1] + f.z[1] * p[2],
79
+ f.o[2] + f.x[2] * p[0] + f.y[2] * p[1] + f.z[2] * p[2],
80
+ ];
81
+ }
82
+ const IDENTITY_FRAME3 = { o: [0, 0, 0], x: [1, 0, 0], y: [0, 1, 0], z: [0, 0, 1] };
83
+ export function transformBounds(bounds, frame) {
84
+ const min = [Infinity, Infinity, Infinity], max = [-Infinity, -Infinity, -Infinity];
85
+ for (const x of [bounds.min[0], bounds.max[0]])
86
+ for (const y of [bounds.min[1], bounds.max[1]])
87
+ for (const z of [bounds.min[2], bounds.max[2]]) {
88
+ const p = applyFrame(frame, [x, y, z]);
89
+ for (let i = 0; i < 3; i++) {
90
+ min[i] = Math.min(min[i], p[i]);
91
+ max[i] = Math.max(max[i], p[i]);
92
+ }
93
+ }
94
+ return { min, max };
95
+ }
96
+ export function composeFrame(outer, inner) {
97
+ const direction = (p) => [0, 1, 2].map(i => outer.x[i] * p[0] + outer.y[i] * p[1] + outer.z[i] * p[2]);
98
+ return { o: applyFrame(outer, inner.o), x: direction(inner.x), y: direction(inner.y), z: direction(inner.z) };
99
+ }
100
+ /** Rigid placement inverse; axis3d supplies orthonormal placement axes. */
101
+ export function inverseFrame(f) {
102
+ return {
103
+ o: [f.x, f.y, f.z].map(v => -(v[0] * f.o[0] + v[1] * f.o[1] + v[2] * f.o[2])),
104
+ x: [f.x[0], f.y[0], f.z[0]], y: [f.x[1], f.y[1], f.z[1]], z: [f.x[2], f.y[2], f.z[2]],
105
+ };
106
+ }
107
+ /** Full 3D local-placement chain, including the opening's rotated frame.
108
+ * Missing references, cycles and excessive acyclic chains are unreadable. */
109
+ export function placementInAncestor(reader, placementId, ancestorId) {
110
+ let frame = IDENTITY_FRAME3;
111
+ let id = placementId;
112
+ const visited = new Set();
113
+ while (id !== null && id !== ancestorId) {
114
+ if (visited.size >= 10_000 || visited.has(id))
115
+ return null;
116
+ visited.add(id);
117
+ const placement = reader.entity(id);
118
+ const axisId = placement ? refId(placement.attributes[1]) : null;
119
+ if (placement?.type.toUpperCase() !== 'IFCLOCALPLACEMENT' || axisId === null)
120
+ return null;
121
+ const own = axis3d(reader, axisId);
122
+ if (!own)
123
+ return null;
124
+ frame = composeFrame(own, frame);
125
+ id = refId(placement.attributes[0]);
126
+ }
127
+ return id === ancestorId ? frame : null;
128
+ }
129
+ /** Subcontexts inherit CoordinateSpaceDimension from ParentContext. */
130
+ export function contextDimension(reader, contextId) {
131
+ let id = contextId;
132
+ const visited = new Set();
133
+ while (id !== null && visited.size < 10_000 && !visited.has(id)) {
134
+ visited.add(id);
135
+ const context = reader.entity(id);
136
+ if (context?.type.toUpperCase() === 'IFCGEOMETRICREPRESENTATIONCONTEXT') {
137
+ const dimension = context.attributes[2];
138
+ return dimension === 2 || dimension === 3 ? dimension : null;
139
+ }
140
+ if (context?.type.toUpperCase() !== 'IFCGEOMETRICREPRESENTATIONSUBCONTEXT')
141
+ return null;
142
+ id = refId(context.attributes[6]);
143
+ }
144
+ return null;
145
+ }
146
+ //# sourceMappingURL=host-geometry-frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-geometry-frame.js","sourceRoot":"","sources":["../../src/in-store/host-geometry-frame.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;4EAC4E;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAa/C,yEAAyE;AACzE,MAAM,UAAU,KAAK,CAAC,KAAc;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACpF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,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AO,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,sCAAsC;YAAE,OAAO,IAAI,CAAC;QACxF,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,29 @@
1
+ /** Shared hosted size/position commit (#6232). Resize the actual occurrence's
2
+ * geometry and its cut together, preserving the source's topology and style.
3
+ * Placement, movement and resize share one conservative fit/overlap decision. */
4
+ import type { IfcDataStore } from '@ifc-lite/parser';
5
+ import type { MutablePropertyView, StoreEditor } from '@ifc-lite/mutations';
6
+ import { type HostedFillRead } from './hosted-fill-read.js';
7
+ export interface HostedElementSize {
8
+ /** Effective IfcDoor / IfcWindow dimension, metres. Geometry supplies the
9
+ * dimension when the optional EXPRESS attribute is omitted. */
10
+ readonly OverallWidth: number;
11
+ readonly OverallHeight: number;
12
+ }
13
+ export interface HostedElementEdit {
14
+ readonly OverallWidth?: number;
15
+ readonly OverallHeight?: number;
16
+ /** Along the host's local X to the opening placement origin, metres. */
17
+ readonly Offset?: number;
18
+ /** Height of the opening placement origin in the host frame, metres. */
19
+ readonly Sill?: number;
20
+ }
21
+ /** Read through the effective overlay, including imported mapped geometry.
22
+ * A missing or unsupported physical shape is unreadable, never a rectangle. */
23
+ export declare function readHostedElementSize(store: IfcDataStore, id: number, view?: MutablePropertyView | null): HostedElementSize | null;
24
+ /** Atomic params-to-commit operation. Affine resizing is centred across the
25
+ * existing cut and held at its bottom; host thickness stays unchanged. Only
26
+ * the occurrence's Representation/placement/dimensions change, never its type
27
+ * maps, GlobalId, metadata or relationships. Refusals leave no overlay writes. */
28
+ export declare function editHostedElementInStore(store: IfcDataStore, editor: StoreEditor, id: number, patch: HostedElementEdit): HostedFillRead;
29
+ //# sourceMappingURL=hosted-element-edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-element-edit.d.ts","sourceRoot":"","sources":["../../src/in-store/hosted-element-edit.ts"],"names":[],"mappings":"AAIA;;iFAEiF;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAI5E,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAO5E,MAAM,WAAW,iBAAiB;IAChC;mEAC+D;IAC/D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,wEAAwE;IACxE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,wEAAwE;IACxE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AA4CD;+EAC+E;AAC/E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAAG,iBAAiB,GAAG,IAAI,CAElI;AAED;;;kFAGkF;AAClF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,cAAc,CAoDvI"}
@@ -0,0 +1,120 @@
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 { fromNativeLength, toNativeLength } from './anchor.js';
5
+ import { AnchorEntityReader } from './resolve-anchor.js';
6
+ import { localBodyExtent, placedBodyExtent, resolveHostAnchor } from './resolve-host.js';
7
+ import { readHostedFill } from './hosted-fill-read.js';
8
+ import { validateWallOpeningBounds } from './hosted-element.js';
9
+ import { scaleHostedShape } from './hosted-shape-edit.js';
10
+ import { moveHostedOpeningPlacement } from './hosted-placement-edit.js';
11
+ import { placementInAncestor, refId, transformBounds } from './host-geometry-frame.js';
12
+ import { safeLengthUnitScale } from './length-unit-scale.js';
13
+ function geometry(store, reader, id, view, withSize = true) {
14
+ const read = readHostedFill(store, id, view);
15
+ const host = read ? reader.entity(read.hostId) : null;
16
+ const hostPlacement = host ? refId(host.attributes[5]) : null;
17
+ const opening = read ? reader.entity(read.openingId) : null;
18
+ const openingPlacement = opening ? refId(opening.attributes[5]) : null;
19
+ const openingFrame = hostPlacement === null || openingPlacement === null ? null : placementInAncestor(reader, openingPlacement, hostPlacement);
20
+ const cut = read ? placedBodyExtent(store, read.openingId, view) : null;
21
+ if (!read || !cut || !openingFrame || hostPlacement === null)
22
+ return null;
23
+ if (read.fillingId === null)
24
+ return { read, cut, openingFrame, fillingFrame: null, size: null };
25
+ const filling = reader.entity(read.fillingId);
26
+ if (!filling || !['IFCDOOR', 'IFCWINDOW'].includes(filling.type.toUpperCase()))
27
+ return null;
28
+ const fillingPlacement = refId(filling.attributes[5]);
29
+ const fillingFrame = fillingPlacement === null ? null : placementInAncestor(reader, fillingPlacement, hostPlacement);
30
+ if (!fillingFrame)
31
+ return null;
32
+ // Movement needs a valid placement and opening, even when the filling's
33
+ // optional Body is absent or outside the conservative size reader (#6571).
34
+ if (!withSize)
35
+ return { read, cut, openingFrame, fillingFrame, size: null };
36
+ const local = localBodyExtent(store, read.fillingId, view);
37
+ if (!local)
38
+ return null;
39
+ const body = transformBounds(local, fillingFrame);
40
+ const scale = store.source.byteLength > 0 ? safeLengthUnitScale(store.source, store.entityIndex, 'readHostedElementSize') ?? 1 : 1;
41
+ const dimension = (name, axis) => {
42
+ const index = filling.names.indexOf(name);
43
+ const value = index < 0 ? null : filling.attributes[index];
44
+ const native = value === null || value === undefined ? body.max[axis] - body.min[axis] : value;
45
+ return typeof native === 'number' && Number.isFinite(native) && native > 0 ? fromNativeLength({ lengthUnitScale: scale }, native) : null;
46
+ };
47
+ const OverallWidth = dimension('OverallWidth', 0), OverallHeight = dimension('OverallHeight', 2);
48
+ return OverallWidth === null || OverallHeight === null ? null : {
49
+ read, cut, openingFrame, fillingFrame, size: { OverallWidth, OverallHeight },
50
+ };
51
+ }
52
+ /** Read through the effective overlay, including imported mapped geometry.
53
+ * A missing or unsupported physical shape is unreadable, never a rectangle. */
54
+ export function readHostedElementSize(store, id, view) {
55
+ return geometry(store, new AnchorEntityReader(store, view), id, view)?.size ?? null;
56
+ }
57
+ /** Atomic params-to-commit operation. Affine resizing is centred across the
58
+ * existing cut and held at its bottom; host thickness stays unchanged. Only
59
+ * the occurrence's Representation/placement/dimensions change, never its type
60
+ * maps, GlobalId, metadata or relationships. Refusals leave no overlay writes. */
61
+ export function editHostedElementInStore(store, editor, id, patch) {
62
+ if (!['IFC2X3', 'IFC4', 'IFC4X3'].includes(store.schemaVersion ?? 'IFC4'))
63
+ throw new Error('Hosted edits support IFC2X3, IFC4 and IFC4X3 only');
64
+ for (const [name, value] of Object.entries(patch)) {
65
+ if (value !== undefined && (!Number.isFinite(value) || ((name === 'OverallWidth' || name === 'OverallHeight') && value <= 0))) {
66
+ throw new Error(`${name} must be ${name.startsWith('Overall') ? 'positive and ' : ''}finite`);
67
+ }
68
+ }
69
+ return editor.runAtomic(draft => {
70
+ const view = draft.getMutationView(), reader = new AnchorEntityReader(store, view);
71
+ const sizing = patch.OverallWidth !== undefined || patch.OverallHeight !== undefined;
72
+ const current = geometry(store, reader, id, view, sizing);
73
+ if (!current)
74
+ throw new Error(`The hosted geometry of #${id} cannot be read, so the edit is refused`);
75
+ const { read, cut, size } = current;
76
+ const host = resolveHostAnchor(store, read.hostId, view);
77
+ if (host.hostKind !== 'wall')
78
+ throw new Error('Hosted size/position edits require a wall host');
79
+ if (sizing && !size)
80
+ throw new Error('Overall dimensions apply to a hosted IfcDoor or IfcWindow');
81
+ const widthScale = patch.OverallWidth === undefined || !size ? 1 : patch.OverallWidth / size.OverallWidth;
82
+ const heightScale = patch.OverallHeight === undefined || !size ? 1 : patch.OverallHeight / size.OverallHeight;
83
+ const dx = patch.Offset === undefined ? 0 : toNativeLength(host, patch.Offset) - read.location[0];
84
+ const dz = patch.Sill === undefined ? 0 : toNativeLength(host, patch.Sill) - read.location[2];
85
+ const anchor = [(cut.min[0] + cut.max[0]) / 2, (cut.min[1] + cut.max[1]) / 2, cut.min[2]];
86
+ const proposed = {
87
+ min: [anchor[0] + (cut.min[0] - anchor[0]) * widthScale + dx, cut.min[1], cut.min[2] + dz],
88
+ max: [anchor[0] + (cut.max[0] - anchor[0]) * widthScale + dx, cut.max[1], cut.min[2] + (cut.max[2] - cut.min[2]) * heightScale + dz],
89
+ };
90
+ validateWallOpeningBounds(store, view, host, proposed, read.openingId);
91
+ if (widthScale !== 1 || heightScale !== 1) {
92
+ scaleHostedShape(reader, draft, read.openingId, current.openingFrame, anchor, widthScale, heightScale);
93
+ if (read.fillingId !== null && current.fillingFrame) {
94
+ scaleHostedShape(reader, draft, read.fillingId, current.fillingFrame, anchor, widthScale, heightScale);
95
+ }
96
+ }
97
+ if (read.fillingId !== null && size) {
98
+ const filling = reader.entity(read.fillingId);
99
+ for (const name of ['OverallWidth', 'OverallHeight']) {
100
+ const value = patch[name], index = filling.names.indexOf(name);
101
+ if (value !== undefined) {
102
+ if (index < 0)
103
+ throw new Error(`${filling.type} has no ${name} attribute in this schema`);
104
+ draft.setPositionalAttribute(read.fillingId, index, toNativeLength(host, value));
105
+ }
106
+ }
107
+ }
108
+ if (dx !== 0 || dz !== 0)
109
+ moveHostedOpeningPlacement(reader, draft, read, [read.location[0] + dx, read.location[1], read.location[2] + dz]);
110
+ const updated = readHostedFill(store, id, view);
111
+ const actual = placedBodyExtent(store, read.openingId, view);
112
+ const eps = toNativeLength(host, 1e-6);
113
+ if (!updated || !actual || actual.min.some((value, axis) => Math.abs(value - proposed.min[axis]) > eps)
114
+ || actual.max.some((value, axis) => Math.abs(value - proposed.max[axis]) > eps)) {
115
+ throw new Error('The hosted edit cannot reproduce its validated bounds; all writes were rolled back');
116
+ }
117
+ return updated;
118
+ });
119
+ }
120
+ //# sourceMappingURL=hosted-element-edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-element-edit.js","sourceRoot":"","sources":["../../src/in-store/hosted-element-edit.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAO/D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAmB,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAuB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,eAAe,EAA0B,MAAM,0BAA0B,CAAC;AAC/G,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AA0B7D,SAAS,QAAQ,CAAC,KAAmB,EAAE,MAA0B,EAAE,EAAU,EAAE,IAAiC,EAAE,QAAQ,GAAG,IAAI;IAC/H,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACtD,MAAM,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CA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F,CAAC,CAAC;QACxG,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,41 @@
1
+ /** Params-to-commit core for hosted placement (#6232 D5). Hosts supply their
2
+ * editor and history/remesh policy; the IFC graph and refusal rules live here. */
3
+ import type { StoreEditor, MutablePropertyView } from '@ifc-lite/mutations';
4
+ import type { IfcDataStore } from '@ifc-lite/parser';
5
+ import { type HostAnchor, type HostBounds } from './anchor.js';
6
+ import { type OpeningInStoreParams } from './opening.js';
7
+ import { type HostedDoorInStoreParams, type HostedWindowInStoreParams } from './hosted-fill.js';
8
+ import { type HostedFillRead } from './hosted-fill-read.js';
9
+ export type HostedElementInStoreSpec = {
10
+ readonly kind: 'opening';
11
+ readonly params: OpeningInStoreParams;
12
+ } | {
13
+ readonly kind: 'door';
14
+ readonly params: HostedDoorInStoreParams;
15
+ } | {
16
+ readonly kind: 'window';
17
+ readonly params: HostedWindowInStoreParams;
18
+ };
19
+ export interface HostedElementInStoreResult {
20
+ readonly expressId: number;
21
+ readonly openingId: number;
22
+ readonly hostId: number;
23
+ }
24
+ export interface HostedOpeningExtent extends HostedFillRead {
25
+ /** Cut bounds in the host's placement frame, in the file's native units. */
26
+ readonly bounds: HostBounds;
27
+ }
28
+ /** Effective void relationships, including this session's creations, edits
29
+ * and deletions. Unreadable placement/geometry is reported rather than guessed. */
30
+ export declare function readHostOpeningExtents(store: IfcDataStore, hostId: number, view?: MutablePropertyView | null): {
31
+ cuts: HostedOpeningExtent[];
32
+ unreadable: number[];
33
+ };
34
+ /** Package-private fit/overlap decision shared by placement and edits. The
35
+ * selected cut alone is excluded; every other unreadable cut still refuses. */
36
+ export declare function validateWallOpeningBounds(store: IfcDataStore, view: MutablePropertyView, host: HostAnchor, proposed: HostBounds, excludeOpeningId?: number): void;
37
+ /** Write an opening or wall-hosted filling in one atomic overlay operation.
38
+ * The viewer, SDK and MCP share this core; callers group its mutation records
39
+ * into their own undo batch. Every refusal leaves the overlay unchanged. */
40
+ export declare function addHostedElementInStore(store: IfcDataStore, editor: StoreEditor, hostId: number, spec: HostedElementInStoreSpec): HostedElementInStoreResult;
41
+ //# sourceMappingURL=hosted-element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-element.d.ts","sourceRoot":"","sources":["../../src/in-store/hosted-element.ts"],"names":[],"mappings":"AAIA;kFACkF;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE/E,OAAO,EAAqB,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAEL,KAAK,uBAAuB,EAAE,KAAK,yBAAyB,EAC7D,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAK5E,MAAM,MAAM,wBAAwB,GAChC;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,GACnE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAA;CAAE,GACnE;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAA;CAAE,CAAC;AAE5E,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B;AAED;mFACmF;AACnF,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAChC;IAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAoBvD;AAuBD;+EAC+E;AAC/E,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,mBAAmB,EACzB,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,UAAU,EACpB,gBAAgB,CAAC,EAAE,MAAM,GACxB,IAAI,CAsBN;AAED;;4EAE4E;AAC5E,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,wBAAwB,GAC7B,0BAA0B,CAqB5B"}
@@ -0,0 +1,124 @@
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 { toNativeLength } from './anchor.js';
5
+ import { assertPositiveFinite } from './_emit-helpers.js';
6
+ import { addOpeningToStore } from './opening.js';
7
+ import { addHostedDoorToStore, addHostedWindowToStore, } from './hosted-fill.js';
8
+ import { readHostedFill } from './hosted-fill-read.js';
9
+ import { AnchorEntityReader } from './resolve-anchor.js';
10
+ import { placedBodyExtent, resolveHostAnchor } from './resolve-host.js';
11
+ import { assertHostedGlobalIdAvailable } from './hosted-global-id.js';
12
+ /** Effective void relationships, including this session's creations, edits
13
+ * and deletions. Unreadable placement/geometry is reported rather than guessed. */
14
+ export function readHostOpeningExtents(store, hostId, view) {
15
+ const reader = new AnchorEntityReader(store, view);
16
+ const cuts = [];
17
+ const unreadable = [];
18
+ for (const id of reader.ids('IFCRELVOIDSELEMENT')) {
19
+ const rel = reader.entity(id);
20
+ if (!rel) {
21
+ unreadable.push(id);
22
+ continue;
23
+ }
24
+ const relatingHost = refId(rel.attributes[4]);
25
+ // An unreadable host reference cannot establish that this cut belongs to
26
+ // a different wall, so fail conservatively instead of skipping it.
27
+ if (relatingHost === null) {
28
+ unreadable.push(id);
29
+ continue;
30
+ }
31
+ if (relatingHost !== hostId)
32
+ continue;
33
+ const openingId = refId(rel.attributes[5]);
34
+ if (openingId === null) {
35
+ unreadable.push(id);
36
+ continue;
37
+ }
38
+ const fill = readHostedFill(store, openingId, view);
39
+ const bounds = fill ? placedBodyExtent(store, openingId, view) : null;
40
+ if (!fill || fill.hostId !== hostId || !bounds)
41
+ unreadable.push(openingId);
42
+ else
43
+ cuts.push({ ...fill, bounds });
44
+ }
45
+ return { cuts, unreadable };
46
+ }
47
+ function refId(value) {
48
+ if (typeof value === 'number' && Number.isInteger(value) && value > 0)
49
+ return value;
50
+ return typeof value === 'string' && /^#[1-9][0-9]*$/.test(value) ? Number(value.slice(1)) : null;
51
+ }
52
+ function validateWallCut(store, view, host, spec) {
53
+ if (host.hostKind !== 'wall')
54
+ return; // Slab openings retain their existing builder contract.
55
+ const params = spec.params;
56
+ if (!('Offset' in params))
57
+ throw new Error('Hosted wall placement requires Offset, Width and Height');
58
+ assertPositiveFinite([params.Width, params.Height], 'Hosted wall placement: Width and Height must be positive');
59
+ const sill = params.Sill ?? 0;
60
+ if (!Number.isFinite(params.Offset) || !Number.isFinite(sill))
61
+ throw new Error('Hosted wall placement: Offset and Sill must be finite');
62
+ const bounds = host.hostBounds;
63
+ if (!bounds)
64
+ throw new Error(`The body of host #${host.hostId} cannot be read, so hosted placement is refused`);
65
+ const x = toNativeLength(host, params.Offset), w = toNativeLength(host, params.Width);
66
+ const z = toNativeLength(host, sill), h = toNativeLength(host, params.Height);
67
+ validateWallOpeningBounds(store, view, host, {
68
+ min: [x - w / 2, bounds.min[1], z], max: [x + w / 2, bounds.max[1], z + h],
69
+ });
70
+ }
71
+ /** Package-private fit/overlap decision shared by placement and edits. The
72
+ * selected cut alone is excluded; every other unreadable cut still refuses. */
73
+ export function validateWallOpeningBounds(store, view, host, proposed, excludeOpeningId) {
74
+ if (host.hostKind !== 'wall')
75
+ return;
76
+ if ([...proposed.min, ...proposed.max].some(value => !Number.isFinite(value))
77
+ || proposed.min.some((value, axis) => value >= proposed.max[axis])) {
78
+ throw new Error('Hosted opening bounds must be finite with positive dimensions');
79
+ }
80
+ const bounds = host.hostBounds;
81
+ if (!bounds)
82
+ throw new Error(`The body of host #${host.hostId} cannot be read, so hosted placement is refused`);
83
+ const eps = toNativeLength(host, 1e-6);
84
+ if (proposed.min[0] < bounds.min[0] - eps || proposed.max[0] > bounds.max[0] + eps
85
+ || proposed.min[2] < bounds.min[2] - eps || proposed.max[2] > bounds.max[2] + eps) {
86
+ throw new Error("It doesn't fit in this wall: change its offset or sill");
87
+ }
88
+ const existing = readHostOpeningExtents(store, host.hostId, view);
89
+ if (existing.unreadable.length) {
90
+ throw new Error(`Opening geometry ${existing.unreadable.map(id => `#${id}`).join(', ')} cannot be read, so hosted placement is refused`);
91
+ }
92
+ const overlap = existing.cuts.find(({ openingId, bounds: cut }) => openingId !== excludeOpeningId
93
+ && Math.min(proposed.max[0], cut.max[0]) - Math.max(proposed.min[0], cut.min[0]) > eps
94
+ && Math.min(proposed.max[2], cut.max[2]) - Math.max(proposed.min[2], cut.min[2]) > eps
95
+ && Math.min(bounds.max[1], proposed.max[1], cut.max[1]) - Math.max(bounds.min[1], proposed.min[1], cut.min[1]) > eps);
96
+ if (overlap)
97
+ throw new Error(`The new opening overlaps opening #${overlap.openingId} in wall #${host.hostId}`);
98
+ }
99
+ /** Write an opening or wall-hosted filling in one atomic overlay operation.
100
+ * The viewer, SDK and MCP share this core; callers group its mutation records
101
+ * into their own undo batch. Every refusal leaves the overlay unchanged. */
102
+ export function addHostedElementInStore(store, editor, hostId, spec) {
103
+ const schema = store.schemaVersion ?? 'IFC4';
104
+ if (!['IFC2X3', 'IFC4', 'IFC4X3'].includes(schema)) {
105
+ throw new Error(`Hosted placement supports IFC2X3, IFC4 and IFC4X3 only; ${schema} is refused`);
106
+ }
107
+ return editor.runAtomic(draft => {
108
+ const view = draft.getMutationView();
109
+ if (spec.params.GlobalId !== undefined) {
110
+ assertHostedGlobalIdAvailable(store, view, spec.params.GlobalId);
111
+ }
112
+ const host = resolveHostAnchor(store, hostId, view);
113
+ validateWallCut(store, view, host, spec);
114
+ if (spec.kind === 'opening') {
115
+ const opening = addOpeningToStore(draft, host, spec.params);
116
+ return { expressId: opening.openingId, openingId: opening.openingId, hostId };
117
+ }
118
+ const fill = spec.kind === 'door'
119
+ ? addHostedDoorToStore(draft, host, spec.params)
120
+ : addHostedWindowToStore(draft, host, spec.params);
121
+ return { expressId: fill.fillingId, openingId: fill.opening.openingId, hostId };
122
+ });
123
+ }
124
+ //# sourceMappingURL=hosted-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-element.js","sourceRoot":"","sources":["../../src/in-store/hosted-element.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAM/D,OAAO,EAAE,cAAc,EAAoC,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAA6B,MAAM,cAAc,CAAC;AAC5E,OAAO,EACL,oBAAoB,EAAE,sBAAsB,GAE7C,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAuB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAkBtE;mFACmF;AACnF,MAAM,UAAU,sBAAsB,CACpC,KAAmB,EACnB,MAAc,EACd,IAAiC;IAEjC,MAAM,MAAM,GAA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AAG,KAAK,CAAC,eAAe,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACvC,6BAA6B,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACpD,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,OAAO,GAAG,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC5D,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;QAChF,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,KAAK,MAAM;YAC/B,CAAC,CAAC,oBAAoB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YAChD,CAAC,CAAC,sBAAsB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACrD,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAClF,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Live reads for wall-hosted openings, doors and windows (#6232): the host
3
+ * wall's frame on its storey, and where an opening sits in its host.
4
+ *
5
+ * `addOpeningToStore` places the opening relative to the host's
6
+ * IfcLocalPlacement with its Location at `[Offset, …, Sill]` in the host's
7
+ * frame, and `addHostedDoorToStore` / `addHostedWindowToStore` place the
8
+ * filling relative to the opening. So a placing gesture needs the host's
9
+ * frame to turn a cursor into `Offset`, and an edit of Offset or Sill is one
10
+ * write to the opening's Location point: the filling follows it.
11
+ *
12
+ * Every read goes through the mutation overlay, so a wall or opening authored
13
+ * this session reads like one from the file, and a deleted one is gone.
14
+ */
15
+ import { type IfcDataStore } from '@ifc-lite/parser';
16
+ import type { MutablePropertyView } from '@ifc-lite/mutations';
17
+ export interface HostPlanFrame {
18
+ /** The host's placement origin, storey-local metres; z is its height above the storey's placement. */
19
+ origin: [number, number, number];
20
+ /** The host's local +X on the storey plane, unit length. */
21
+ axisX: [number, number];
22
+ }
23
+ /**
24
+ * The host's placement frame on storey `storeyExpressId`, composed through
25
+ * every `PlacementRelTo` hop the same way the storey's wall axes are
26
+ * (`extractWallSegmentsForStorey`), so a point read against one lines up
27
+ * with the other. Null when the host has no readable placement.
28
+ */
29
+ export declare function hostPlanFrame(store: IfcDataStore, hostExpressId: number, storeyExpressId: number, view?: MutablePropertyView | null): HostPlanFrame | null;
30
+ export interface HostedFillRead {
31
+ /** The voided wall or slab (IfcRelVoidsElement.RelatingBuildingElement). */
32
+ hostId: number;
33
+ openingId: number;
34
+ /** The IfcDoor / IfcWindow in the opening (IfcRelFillsElement); null for a bare opening. */
35
+ fillingId: number | null;
36
+ /** The opening placement's Location point: Offset is its x, Sill its z (native units). */
37
+ locationPointId: number;
38
+ /** Its current coordinates, native units. */
39
+ location: [number, number, number];
40
+ /** Along the host's local X to the opening's placement origin, metres (the centre, for an authored one). */
41
+ offset: number;
42
+ /** The opening's bottom above the host's placement origin, metres. */
43
+ sill: number;
44
+ }
45
+ /**
46
+ * Where an opening, or the door or window filling one, sits in its host.
47
+ * Null when `expressId` is neither, when it has no live host, or when the
48
+ * opening is not placed relative to its host (an absolutely placed opening
49
+ * has no offset along the wall to edit).
50
+ */
51
+ export declare function readHostedFill(store: IfcDataStore, expressId: number, view?: MutablePropertyView | null): HostedFillRead | null;
52
+ /** Package-private batch reader: one relation walk for any number of cuts.
53
+ * Reuses the single-read placement contract; source relations are indexed
54
+ * before the atomic writer starts moving any occurrence (#6232). */
55
+ export declare function readHostedOpeningBatch(store: IfcDataStore, openingIds: ReadonlySet<number>, view?: MutablePropertyView | null): ReadonlyMap<number, HostedFillRead | null>;
56
+ //# sourceMappingURL=hosted-fill-read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-fill-read.d.ts","sourceRoot":"","sources":["../../src/in-store/hosted-fill-read.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAa/D,MAAM,WAAW,aAAa;IAC5B,sGAAsG;IACtG,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,4DAA4D;IAC5D,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzB;AAQD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,YAAY,EACnB,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,EACvB,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAChC,aAAa,GAAG,IAAI,CAatB;AA6CD,MAAM,WAAW,cAAc;IAC7B,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,4FAA4F;IAC5F,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,0FAA0F;IAC1F,eAAe,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,4GAA4G;IAC5G,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;CACd;AAUD;;;;;GAKG;AACH,wBAAg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