@ifc-lite/create 4.0.0 → 5.1.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 (325) 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/edit/effective-mutation-view.d.ts +6 -0
  33. package/dist/in-store/edit/effective-mutation-view.d.ts.map +1 -0
  34. package/dist/in-store/edit/effective-mutation-view.js +45 -0
  35. package/dist/in-store/edit/effective-mutation-view.js.map +1 -0
  36. package/dist/in-store/edit/effective-storey.d.ts +13 -0
  37. package/dist/in-store/edit/effective-storey.d.ts.map +1 -0
  38. package/dist/in-store/edit/effective-storey.js +36 -0
  39. package/dist/in-store/edit/effective-storey.js.map +1 -0
  40. package/dist/in-store/edit/effective-storeys.d.ts +9 -0
  41. package/dist/in-store/edit/effective-storeys.d.ts.map +1 -0
  42. package/dist/in-store/edit/effective-storeys.js +16 -0
  43. package/dist/in-store/edit/effective-storeys.js.map +1 -0
  44. package/dist/in-store/edit/hosted-opening-refit.d.ts +29 -0
  45. package/dist/in-store/edit/hosted-opening-refit.d.ts.map +1 -0
  46. package/dist/in-store/edit/hosted-opening-refit.js +168 -0
  47. package/dist/in-store/edit/hosted-opening-refit.js.map +1 -0
  48. package/dist/in-store/edit/length-unit-scale.d.ts +24 -0
  49. package/dist/in-store/edit/length-unit-scale.d.ts.map +1 -0
  50. package/dist/in-store/edit/length-unit-scale.js +37 -0
  51. package/dist/in-store/edit/length-unit-scale.js.map +1 -0
  52. package/dist/in-store/edit/linear-element-edit.d.ts +131 -0
  53. package/dist/in-store/edit/linear-element-edit.d.ts.map +1 -0
  54. package/dist/in-store/edit/linear-element-edit.js +259 -0
  55. package/dist/in-store/edit/linear-element-edit.js.map +1 -0
  56. package/dist/in-store/edit/metadata-clone-effective.d.ts +5 -0
  57. package/dist/in-store/edit/metadata-clone-effective.d.ts.map +1 -0
  58. package/dist/in-store/edit/metadata-clone-effective.js +47 -0
  59. package/dist/in-store/edit/metadata-clone-effective.js.map +1 -0
  60. package/dist/in-store/edit/metadata-clone.d.ts +40 -0
  61. package/dist/in-store/edit/metadata-clone.d.ts.map +1 -0
  62. package/dist/in-store/edit/metadata-clone.js +107 -0
  63. package/dist/in-store/edit/metadata-clone.js.map +1 -0
  64. package/dist/in-store/edit/placement-core.d.ts +140 -0
  65. package/dist/in-store/edit/placement-core.d.ts.map +1 -0
  66. package/dist/in-store/edit/placement-core.js +317 -0
  67. package/dist/in-store/edit/placement-core.js.map +1 -0
  68. package/dist/in-store/edit/polygon-clip.d.ts +58 -0
  69. package/dist/in-store/edit/polygon-clip.d.ts.map +1 -0
  70. package/dist/in-store/edit/polygon-clip.js +153 -0
  71. package/dist/in-store/edit/polygon-clip.js.map +1 -0
  72. package/dist/in-store/edit/read-profile.d.ts +6 -0
  73. package/dist/in-store/edit/read-profile.d.ts.map +1 -0
  74. package/dist/in-store/edit/read-profile.js +95 -0
  75. package/dist/in-store/edit/read-profile.js.map +1 -0
  76. package/dist/in-store/edit/slab-edit-frame.d.ts +40 -0
  77. package/dist/in-store/edit/slab-edit-frame.d.ts.map +1 -0
  78. package/dist/in-store/edit/slab-edit-frame.js +146 -0
  79. package/dist/in-store/edit/slab-edit-frame.js.map +1 -0
  80. package/dist/in-store/edit/slab-edit.d.ts +112 -0
  81. package/dist/in-store/edit/slab-edit.d.ts.map +1 -0
  82. package/dist/in-store/edit/slab-edit.js +275 -0
  83. package/dist/in-store/edit/slab-edit.js.map +1 -0
  84. package/dist/in-store/edit/slab-opening-carry.d.ts +10 -0
  85. package/dist/in-store/edit/slab-opening-carry.d.ts.map +1 -0
  86. package/dist/in-store/edit/slab-opening-carry.js +65 -0
  87. package/dist/in-store/edit/slab-opening-carry.js.map +1 -0
  88. package/dist/in-store/edit/split-guid.d.ts +29 -0
  89. package/dist/in-store/edit/split-guid.d.ts.map +1 -0
  90. package/dist/in-store/edit/split-guid.js +64 -0
  91. package/dist/in-store/edit/split-guid.js.map +1 -0
  92. package/dist/in-store/edit/split-target.d.ts +90 -0
  93. package/dist/in-store/edit/split-target.d.ts.map +1 -0
  94. package/dist/in-store/edit/split-target.js +116 -0
  95. package/dist/in-store/edit/split-target.js.map +1 -0
  96. package/dist/in-store/edit/target.d.ts +8 -0
  97. package/dist/in-store/edit/target.d.ts.map +1 -0
  98. package/dist/in-store/edit/target.js +5 -0
  99. package/dist/in-store/edit/target.js.map +1 -0
  100. package/dist/in-store/edit/trim-extend-geometry.d.ts +99 -0
  101. package/dist/in-store/edit/trim-extend-geometry.d.ts.map +1 -0
  102. package/dist/in-store/edit/trim-extend-geometry.js +105 -0
  103. package/dist/in-store/edit/trim-extend-geometry.js.map +1 -0
  104. package/dist/in-store/edit/wall-axis-edit.d.ts +16 -0
  105. package/dist/in-store/edit/wall-axis-edit.d.ts.map +1 -0
  106. package/dist/in-store/edit/wall-axis-edit.js +40 -0
  107. package/dist/in-store/edit/wall-axis-edit.js.map +1 -0
  108. package/dist/in-store/edit/wall-edit.d.ts +157 -0
  109. package/dist/in-store/edit/wall-edit.d.ts.map +1 -0
  110. package/dist/in-store/edit/wall-edit.js +276 -0
  111. package/dist/in-store/edit/wall-edit.js.map +1 -0
  112. package/dist/in-store/edit/wall-hosted-cuts.d.ts +35 -0
  113. package/dist/in-store/edit/wall-hosted-cuts.d.ts.map +1 -0
  114. package/dist/in-store/edit/wall-hosted-cuts.js +27 -0
  115. package/dist/in-store/edit/wall-hosted-cuts.js.map +1 -0
  116. package/dist/in-store/edit/wall-opening-reassign.d.ts +18 -0
  117. package/dist/in-store/edit/wall-opening-reassign.d.ts.map +1 -0
  118. package/dist/in-store/edit/wall-opening-reassign.js +50 -0
  119. package/dist/in-store/edit/wall-opening-reassign.js.map +1 -0
  120. package/dist/in-store/element-align.d.ts +13 -0
  121. package/dist/in-store/element-align.d.ts.map +1 -0
  122. package/dist/in-store/element-align.js +90 -0
  123. package/dist/in-store/element-align.js.map +1 -0
  124. package/dist/in-store/element-replacement.d.ts +26 -0
  125. package/dist/in-store/element-replacement.d.ts.map +1 -0
  126. package/dist/in-store/element-replacement.js +68 -0
  127. package/dist/in-store/element-replacement.js.map +1 -0
  128. package/dist/in-store/element-size-edit.d.ts +40 -0
  129. package/dist/in-store/element-size-edit.d.ts.map +1 -0
  130. package/dist/in-store/element-size-edit.js +103 -0
  131. package/dist/in-store/element-size-edit.js.map +1 -0
  132. package/dist/in-store/element-split-axis.d.ts +6 -0
  133. package/dist/in-store/element-split-axis.d.ts.map +1 -0
  134. package/dist/in-store/element-split-axis.js +87 -0
  135. package/dist/in-store/element-split-axis.js.map +1 -0
  136. package/dist/in-store/element-split-joined.d.ts +13 -0
  137. package/dist/in-store/element-split-joined.d.ts.map +1 -0
  138. package/dist/in-store/element-split-joined.js +74 -0
  139. package/dist/in-store/element-split-joined.js.map +1 -0
  140. package/dist/in-store/element-split-placement.d.ts +19 -0
  141. package/dist/in-store/element-split-placement.d.ts.map +1 -0
  142. package/dist/in-store/element-split-placement.js +48 -0
  143. package/dist/in-store/element-split-placement.js.map +1 -0
  144. package/dist/in-store/element-split-slab.d.ts +19 -0
  145. package/dist/in-store/element-split-slab.d.ts.map +1 -0
  146. package/dist/in-store/element-split-slab.js +86 -0
  147. package/dist/in-store/element-split-slab.js.map +1 -0
  148. package/dist/in-store/element-split.d.ts +49 -0
  149. package/dist/in-store/element-split.d.ts.map +1 -0
  150. package/dist/in-store/element-split.js +52 -0
  151. package/dist/in-store/element-split.js.map +1 -0
  152. package/dist/in-store/element-transform-edit.d.ts +33 -0
  153. package/dist/in-store/element-transform-edit.d.ts.map +1 -0
  154. package/dist/in-store/element-transform-edit.js +97 -0
  155. package/dist/in-store/element-transform-edit.js.map +1 -0
  156. package/dist/in-store/element-transform-frames.d.ts +58 -0
  157. package/dist/in-store/element-transform-frames.d.ts.map +1 -0
  158. package/dist/in-store/element-transform-frames.js +110 -0
  159. package/dist/in-store/element-transform-frames.js.map +1 -0
  160. package/dist/in-store/element-transform-joins.d.ts +4 -0
  161. package/dist/in-store/element-transform-joins.d.ts.map +1 -0
  162. package/dist/in-store/element-transform-joins.js +62 -0
  163. package/dist/in-store/element-transform-joins.js.map +1 -0
  164. package/dist/in-store/element-transform-plan.d.ts +38 -0
  165. package/dist/in-store/element-transform-plan.d.ts.map +1 -0
  166. package/dist/in-store/element-transform-plan.js +115 -0
  167. package/dist/in-store/element-transform-plan.js.map +1 -0
  168. package/dist/in-store/element-trim-extend.d.ts +25 -0
  169. package/dist/in-store/element-trim-extend.d.ts.map +1 -0
  170. package/dist/in-store/element-trim-extend.js +97 -0
  171. package/dist/in-store/element-trim-extend.js.map +1 -0
  172. package/dist/in-store/extract-grids.d.ts +7 -17
  173. package/dist/in-store/extract-grids.d.ts.map +1 -1
  174. package/dist/in-store/extract-grids.js +11 -2
  175. package/dist/in-store/extract-grids.js.map +1 -1
  176. package/dist/in-store/grid-column.d.ts +23 -0
  177. package/dist/in-store/grid-column.d.ts.map +1 -0
  178. package/dist/in-store/grid-column.js +73 -0
  179. package/dist/in-store/grid-column.js.map +1 -0
  180. package/dist/in-store/grid-intersection-read.d.ts +10 -0
  181. package/dist/in-store/grid-intersection-read.d.ts.map +1 -0
  182. package/dist/in-store/grid-intersection-read.js +45 -0
  183. package/dist/in-store/grid-intersection-read.js.map +1 -0
  184. package/dist/in-store/grid.d.ts +7 -1
  185. package/dist/in-store/grid.d.ts.map +1 -1
  186. package/dist/in-store/grid.js +12 -2
  187. package/dist/in-store/grid.js.map +1 -1
  188. package/dist/in-store/group-evidence.d.ts +49 -0
  189. package/dist/in-store/group-evidence.d.ts.map +1 -0
  190. package/dist/in-store/group-evidence.js +111 -0
  191. package/dist/in-store/group-evidence.js.map +1 -0
  192. package/dist/in-store/group-graph.d.ts +51 -0
  193. package/dist/in-store/group-graph.d.ts.map +1 -0
  194. package/dist/in-store/group-graph.js +213 -0
  195. package/dist/in-store/group-graph.js.map +1 -0
  196. package/dist/in-store/group.d.ts +34 -0
  197. package/dist/in-store/group.d.ts.map +1 -0
  198. package/dist/in-store/group.js +181 -0
  199. package/dist/in-store/group.js.map +1 -0
  200. package/dist/in-store/host-geometry-frame.d.ts +5 -1
  201. package/dist/in-store/host-geometry-frame.d.ts.map +1 -1
  202. package/dist/in-store/host-geometry-frame.js +46 -2
  203. package/dist/in-store/host-geometry-frame.js.map +1 -1
  204. package/dist/in-store/index.d.ts +7 -0
  205. package/dist/in-store/index.d.ts.map +1 -1
  206. package/dist/in-store/index.js +7 -0
  207. package/dist/in-store/index.js.map +1 -1
  208. package/dist/in-store/linear-profile-frame.d.ts +10 -0
  209. package/dist/in-store/linear-profile-frame.d.ts.map +1 -0
  210. package/dist/in-store/linear-profile-frame.js +17 -0
  211. package/dist/in-store/linear-profile-frame.js.map +1 -0
  212. package/dist/in-store/material.d.ts.map +1 -1
  213. package/dist/in-store/material.js +17 -6
  214. package/dist/in-store/material.js.map +1 -1
  215. package/dist/in-store/member.d.ts.map +1 -1
  216. package/dist/in-store/member.js +3 -7
  217. package/dist/in-store/member.js.map +1 -1
  218. package/dist/in-store/ordinary-element.d.ts +47 -0
  219. package/dist/in-store/ordinary-element.d.ts.map +1 -0
  220. package/dist/in-store/ordinary-element.js +38 -0
  221. package/dist/in-store/ordinary-element.js.map +1 -0
  222. package/dist/in-store/placement-frame.d.ts +6 -1
  223. package/dist/in-store/placement-frame.d.ts.map +1 -1
  224. package/dist/in-store/placement-frame.js +5 -1
  225. package/dist/in-store/placement-frame.js.map +1 -1
  226. package/dist/in-store/resolve-anchor.d.ts +3 -2
  227. package/dist/in-store/resolve-anchor.d.ts.map +1 -1
  228. package/dist/in-store/resolve-anchor.js +7 -5
  229. package/dist/in-store/resolve-anchor.js.map +1 -1
  230. package/dist/in-store/resolve-relations.d.ts +3 -1
  231. package/dist/in-store/resolve-relations.d.ts.map +1 -1
  232. package/dist/in-store/resolve-relations.js +8 -3
  233. package/dist/in-store/resolve-relations.js.map +1 -1
  234. package/dist/in-store/room-candidates.d.ts +58 -0
  235. package/dist/in-store/room-candidates.d.ts.map +1 -0
  236. package/dist/in-store/room-candidates.js +135 -0
  237. package/dist/in-store/room-candidates.js.map +1 -0
  238. package/dist/in-store/room-creation-plan.d.ts +16 -0
  239. package/dist/in-store/room-creation-plan.d.ts.map +1 -0
  240. package/dist/in-store/room-creation-plan.js +28 -0
  241. package/dist/in-store/room-creation-plan.js.map +1 -0
  242. package/dist/in-store/room-floor-height.d.ts +24 -0
  243. package/dist/in-store/room-floor-height.d.ts.map +1 -0
  244. package/dist/in-store/room-floor-height.js +32 -0
  245. package/dist/in-store/room-floor-height.js.map +1 -0
  246. package/dist/in-store/room-footprint-native.d.ts +19 -0
  247. package/dist/in-store/room-footprint-native.d.ts.map +1 -0
  248. package/dist/in-store/room-footprint-native.js +117 -0
  249. package/dist/in-store/room-footprint-native.js.map +1 -0
  250. package/dist/in-store/room-layout-cache.d.ts +23 -0
  251. package/dist/in-store/room-layout-cache.d.ts.map +1 -0
  252. package/dist/in-store/room-layout-cache.js +84 -0
  253. package/dist/in-store/room-layout-cache.js.map +1 -0
  254. package/dist/in-store/room-layout-core.d.ts +68 -0
  255. package/dist/in-store/room-layout-core.d.ts.map +1 -0
  256. package/dist/in-store/room-layout-core.js +153 -0
  257. package/dist/in-store/room-layout-core.js.map +1 -0
  258. package/dist/in-store/room-population.d.ts +5 -0
  259. package/dist/in-store/room-population.d.ts.map +1 -0
  260. package/dist/in-store/room-population.js +28 -0
  261. package/dist/in-store/room-population.js.map +1 -0
  262. package/dist/in-store/room-space-meshes.d.ts +15 -0
  263. package/dist/in-store/room-space-meshes.d.ts.map +1 -0
  264. package/dist/in-store/room-space-meshes.js +38 -0
  265. package/dist/in-store/room-space-meshes.js.map +1 -0
  266. package/dist/in-store/room-store.d.ts +55 -0
  267. package/dist/in-store/room-store.d.ts.map +1 -0
  268. package/dist/in-store/room-store.js +173 -0
  269. package/dist/in-store/room-store.js.map +1 -0
  270. package/dist/in-store/room-storey-elevation.d.ts +5 -0
  271. package/dist/in-store/room-storey-elevation.d.ts.map +1 -0
  272. package/dist/in-store/room-storey-elevation.js +42 -0
  273. package/dist/in-store/room-storey-elevation.js.map +1 -0
  274. package/dist/in-store/room-storey-frame.d.ts +47 -0
  275. package/dist/in-store/room-storey-frame.d.ts.map +1 -0
  276. package/dist/in-store/room-storey-frame.js +48 -0
  277. package/dist/in-store/room-storey-frame.js.map +1 -0
  278. package/dist/in-store/room-wall-rects.d.ts +117 -0
  279. package/dist/in-store/room-wall-rects.d.ts.map +1 -0
  280. package/dist/in-store/room-wall-rects.js +157 -0
  281. package/dist/in-store/room-wall-rects.js.map +1 -0
  282. package/dist/in-store/schema-attributes.d.ts +3 -3
  283. package/dist/in-store/schema-attributes.d.ts.map +1 -1
  284. package/dist/in-store/schema-attributes.js +9 -7
  285. package/dist/in-store/schema-attributes.js.map +1 -1
  286. package/dist/in-store/slab.d.ts.map +1 -1
  287. package/dist/in-store/slab.js +1 -4
  288. package/dist/in-store/slab.js.map +1 -1
  289. package/dist/in-store/stair-removal.d.ts +17 -0
  290. package/dist/in-store/stair-removal.d.ts.map +1 -0
  291. package/dist/in-store/stair-removal.js +134 -0
  292. package/dist/in-store/stair-removal.js.map +1 -0
  293. package/dist/in-store/storey-plan-frame.d.ts +2 -1
  294. package/dist/in-store/storey-plan-frame.d.ts.map +1 -1
  295. package/dist/in-store/storey-plan-frame.js +20 -11
  296. package/dist/in-store/storey-plan-frame.js.map +1 -1
  297. package/dist/in-store/storey-reassignment-plan.d.ts +53 -0
  298. package/dist/in-store/storey-reassignment-plan.d.ts.map +1 -0
  299. package/dist/in-store/storey-reassignment-plan.js +237 -0
  300. package/dist/in-store/storey-reassignment-plan.js.map +1 -0
  301. package/dist/in-store/storey-reassignment.d.ts +8 -0
  302. package/dist/in-store/storey-reassignment.d.ts.map +1 -0
  303. package/dist/in-store/storey-reassignment.js +52 -0
  304. package/dist/in-store/storey-reassignment.js.map +1 -0
  305. package/dist/in-store/trim-extend-plan.d.ts +27 -0
  306. package/dist/in-store/trim-extend-plan.d.ts.map +1 -0
  307. package/dist/in-store/trim-extend-plan.js +49 -0
  308. package/dist/in-store/trim-extend-plan.js.map +1 -0
  309. package/dist/in-store/wall-join-edit.d.ts +0 -17
  310. package/dist/in-store/wall-join-edit.d.ts.map +1 -1
  311. package/dist/in-store/wall-join-edit.js +41 -7
  312. package/dist/in-store/wall-join-edit.js.map +1 -1
  313. package/dist/in-store/wall-section-edit.d.ts +16 -0
  314. package/dist/in-store/wall-section-edit.d.ts.map +1 -0
  315. package/dist/in-store/wall-section-edit.js +75 -0
  316. package/dist/in-store/wall-section-edit.js.map +1 -0
  317. package/dist/in-store/wall-size-edit.d.ts +29 -0
  318. package/dist/in-store/wall-size-edit.d.ts.map +1 -0
  319. package/dist/in-store/wall-size-edit.js +65 -0
  320. package/dist/in-store/wall-size-edit.js.map +1 -0
  321. package/dist/index.d.ts +24 -0
  322. package/dist/index.d.ts.map +1 -1
  323. package/dist/index.js +23 -0
  324. package/dist/index.js.map +1 -1
  325. package/package.json +8 -7
@@ -0,0 +1,153 @@
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
+ /** Shared native DCEL reads and edit policy for the Room command (#6232 D5).
5
+ * The host supplies the actual WASM plate; this module owns no runtime heap. */
6
+ import { polygonArea } from './room-footprint-offset.js';
7
+ const errorMessage = (error) => error instanceof Error
8
+ ? error.message || error.name || 'Edit failed'
9
+ : String(error).replace(/^\w+:\s*/, '');
10
+ function distToSeg(px, py, ax, ay, bx, by) {
11
+ const dx = bx - ax, dy = by - ay;
12
+ const len2 = dx * dx + dy * dy || 1e-9;
13
+ const t = Math.max(0, Math.min(1, ((px - ax) * dx + (py - ay) * dy) / len2));
14
+ return Math.hypot(px - (ax + t * dx), py - (ay + t * dy));
15
+ }
16
+ const pts = (flat) => {
17
+ const out = [];
18
+ for (let i = 0; i + 1 < flat.length; i += 2)
19
+ out.push([flat[i], flat[i + 1]]);
20
+ return out;
21
+ };
22
+ /** Every room face of `plate`, with its wall-axis, inner and outer outlines. */
23
+ export function readFaces(plate) {
24
+ return plate.snapshot().map((r) => ({
25
+ face: r.face,
26
+ centre: r.outline,
27
+ inner: pts(plate.netOutline(r.face, true)),
28
+ outer: pts(plate.netOutline(r.face, false)),
29
+ }));
30
+ }
31
+ /** Creation cutoff filters reads without discarding a retained edited plate. */
32
+ export function filterRoomFaces(faces, minArea) {
33
+ return faces.filter((face) => Math.min(polygonArea(face.inner.length >= 3 ? face.inner : face.centre), polygonArea(face.centre)) >= minArea);
34
+ }
35
+ const EPS = 1e-6;
36
+ const same = (p, q) => Math.abs(p[0] - q[0]) < EPS && Math.abs(p[1] - q[1]) < EPS;
37
+ /** The layout edge nearest `p` within `tol`: its half-edge id and the face on this side. */
38
+ function edgeAt(h, p, tol) {
39
+ let best = null;
40
+ for (const r of h.snapshot()) {
41
+ const bounds = h.boundingElements(r.face);
42
+ const n = r.outline.length;
43
+ for (let i = 0; i < n; i++) {
44
+ const a = r.outline[i], b = r.outline[(i + 1) % n];
45
+ const d = distToSeg(p[0], p[1], a[0], a[1], b[0], b[1]);
46
+ if (bounds[i] && d <= tol && (!best || d < best.d))
47
+ best = { edge: bounds[i].edge, face: r.face, a, b, d };
48
+ }
49
+ }
50
+ return best;
51
+ }
52
+ /** Project `p` onto segment a→b. */
53
+ function onSegment(p, a, b) {
54
+ const dx = b[0] - a[0], dy = b[1] - a[1];
55
+ const t = Math.max(0, Math.min(1, ((p[0] - a[0]) * dx + (p[1] - a[1]) * dy) / (dx * dx + dy * dy || 1e-12)));
56
+ return [a[0] + t * dx, a[1] + t * dy];
57
+ }
58
+ /** A cut end: an existing node, else a new node on the wall edge there. */
59
+ function cutNode(h, p, tol) {
60
+ const v = h.findVertexNear(p[0], p[1], tol);
61
+ if (v !== undefined) {
62
+ const room = h.snapshot().flatMap((r) => r.outline).find((q) => Math.hypot(q[0] - p[0], q[1] - p[1]) <= tol);
63
+ return { v, at: room ?? [p[0], p[1]] };
64
+ }
65
+ const e = edgeAt(h, p, tol);
66
+ if (!e)
67
+ throw new Error('pick the cut ends on the room outline');
68
+ const at = onSegment(p, e.a, e.b);
69
+ return { v: h.splitEdge(e.edge, at[0], at[1]), at };
70
+ }
71
+ /**
72
+ * Run `op` on `h` (the Edit gestures, as plate calls). Throws the
73
+ * engine's refusal (`editError` reads it). Returns false when nothing changed.
74
+ */
75
+ export function applyLayoutOp(h, op, tol) {
76
+ switch (op.kind) {
77
+ case 'prune':
78
+ return h.prune() > 0;
79
+ case 'drag': {
80
+ const v = h.findVertexNear(op.from[0], op.from[1], tol);
81
+ if (v === undefined)
82
+ throw new Error('no room corner here');
83
+ h.dragVertex(v, op.to[0], op.to[1]);
84
+ return true;
85
+ }
86
+ case 'split': {
87
+ // Insert any new node on a wall edge, then cut the room both ends bound.
88
+ const a = cutNode(h, op.a, tol);
89
+ const b = cutNode(h, op.b, tol);
90
+ if (a.v === b.v)
91
+ throw new Error('the two cut points are the same');
92
+ const onBoundary = (r, p) => r.outline.some((q) => same(q, p));
93
+ const room = h.snapshot().find((r) => onBoundary(r, a.at) && onBoundary(r, b.at));
94
+ if (!room)
95
+ throw new Error('the two points are not on the same room');
96
+ h.splitFace(room.face, a.v, b.v, -1);
97
+ return true;
98
+ }
99
+ case 'remove': {
100
+ const v = h.findVertexNear(op.at[0], op.at[1], tol);
101
+ if (v !== undefined) {
102
+ // A corner between two walls dissolves; a wall junction won't, so remove one of its walls.
103
+ try {
104
+ h.dissolveVertex(v);
105
+ return true;
106
+ }
107
+ catch (dissolveError) {
108
+ const reason = errorMessage(dissolveError);
109
+ for (const r of h.snapshot()) {
110
+ const k = r.outline.findIndex((q) => Math.hypot(q[0] - op.at[0], q[1] - op.at[1]) <= tol);
111
+ if (k < 0)
112
+ continue;
113
+ const bounds = h.boundingElements(r.face);
114
+ for (const idx of [k, (k - 1 + r.outline.length) % r.outline.length]) {
115
+ const b = bounds[idx];
116
+ if (!b)
117
+ continue;
118
+ try {
119
+ removeEdge(h, b.edge);
120
+ return true;
121
+ }
122
+ catch (error) {
123
+ console.debug('[room.place] enclosing wall retained', errorMessage(error));
124
+ }
125
+ }
126
+ }
127
+ throw new Error(`no wall here separates two rooms (${reason})`);
128
+ }
129
+ }
130
+ const e = edgeAt(h, op.at, tol);
131
+ if (!e)
132
+ throw new Error('no room edge here');
133
+ removeEdge(h, e.edge);
134
+ return true;
135
+ }
136
+ }
137
+ }
138
+ /** Merge the two rooms an edge separates, or delete a bridge / spur wall and its orphans. */
139
+ function removeEdge(h, edge) {
140
+ const across = h.neighborAcross(edge);
141
+ const rooms = new Set(h.roomIds());
142
+ const own = h.snapshot().find((r) => h.boundingElements(r.face).some((b) => b.edge === edge))?.face;
143
+ if (across !== undefined && own !== undefined && across !== own && rooms.has(across))
144
+ h.mergeFaces(edge);
145
+ else
146
+ h.removeEdge(edge);
147
+ }
148
+ export function flattenRoomRects(rects) {
149
+ const flat = new Float64Array(rects.length * 8);
150
+ rects.forEach((r, w) => r.slice(0, 4).forEach((p, c) => { flat[w * 8 + c * 2] = p[0]; flat[w * 8 + c * 2 + 1] = p[1]; }));
151
+ return flat;
152
+ }
153
+ //# sourceMappingURL=room-layout-core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-layout-core.js","sourceRoot":"","sources":["../../src/in-store/room-layout-core.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;gFACgF;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAyBzD,MAAM,YAAY,GAAG,CAAC,KAAc,EAAU,EAAE,CAAC,KAAK,YAAY,KAAK;IACrE,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,IAAI,aAAa;IAC9C,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAE1C,SAAS,SAAS,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU;IACvF,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACjC,MAAM,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,IAAI,CAAC;IACvC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,I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,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;IAChI,IAAI,MAAM,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,IAAI,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;QAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;;QACpG,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAOD,MAAM,UAAU,gBAAgB,CAAC,KAAiC;IAChE,MAAM,IAAI,GAAG,IAAI,YAAY,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAChD,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1H,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { IfcDataStore } from '@ifc-lite/parser';
2
+ import { type MutablePropertyView } from '@ifc-lite/mutations';
3
+ /** Complete live IfcSpace ownership, including spaces without readable geometry (#7324). */
4
+ export declare function effectiveRoomIdsByStorey(store: IfcDataStore, view: MutablePropertyView | null | undefined, storeyIds: readonly number[]): Map<number, number[]>;
5
+ //# sourceMappingURL=room-population.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-population.d.ts","sourceRoot":"","sources":["../../src/in-store/room-population.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI1F,4FAA4F;AAC5F,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,GAC9F,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAcvB"}
@@ -0,0 +1,28 @@
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 { iterateEffectiveEntityIds } from '@ifc-lite/mutations';
5
+ import { liveEntityConforms } from './resolve-relations.js';
6
+ import { effectiveStoreyId } from './edit/effective-storey.js';
7
+ /** Complete live IfcSpace ownership, including spaces without readable geometry (#7324). */
8
+ export function effectiveRoomIdsByStorey(store, view, storeyIds) {
9
+ const populations = new Map(storeyIds.map(id => [id, []]));
10
+ let scanned = 0;
11
+ for (const { expressId } of iterateEffectiveEntityIds(store, view)) {
12
+ if (++scanned > 200000)
13
+ throw new Error('The loaded model is too large for a complete reviewed Room population');
14
+ if (!liveEntityConforms(store, expressId, 'IfcSpace', view))
15
+ continue;
16
+ const owner = effectiveStoreyId(store, view, expressId);
17
+ const rows = owner === undefined ? undefined : populations.get(owner);
18
+ if (!rows)
19
+ continue;
20
+ if (rows.length >= 128)
21
+ throw new Error('More than 128 rooms belong to this storey; a complete review is unavailable');
22
+ rows.push(expressId);
23
+ }
24
+ for (const rows of populations.values())
25
+ rows.sort((a, b) => a - b);
26
+ return populations;
27
+ }
28
+ //# sourceMappingURL=room-population.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-population.js","sourceRoot":"","sources":["../../src/in-store/room-population.ts"],"names":[],"mappings":"AAAA;;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AG,CAAC,CAAC,CAAC;IACpE,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /** Mesh-to-plan adapter; candidate occupancy policy is shared in create. */
2
+ import type { MeshData } from '@ifc-lite/geometry';
3
+ import type { Pt } from './room-layout-core.js';
4
+ type Tri = [Pt, Pt, Pt];
5
+ /**
6
+ * The plan triangles of the IfcSpace meshes whose height range overlaps the
7
+ * render-Y band `[lo, hi]`. `toPlan` maps a render-frame vertex to the plan
8
+ * frame the rooms are in; `live` drops meshes of deleted spaces.
9
+ */
10
+ export declare function spaceMeshTriangles(meshes: readonly MeshData[], band: {
11
+ lo: number;
12
+ hi: number;
13
+ }, toPlan: (x: number, y: number, z: number) => Pt, live: (mesh: MeshData) => boolean): Tri[];
14
+ export {};
15
+ //# sourceMappingURL=room-space-meshes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-space-meshes.d.ts","sourceRoot":"","sources":["../../src/in-store/room-space-meshes.ts"],"names":[],"mappings":"AAIA,4EAA4E;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAChD,KAAK,GAAG,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAIxB;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,QAAQ,EAAE,EAC3B,IAAI,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAChC,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,EAAE,EAC/C,IAAI,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,GAChC,GAAG,EAAE,CAsBP"}
@@ -0,0 +1,38 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ const cross = (o, a, b) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
5
+ /**
6
+ * The plan triangles of the IfcSpace meshes whose height range overlaps the
7
+ * render-Y band `[lo, hi]`. `toPlan` maps a render-frame vertex to the plan
8
+ * frame the rooms are in; `live` drops meshes of deleted spaces.
9
+ */
10
+ export function spaceMeshTriangles(meshes, band, toPlan, live) {
11
+ const out = [];
12
+ for (const mesh of meshes) {
13
+ if (mesh.ifcType !== 'IfcSpace' || !live(mesh))
14
+ continue;
15
+ const pos = mesh.positions;
16
+ const o = mesh.origin ?? [0, 0, 0];
17
+ let ymin = Infinity, ymax = -Infinity;
18
+ for (let i = 1; i < pos.length; i += 3) {
19
+ const y = o[1] + pos[i];
20
+ if (y < ymin)
21
+ ymin = y;
22
+ if (y > ymax)
23
+ ymax = y;
24
+ }
25
+ if (!(ymax > band.lo && ymin < band.hi))
26
+ continue;
27
+ const at = (v) => toPlan(o[0] + pos[v * 3], o[1] + pos[v * 3 + 1], o[2] + pos[v * 3 + 2]);
28
+ const idx = mesh.indices;
29
+ for (let t = 0; t + 2 < idx.length; t += 3) {
30
+ const tri = [at(idx[t]), at(idx[t + 1]), at(idx[t + 2])];
31
+ // Walls of the volume project to slivers; only its floor and ceiling cover plan area.
32
+ if (Math.abs(cross(tri[0], tri[1], tri[2])) > 1e-9)
33
+ out.push(tri);
34
+ }
35
+ }
36
+ return out;
37
+ }
38
+ //# sourceMappingURL=room-space-meshes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-space-meshes.js","sourceRoot":"","sources":["../../src/in-store/room-space-meshes.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAO/D,MAAM,KAAK,GAAG,CAAC,CAAK,EAAE,CAAK,EAAE,CAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,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C,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACtG,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC;QACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3C,MAAM,GAAG,GAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9D,sFAAsF;YACtF,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { type IfcDataStore } from '@ifc-lite/parser';
2
+ import { type StoreEditor } from '@ifc-lite/mutations';
3
+ import { type SlabSplitChain } from './edit/split-target.js';
4
+ import { type GlobalIdScope } from './edit/split-guid.js';
5
+ import { type RoomBoundary, type RoomCandidate } from './room-candidates.js';
6
+ import type { LayoutFace, Pt } from './room-layout-core.js';
7
+ export interface NewRoom {
8
+ outline: Pt[];
9
+ height: number;
10
+ z: number;
11
+ Name: string;
12
+ PredefinedType?: string;
13
+ ObjectType?: string;
14
+ grossArea: number;
15
+ netArea: number;
16
+ derived: boolean;
17
+ }
18
+ export type RoomChain = SlabSplitChain;
19
+ export type RoomRewrite = {
20
+ ok: true;
21
+ storeyId: number;
22
+ chain: RoomChain;
23
+ } | {
24
+ ok: false;
25
+ reason: 'shape' | 'storey';
26
+ };
27
+ export type RoomUpdate = {
28
+ ok: true;
29
+ outline: Pt[];
30
+ } | {
31
+ ok: false;
32
+ reason: 'shape' | 'storey' | 'noRoom';
33
+ };
34
+ export interface LayoutSync {
35
+ created: number[];
36
+ deleted: number[];
37
+ remesh: number[];
38
+ }
39
+ /** Source and overlay use the exact same supported extrusion predicate. */
40
+ export declare function roomChainInStore(store: IfcDataStore, editor: StoreEditor, id: number): RoomRewrite;
41
+ /** Auto/pick/draw commit their supplied native outlines together as one operation. */
42
+ export declare function createRoomsInStore(store: IfcDataStore, editor: StoreEditor, storeyId: number, rooms: readonly NewRoom[]): number[];
43
+ export declare function setRoomAreasInStore(editor: StoreEditor, id: number, areas: {
44
+ grossArea: number;
45
+ netArea: number;
46
+ }, height: number): void;
47
+ /** Preserve root identity, placement, metadata and links while replacing only its profile. */
48
+ export declare function rewriteRoomOutlineInStore(store: IfcDataStore, editor: StoreEditor, id: number, chain: RoomChain, outline: readonly Pt[], areas: {
49
+ grossArea: number;
50
+ netArea: number;
51
+ }): void;
52
+ export declare function updateRoomOutlineInStore(store: IfcDataStore, editor: StoreEditor, id: number, boundary: RoomBoundary, roomsOn: (storeyId: number) => readonly RoomCandidate[]): RoomUpdate;
53
+ /** Native layout edit keeps the larger split/merged room identity and its metadata. */
54
+ export declare function syncRoomLayoutInStore(store: IfcDataStore, editor: StoreEditor, before: readonly RoomCandidate[], after: readonly LayoutFace[], globalIdScopes?: readonly GlobalIdScope[], editedStoreyId?: number): LayoutSync;
55
+ //# sourceMappingURL=room-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-store.d.ts","sourceRoot":"","sources":["../../src/in-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EAAE,cAAc,GAAE,SAAS,aAAa,EAAO,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,UAAU,CA2DlO"}
@@ -0,0 +1,173 @@
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
+ /** Canonical atomic Room graph writes over the native DCEL's candidates (#6232 D5). */
5
+ import { editOwnershipRefusal } from '@ifc-lite/export';
6
+ import { QuantityType } from '@ifc-lite/data';
7
+ import { getSchemaRegistryForVersion } from '@ifc-lite/parser';
8
+ import { recordSessionMutation } from '@ifc-lite/mutations';
9
+ import { addSpaceToStore } from './space.js';
10
+ import { GENERATED_SPACE_OBJECTTYPE } from './generate-spaces.js';
11
+ import { resolveSpatialAnchor } from './resolve-anchor.js';
12
+ import { resolveSplitTarget } from './edit/split-target.js';
13
+ import { getModelLengthUnitScale } from './edit/length-unit-scale.js';
14
+ import { effectiveStoreyId } from './edit/effective-storey.js';
15
+ import { emitClippedProfile } from './element-split-slab.js';
16
+ import { readAttributes } from './edit/placement-core.js';
17
+ import { cloneElementMetadata } from './edit/metadata-clone.js';
18
+ import { deriveSplitGlobalId, globalIdTakenIn, keepsFirstPiece } from './edit/split-guid.js';
19
+ import { polygonArea as polyArea, pointInPolygon as pointInPoly } from './room-footprint-offset.js';
20
+ import { roomAt, interiorPoint, roomOutline } from './room-candidates.js';
21
+ /** Source and overlay use the exact same supported extrusion predicate. */
22
+ export function roomChainInStore(store, editor, id) {
23
+ const view = editor.getMutationView();
24
+ const target = resolveSplitTarget(store, view, editor, id, getModelLengthUnitScale(store));
25
+ if (!target.ok)
26
+ return { ok: false, reason: target.code === 'storey' || target.code === 'container' ? 'storey' : 'shape' };
27
+ if (target.kind !== 'slab' || target.chain.elementType !== 'IfcSpace')
28
+ return { ok: false, reason: 'shape' };
29
+ const storeyId = effectiveStoreyId(store, view, id);
30
+ return storeyId === undefined ? { ok: false, reason: 'storey' } : { ok: true, storeyId, chain: target.chain };
31
+ }
32
+ /** Auto/pick/draw commit their supplied native outlines together as one operation. */
33
+ export function createRoomsInStore(store, editor, storeyId, rooms) {
34
+ if (rooms.length > 10000)
35
+ throw new Error('Room batch exceeds 10000 rooms');
36
+ return editor.runAtomic(draft => {
37
+ const anchor = resolveSpatialAnchor(store, storeyId, draft.getMutationView());
38
+ return rooms.map(room => addSpaceToStore(draft, anchor, {
39
+ Profile: 'polygon', OuterCurve: room.outline, Position: [0, 0, room.z], Height: room.height, Name: room.Name,
40
+ ...(room.PredefinedType !== undefined ? { PredefinedType: room.PredefinedType } : {}),
41
+ ...(room.ObjectType ? { ObjectType: room.ObjectType } : room.derived ? { ObjectType: GENERATED_SPACE_OBJECTTYPE } : {}),
42
+ grossFloorArea: room.grossArea, netFloorArea: room.netArea,
43
+ }).spaceId);
44
+ });
45
+ }
46
+ export function setRoomAreasInStore(editor, id, areas, height) {
47
+ const view = editor.getMutationView(), qto = 'Qto_SpaceBaseQuantities';
48
+ view.setQuantity(id, qto, 'GrossFloorArea', areas.grossArea, QuantityType.Area);
49
+ view.setQuantity(id, qto, 'NetFloorArea', areas.netArea, QuantityType.Area);
50
+ view.setQuantity(id, qto, 'GrossVolume', areas.grossArea * height, QuantityType.Volume);
51
+ }
52
+ /** Preserve root identity, placement, metadata and links while replacing only its profile. */
53
+ export function rewriteRoomOutlineInStore(store, editor, id, chain, outline, areas) {
54
+ const ownership = editOwnershipRefusal(store, editor.getMutationView(), [chain.extrudedSolidId], new Set([id]));
55
+ if (ownership)
56
+ throw new Error(ownership);
57
+ const origin = chain.placementOrigin;
58
+ const emitted = emitClippedProfile(editor, outline, origin, chain.baseElevation - origin[2], getModelLengthUnitScale(store));
59
+ editor.setPositionalAttribute(chain.extrudedSolidId, 0, `#${emitted.profile}`);
60
+ editor.setPositionalAttribute(chain.extrudedSolidId, 1, `#${emitted.solidPosition}`);
61
+ editor.setPositionalAttribute(chain.extrudedSolidId, 2, `#${emitted.up}`);
62
+ setRoomAreasInStore(editor, id, areas, chain.thickness);
63
+ }
64
+ export function updateRoomOutlineInStore(store, editor, id, boundary, roomsOn) {
65
+ return editor.runAtomic(draft => {
66
+ const target = roomChainInStore(store, draft, id);
67
+ if (!target.ok)
68
+ return target;
69
+ const room = roomAt(roomsOn(target.storeyId), interiorPoint(target.chain.footprint));
70
+ if (!room)
71
+ return { ok: false, reason: 'noRoom' };
72
+ const outline = roomOutline(room, boundary);
73
+ rewriteRoomOutlineInStore(store, draft, id, target.chain, outline, room);
74
+ return { ok: true, outline };
75
+ });
76
+ }
77
+ function dropCollinear(ring) {
78
+ const out = ring.filter((p, i) => {
79
+ const a = ring[(i + ring.length - 1) % ring.length], b = ring[(i + 1) % ring.length];
80
+ const cross = (p[0] - a[0]) * (b[1] - a[1]) - (p[1] - a[1]) * (b[0] - a[0]);
81
+ return Math.abs(cross) > 1e-9 * Math.max(1, Math.hypot(b[0] - a[0], b[1] - a[1]));
82
+ });
83
+ return out.length >= 3 ? out : [...ring];
84
+ }
85
+ const outlineOf = (face, link) => dropCollinear(roomOutline(face, link.boundary));
86
+ const ringKey = (ring) => ring.map(p => `${p[0].toFixed(4)},${p[1].toFixed(4)}`).join(';');
87
+ const areasOf = (face) => ({ grossArea: polyArea(face.centre), netArea: polyArea(face.inner) });
88
+ function chainOf(store, editor, id) {
89
+ const target = roomChainInStore(store, editor, id);
90
+ if (!target.ok)
91
+ throw new Error(`Room layout refuses unsupported ${target.reason} for #${id}`);
92
+ return target.chain;
93
+ }
94
+ function faceHolding(faces, p) {
95
+ let hit = null;
96
+ for (const face of faces)
97
+ if (pointInPoly(p[0], p[1], face.centre) && (!hit || polyArea(face.centre) < polyArea(hit.centre)))
98
+ hit = face;
99
+ return hit;
100
+ }
101
+ /** Native layout edit keeps the larger split/merged room identity and its metadata. */
102
+ export function syncRoomLayoutInStore(store, editor, before, after, globalIdScopes = [], editedStoreyId) {
103
+ return editor.runAtomic(draft => {
104
+ const out = { created: [], deleted: [], remesh: [] }, view = draft.getMutationView();
105
+ const seen = new Set(view.getMutations().map(mutation => mutation.id));
106
+ const pre = new Map(before.map(c => [c.face, c])), post = new Map(after.map(f => [f.face, f]));
107
+ const removed = before.filter(c => !post.has(c.face)), handled = new Set();
108
+ for (const face of after) {
109
+ if (pre.has(face.face))
110
+ continue;
111
+ const parent = faceHolding(before, interiorPoint(face.inner.length >= 3 ? face.inner : face.centre));
112
+ const kept = parent ? post.get(parent.face) : undefined;
113
+ if (!parent?.room || !kept || handled.has(kept.face))
114
+ continue;
115
+ const { room: link } = parent, chain = chainOf(store, draft, link.expressId);
116
+ const keepFirst = keepsFirstPiece(polyArea(outlineOf(kept, link)), polyArea(outlineOf(face, link)));
117
+ const [keptFace, cutFace] = keepFirst ? [kept, face] : [face, kept];
118
+ const attrs = readAttributes(store, view, draft, link.expressId);
119
+ if (!attrs)
120
+ throw new Error('Room layout refuses unreadable source attributes');
121
+ const classification = attrs[9];
122
+ if (classification != null && typeof classification !== 'string')
123
+ throw new Error('Room layout refuses invalid classification');
124
+ const schema = store.schemaVersion;
125
+ const registry = getSchemaRegistryForVersion(schema === 'IFC2X3' || schema === 'IFC4X3' ? schema : 'IFC4');
126
+ if (classification == null && !registry.entities.IfcSpace.allAttributes[9].optional)
127
+ throw new Error('Room layout requires source classification');
128
+ const target = roomChainInStore(store, draft, link.expressId);
129
+ if (!target.ok)
130
+ throw new Error('Room layout requires a storey');
131
+ const added = addSpaceToStore(draft, resolveSpatialAnchor(store, target.storeyId, view), {
132
+ Profile: 'polygon', Position: [0, 0, chain.baseElevation], OuterCurve: outlineOf(cutFace, link), Height: chain.thickness,
133
+ ...(typeof attrs[2] === 'string' ? { Name: attrs[2] } : {}),
134
+ ...(typeof classification === 'string' ? { PredefinedType: classification.replace(/^\.|\.$/g, '') } : {}),
135
+ ...(typeof attrs[4] === 'string' ? { ObjectType: attrs[4] } : {}),
136
+ GlobalId: deriveSplitGlobalId(typeof attrs[0] === 'string' ? attrs[0] : String(link.expressId), globalIdTakenIn([{ dataStore: store, view }, ...globalIdScopes])),
137
+ }).spaceId;
138
+ if (classification == null)
139
+ draft.setPositionalAttribute(added, 9, null);
140
+ rewriteRoomOutlineInStore(store, draft, link.expressId, chain, outlineOf(keptFace, link), areasOf(keptFace));
141
+ cloneElementMetadata(store, view, draft, link.expressId, [added]);
142
+ setRoomAreasInStore(draft, added, areasOf(cutFace), chain.thickness);
143
+ handled.add(kept.face).add(face.face);
144
+ out.created.push(added);
145
+ out.remesh.push(link.expressId, added);
146
+ }
147
+ for (const face of after) {
148
+ if (handled.has(face.face))
149
+ continue;
150
+ const own = pre.get(face.face), absorbed = removed.filter(r => pointInPoly(r.interior[0], r.interior[1], face.centre));
151
+ const sources = [...(own ? [own] : []), ...absorbed];
152
+ const links = [...new Map(sources.flatMap(c => c.room ? [[c.room.expressId, c.room]] : [])).values()];
153
+ if (links.length === 0 || (absorbed.length === 0 && own && ringKey(own.centre) === ringKey(face.centre)))
154
+ continue;
155
+ const chains = links.map(link => ({ link, chain: chainOf(store, draft, link.expressId) }));
156
+ chains.sort((x, y) => polyArea(y.chain.footprint) - polyArea(x.chain.footprint));
157
+ const [{ link, chain }, ...merged] = chains;
158
+ rewriteRoomOutlineInStore(store, draft, link.expressId, chain, outlineOf(face, link), areasOf(face));
159
+ out.remesh.push(link.expressId);
160
+ for (const entry of merged) {
161
+ if (!draft.removeEntity(entry.link.expressId))
162
+ throw new Error('Room layout could not remove merged room');
163
+ out.deleted.push(entry.link.expressId);
164
+ }
165
+ }
166
+ // Native callers pass the storey after a changed layout operation.
167
+ if (editedStoreyId !== undefined && !view.getMutations().some(mutation => !seen.has(mutation.id))) {
168
+ recordSessionMutation(view, editedStoreyId, 'room-layout');
169
+ }
170
+ return out;
171
+ });
172
+ }
173
+ //# sourceMappingURL=room-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-store.js","sourceRoot":"","sources":["../../src/in-store/room-store.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA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CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { MutablePropertyView } from '@ifc-lite/mutations';
2
+ import { type IfcDataStore } from '@ifc-lite/parser';
3
+ /** Renderer-frame floor height for a live storey, including authored Elevation. */
4
+ export declare function effectiveStoreyElevation(store: IfcDataStore, view: MutablePropertyView | null | undefined, storeyId: number): number;
5
+ //# sourceMappingURL=room-storey-elevation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-storey-elevation.d.ts","sourceRoot":"","sources":["../../src/in-store/room-storey-elevation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAiD,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEpG,mFAAmF;AACnF,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,EAC5C,QAAQ,EAAE,MAAM,GACf,MAAM,CAkCR"}
@@ -0,0 +1,42 @@
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 { EntityExtractor, resolveEffectiveEntityRecord } from '@ifc-lite/parser';
5
+ /** Renderer-frame floor height for a live storey, including authored Elevation. */
6
+ export function effectiveStoreyElevation(store, view, storeyId) {
7
+ const created = view?.getNewEntity(storeyId);
8
+ const retype = view?.getEntityTypeMutation(storeyId)?.newType;
9
+ const named = view?.getAttributeMutationsForEntity(storeyId) ?? [];
10
+ const positional = view?.getPositionalMutationsForEntity(storeyId);
11
+ // Hover raycasts ask for this floor repeatedly. The parsed hierarchy is
12
+ // already in metres, so avoid extracting an unchanged source record.
13
+ if (!created && !retype && !positional?.has(9)
14
+ && !named.some(({ name }) => name === 'Elevation')) {
15
+ return store.spatialHierarchy?.storeyElevations.get(storeyId) ?? 0;
16
+ }
17
+ // @raw-entity-enumeration-ok point lookup for the already-selected effective storey's source record
18
+ const ref = created ? undefined : store.entityIndex.byId.get(storeyId)
19
+ ?? store.deferredEntityIndex?.get(storeyId);
20
+ const source = ref && store.source.byteLength > 0
21
+ ? new EntityExtractor(store.source).extractEntity(ref)
22
+ : null;
23
+ const entity = created ?? source;
24
+ if (entity) {
25
+ const record = resolveEffectiveEntityRecord(entity, {
26
+ retype,
27
+ named: named.map(({ name, value }) => [name, value]),
28
+ positional: positional ?? [],
29
+ }, store.schemaVersion);
30
+ const value = record.attributes[9]; // IfcBuildingStorey.Elevation in IFC2X3/IFC4.
31
+ const raw = typeof value === 'number' ? value
32
+ : typeof value === 'string' && value.trim() ? Number(value)
33
+ : value && typeof value === 'object' && 'real' in value && typeof value.real === 'number'
34
+ ? value.real
35
+ : Array.isArray(value) && typeof value[1] === 'number' ? value[1] : undefined;
36
+ if (raw !== undefined && Number.isFinite(raw))
37
+ return raw * (store.lengthUnitScale ?? 1);
38
+ }
39
+ // The parsed hierarchy also includes ObjectPlacement-Z when Elevation is null.
40
+ return store.spatialHierarchy?.storeyElevations.get(storeyId) ?? 0;
41
+ }
42
+ //# sourceMappingURL=room-storey-elevation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-storey-elevation.js","sourceRoot":"","sources":["../../src/in-store/room-storey-elevation.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAG/D,OAAO,EAAE,eAAe,EAAE,4BAA4B,EAAqB,MAAM,kBAAkB,CAAC;AAEpG,mFAAmF;AACnF,MAAM,UAAU,wBAAwB,CACtC,KAAmB,EACnB,IAA4C,EAC5C,QAAgB;IAEhB,MAAM,OAAO,GAAG,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,EAAE,qBAAqB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC9D,MAAM,KAAK,GAAG,IAAI,EAAE,8BAA8B,CAAC,QA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