@ifc-lite/create 4.0.0 → 5.1.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.
Files changed (336) hide show
  1. package/README.md +34 -0
  2. package/dist/in-store/align-boxes.d.ts +38 -0
  3. package/dist/in-store/align-boxes.d.ts.map +1 -0
  4. package/dist/in-store/align-boxes.js +97 -0
  5. package/dist/in-store/align-boxes.js.map +1 -0
  6. package/dist/in-store/anchor.d.ts.map +1 -1
  7. package/dist/in-store/anchor.js +13 -2
  8. package/dist/in-store/anchor.js.map +1 -1
  9. package/dist/in-store/beam.d.ts.map +1 -1
  10. package/dist/in-store/beam.js +3 -10
  11. package/dist/in-store/beam.js.map +1 -1
  12. package/dist/in-store/copy-array.d.ts +17 -0
  13. package/dist/in-store/copy-array.d.ts.map +1 -0
  14. package/dist/in-store/copy-array.js +47 -0
  15. package/dist/in-store/copy-array.js.map +1 -0
  16. package/dist/in-store/copy-batch.d.ts +27 -0
  17. package/dist/in-store/copy-batch.d.ts.map +1 -0
  18. package/dist/in-store/copy-batch.js +101 -0
  19. package/dist/in-store/copy-batch.js.map +1 -0
  20. package/dist/in-store/copy-dependent-walk.d.ts +27 -0
  21. package/dist/in-store/copy-dependent-walk.d.ts.map +1 -0
  22. package/dist/in-store/copy-dependent-walk.js +61 -0
  23. package/dist/in-store/copy-dependent-walk.js.map +1 -0
  24. package/dist/in-store/copy-frame.d.ts +4 -3
  25. package/dist/in-store/copy-frame.d.ts.map +1 -1
  26. package/dist/in-store/copy-frame.js +14 -1
  27. package/dist/in-store/copy-frame.js.map +1 -1
  28. package/dist/in-store/copy-product.d.ts +0 -20
  29. package/dist/in-store/copy-product.d.ts.map +1 -1
  30. package/dist/in-store/copy-product.js +35 -35
  31. package/dist/in-store/copy-product.js.map +1 -1
  32. package/dist/in-store/duplicate.d.ts +8 -0
  33. package/dist/in-store/duplicate.d.ts.map +1 -1
  34. package/dist/in-store/duplicate.js +8 -1
  35. package/dist/in-store/duplicate.js.map +1 -1
  36. package/dist/in-store/edit/effective-mutation-view.d.ts +6 -0
  37. package/dist/in-store/edit/effective-mutation-view.d.ts.map +1 -0
  38. package/dist/in-store/edit/effective-mutation-view.js +45 -0
  39. package/dist/in-store/edit/effective-mutation-view.js.map +1 -0
  40. package/dist/in-store/edit/effective-storey.d.ts +13 -0
  41. package/dist/in-store/edit/effective-storey.d.ts.map +1 -0
  42. package/dist/in-store/edit/effective-storey.js +36 -0
  43. package/dist/in-store/edit/effective-storey.js.map +1 -0
  44. package/dist/in-store/edit/effective-storeys.d.ts +9 -0
  45. package/dist/in-store/edit/effective-storeys.d.ts.map +1 -0
  46. package/dist/in-store/edit/effective-storeys.js +16 -0
  47. package/dist/in-store/edit/effective-storeys.js.map +1 -0
  48. package/dist/in-store/edit/hosted-opening-refit.d.ts +29 -0
  49. package/dist/in-store/edit/hosted-opening-refit.d.ts.map +1 -0
  50. package/dist/in-store/edit/hosted-opening-refit.js +168 -0
  51. package/dist/in-store/edit/hosted-opening-refit.js.map +1 -0
  52. package/dist/in-store/edit/length-unit-scale.d.ts +24 -0
  53. package/dist/in-store/edit/length-unit-scale.d.ts.map +1 -0
  54. package/dist/in-store/edit/length-unit-scale.js +37 -0
  55. package/dist/in-store/edit/length-unit-scale.js.map +1 -0
  56. package/dist/in-store/edit/linear-element-edit.d.ts +131 -0
  57. package/dist/in-store/edit/linear-element-edit.d.ts.map +1 -0
  58. package/dist/in-store/edit/linear-element-edit.js +259 -0
  59. package/dist/in-store/edit/linear-element-edit.js.map +1 -0
  60. package/dist/in-store/edit/metadata-clone-effective.d.ts +5 -0
  61. package/dist/in-store/edit/metadata-clone-effective.d.ts.map +1 -0
  62. package/dist/in-store/edit/metadata-clone-effective.js +47 -0
  63. package/dist/in-store/edit/metadata-clone-effective.js.map +1 -0
  64. package/dist/in-store/edit/metadata-clone.d.ts +40 -0
  65. package/dist/in-store/edit/metadata-clone.d.ts.map +1 -0
  66. package/dist/in-store/edit/metadata-clone.js +142 -0
  67. package/dist/in-store/edit/metadata-clone.js.map +1 -0
  68. package/dist/in-store/edit/placement-core.d.ts +140 -0
  69. package/dist/in-store/edit/placement-core.d.ts.map +1 -0
  70. package/dist/in-store/edit/placement-core.js +317 -0
  71. package/dist/in-store/edit/placement-core.js.map +1 -0
  72. package/dist/in-store/edit/polygon-clip.d.ts +58 -0
  73. package/dist/in-store/edit/polygon-clip.d.ts.map +1 -0
  74. package/dist/in-store/edit/polygon-clip.js +153 -0
  75. package/dist/in-store/edit/polygon-clip.js.map +1 -0
  76. package/dist/in-store/edit/read-profile.d.ts +6 -0
  77. package/dist/in-store/edit/read-profile.d.ts.map +1 -0
  78. package/dist/in-store/edit/read-profile.js +95 -0
  79. package/dist/in-store/edit/read-profile.js.map +1 -0
  80. package/dist/in-store/edit/slab-edit-frame.d.ts +40 -0
  81. package/dist/in-store/edit/slab-edit-frame.d.ts.map +1 -0
  82. package/dist/in-store/edit/slab-edit-frame.js +146 -0
  83. package/dist/in-store/edit/slab-edit-frame.js.map +1 -0
  84. package/dist/in-store/edit/slab-edit.d.ts +112 -0
  85. package/dist/in-store/edit/slab-edit.d.ts.map +1 -0
  86. package/dist/in-store/edit/slab-edit.js +275 -0
  87. package/dist/in-store/edit/slab-edit.js.map +1 -0
  88. package/dist/in-store/edit/slab-opening-carry.d.ts +10 -0
  89. package/dist/in-store/edit/slab-opening-carry.d.ts.map +1 -0
  90. package/dist/in-store/edit/slab-opening-carry.js +65 -0
  91. package/dist/in-store/edit/slab-opening-carry.js.map +1 -0
  92. package/dist/in-store/edit/split-guid.d.ts +29 -0
  93. package/dist/in-store/edit/split-guid.d.ts.map +1 -0
  94. package/dist/in-store/edit/split-guid.js +64 -0
  95. package/dist/in-store/edit/split-guid.js.map +1 -0
  96. package/dist/in-store/edit/split-target.d.ts +90 -0
  97. package/dist/in-store/edit/split-target.d.ts.map +1 -0
  98. package/dist/in-store/edit/split-target.js +116 -0
  99. package/dist/in-store/edit/split-target.js.map +1 -0
  100. package/dist/in-store/edit/target.d.ts +8 -0
  101. package/dist/in-store/edit/target.d.ts.map +1 -0
  102. package/dist/in-store/edit/target.js +5 -0
  103. package/dist/in-store/edit/target.js.map +1 -0
  104. package/dist/in-store/edit/trim-extend-geometry.d.ts +99 -0
  105. package/dist/in-store/edit/trim-extend-geometry.d.ts.map +1 -0
  106. package/dist/in-store/edit/trim-extend-geometry.js +105 -0
  107. package/dist/in-store/edit/trim-extend-geometry.js.map +1 -0
  108. package/dist/in-store/edit/wall-axis-edit.d.ts +16 -0
  109. package/dist/in-store/edit/wall-axis-edit.d.ts.map +1 -0
  110. package/dist/in-store/edit/wall-axis-edit.js +40 -0
  111. package/dist/in-store/edit/wall-axis-edit.js.map +1 -0
  112. package/dist/in-store/edit/wall-edit.d.ts +157 -0
  113. package/dist/in-store/edit/wall-edit.d.ts.map +1 -0
  114. package/dist/in-store/edit/wall-edit.js +276 -0
  115. package/dist/in-store/edit/wall-edit.js.map +1 -0
  116. package/dist/in-store/edit/wall-hosted-cuts.d.ts +35 -0
  117. package/dist/in-store/edit/wall-hosted-cuts.d.ts.map +1 -0
  118. package/dist/in-store/edit/wall-hosted-cuts.js +27 -0
  119. package/dist/in-store/edit/wall-hosted-cuts.js.map +1 -0
  120. package/dist/in-store/edit/wall-opening-reassign.d.ts +18 -0
  121. package/dist/in-store/edit/wall-opening-reassign.d.ts.map +1 -0
  122. package/dist/in-store/edit/wall-opening-reassign.js +50 -0
  123. package/dist/in-store/edit/wall-opening-reassign.js.map +1 -0
  124. package/dist/in-store/element-align.d.ts +13 -0
  125. package/dist/in-store/element-align.d.ts.map +1 -0
  126. package/dist/in-store/element-align.js +90 -0
  127. package/dist/in-store/element-align.js.map +1 -0
  128. package/dist/in-store/element-replacement.d.ts +26 -0
  129. package/dist/in-store/element-replacement.d.ts.map +1 -0
  130. package/dist/in-store/element-replacement.js +68 -0
  131. package/dist/in-store/element-replacement.js.map +1 -0
  132. package/dist/in-store/element-size-edit.d.ts +40 -0
  133. package/dist/in-store/element-size-edit.d.ts.map +1 -0
  134. package/dist/in-store/element-size-edit.js +103 -0
  135. package/dist/in-store/element-size-edit.js.map +1 -0
  136. package/dist/in-store/element-split-axis.d.ts +6 -0
  137. package/dist/in-store/element-split-axis.d.ts.map +1 -0
  138. package/dist/in-store/element-split-axis.js +87 -0
  139. package/dist/in-store/element-split-axis.js.map +1 -0
  140. package/dist/in-store/element-split-joined.d.ts +13 -0
  141. package/dist/in-store/element-split-joined.d.ts.map +1 -0
  142. package/dist/in-store/element-split-joined.js +74 -0
  143. package/dist/in-store/element-split-joined.js.map +1 -0
  144. package/dist/in-store/element-split-placement.d.ts +19 -0
  145. package/dist/in-store/element-split-placement.d.ts.map +1 -0
  146. package/dist/in-store/element-split-placement.js +48 -0
  147. package/dist/in-store/element-split-placement.js.map +1 -0
  148. package/dist/in-store/element-split-slab.d.ts +19 -0
  149. package/dist/in-store/element-split-slab.d.ts.map +1 -0
  150. package/dist/in-store/element-split-slab.js +86 -0
  151. package/dist/in-store/element-split-slab.js.map +1 -0
  152. package/dist/in-store/element-split.d.ts +49 -0
  153. package/dist/in-store/element-split.d.ts.map +1 -0
  154. package/dist/in-store/element-split.js +52 -0
  155. package/dist/in-store/element-split.js.map +1 -0
  156. package/dist/in-store/element-transform-edit.d.ts +33 -0
  157. package/dist/in-store/element-transform-edit.d.ts.map +1 -0
  158. package/dist/in-store/element-transform-edit.js +97 -0
  159. package/dist/in-store/element-transform-edit.js.map +1 -0
  160. package/dist/in-store/element-transform-frames.d.ts +45 -0
  161. package/dist/in-store/element-transform-frames.d.ts.map +1 -0
  162. package/dist/in-store/element-transform-frames.js +121 -0
  163. package/dist/in-store/element-transform-frames.js.map +1 -0
  164. package/dist/in-store/element-transform-joins.d.ts +4 -0
  165. package/dist/in-store/element-transform-joins.d.ts.map +1 -0
  166. package/dist/in-store/element-transform-joins.js +62 -0
  167. package/dist/in-store/element-transform-joins.js.map +1 -0
  168. package/dist/in-store/element-transform-plan.d.ts +38 -0
  169. package/dist/in-store/element-transform-plan.d.ts.map +1 -0
  170. package/dist/in-store/element-transform-plan.js +115 -0
  171. package/dist/in-store/element-transform-plan.js.map +1 -0
  172. package/dist/in-store/element-trim-extend.d.ts +25 -0
  173. package/dist/in-store/element-trim-extend.d.ts.map +1 -0
  174. package/dist/in-store/element-trim-extend.js +97 -0
  175. package/dist/in-store/element-trim-extend.js.map +1 -0
  176. package/dist/in-store/extract-grids.d.ts +7 -17
  177. package/dist/in-store/extract-grids.d.ts.map +1 -1
  178. package/dist/in-store/extract-grids.js +11 -2
  179. package/dist/in-store/extract-grids.js.map +1 -1
  180. package/dist/in-store/grid-column.d.ts +23 -0
  181. package/dist/in-store/grid-column.d.ts.map +1 -0
  182. package/dist/in-store/grid-column.js +73 -0
  183. package/dist/in-store/grid-column.js.map +1 -0
  184. package/dist/in-store/grid-intersection-read.d.ts +10 -0
  185. package/dist/in-store/grid-intersection-read.d.ts.map +1 -0
  186. package/dist/in-store/grid-intersection-read.js +45 -0
  187. package/dist/in-store/grid-intersection-read.js.map +1 -0
  188. package/dist/in-store/grid.d.ts +7 -1
  189. package/dist/in-store/grid.d.ts.map +1 -1
  190. package/dist/in-store/grid.js +12 -2
  191. package/dist/in-store/grid.js.map +1 -1
  192. package/dist/in-store/group-evidence.d.ts +49 -0
  193. package/dist/in-store/group-evidence.d.ts.map +1 -0
  194. package/dist/in-store/group-evidence.js +111 -0
  195. package/dist/in-store/group-evidence.js.map +1 -0
  196. package/dist/in-store/group-graph.d.ts +51 -0
  197. package/dist/in-store/group-graph.d.ts.map +1 -0
  198. package/dist/in-store/group-graph.js +207 -0
  199. package/dist/in-store/group-graph.js.map +1 -0
  200. package/dist/in-store/group.d.ts +34 -0
  201. package/dist/in-store/group.d.ts.map +1 -0
  202. package/dist/in-store/group.js +181 -0
  203. package/dist/in-store/group.js.map +1 -0
  204. package/dist/in-store/host-geometry-frame.d.ts +5 -1
  205. package/dist/in-store/host-geometry-frame.d.ts.map +1 -1
  206. package/dist/in-store/host-geometry-frame.js +58 -10
  207. package/dist/in-store/host-geometry-frame.js.map +1 -1
  208. package/dist/in-store/index.d.ts +7 -0
  209. package/dist/in-store/index.d.ts.map +1 -1
  210. package/dist/in-store/index.js +7 -0
  211. package/dist/in-store/index.js.map +1 -1
  212. package/dist/in-store/linear-profile-frame.d.ts +10 -0
  213. package/dist/in-store/linear-profile-frame.d.ts.map +1 -0
  214. package/dist/in-store/linear-profile-frame.js +17 -0
  215. package/dist/in-store/linear-profile-frame.js.map +1 -0
  216. package/dist/in-store/material.d.ts.map +1 -1
  217. package/dist/in-store/material.js +17 -6
  218. package/dist/in-store/material.js.map +1 -1
  219. package/dist/in-store/member.d.ts.map +1 -1
  220. package/dist/in-store/member.js +3 -7
  221. package/dist/in-store/member.js.map +1 -1
  222. package/dist/in-store/ordinary-element.d.ts +47 -0
  223. package/dist/in-store/ordinary-element.d.ts.map +1 -0
  224. package/dist/in-store/ordinary-element.js +38 -0
  225. package/dist/in-store/ordinary-element.js.map +1 -0
  226. package/dist/in-store/placement-frame.d.ts +5 -17
  227. package/dist/in-store/placement-frame.d.ts.map +1 -1
  228. package/dist/in-store/placement-frame.js +59 -43
  229. package/dist/in-store/placement-frame.js.map +1 -1
  230. package/dist/in-store/resolve-anchor.d.ts +3 -2
  231. package/dist/in-store/resolve-anchor.d.ts.map +1 -1
  232. package/dist/in-store/resolve-anchor.js +7 -5
  233. package/dist/in-store/resolve-anchor.js.map +1 -1
  234. package/dist/in-store/resolve-relations.d.ts +3 -1
  235. package/dist/in-store/resolve-relations.d.ts.map +1 -1
  236. package/dist/in-store/resolve-relations.js +8 -3
  237. package/dist/in-store/resolve-relations.js.map +1 -1
  238. package/dist/in-store/resolve-source.d.ts.map +1 -1
  239. package/dist/in-store/resolve-source.js +10 -3
  240. package/dist/in-store/resolve-source.js.map +1 -1
  241. package/dist/in-store/room-candidates.d.ts +58 -0
  242. package/dist/in-store/room-candidates.d.ts.map +1 -0
  243. package/dist/in-store/room-candidates.js +135 -0
  244. package/dist/in-store/room-candidates.js.map +1 -0
  245. package/dist/in-store/room-creation-plan.d.ts +16 -0
  246. package/dist/in-store/room-creation-plan.d.ts.map +1 -0
  247. package/dist/in-store/room-creation-plan.js +28 -0
  248. package/dist/in-store/room-creation-plan.js.map +1 -0
  249. package/dist/in-store/room-floor-height.d.ts +24 -0
  250. package/dist/in-store/room-floor-height.d.ts.map +1 -0
  251. package/dist/in-store/room-floor-height.js +32 -0
  252. package/dist/in-store/room-floor-height.js.map +1 -0
  253. package/dist/in-store/room-footprint-native.d.ts +19 -0
  254. package/dist/in-store/room-footprint-native.d.ts.map +1 -0
  255. package/dist/in-store/room-footprint-native.js +117 -0
  256. package/dist/in-store/room-footprint-native.js.map +1 -0
  257. package/dist/in-store/room-layout-cache.d.ts +23 -0
  258. package/dist/in-store/room-layout-cache.d.ts.map +1 -0
  259. package/dist/in-store/room-layout-cache.js +84 -0
  260. package/dist/in-store/room-layout-cache.js.map +1 -0
  261. package/dist/in-store/room-layout-core.d.ts +68 -0
  262. package/dist/in-store/room-layout-core.d.ts.map +1 -0
  263. package/dist/in-store/room-layout-core.js +153 -0
  264. package/dist/in-store/room-layout-core.js.map +1 -0
  265. package/dist/in-store/room-population.d.ts +5 -0
  266. package/dist/in-store/room-population.d.ts.map +1 -0
  267. package/dist/in-store/room-population.js +28 -0
  268. package/dist/in-store/room-population.js.map +1 -0
  269. package/dist/in-store/room-space-meshes.d.ts +15 -0
  270. package/dist/in-store/room-space-meshes.d.ts.map +1 -0
  271. package/dist/in-store/room-space-meshes.js +38 -0
  272. package/dist/in-store/room-space-meshes.js.map +1 -0
  273. package/dist/in-store/room-store.d.ts +55 -0
  274. package/dist/in-store/room-store.d.ts.map +1 -0
  275. package/dist/in-store/room-store.js +173 -0
  276. package/dist/in-store/room-store.js.map +1 -0
  277. package/dist/in-store/room-storey-elevation.d.ts +5 -0
  278. package/dist/in-store/room-storey-elevation.d.ts.map +1 -0
  279. package/dist/in-store/room-storey-elevation.js +42 -0
  280. package/dist/in-store/room-storey-elevation.js.map +1 -0
  281. package/dist/in-store/room-storey-frame.d.ts +47 -0
  282. package/dist/in-store/room-storey-frame.d.ts.map +1 -0
  283. package/dist/in-store/room-storey-frame.js +48 -0
  284. package/dist/in-store/room-storey-frame.js.map +1 -0
  285. package/dist/in-store/room-wall-rects.d.ts +117 -0
  286. package/dist/in-store/room-wall-rects.d.ts.map +1 -0
  287. package/dist/in-store/room-wall-rects.js +157 -0
  288. package/dist/in-store/room-wall-rects.js.map +1 -0
  289. package/dist/in-store/schema-attributes.d.ts +3 -3
  290. package/dist/in-store/schema-attributes.d.ts.map +1 -1
  291. package/dist/in-store/schema-attributes.js +9 -7
  292. package/dist/in-store/schema-attributes.js.map +1 -1
  293. package/dist/in-store/slab.d.ts.map +1 -1
  294. package/dist/in-store/slab.js +1 -4
  295. package/dist/in-store/slab.js.map +1 -1
  296. package/dist/in-store/stair-removal.d.ts +17 -0
  297. package/dist/in-store/stair-removal.d.ts.map +1 -0
  298. package/dist/in-store/stair-removal.js +134 -0
  299. package/dist/in-store/stair-removal.js.map +1 -0
  300. package/dist/in-store/storey-plan-frame.d.ts +2 -1
  301. package/dist/in-store/storey-plan-frame.d.ts.map +1 -1
  302. package/dist/in-store/storey-plan-frame.js +20 -11
  303. package/dist/in-store/storey-plan-frame.js.map +1 -1
  304. package/dist/in-store/storey-reassignment-plan.d.ts +53 -0
  305. package/dist/in-store/storey-reassignment-plan.d.ts.map +1 -0
  306. package/dist/in-store/storey-reassignment-plan.js +237 -0
  307. package/dist/in-store/storey-reassignment-plan.js.map +1 -0
  308. package/dist/in-store/storey-reassignment.d.ts +8 -0
  309. package/dist/in-store/storey-reassignment.d.ts.map +1 -0
  310. package/dist/in-store/storey-reassignment.js +52 -0
  311. package/dist/in-store/storey-reassignment.js.map +1 -0
  312. package/dist/in-store/trim-extend-plan.d.ts +27 -0
  313. package/dist/in-store/trim-extend-plan.d.ts.map +1 -0
  314. package/dist/in-store/trim-extend-plan.js +49 -0
  315. package/dist/in-store/trim-extend-plan.js.map +1 -0
  316. package/dist/in-store/wall-join-edit.d.ts +0 -17
  317. package/dist/in-store/wall-join-edit.d.ts.map +1 -1
  318. package/dist/in-store/wall-join-edit.js +41 -7
  319. package/dist/in-store/wall-join-edit.js.map +1 -1
  320. package/dist/in-store/wall-section-edit.d.ts +16 -0
  321. package/dist/in-store/wall-section-edit.d.ts.map +1 -0
  322. package/dist/in-store/wall-section-edit.js +75 -0
  323. package/dist/in-store/wall-section-edit.js.map +1 -0
  324. package/dist/in-store/wall-size-edit.d.ts +29 -0
  325. package/dist/in-store/wall-size-edit.d.ts.map +1 -0
  326. package/dist/in-store/wall-size-edit.js +65 -0
  327. package/dist/in-store/wall-size-edit.js.map +1 -0
  328. package/dist/index.d.ts +24 -0
  329. package/dist/index.d.ts.map +1 -1
  330. package/dist/index.js +23 -0
  331. package/dist/index.js.map +1 -1
  332. package/dist/landxml/profile-geometry.d.ts +10 -0
  333. package/dist/landxml/profile-geometry.d.ts.map +1 -1
  334. package/dist/landxml/profile-geometry.js +16 -1
  335. package/dist/landxml/profile-geometry.js.map +1 -1
  336. package/package.json +9 -8
@@ -0,0 +1,116 @@
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 { asExpressIdRef, readAttributes } from './placement-core.js';
5
+ import { resolveWallEditChain } from './wall-edit.js';
6
+ import { resolveLinearElementChain } from './linear-element-edit.js';
7
+ import { resolveSlabEditChain } from './slab-edit.js';
8
+ import { effectiveContainerTypeName, effectiveStoreyId } from './effective-storey.js';
9
+ const WALL_TYPES = new Set(['IFCWALL', 'IFCWALLSTANDARDCASE']);
10
+ const LINEAR_TYPES = new Set(['IFCBEAM', 'IFCCOLUMN', 'IFCMEMBER']);
11
+ const SLAB_TYPES = new Set(['IFCSLAB', 'IFCROOF', 'IFCPLATE', 'IFCSPACE']);
12
+ const MESH_ITEMS = new Set([
13
+ 'IFCTRIANGULATEDFACESET', 'IFCPOLYGONALFACESET', 'IFCFACETEDBREP', 'IFCFACETEDBREPWITHVOIDS',
14
+ 'IFCADVANCEDBREP', 'IFCADVANCEDBREPWITHVOIDS', 'IFCFACEBASEDSURFACEMODEL', 'IFCSHELLBASEDSURFACEMODEL',
15
+ ]);
16
+ /**
17
+ * Classify `expressId` for the Split tool. All lengths on a returned chain
18
+ * are metres (`lengthUnitScale` is the model's native-unit → metre factor).
19
+ */
20
+ export function resolveSplitTarget(dataStore, view, editor, expressId, lengthUnitScale) {
21
+ const stepType = editor.getEntityType(expressId)?.toUpperCase();
22
+ if (!stepType)
23
+ return { ok: false, code: 'type' };
24
+ let target = null;
25
+ if (WALL_TYPES.has(stepType)) {
26
+ const chain = resolveWallEditChain(dataStore, view, editor, expressId, lengthUnitScale);
27
+ if (chain && Number.isFinite(chain.height) && chain.height > 0)
28
+ target = { ok: true, kind: 'wall', chain };
29
+ }
30
+ else if (LINEAR_TYPES.has(stepType)) {
31
+ const chain = resolveLinearElementChain(dataStore, view, editor, expressId, lengthUnitScale);
32
+ if (chain)
33
+ target = { ok: true, kind: 'linear', chain };
34
+ }
35
+ else if (SLAB_TYPES.has(stepType)) {
36
+ const chain = resolveSlabEditChain(dataStore, view, editor, expressId, lengthUnitScale);
37
+ // A tilted or rotated extrusion reads a footprint but cannot be cut in plan.
38
+ if (chain && chain.baseElevation !== null)
39
+ target = { ok: true, kind: 'slab', chain: { ...chain, baseElevation: chain.baseElevation } };
40
+ }
41
+ else {
42
+ return { ok: false, code: 'type' };
43
+ }
44
+ if (!target) {
45
+ return { ok: false, code: diagnoseBody(dataStore, view, editor, expressId, SLAB_TYPES.has(stepType)) };
46
+ }
47
+ // The split commit's own storey gate (`resolveSplitContext`) reads the live
48
+ // containment, so a queued re-containment or removal is honoured here too.
49
+ if (effectiveStoreyId(dataStore, view, expressId) === undefined) {
50
+ return { ok: false, code: effectiveContainerTypeName(dataStore, view, expressId) ? 'container' : 'storey' };
51
+ }
52
+ return target;
53
+ }
54
+ /**
55
+ * Why the chain reader refused a supported class: look at the first item of
56
+ * the first representation — the same slot every chain reader walks. Slab-like
57
+ * readers also take a polyline profile; walls only a rectangle, and linear
58
+ * elements a rectangle or one of the picker's sections (I, L, T, U, C, circle, hollow).
59
+ */
60
+ function diagnoseBody(dataStore, view, editor, expressId, polygonProfileOk) {
61
+ const read = (id) => (id === null ? null : readAttributes(dataStore, view, editor, id));
62
+ const shape = read(asExpressIdRef(read(expressId)?.[6]));
63
+ const reps = shape?.[2];
64
+ if (!Array.isArray(reps) || reps.length === 0)
65
+ return 'noBody';
66
+ const items = read(asExpressIdRef(reps[0]))?.[3];
67
+ if (!Array.isArray(items) || items.length === 0)
68
+ return 'noBody';
69
+ const itemId = asExpressIdRef(items[0]);
70
+ const itemType = itemId === null ? undefined : editor.getEntityType(itemId)?.toUpperCase();
71
+ if (!itemType)
72
+ return 'noBody';
73
+ if (itemType === 'IFCMAPPEDITEM')
74
+ return 'mapped';
75
+ if (MESH_ITEMS.has(itemType))
76
+ return 'mesh';
77
+ if (itemType === 'IFCBOOLEANCLIPPINGRESULT' || itemType === 'IFCBOOLEANRESULT')
78
+ return 'boolean';
79
+ if (itemType === 'IFCEXTRUDEDAREASOLID') {
80
+ const profileId = asExpressIdRef(read(itemId)?.[0]);
81
+ const profileType = profileId === null ? undefined : editor.getEntityType(profileId)?.toUpperCase();
82
+ const handled = profileType === 'IFCRECTANGLEPROFILEDEF'
83
+ || (polygonProfileOk && profileType === 'IFCARBITRARYCLOSEDPROFILEDEF');
84
+ if (!handled)
85
+ return 'profile';
86
+ }
87
+ return 'shape';
88
+ }
89
+ /**
90
+ * A commit action's gate: the chain when `target` is the `kind` that action
91
+ * cuts, else the catalogue key of the refusal — the same reason the Split
92
+ * button's tooltip shows for this element.
93
+ */
94
+ export function splitChainOfKind(target, kind) {
95
+ if (!target.ok)
96
+ return { reasonKey: splitUnavailableKey(target.code) };
97
+ if (target.kind !== kind)
98
+ return { reasonKey: 'splitTool.unavailable.kind' };
99
+ // `kind` matched, so the union member's chain IS `SplitChains[K]`.
100
+ return { chain: target.chain };
101
+ }
102
+ /** Catalogue key for each {@link SplitUnavailableCode}. */
103
+ export function splitUnavailableKey(code) {
104
+ switch (code) {
105
+ case 'type': return 'splitTool.unavailable.type';
106
+ case 'storey': return 'splitTool.unavailable.storey';
107
+ case 'container': return 'splitTool.unavailable.container';
108
+ case 'noBody': return 'splitTool.unavailable.noBody';
109
+ case 'mesh': return 'splitTool.unavailable.mesh';
110
+ case 'mapped': return 'splitTool.unavailable.mapped';
111
+ case 'boolean': return 'splitTool.unavailable.boolean';
112
+ case 'profile': return 'splitTool.unavailable.profile';
113
+ case 'shape': return 'splitTool.unavailable.shape';
114
+ }
115
+ }
116
+ //# sourceMappingURL=split-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split-target.js","sourceRoot":"","sources":["../../../src/in-store/edit/split-target.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA2B/D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAsB,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAA+B,MAAM,0BAA0B,CAAC;AAClG,OAAO,EAAE,oBAAoB,EAAsB,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AA+BtF,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAC/D,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AACpE,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAE3E,M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H,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { IfcDataStore } from '@ifc-lite/parser';
2
+ import type { MutablePropertyView, StoreEditor } from '@ifc-lite/mutations';
3
+ export interface EditTarget {
4
+ readonly dataStore: IfcDataStore;
5
+ readonly view: MutablePropertyView;
6
+ readonly editor: StoreEditor;
7
+ }
8
+ //# sourceMappingURL=target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../src/in-store/edit/target.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE5E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B"}
@@ -0,0 +1,5 @@
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
+ export {};
5
+ //# sourceMappingURL=target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.js","sourceRoot":"","sources":["../../../src/in-store/edit/target.ts"],"names":[],"mappings":"AAAA;;+DAE+D"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The reach arithmetic behind `element.trimExtend` (charter #6232, C1): where
3
+ * a wall's or beam's axis meets a boundary line, and whether that is a trim
4
+ * (the boundary cuts across the element) or an extension (the element stops
5
+ * short of it). Pure plan geometry: no store, no i18n.
6
+ *
7
+ * Everything is metres in the storey's local frame. A target is a straight
8
+ * axis `p0 + dir · at`, `at` in 0..length; a beam may rise, so `dir` is 3D and
9
+ * the crossing is found on its plan projection (a boundary is a vertical
10
+ * plane). A boundary is a line through `a` and `b`, of which only the stretch
11
+ * `tMin..tMax` (in units of `b - a`) exists: a wall's axis or a slab edge is a
12
+ * segment, a grid axis a line.
13
+ */
14
+ type Vec2 = readonly [number, number];
15
+ type Vec3 = [number, number, number];
16
+ /** The line a target is trimmed or extended to. */
17
+ export interface ReachBoundary {
18
+ readonly a: Vec2;
19
+ readonly b: Vec2;
20
+ /** The stretch of the line that exists, in units of `b - a`; ±Infinity for a line without ends. */
21
+ readonly tMin: number;
22
+ readonly tMax: number;
23
+ /** How far past `tMin` / `tMax` the crossing may fall and still count, metres (a wall's half thickness). */
24
+ readonly reach: number;
25
+ }
26
+ /** A straight element axis. */
27
+ export interface ReachTarget {
28
+ readonly p0: Vec3;
29
+ /** Unit direction, start to end; may rise. */
30
+ readonly dir: Vec3;
31
+ readonly length: number;
32
+ }
33
+ export type ReachMode = 'trim' | 'extend';
34
+ export type ReachEnd = 'start' | 'end';
35
+ /** Why a target cannot reach the boundary; the command turns each into a sentence. */
36
+ export type ReachRefusal =
37
+ /** The element runs along the boundary: they never cross. */
38
+ 'parallel'
39
+ /** Vertical, so it has no plan axis to cross. */
40
+ | 'vertical'
41
+ /** The lines cross, but past the end of the boundary. */
42
+ | 'boundaryShort'
43
+ /** Extend, but the boundary cuts across the element: Shift trims. */
44
+ | 'crossesInside'
45
+ /** Trim, but the element ends before the boundary: Shift extends. */
46
+ | 'notReached'
47
+ /** Extend, but the boundary lies past the other end than the clicked one. */
48
+ | 'otherEnd'
49
+ /** Trim would leave less than the minimum length. */
50
+ | 'tooShort'
51
+ /** The end is already on the boundary and there is nothing to join. */
52
+ | 'alreadyThere';
53
+ export type ReachPlan = {
54
+ readonly ok: true;
55
+ /** `extend` also covers an end already on the boundary (a join without a move). */
56
+ readonly op: ReachMode;
57
+ /** The end that moves. */
58
+ readonly end: ReachEnd;
59
+ /** Distance from the current start to the moved end's new place, along `dir`. */
60
+ readonly at: number;
61
+ /** The new axis ends, storey-local. */
62
+ readonly start: Vec3;
63
+ readonly stop: Vec3;
64
+ readonly length: number;
65
+ /** Metres the end moves outward: positive extends, negative trims. */
66
+ readonly moved: number;
67
+ /** The crossing in plan. */
68
+ readonly point: Vec2;
69
+ } | {
70
+ readonly ok: false;
71
+ readonly reason: ReachRefusal;
72
+ };
73
+ export interface Crossing {
74
+ /** Distance along the target from its start (may be negative or past the end). */
75
+ readonly at: number;
76
+ /** Position along the boundary, in units of `b - a`. */
77
+ readonly t: number;
78
+ readonly point: Vec2;
79
+ }
80
+ /** Where the target's axis line crosses the boundary line, or why it does not. */
81
+ export declare function crossing(target: ReachTarget, boundary: ReachBoundary): Crossing | ReachRefusal;
82
+ /**
83
+ * Trim or extend `target` to `boundary`. `click` is where along the target
84
+ * (metres from its start, clamped to the element) it was clicked.
85
+ *
86
+ * - extend: the end nearest the click moves out to the boundary; it must be
87
+ * the end the boundary lies beyond.
88
+ * - trim: the boundary must cross the element; the side the click is on (the
89
+ * end nearest it) is removed, the far side stays.
90
+ *
91
+ * `joins` says the result is joined to the boundary (a wall to a wall): an end
92
+ * already on the boundary is then a valid extension by nothing, which makes
93
+ * the join; without it there is nothing to do and the plan is refused.
94
+ */
95
+ export declare function planReach(target: ReachTarget, boundary: ReachBoundary, mode: ReachMode, click: number, minLength: number, joins: boolean): ReachPlan;
96
+ /** Distance along the target's plan axis line from its start to the projection of `p`, in axis metres, clamped to the element. */
97
+ export declare function clickAlong(target: ReachTarget, p: Vec2): number;
98
+ export {};
99
+ //# sourceMappingURL=trim-extend-geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trim-extend-geometry.d.ts","sourceRoot":"","sources":["../../../src/in-store/edit/trim-extend-geometry.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,KAAK,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACtC,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAErC,mDAAmD;AACnD,MAAM,WAAW,aAAa;IA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,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4BAA4B;IAC5B,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;CACtB,GACC;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;CAAE,CAAC;AAS1D,MAAM,WAAW,QAAQ;IACvB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;CACtB;AAED,kFAAkF;AAClF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,GAAG,QAAQ,GAAG,YAAY,CAgB9F;AAgBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,OAAO,GACb,SAAS,CAsCX;AAED,kIAAkI;AAClI,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAK/D"}
@@ -0,0 +1,105 @@
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
+ /** A crossing this close to an end (metres) is AT that end. */
5
+ const AT_END = 1e-3;
6
+ /** Directions with a smaller sine between them are parallel. */
7
+ const PARALLEL_SIN = 1e-3;
8
+ /** A plan axis shorter than this per metre of axis is a vertical element. */
9
+ const MIN_PLAN_AXIS = 0.05;
10
+ /** Where the target's axis line crosses the boundary line, or why it does not. */
11
+ export function crossing(target, boundary) {
12
+ const [dx, dy] = target.dir;
13
+ const planLength = Math.hypot(dx, dy);
14
+ if (planLength < MIN_PLAN_AXIS)
15
+ return 'vertical';
16
+ const bx = boundary.b[0] - boundary.a[0];
17
+ const by = boundary.b[1] - boundary.a[1];
18
+ const boundaryLength = Math.hypot(bx, by);
19
+ if (!(boundaryLength > 1e-9))
20
+ return 'parallel';
21
+ const denom = dx * by - dy * bx;
22
+ if (Math.abs(denom) <= PARALLEL_SIN * planLength * boundaryLength)
23
+ return 'parallel';
24
+ const wx = boundary.a[0] - target.p0[0];
25
+ const wy = boundary.a[1] - target.p0[1];
26
+ // p0 + at·dir = a + t·(b - a), on the plan projection.
27
+ const at = (wx * by - wy * bx) / denom;
28
+ const t = (wx * dy - wy * dx) / denom;
29
+ return { at, t, point: [boundary.a[0] + t * bx, boundary.a[1] + t * by] };
30
+ }
31
+ function onBoundary(boundary, t) {
32
+ const length = Math.hypot(boundary.b[0] - boundary.a[0], boundary.b[1] - boundary.a[1]);
33
+ const slack = boundary.reach / length;
34
+ return t >= boundary.tMin - slack && t <= boundary.tMax + slack;
35
+ }
36
+ /** The axis with the end at `at` moved to `to`: new start and end. */
37
+ function reshaped(target, end, to) {
38
+ const from = end === 'start' ? to : 0;
39
+ const upTo = end === 'end' ? to : target.length;
40
+ const point = (s) => [target.p0[0] + target.dir[0] * s, target.p0[1] + target.dir[1] * s, target.p0[2] + target.dir[2] * s];
41
+ return { start: point(from), stop: point(upTo), length: upTo - from };
42
+ }
43
+ /**
44
+ * Trim or extend `target` to `boundary`. `click` is where along the target
45
+ * (metres from its start, clamped to the element) it was clicked.
46
+ *
47
+ * - extend: the end nearest the click moves out to the boundary; it must be
48
+ * the end the boundary lies beyond.
49
+ * - trim: the boundary must cross the element; the side the click is on (the
50
+ * end nearest it) is removed, the far side stays.
51
+ *
52
+ * `joins` says the result is joined to the boundary (a wall to a wall): an end
53
+ * already on the boundary is then a valid extension by nothing, which makes
54
+ * the join; without it there is nothing to do and the plan is refused.
55
+ */
56
+ export function planReach(target, boundary, mode, click, minLength, joins) {
57
+ const cross = crossing(target, boundary);
58
+ if (typeof cross === 'string')
59
+ return { ok: false, reason: cross };
60
+ if (!onBoundary(boundary, cross.t))
61
+ return { ok: false, reason: 'boundaryShort' };
62
+ const { at, point } = cross;
63
+ const { length } = target;
64
+ const clicked = click < length / 2 ? 'start' : 'end';
65
+ const done = (op, end, to) => {
66
+ const next = reshaped(target, end, to);
67
+ return {
68
+ ok: true, op, end, at: to, start: next.start, stop: next.stop, length: next.length,
69
+ moved: end === 'end' ? to - length : -to, point,
70
+ };
71
+ };
72
+ // An end already on the boundary: nothing moves, so only a join can come of it.
73
+ const atStart = Math.abs(at) <= AT_END;
74
+ const atEnd = Math.abs(at - length) <= AT_END;
75
+ if (atStart || atEnd) {
76
+ if (!joins)
77
+ return { ok: false, reason: 'alreadyThere' };
78
+ const end = atStart && atEnd ? clicked : atStart ? 'start' : 'end';
79
+ return done('extend', end, end === 'start' ? 0 : length);
80
+ }
81
+ if (mode === 'extend') {
82
+ if (at > 0 && at < length)
83
+ return { ok: false, reason: 'crossesInside' };
84
+ const beyond = at > length ? 'end' : 'start';
85
+ if (beyond !== clicked)
86
+ return { ok: false, reason: 'otherEnd' };
87
+ return done('extend', beyond, at);
88
+ }
89
+ if (!(at > 0 && at < length))
90
+ return { ok: false, reason: 'notReached' };
91
+ // The click's side of the crossing goes.
92
+ const removed = click < at ? 'start' : 'end';
93
+ const left = removed === 'start' ? length - at : at;
94
+ if (left < minLength)
95
+ return { ok: false, reason: 'tooShort' };
96
+ return done('trim', removed, at);
97
+ }
98
+ /** Distance along the target's plan axis line from its start to the projection of `p`, in axis metres, clamped to the element. */
99
+ export function clickAlong(target, p) {
100
+ const [dx, dy] = target.dir;
101
+ const planLength = Math.hypot(dx, dy);
102
+ const s = ((p[0] - target.p0[0]) * dx + (p[1] - target.p0[1]) * dy) / (planLength * planLength);
103
+ return Math.min(target.length, Math.max(0, s));
104
+ }
105
+ //# sourceMappingURL=trim-extend-geometry.js.map
@@ -0,0 +1 @@
1
+ {"version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AAC,UAAU,GAAG,UAAU,CAAC,CAAC;IAChG,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The `Axis` representation of a rectangle wall (#6232 B2): `addWallToStore`
3
+ * writes one beside the Body, a `Curve2D` IfcPolyline from the wall's Start to
4
+ * its End in the wall's own frame. A resize that moves the wall by its
5
+ * placement and profile alone has to move this polyline too, or the centreline
6
+ * that `extractWallSegmentsForStorey` and the snap engine prefer is left behind.
7
+ */
8
+ import type { IfcDataStore } from '@ifc-lite/parser';
9
+ import type { MutablePropertyView, StoreEditor } from '@ifc-lite/mutations';
10
+ /**
11
+ * Point the wall's `Axis` polyline at `[0, 0]` .. `[length, 0]` (the wall's
12
+ * frame after a resize, whose origin is the new Start). A wall without an Axis
13
+ * is left as it is. `length` is in the wall's native unit.
14
+ */
15
+ export declare function moveWallAxis(dataStore: IfcDataStore, view: MutablePropertyView, editor: StoreEditor, expressId: number, length: number): void;
16
+ //# sourceMappingURL=wall-axis-edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wall-axis-edit.d.ts","sourceRoot":"","sources":["../../../src/in-store/edit/wall-axis-edit.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AA6B5E;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,YAAY,EACvB,IAAI,EAAE,mBAAmB,EACzB,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,IAAI,CAKN"}
@@ -0,0 +1,40 @@
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 { asExpressIdRef, readAttributes } from './placement-core.js';
5
+ /**
6
+ * The two IfcCartesianPoints of a wall's `Axis` polyline (`addWallToStore`
7
+ * writes one, Start -> End in the wall's frame), or null for a wall without.
8
+ */
9
+ function wallAxisPointIds(dataStore, view, editor, expressId) {
10
+ const productShapeId = asExpressIdRef(readAttributes(dataStore, view, editor, expressId)?.[6]);
11
+ const reps = productShapeId === null ? null : readAttributes(dataStore, view, editor, productShapeId)?.[2];
12
+ if (!Array.isArray(reps))
13
+ return null;
14
+ for (const ref of reps) {
15
+ const rep = asExpressIdRef(ref) === null ? null : readAttributes(dataStore, view, editor, asExpressIdRef(ref));
16
+ // IfcShapeRepresentation: [1] RepresentationIdentifier, [3] Items.
17
+ if (!rep || rep[1] !== 'Axis' || !Array.isArray(rep[3]))
18
+ continue;
19
+ const polylineId = asExpressIdRef(rep[3][0]);
20
+ const points = polylineId === null ? null : readAttributes(dataStore, view, editor, polylineId)?.[0];
21
+ if (!Array.isArray(points) || points.length !== 2)
22
+ return null;
23
+ const [from, to] = [asExpressIdRef(points[0]), asExpressIdRef(points[1])];
24
+ return from !== null && to !== null ? [from, to] : null;
25
+ }
26
+ return null;
27
+ }
28
+ /**
29
+ * Point the wall's `Axis` polyline at `[0, 0]` .. `[length, 0]` (the wall's
30
+ * frame after a resize, whose origin is the new Start). A wall without an Axis
31
+ * is left as it is. `length` is in the wall's native unit.
32
+ */
33
+ export function moveWallAxis(dataStore, view, editor, expressId, length) {
34
+ const axis = wallAxisPointIds(dataStore, view, editor, expressId);
35
+ if (!axis)
36
+ return;
37
+ editor.setPositionalAttribute(axis[0], 0, [0, 0]);
38
+ editor.setPositionalAttribute(axis[1], 0, [length, 0]);
39
+ }
40
+ //# sourceMappingURL=wall-axis-edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wall-axis-edit.js","sourceRoot":"","sources":["../../../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AC,CAAC,CAAC,CAAC;QACrG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAC/D,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,OAAO,IAAI,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAC1B,SAAuB,EACvB,IAAyB,EACzB,MAAmB,EACnB,SAAiB,EACjB,MAAc;IAEd,MAAM,IAAI,GAAG,gBAAgB,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IAClE,IAAI,CAAC,IAAI;QAAE,OAAO;IAClB,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClD,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Wall-specific placement + representation edits.
3
+ *
4
+ * A rectangular-profile wall created by `addWallToStore` encodes its
5
+ * start/end as four coupled entities — the placement origin, the
6
+ * RefDirection (start→end), the profile XDim, and the profile
7
+ * origin (centred at XDim/2). Resizing means touching all four
8
+ * coherently, so this module owns that ensemble.
9
+ *
10
+ * Generic placement reads / writes live in `placement-core.ts`.
11
+ */
12
+ import type { IfcDataStore } from '@ifc-lite/parser';
13
+ import type { MutablePropertyView, StoreEditor } from '@ifc-lite/mutations';
14
+ /**
15
+ * Every length on a {@link WallEditChain} is in METRES — the viewer's render
16
+ * and authoring space — whatever the file's length unit. Raw STEP reads are
17
+ * in native units (e.g. millimetres) and are multiplied by the model's
18
+ * `lengthUnitScale` on the way in; the ids are what a writer needs to divide
19
+ * back out (#6233).
20
+ */
21
+ export interface WallEditChain {
22
+ /** IfcLocalPlacement.RelativePlacement.Location — the wall's start point. */
23
+ startPointId: number;
24
+ /** Current start coordinates (storey-local, metres). */
25
+ startCoordinates: [number, number, number];
26
+ /** IfcAxis2Placement3D.RefDirection — wall direction (start→end). */
27
+ refDirectionId: number;
28
+ /** Current RefDirection ratios. */
29
+ refDirection: [number, number, number];
30
+ /** IfcRectangleProfileDef.XDim — wall length along its local X. */
31
+ profileId: number;
32
+ /** Current wall length. */
33
+ wallLength: number;
34
+ /** IfcRectangleProfileDef.YDim — wall thickness. */
35
+ thickness: number;
36
+ /** Profile origin IfcCartesianPoint with `[length/2, 0]`. */
37
+ profileOriginPointId: number;
38
+ /** IfcExtrudedAreaSolid id — exposed so split readers don't re-walk. */
39
+ extrudedSolidId: number;
40
+ /** Extrusion depth ( = wall height in metres ); `NaN` when the slot wasn't a number. */
41
+ height: number;
42
+ /** The native-unit → metre factor the lengths above were scaled by. */
43
+ lengthUnitScale: number;
44
+ }
45
+ /**
46
+ * Resolve the wall-edit chain for a wall created by
47
+ * `@ifc-lite/create#addWallToStore` (or any source-buffer wall that
48
+ * happens to follow the same `IfcRectangleProfileDef →
49
+ * IfcExtrudedAreaSolid` shape).
50
+ *
51
+ * Returns null when the entity isn't a wall, doesn't have an explicit
52
+ * RefDirection, or its representation isn't the expected rectangle-
53
+ * profile / extruded-solid pair. Callers should treat null as
54
+ * "endpoints not editable" and hide their drag handles rather than
55
+ * crashing.
56
+ *
57
+ * `lengthUnitScale` is the model's native-unit → metre factor
58
+ * (`getModelLengthUnitScale`); the viewer's slice actions always pass it.
59
+ */
60
+ export declare function resolveWallEditChain(dataStore: IfcDataStore, view: MutablePropertyView, editor: StoreEditor, expressId: number, lengthUnitScale?: number): WallEditChain | null;
61
+ /**
62
+ * Pure geometry math for splitting a rectangle-profile wall at
63
+ * `distance` along its axis (measured from the start). Returns the
64
+ * geometry of the two resulting walls in storey-local IFC space.
65
+ *
66
+ * The split is a straight perpendicular cut — both halves keep the
67
+ * source wall's direction vector and thickness. The "left" half
68
+ * starts at the source's start and runs `distance`; the "right"
69
+ * half starts at the cut point and runs the remaining length.
70
+ *
71
+ * Returns `null` (with a reason) when:
72
+ * - the wall chain doesn't resolve
73
+ * - `distance` is outside `(MIN_SEGMENT_LENGTH, length - MIN_SEGMENT_LENGTH)`
74
+ * - input is otherwise inconsistent
75
+ *
76
+ * Caller is responsible for actually building the two new walls and
77
+ * tombstoning the source — this helper is pure and easy to unit-test
78
+ * without a store editor.
79
+ */
80
+ export declare const MIN_WALL_SEGMENT_LENGTH = 0.05;
81
+ export interface WallSplitGeometry {
82
+ /** Geometry that `addWallToStore` would consume for the "before-cut" half. */
83
+ left: {
84
+ Start: [number, number, number];
85
+ End: [number, number, number];
86
+ Thickness: number;
87
+ /** Carried over from the source — caller may override. */
88
+ Height: number;
89
+ };
90
+ right: {
91
+ Start: [number, number, number];
92
+ End: [number, number, number];
93
+ Thickness: number;
94
+ Height: number;
95
+ };
96
+ /** Cut point in storey-local space (Start + dir·distance, Z = source Z). */
97
+ cutPoint: [number, number, number];
98
+ /** Source's length, so the caller can validate UX feedback. */
99
+ sourceLength: number;
100
+ }
101
+ export type WallSplitResult = {
102
+ ok: true;
103
+ geometry: WallSplitGeometry;
104
+ } | {
105
+ ok: false;
106
+ reason: string;
107
+ };
108
+ /**
109
+ * Compute the geometry for a split without mutating the store. Used
110
+ * by the mutationSlice action to drive `addWallToStore` twice and by
111
+ * tests that exercise the math in isolation.
112
+ *
113
+ * `sourceHeight` is passed in rather than re-read here because the
114
+ * extrusion `Depth` lives on the `IfcExtrudedAreaSolid` (attribute 3),
115
+ * not in the WallEditChain. The slice action reads it once and
116
+ * forwards the value.
117
+ */
118
+ export declare function computeWallSplitGeometry(chain: WallEditChain, distance: number, sourceHeight: number): WallSplitResult;
119
+ /**
120
+ * Project an arbitrary 3D point onto the wall's axis and return the
121
+ * signed distance from the wall's start (storey-local). Useful for
122
+ * the Split tool's hover preview: cursor lands anywhere near the
123
+ * wall, we report where the cut would land.
124
+ *
125
+ * Clamps to `[0, length]` — callers decide whether to enforce the
126
+ * min-segment guard.
127
+ */
128
+ export declare function projectOntoWallAxis(chain: WallEditChain, pointStoreyLocal: [number, number, number]): number;
129
+ export type WallResizeResult = {
130
+ ok: true;
131
+ newStart: [number, number, number];
132
+ newEnd: [number, number, number];
133
+ newLength: number;
134
+ } | {
135
+ ok: false;
136
+ reason: string;
137
+ };
138
+ /**
139
+ * Resize a rectangular-profile wall by setting new start AND end
140
+ * points, in the wall's native STEP units, straight through the
141
+ * editor with no history. The viewer's undoable resize is
142
+ * `MutationSlice.resizeWall` (`store/slices/mutation-wall-resize.ts`):
143
+ * it works in metres, writes the same four entities as one batched
144
+ * undo step, and folds an endpoint drag's frames into that step.
145
+ *
146
+ * - wall placement origin (IfcCartesianPoint)
147
+ * - RefDirection (IfcDirection) → new normalised (end-start)
148
+ * - profile XDim (IfcRectangleProfileDef) → new length
149
+ * - profile origin (IfcCartesianPoint) → [newLength/2, 0]
150
+ * - the `Axis` polyline's two points, when the wall has one → [0, 0] and
151
+ * [newLength, 0], so the centreline readers prefer stays with the body
152
+ *
153
+ * A wall with joins or cut ends is not a rectangle wall: it is re-shaped
154
+ * (and its joins recomputed) by `reshapeWallsIn` / `@ifc-lite/create`.
155
+ */
156
+ export declare function resizeRectangleWall(dataStore: IfcDataStore, view: MutablePropertyView, editor: StoreEditor, expressId: number, newStart: [number, number, number], newEnd: [number, number, number]): WallResizeResult;
157
+ //# sourceMappingURL=wall-edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"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