@pascal-app/core 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-operations/__fixtures__/add-object-cases.d.ts +235 -0
- package/dist/agent-operations/__fixtures__/add-object-cases.d.ts.map +1 -0
- package/dist/agent-operations/__fixtures__/add-object-cases.js +129 -0
- package/dist/agent-operations/__fixtures__/build-room-cases.d.ts +4 -0
- package/dist/agent-operations/__fixtures__/build-room-cases.d.ts.map +1 -0
- package/dist/agent-operations/__fixtures__/build-room-cases.js +635 -0
- package/dist/agent-operations/__fixtures__/cases.d.ts +52 -0
- package/dist/agent-operations/__fixtures__/cases.d.ts.map +1 -0
- package/dist/agent-operations/__fixtures__/cases.js +689 -0
- package/dist/agent-operations/__fixtures__/find-by-type-cases.d.ts +7 -0
- package/dist/agent-operations/__fixtures__/find-by-type-cases.d.ts.map +1 -0
- package/dist/agent-operations/__fixtures__/find-by-type-cases.js +21 -0
- package/dist/agent-operations/__fixtures__/place-items-cases.d.ts +17 -0
- package/dist/agent-operations/__fixtures__/place-items-cases.d.ts.map +1 -0
- package/dist/agent-operations/__fixtures__/place-items-cases.js +506 -0
- package/dist/agent-operations/__fixtures__/room-cases.d.ts +3 -0
- package/dist/agent-operations/__fixtures__/room-cases.d.ts.map +1 -0
- package/dist/agent-operations/__fixtures__/room-cases.js +338 -0
- package/dist/agent-operations/__fixtures__/search-assets-cases.d.ts +5 -0
- package/dist/agent-operations/__fixtures__/search-assets-cases.d.ts.map +1 -0
- package/dist/agent-operations/__fixtures__/search-assets-cases.js +137 -0
- package/dist/agent-operations/__fixtures__/structure-cases.d.ts +6 -0
- package/dist/agent-operations/__fixtures__/structure-cases.d.ts.map +1 -0
- package/dist/agent-operations/__fixtures__/structure-cases.js +588 -0
- package/dist/agent-operations/__fixtures__/verify-scene-cases.d.ts +3 -0
- package/dist/agent-operations/__fixtures__/verify-scene-cases.d.ts.map +1 -0
- package/dist/agent-operations/__fixtures__/verify-scene-cases.js +302 -0
- package/dist/agent-operations/achieved.d.ts +16 -0
- package/dist/agent-operations/achieved.d.ts.map +1 -0
- package/dist/agent-operations/achieved.js +28 -0
- package/dist/agent-operations/add-column.d.ts +23 -0
- package/dist/agent-operations/add-column.d.ts.map +1 -0
- package/dist/agent-operations/add-column.js +97 -0
- package/dist/agent-operations/add-level.d.ts +14 -0
- package/dist/agent-operations/add-level.d.ts.map +1 -0
- package/dist/agent-operations/add-level.js +94 -0
- package/dist/agent-operations/add-object.d.ts +114 -0
- package/dist/agent-operations/add-object.d.ts.map +1 -0
- package/dist/agent-operations/add-object.js +361 -0
- package/dist/agent-operations/add-wall.d.ts +15 -0
- package/dist/agent-operations/add-wall.d.ts.map +1 -0
- package/dist/agent-operations/add-wall.js +47 -0
- package/dist/agent-operations/apply-changes.d.ts +16 -0
- package/dist/agent-operations/apply-changes.d.ts.map +1 -0
- package/dist/agent-operations/apply-changes.js +93 -0
- package/dist/agent-operations/apply-outcome.d.ts +15 -0
- package/dist/agent-operations/apply-outcome.d.ts.map +1 -0
- package/dist/agent-operations/apply-outcome.js +18 -0
- package/dist/agent-operations/collections.d.ts +28 -0
- package/dist/agent-operations/collections.d.ts.map +1 -0
- package/dist/agent-operations/collections.js +130 -0
- package/dist/agent-operations/create-room.d.ts +36 -0
- package/dist/agent-operations/create-room.d.ts.map +1 -0
- package/dist/agent-operations/create-room.js +177 -0
- package/dist/agent-operations/create-stair.d.ts +33 -0
- package/dist/agent-operations/create-stair.d.ts.map +1 -0
- package/dist/agent-operations/create-stair.js +247 -0
- package/dist/agent-operations/delete-node.d.ts +6 -0
- package/dist/agent-operations/delete-node.d.ts.map +1 -0
- package/dist/agent-operations/delete-node.js +9 -0
- package/dist/agent-operations/door-clearance.d.ts +135 -0
- package/dist/agent-operations/door-clearance.d.ts.map +1 -0
- package/dist/agent-operations/door-clearance.js +334 -0
- package/dist/agent-operations/duplicate-level.d.ts +12 -0
- package/dist/agent-operations/duplicate-level.d.ts.map +1 -0
- package/dist/agent-operations/duplicate-level.js +54 -0
- package/dist/agent-operations/find-by-type.d.ts +11 -0
- package/dist/agent-operations/find-by-type.d.ts.map +1 -0
- package/dist/agent-operations/find-by-type.js +94 -0
- package/dist/agent-operations/furnish-room.d.ts +18 -0
- package/dist/agent-operations/furnish-room.d.ts.map +1 -0
- package/dist/agent-operations/furnish-room.js +259 -0
- package/dist/agent-operations/get-node.d.ts +9 -0
- package/dist/agent-operations/get-node.d.ts.map +1 -0
- package/dist/agent-operations/get-node.js +33 -0
- package/dist/agent-operations/hosted-services.d.ts +13 -0
- package/dist/agent-operations/hosted-services.d.ts.map +1 -0
- package/dist/agent-operations/hosted-services.js +22 -0
- package/dist/agent-operations/index.d.ts +277 -0
- package/dist/agent-operations/index.d.ts.map +1 -0
- package/dist/agent-operations/index.js +80 -0
- package/dist/agent-operations/layout-clearance.d.ts +108 -0
- package/dist/agent-operations/layout-clearance.d.ts.map +1 -0
- package/dist/agent-operations/layout-clearance.js +190 -0
- package/dist/agent-operations/level-reads.d.ts +33 -0
- package/dist/agent-operations/level-reads.d.ts.map +1 -0
- package/dist/agent-operations/level-reads.js +161 -0
- package/dist/agent-operations/level-target.d.ts +11 -0
- package/dist/agent-operations/level-target.d.ts.map +1 -0
- package/dist/agent-operations/level-target.js +29 -0
- package/dist/agent-operations/list-levels.d.ts +4 -0
- package/dist/agent-operations/list-levels.d.ts.map +1 -0
- package/dist/agent-operations/list-levels.js +31 -0
- package/dist/agent-operations/material-preset.d.ts +11 -0
- package/dist/agent-operations/material-preset.d.ts.map +1 -0
- package/dist/agent-operations/material-preset.js +74 -0
- package/dist/agent-operations/material-refs.d.ts +24 -0
- package/dist/agent-operations/material-refs.d.ts.map +1 -0
- package/dist/agent-operations/material-refs.js +100 -0
- package/dist/agent-operations/node-patch.d.ts +3 -0
- package/dist/agent-operations/node-patch.d.ts.map +1 -0
- package/dist/agent-operations/node-patch.js +114 -0
- package/dist/agent-operations/paint.d.ts +21 -0
- package/dist/agent-operations/paint.d.ts.map +1 -0
- package/dist/agent-operations/paint.js +219 -0
- package/dist/agent-operations/place-items.d.ts +20 -0
- package/dist/agent-operations/place-items.d.ts.map +1 -0
- package/dist/agent-operations/place-items.js +226 -0
- package/dist/agent-operations/plan-geometry.d.ts +24 -0
- package/dist/agent-operations/plan-geometry.d.ts.map +1 -0
- package/dist/agent-operations/plan-geometry.js +94 -0
- package/dist/agent-operations/room-structure.d.ts +87 -0
- package/dist/agent-operations/room-structure.d.ts.map +1 -0
- package/dist/agent-operations/room-structure.js +144 -0
- package/dist/agent-operations/scene-materials.d.ts +15 -0
- package/dist/agent-operations/scene-materials.d.ts.map +1 -0
- package/dist/agent-operations/scene-materials.js +62 -0
- package/dist/agent-operations/scene-measure.d.ts +73 -0
- package/dist/agent-operations/scene-measure.d.ts.map +1 -0
- package/dist/agent-operations/scene-measure.js +73 -0
- package/dist/agent-operations/scene-queries.d.ts +4510 -0
- package/dist/agent-operations/scene-queries.d.ts.map +1 -0
- package/dist/agent-operations/scene-queries.js +84 -0
- package/dist/agent-operations/scene-view.d.ts +98 -0
- package/dist/agent-operations/scene-view.d.ts.map +1 -0
- package/dist/agent-operations/scene-view.js +559 -0
- package/dist/agent-operations/search-assets.d.ts +14 -0
- package/dist/agent-operations/search-assets.d.ts.map +1 -0
- package/dist/agent-operations/search-assets.js +42 -0
- package/dist/agent-operations/search-materials.d.ts +12 -0
- package/dist/agent-operations/search-materials.d.ts.map +1 -0
- package/dist/agent-operations/search-materials.js +111 -0
- package/dist/agent-operations/stairs.d.ts +5 -0
- package/dist/agent-operations/stairs.d.ts.map +1 -0
- package/dist/agent-operations/stairs.js +70 -0
- package/dist/agent-operations/types.d.ts +59 -0
- package/dist/agent-operations/types.d.ts.map +1 -0
- package/dist/agent-operations/types.js +1 -0
- package/dist/agent-operations/verify-scene.d.ts +50 -0
- package/dist/agent-operations/verify-scene.d.ts.map +1 -0
- package/dist/agent-operations/verify-scene.js +369 -0
- package/dist/agent-operations/wall-opening.d.ts +65 -0
- package/dist/agent-operations/wall-opening.d.ts.map +1 -0
- package/dist/agent-operations/wall-opening.js +55 -0
- package/dist/agent-tools/achieved.d.ts +9 -0
- package/dist/agent-tools/achieved.d.ts.map +1 -0
- package/dist/agent-tools/achieved.js +8 -0
- package/dist/agent-tools/add-object.d.ts +43 -0
- package/dist/agent-tools/add-object.d.ts.map +1 -0
- package/dist/agent-tools/add-object.js +86 -0
- package/dist/agent-tools/assets.d.ts +13 -0
- package/dist/agent-tools/assets.d.ts.map +1 -0
- package/dist/agent-tools/assets.js +18 -0
- package/dist/agent-tools/clear-scene.d.ts +10 -0
- package/dist/agent-tools/clear-scene.d.ts.map +1 -0
- package/dist/agent-tools/clear-scene.js +9 -0
- package/dist/agent-tools/collections.d.ts +35 -0
- package/dist/agent-tools/collections.d.ts.map +1 -0
- package/dist/agent-tools/collections.js +31 -0
- package/dist/agent-tools/columns.d.ts +44 -0
- package/dist/agent-tools/columns.d.ts.map +1 -0
- package/dist/agent-tools/columns.js +59 -0
- package/dist/agent-tools/contract.d.ts +68 -0
- package/dist/agent-tools/contract.d.ts.map +1 -0
- package/dist/agent-tools/contract.js +1 -0
- package/dist/agent-tools/create-room.d.ts +63 -0
- package/dist/agent-tools/create-room.d.ts.map +1 -0
- package/dist/agent-tools/create-room.js +90 -0
- package/dist/agent-tools/find-by-type.d.ts +11 -0
- package/dist/agent-tools/find-by-type.d.ts.map +1 -0
- package/dist/agent-tools/find-by-type.js +14 -0
- package/dist/agent-tools/furnish-room.d.ts +26 -0
- package/dist/agent-tools/furnish-room.d.ts.map +1 -0
- package/dist/agent-tools/furnish-room.js +35 -0
- package/dist/agent-tools/hosted-services.d.ts +402 -0
- package/dist/agent-tools/hosted-services.d.ts.map +1 -0
- package/dist/agent-tools/hosted-services.js +148 -0
- package/dist/agent-tools/index.d.ts +864 -0
- package/dist/agent-tools/index.d.ts.map +1 -0
- package/dist/agent-tools/index.js +82 -0
- package/dist/agent-tools/levels.d.ts +72 -0
- package/dist/agent-tools/levels.d.ts.map +1 -0
- package/dist/agent-tools/levels.js +76 -0
- package/dist/agent-tools/measurement.d.ts +37 -0
- package/dist/agent-tools/measurement.d.ts.map +1 -0
- package/dist/agent-tools/measurement.js +94 -0
- package/dist/agent-tools/node-id.d.ts +3 -0
- package/dist/agent-tools/node-id.d.ts.map +1 -0
- package/dist/agent-tools/node-id.js +2 -0
- package/dist/agent-tools/nodes.d.ts +17 -0
- package/dist/agent-tools/nodes.d.ts.map +1 -0
- package/dist/agent-tools/nodes.js +13 -0
- package/dist/agent-tools/paint.d.ts +46 -0
- package/dist/agent-tools/paint.d.ts.map +1 -0
- package/dist/agent-tools/paint.js +29 -0
- package/dist/agent-tools/place-items.d.ts +19 -0
- package/dist/agent-tools/place-items.d.ts.map +1 -0
- package/dist/agent-tools/place-items.js +29 -0
- package/dist/agent-tools/refusal.d.ts +20 -0
- package/dist/agent-tools/refusal.d.ts.map +1 -0
- package/dist/agent-tools/refusal.js +29 -0
- package/dist/agent-tools/room-structure.d.ts +438 -0
- package/dist/agent-tools/room-structure.d.ts.map +1 -0
- package/dist/agent-tools/room-structure.js +207 -0
- package/dist/agent-tools/search-materials.d.ts +20 -0
- package/dist/agent-tools/search-materials.d.ts.map +1 -0
- package/dist/agent-tools/search-materials.js +32 -0
- package/dist/agent-tools/stairs.d.ts +86 -0
- package/dist/agent-tools/stairs.d.ts.map +1 -0
- package/dist/agent-tools/stairs.js +103 -0
- package/dist/agent-tools/verify-scene.d.ts +13 -0
- package/dist/agent-tools/verify-scene.d.ts.map +1 -0
- package/dist/agent-tools/verify-scene.js +21 -0
- package/dist/agent-tools/view-scene.d.ts +43 -0
- package/dist/agent-tools/view-scene.d.ts.map +1 -0
- package/dist/agent-tools/view-scene.js +80 -0
- package/dist/agent-tools/wall-openings.d.ts +163 -0
- package/dist/agent-tools/wall-openings.d.ts.map +1 -0
- package/dist/agent-tools/wall-openings.js +144 -0
- package/dist/agent-tools/walls.d.ts +21 -0
- package/dist/agent-tools/walls.d.ts.map +1 -0
- package/dist/agent-tools/walls.js +30 -0
- package/dist/agent-tools/write-target.d.ts +12 -0
- package/dist/agent-tools/write-target.d.ts.map +1 -0
- package/dist/agent-tools/write-target.js +10 -0
- package/dist/building/__fixtures__/wall-opening-cases.d.ts +736 -0
- package/dist/building/__fixtures__/wall-opening-cases.d.ts.map +1 -0
- package/dist/building/__fixtures__/wall-opening-cases.js +307 -0
- package/dist/building/door-types.d.ts +22 -0
- package/dist/building/door-types.d.ts.map +1 -0
- package/dist/building/door-types.js +167 -0
- package/dist/building/floor-item-fit.d.ts +38 -0
- package/dist/building/floor-item-fit.d.ts.map +1 -0
- package/dist/building/floor-item-fit.js +47 -0
- package/dist/building/index.d.ts +7 -0
- package/dist/building/index.d.ts.map +1 -0
- package/dist/building/index.js +6 -0
- package/dist/building/level-duplication.d.ts +8983 -0
- package/dist/building/level-duplication.d.ts.map +1 -0
- package/dist/building/level-duplication.js +314 -0
- package/dist/building/opening-style-presets.d.ts +46 -0
- package/dist/building/opening-style-presets.d.ts.map +1 -0
- package/dist/building/opening-style-presets.js +195 -0
- package/dist/building/wall-openings.d.ts +445 -0
- package/dist/building/wall-openings.d.ts.map +1 -0
- package/dist/building/wall-openings.js +231 -0
- package/dist/building/window-types.d.ts +17 -0
- package/dist/building/window-types.d.ts.map +1 -0
- package/dist/building/window-types.js +31 -0
- package/dist/commands/structure/apply-zone-transform.d.ts +23 -0
- package/dist/commands/structure/apply-zone-transform.d.ts.map +1 -0
- package/dist/commands/structure/apply-zone-transform.js +55 -0
- package/dist/commands/structure/create-mezzanine.d.ts +12 -0
- package/dist/commands/structure/create-mezzanine.d.ts.map +1 -0
- package/dist/commands/structure/create-mezzanine.js +46 -0
- package/dist/commands/structure/create-zone.d.ts +32 -0
- package/dist/commands/structure/create-zone.d.ts.map +1 -0
- package/dist/commands/structure/create-zone.js +126 -0
- package/dist/commands/structure/delete-zone.d.ts +51 -0
- package/dist/commands/structure/delete-zone.d.ts.map +1 -0
- package/dist/commands/structure/delete-zone.js +354 -0
- package/dist/commands/structure/divide-zone.d.ts +38 -0
- package/dist/commands/structure/divide-zone.d.ts.map +1 -0
- package/dist/commands/structure/divide-zone.js +186 -0
- package/dist/commands/structure/duplicate-zone.d.ts +7 -0
- package/dist/commands/structure/duplicate-zone.d.ts.map +1 -0
- package/dist/commands/structure/duplicate-zone.js +21 -0
- package/dist/commands/structure/floor-opening.d.ts +36 -0
- package/dist/commands/structure/floor-opening.d.ts.map +1 -0
- package/dist/commands/structure/floor-opening.js +124 -0
- package/dist/commands/structure/index.d.ts +22 -0
- package/dist/commands/structure/index.d.ts.map +1 -0
- package/dist/commands/structure/index.js +20 -0
- package/dist/commands/structure/lock-outside-faces.d.ts +12 -0
- package/dist/commands/structure/lock-outside-faces.d.ts.map +1 -0
- package/dist/commands/structure/lock-outside-faces.js +32 -0
- package/dist/commands/structure/merge-zones.d.ts +5 -0
- package/dist/commands/structure/merge-zones.d.ts.map +1 -0
- package/dist/commands/structure/merge-zones.js +22 -0
- package/dist/commands/structure/mezzanine-content.d.ts +16 -0
- package/dist/commands/structure/mezzanine-content.d.ts.map +1 -0
- package/dist/commands/structure/mezzanine-content.js +109 -0
- package/dist/commands/structure/plan-mezzanine-stair.d.ts +7 -0
- package/dist/commands/structure/plan-mezzanine-stair.d.ts.map +1 -0
- package/dist/commands/structure/plan-mezzanine-stair.js +127 -0
- package/dist/commands/structure/plan-wall-deletion.d.ts +9 -0
- package/dist/commands/structure/plan-wall-deletion.d.ts.map +1 -0
- package/dist/commands/structure/plan-wall-deletion.js +151 -0
- package/dist/commands/structure/rebase-floor-reference.d.ts +7 -0
- package/dist/commands/structure/rebase-floor-reference.d.ts.map +1 -0
- package/dist/commands/structure/rebase-floor-reference.js +90 -0
- package/dist/commands/structure/resize-mezzanine.d.ts +8 -0
- package/dist/commands/structure/resize-mezzanine.d.ts.map +1 -0
- package/dist/commands/structure/resize-mezzanine.js +43 -0
- package/dist/commands/structure/rotate-zone.d.ts +8 -0
- package/dist/commands/structure/rotate-zone.d.ts.map +1 -0
- package/dist/commands/structure/rotate-zone.js +28 -0
- package/dist/commands/structure/set-floor-foundation.d.ts +62 -0
- package/dist/commands/structure/set-floor-foundation.d.ts.map +1 -0
- package/dist/commands/structure/set-floor-foundation.js +162 -0
- package/dist/commands/structure/set-room-floor-construction.d.ts +8 -0
- package/dist/commands/structure/set-room-floor-construction.d.ts.map +1 -0
- package/dist/commands/structure/set-room-floor-construction.js +72 -0
- package/dist/commands/structure/set-wall-geometry.d.ts +10 -0
- package/dist/commands/structure/set-wall-geometry.d.ts.map +1 -0
- package/dist/commands/structure/set-wall-geometry.js +52 -0
- package/dist/commands/structure/set-zone-edges.d.ts +14 -0
- package/dist/commands/structure/set-zone-edges.d.ts.map +1 -0
- package/dist/commands/structure/set-zone-edges.js +143 -0
- package/dist/commands/structure/set-zone-intent.d.ts +39 -0
- package/dist/commands/structure/set-zone-intent.d.ts.map +1 -0
- package/dist/commands/structure/set-zone-intent.js +125 -0
- package/dist/commands/structure/shared.d.ts +4512 -0
- package/dist/commands/structure/shared.d.ts.map +1 -0
- package/dist/commands/structure/shared.js +102 -0
- package/dist/commands/structure/transform-zone.d.ts +23 -0
- package/dist/commands/structure/transform-zone.d.ts.map +1 -0
- package/dist/commands/structure/transform-zone.js +472 -0
- package/dist/commands/structure/validate-mezzanine.d.ts +5 -0
- package/dist/commands/structure/validate-mezzanine.d.ts.map +1 -0
- package/dist/commands/structure/validate-mezzanine.js +46 -0
- package/dist/commands/structure/zone-crossings.d.ts +8 -0
- package/dist/commands/structure/zone-crossings.d.ts.map +1 -0
- package/dist/commands/structure/zone-crossings.js +162 -0
- package/dist/commands/structure/zone-drop.d.ts +4 -0
- package/dist/commands/structure/zone-drop.d.ts.map +1 -0
- package/dist/commands/structure/zone-drop.js +68 -0
- package/dist/commands/structure/zone-insertion.d.ts +4 -0
- package/dist/commands/structure/zone-insertion.d.ts.map +1 -0
- package/dist/commands/structure/zone-insertion.js +200 -0
- package/dist/commands/structure/zone-transform-content.d.ts +6 -0
- package/dist/commands/structure/zone-transform-content.d.ts.map +1 -0
- package/dist/commands/structure/zone-transform-content.js +117 -0
- package/dist/commands/structure/zone-wall-merge.d.ts +4977 -0
- package/dist/commands/structure/zone-wall-merge.d.ts.map +1 -0
- package/dist/commands/structure/zone-wall-merge.js +135 -0
- package/dist/contracts/reference-discovery.d.ts +18 -0
- package/dist/contracts/reference-discovery.d.ts.map +1 -0
- package/dist/contracts/reference-discovery.js +100 -0
- package/dist/contracts/reference-inventory.d.ts +44 -0
- package/dist/contracts/reference-inventory.d.ts.map +1 -0
- package/dist/contracts/reference-inventory.js +872 -0
- package/dist/events/bus.d.ts +70 -9
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/hooks/scene-registry/item-clip-registry.d.ts +6 -3
- package/dist/hooks/scene-registry/item-clip-registry.d.ts.map +1 -1
- package/dist/hooks/scene-registry/item-clip-registry.js +2 -1
- package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/floor-placed-elevation.js +15 -1
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts +3 -2
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-manager.js +53 -66
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts +1650 -131
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-sync.js +86 -83
- package/dist/hooks/spatial-grid/support-host-patch.d.ts +1 -0
- package/dist/hooks/spatial-grid/support-host-patch.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/support-host-patch.js +12 -5
- package/dist/index.d.ts +83 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +78 -11
- package/dist/lib/__bench__/near-linear-walls.d.ts +2 -0
- package/dist/lib/__bench__/near-linear-walls.d.ts.map +1 -0
- package/dist/lib/__bench__/near-linear-walls.js +24 -0
- package/dist/lib/__bench__/structure-preview.bench.d.ts +2 -0
- package/dist/lib/__bench__/structure-preview.bench.d.ts.map +1 -0
- package/dist/lib/__bench__/structure-preview.bench.js +72 -0
- package/dist/lib/__fixtures__/mezzanine.d.ts +13968 -0
- package/dist/lib/__fixtures__/mezzanine.d.ts.map +1 -0
- package/dist/lib/__fixtures__/mezzanine.js +43 -0
- package/dist/lib/absorb-wall-separators.d.ts +4483 -0
- package/dist/lib/absorb-wall-separators.d.ts.map +1 -0
- package/dist/lib/absorb-wall-separators.js +65 -0
- package/dist/lib/angle-accumulator.d.ts +3 -0
- package/dist/lib/angle-accumulator.d.ts.map +1 -0
- package/dist/lib/angle-accumulator.js +13 -0
- package/dist/lib/artifact-store.d.ts +31 -0
- package/dist/lib/artifact-store.d.ts.map +1 -0
- package/dist/lib/artifact-store.js +42 -0
- package/dist/lib/assembly-stack.d.ts +54 -0
- package/dist/lib/assembly-stack.d.ts.map +1 -0
- package/dist/lib/assembly-stack.js +52 -0
- package/dist/lib/asset-storage.d.ts.map +1 -1
- package/dist/lib/asset-storage.js +3 -0
- package/dist/lib/canonical-opening-ring.d.ts +3 -0
- package/dist/lib/canonical-opening-ring.d.ts.map +1 -0
- package/dist/lib/canonical-opening-ring.js +14 -0
- package/dist/lib/ceiling-children.d.ts +8 -0
- package/dist/lib/ceiling-children.d.ts.map +1 -0
- package/dist/lib/ceiling-children.js +36 -0
- package/dist/lib/ceiling-surface.d.ts +40 -0
- package/dist/lib/ceiling-surface.d.ts.map +1 -0
- package/dist/lib/ceiling-surface.js +65 -0
- package/dist/lib/cutter-host.d.ts +5 -0
- package/dist/lib/cutter-host.d.ts.map +1 -0
- package/dist/lib/cutter-host.js +30 -0
- package/dist/lib/floor-construction-lift.d.ts +4 -0
- package/dist/lib/floor-construction-lift.d.ts.map +1 -0
- package/dist/lib/floor-construction-lift.js +54 -0
- package/dist/lib/floor-footprint-key.d.ts +3 -0
- package/dist/lib/floor-footprint-key.d.ts.map +1 -0
- package/dist/lib/floor-footprint-key.js +9 -0
- package/dist/lib/floor-footprint-name.d.ts +11 -0
- package/dist/lib/floor-footprint-name.d.ts.map +1 -0
- package/dist/lib/floor-footprint-name.js +52 -0
- package/dist/lib/floor-foundation-datum.d.ts +31 -0
- package/dist/lib/floor-foundation-datum.d.ts.map +1 -0
- package/dist/lib/floor-foundation-datum.js +226 -0
- package/dist/lib/floor-foundation-stack.d.ts +16 -0
- package/dist/lib/floor-foundation-stack.d.ts.map +1 -0
- package/dist/lib/floor-foundation-stack.js +214 -0
- package/dist/lib/floor-intent-changes.d.ts +10 -0
- package/dist/lib/floor-intent-changes.d.ts.map +1 -0
- package/dist/lib/floor-intent-changes.js +461 -0
- package/dist/lib/floor-opening-footprints.d.ts +24 -0
- package/dist/lib/floor-opening-footprints.d.ts.map +1 -0
- package/dist/lib/floor-opening-footprints.js +127 -0
- package/dist/lib/floor-opening-intent.d.ts +16 -0
- package/dist/lib/floor-opening-intent.d.ts.map +1 -0
- package/dist/lib/floor-opening-intent.js +82 -0
- package/dist/lib/floor-plate-id.d.ts +5 -0
- package/dist/lib/floor-plate-id.d.ts.map +1 -0
- package/dist/lib/floor-plate-id.js +20 -0
- package/dist/lib/floor-plate-paint.d.ts +8 -0
- package/dist/lib/floor-plate-paint.d.ts.map +1 -0
- package/dist/lib/floor-plate-paint.js +11 -0
- package/dist/lib/floor-plates.d.ts +211 -0
- package/dist/lib/floor-plates.d.ts.map +1 -0
- package/dist/lib/floor-plates.js +729 -0
- package/dist/lib/floor-room-faces.d.ts +5 -0
- package/dist/lib/floor-room-faces.d.ts.map +1 -0
- package/dist/lib/floor-room-faces.js +29 -0
- package/dist/lib/floor-step-finish.d.ts +49 -0
- package/dist/lib/floor-step-finish.d.ts.map +1 -0
- package/dist/lib/floor-step-finish.js +128 -0
- package/dist/lib/geometry-script-node.d.ts +82 -0
- package/dist/lib/geometry-script-node.d.ts.map +1 -0
- package/dist/lib/geometry-script-node.js +147 -0
- package/dist/lib/geometry-surfaces.d.ts +61 -0
- package/dist/lib/geometry-surfaces.d.ts.map +1 -0
- package/dist/lib/geometry-surfaces.js +156 -0
- package/dist/lib/item-slab-support.d.ts +14 -0
- package/dist/lib/item-slab-support.d.ts.map +1 -0
- package/dist/lib/item-slab-support.js +40 -0
- package/dist/lib/level-footprints.d.ts +23 -0
- package/dist/lib/level-footprints.d.ts.map +1 -0
- package/dist/lib/level-footprints.js +398 -0
- package/dist/lib/level-name.d.ts +7 -0
- package/dist/lib/level-name.d.ts.map +1 -1
- package/dist/lib/level-name.js +11 -3
- package/dist/lib/new-zone.d.ts +10 -0
- package/dist/lib/new-zone.d.ts.map +1 -0
- package/dist/lib/new-zone.js +10 -0
- package/dist/lib/node-ancestry.d.ts +30 -0
- package/dist/lib/node-ancestry.d.ts.map +1 -0
- package/dist/lib/node-ancestry.js +76 -0
- package/dist/lib/node-visibility.d.ts +12 -0
- package/dist/lib/node-visibility.d.ts.map +1 -0
- package/dist/lib/node-visibility.js +12 -0
- package/dist/lib/object-cuts.d.ts +11 -0
- package/dist/lib/object-cuts.d.ts.map +1 -0
- package/dist/lib/object-cuts.js +63 -0
- package/dist/lib/opening-floor-datum.d.ts +24 -0
- package/dist/lib/opening-floor-datum.d.ts.map +1 -0
- package/dist/lib/opening-floor-datum.js +145 -0
- package/dist/lib/own-floor-intent.d.ts +15 -0
- package/dist/lib/own-floor-intent.d.ts.map +1 -0
- package/dist/lib/own-floor-intent.js +201 -0
- package/dist/lib/plate-reference.d.ts +3 -0
- package/dist/lib/plate-reference.d.ts.map +1 -0
- package/dist/lib/plate-reference.js +91 -0
- package/dist/lib/plate-surface.d.ts +120 -0
- package/dist/lib/plate-surface.d.ts.map +1 -0
- package/dist/lib/plate-surface.js +725 -0
- package/dist/lib/polygon-boolean.d.ts +17 -0
- package/dist/lib/polygon-boolean.d.ts.map +1 -0
- package/dist/lib/polygon-boolean.js +195 -0
- package/dist/lib/polygon-label.d.ts +7 -0
- package/dist/lib/polygon-label.d.ts.map +1 -0
- package/dist/lib/polygon-label.js +94 -0
- package/dist/lib/room-drawn-floor.d.ts +29 -0
- package/dist/lib/room-drawn-floor.d.ts.map +1 -0
- package/dist/lib/room-drawn-floor.js +88 -0
- package/dist/lib/room-floor-choices.d.ts +11 -0
- package/dist/lib/room-floor-choices.d.ts.map +1 -0
- package/dist/lib/room-floor-choices.js +60 -0
- package/dist/lib/room-floor-feasibility.d.ts +25 -0
- package/dist/lib/room-floor-feasibility.d.ts.map +1 -0
- package/dist/lib/room-floor-feasibility.js +293 -0
- package/dist/lib/room-floor-plate.d.ts +3 -0
- package/dist/lib/room-floor-plate.d.ts.map +1 -0
- package/dist/lib/room-floor-plate.js +4 -0
- package/dist/lib/room-graph.d.ts +79 -0
- package/dist/lib/room-graph.d.ts.map +1 -0
- package/dist/lib/room-graph.js +1265 -0
- package/dist/lib/room-name.d.ts +10 -0
- package/dist/lib/room-name.d.ts.map +1 -0
- package/dist/lib/room-name.js +22 -0
- package/dist/lib/room-topology-index.d.ts +53 -5
- package/dist/lib/room-topology-index.d.ts.map +1 -1
- package/dist/lib/room-topology-index.js +176 -30
- package/dist/lib/room-vertical-placement.d.ts +12 -0
- package/dist/lib/room-vertical-placement.d.ts.map +1 -0
- package/dist/lib/room-vertical-placement.js +28 -0
- package/dist/lib/room-zone-adoption.d.ts +74 -0
- package/dist/lib/room-zone-adoption.d.ts.map +1 -0
- package/dist/lib/room-zone-adoption.js +150 -0
- package/dist/lib/setback-envelope.d.ts +73 -0
- package/dist/lib/setback-envelope.d.ts.map +1 -0
- package/dist/lib/setback-envelope.js +506 -0
- package/dist/lib/slab-polygon.d.ts.map +1 -1
- package/dist/lib/slab-polygon.js +33 -12
- package/dist/lib/slots.d.ts +20 -0
- package/dist/lib/slots.d.ts.map +1 -1
- package/dist/lib/slots.js +44 -0
- package/dist/lib/space-detection.d.ts +14 -94
- package/dist/lib/space-detection.d.ts.map +1 -1
- package/dist/lib/space-detection.js +244 -1616
- package/dist/lib/structure-commit.d.ts +38 -0
- package/dist/lib/structure-commit.d.ts.map +1 -0
- package/dist/lib/structure-commit.js +52 -0
- package/dist/lib/structure-kernel.d.ts +66 -0
- package/dist/lib/structure-kernel.d.ts.map +1 -0
- package/dist/lib/structure-kernel.js +735 -0
- package/dist/lib/structure-reconcile.d.ts +15 -0
- package/dist/lib/structure-reconcile.d.ts.map +1 -0
- package/dist/lib/structure-reconcile.js +218 -0
- package/dist/lib/terrain-contours.d.ts +29 -0
- package/dist/lib/terrain-contours.d.ts.map +1 -0
- package/dist/lib/terrain-contours.js +199 -0
- package/dist/lib/terrain-source-persisted.d.ts +42 -0
- package/dist/lib/terrain-source-persisted.d.ts.map +1 -0
- package/dist/lib/terrain-source-persisted.js +68 -0
- package/dist/lib/terrain-source.d.ts +2 -40
- package/dist/lib/terrain-source.d.ts.map +1 -1
- package/dist/lib/terrain-source.js +2 -68
- package/dist/lib/terrain-support-query.d.ts +83 -0
- package/dist/lib/terrain-support-query.d.ts.map +1 -0
- package/dist/lib/terrain-support-query.js +187 -0
- package/dist/lib/terrain-support.d.ts +1 -77
- package/dist/lib/terrain-support.d.ts.map +1 -1
- package/dist/lib/terrain-support.js +3 -181
- package/dist/lib/unit-containment.js +2 -2
- package/dist/lib/unit-report.d.ts.map +1 -1
- package/dist/lib/unit-report.js +5 -4
- package/dist/lib/zone-colors.d.ts +11 -0
- package/dist/lib/zone-colors.d.ts.map +1 -0
- package/dist/lib/zone-colors.js +32 -0
- package/dist/lib/zone-quantities.d.ts.map +1 -1
- package/dist/lib/zone-quantities.js +113 -223
- package/dist/material-library.d.ts +9 -1
- package/dist/material-library.d.ts.map +1 -1
- package/dist/material-library.js +550 -1
- package/dist/node-slots/block.d.ts +7 -0
- package/dist/node-slots/block.d.ts.map +1 -0
- package/dist/node-slots/block.js +27 -0
- package/dist/node-slots/cabinet.d.ts +4 -0
- package/dist/node-slots/cabinet.d.ts.map +1 -0
- package/dist/node-slots/cabinet.js +24 -0
- package/dist/node-slots/ceiling.d.ts +6 -0
- package/dist/node-slots/ceiling.d.ts.map +1 -0
- package/dist/node-slots/ceiling.js +7 -0
- package/dist/node-slots/column.d.ts +9 -0
- package/dist/node-slots/column.d.ts.map +1 -0
- package/dist/node-slots/column.js +24 -0
- package/dist/node-slots/door.d.ts +9 -0
- package/dist/node-slots/door.d.ts.map +1 -0
- package/dist/node-slots/door.js +20 -0
- package/dist/node-slots/duct.d.ts +5 -0
- package/dist/node-slots/duct.d.ts.map +1 -0
- package/dist/node-slots/duct.js +5 -0
- package/dist/node-slots/elevator.d.ts +9 -0
- package/dist/node-slots/elevator.d.ts.map +1 -0
- package/dist/node-slots/elevator.js +17 -0
- package/dist/node-slots/fence.d.ts +10 -0
- package/dist/node-slots/fence.d.ts.map +1 -0
- package/dist/node-slots/fence.js +23 -0
- package/dist/node-slots/index.d.ts +25 -0
- package/dist/node-slots/index.d.ts.map +1 -0
- package/dist/node-slots/index.js +92 -0
- package/dist/node-slots/lean-to-extension.d.ts +5 -0
- package/dist/node-slots/lean-to-extension.d.ts.map +1 -0
- package/dist/node-slots/lean-to-extension.js +15 -0
- package/dist/node-slots/procedural-item.d.ts +4 -0
- package/dist/node-slots/procedural-item.d.ts.map +1 -0
- package/dist/node-slots/procedural-item.js +3 -0
- package/dist/node-slots/roof-accessories.d.ts +9 -0
- package/dist/node-slots/roof-accessories.d.ts.map +1 -0
- package/dist/node-slots/roof-accessories.js +34 -0
- package/dist/node-slots/shelf.d.ts +9 -0
- package/dist/node-slots/shelf.d.ts.map +1 -0
- package/dist/node-slots/shelf.js +30 -0
- package/dist/node-slots/slab.d.ts +7 -0
- package/dist/node-slots/slab.d.ts.map +1 -0
- package/dist/node-slots/slab.js +21 -0
- package/dist/node-slots/stair.d.ts +8 -0
- package/dist/node-slots/stair.d.ts.map +1 -0
- package/dist/node-slots/stair.js +17 -0
- package/dist/node-slots/wall.d.ts +12 -0
- package/dist/node-slots/wall.d.ts.map +1 -0
- package/dist/node-slots/wall.js +55 -0
- package/dist/node-slots/window.d.ts +5 -0
- package/dist/node-slots/window.d.ts.map +1 -0
- package/dist/node-slots/window.js +11 -0
- package/dist/procedural-items/design-placement.d.ts +49 -0
- package/dist/procedural-items/design-placement.d.ts.map +1 -0
- package/dist/procedural-items/design-placement.js +129 -0
- package/dist/procedural-items/design.d.ts +261 -0
- package/dist/procedural-items/design.d.ts.map +1 -0
- package/dist/procedural-items/design.js +707 -0
- package/dist/procedural-items/fixtures.d.ts +464 -24
- package/dist/procedural-items/fixtures.d.ts.map +1 -1
- package/dist/procedural-items/index.d.ts +5 -0
- package/dist/procedural-items/index.d.ts.map +1 -1
- package/dist/procedural-items/index.js +5 -0
- package/dist/procedural-items/integration.d.ts +127 -6
- package/dist/procedural-items/integration.d.ts.map +1 -1
- package/dist/procedural-items/joints.d.ts +56 -0
- package/dist/procedural-items/joints.d.ts.map +1 -0
- package/dist/procedural-items/joints.js +251 -0
- package/dist/procedural-items/library-colors.d.ts +12 -0
- package/dist/procedural-items/library-colors.d.ts.map +1 -1
- package/dist/procedural-items/library-colors.js +37 -3
- package/dist/procedural-items/motion-controller.d.ts +29 -0
- package/dist/procedural-items/motion-controller.d.ts.map +1 -0
- package/dist/procedural-items/motion-controller.js +130 -0
- package/dist/procedural-items/node.d.ts +490 -24
- package/dist/procedural-items/node.d.ts.map +1 -1
- package/dist/procedural-items/query.d.ts +19 -1
- package/dist/procedural-items/query.d.ts.map +1 -1
- package/dist/procedural-items/query.js +131 -48
- package/dist/procedural-items/recipe.d.ts +258 -14
- package/dist/procedural-items/recipe.d.ts.map +1 -1
- package/dist/procedural-items/recipe.js +933 -61
- package/dist/procedural-items/section.d.ts +27 -0
- package/dist/procedural-items/section.d.ts.map +1 -0
- package/dist/procedural-items/section.js +237 -0
- package/dist/procedural-items/spatial.d.ts +21 -0
- package/dist/procedural-items/spatial.d.ts.map +1 -1
- package/dist/procedural-items/spatial.js +90 -0
- package/dist/registry/handles.d.ts +30 -1
- package/dist/registry/handles.d.ts.map +1 -1
- package/dist/registry/index.d.ts +7 -5
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +4 -2
- package/dist/registry/mechanism.d.ts +9 -0
- package/dist/registry/mechanism.d.ts.map +1 -0
- package/dist/registry/mechanism.js +21 -0
- package/dist/registry/registry.d.ts +6 -3
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +59 -22
- package/dist/registry/scene-api.d.ts +20 -0
- package/dist/registry/scene-api.d.ts.map +1 -1
- package/dist/registry/scene-api.js +26 -13
- package/dist/registry/subtree.d.ts +8 -0
- package/dist/registry/subtree.d.ts.map +1 -1
- package/dist/registry/subtree.js +59 -0
- package/dist/registry/types.d.ts +352 -13
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/schema/__fixtures__/node-fixtures.d.ts.map +1 -1
- package/dist/schema/__fixtures__/node-fixtures.js +2 -0
- package/dist/schema/assembly.d.ts +153 -0
- package/dist/schema/assembly.d.ts.map +1 -0
- package/dist/schema/assembly.js +155 -0
- package/dist/schema/asset-url.d.ts +2 -1
- package/dist/schema/asset-url.d.ts.map +1 -1
- package/dist/schema/asset-url.js +5 -2
- package/dist/schema/base.d.ts +26 -0
- package/dist/schema/base.d.ts.map +1 -1
- package/dist/schema/base.js +2 -0
- package/dist/schema/collection-templates.d.ts +46 -0
- package/dist/schema/collection-templates.d.ts.map +1 -0
- package/dist/schema/collection-templates.js +14 -0
- package/dist/schema/collections.d.ts +7 -0
- package/dist/schema/collections.d.ts.map +1 -1
- package/dist/schema/cut.d.ts +29 -0
- package/dist/schema/cut.d.ts.map +1 -0
- package/dist/schema/cut.js +50 -0
- package/dist/schema/geometry-metadata.d.ts +51 -0
- package/dist/schema/geometry-metadata.d.ts.map +1 -0
- package/dist/schema/geometry-metadata.js +57 -0
- package/dist/schema/geometry-source.d.ts +250 -0
- package/dist/schema/geometry-source.d.ts.map +1 -0
- package/dist/schema/geometry-source.js +130 -0
- package/dist/schema/index.d.ts +20 -7
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +22 -5
- package/dist/schema/nodes/block.d.ts +28 -2
- package/dist/schema/nodes/block.d.ts.map +1 -1
- package/dist/schema/nodes/block.js +22 -9
- package/dist/schema/nodes/box-vent.d.ts +26 -0
- package/dist/schema/nodes/box-vent.d.ts.map +1 -1
- package/dist/schema/nodes/building.d.ts +26 -0
- package/dist/schema/nodes/building.d.ts.map +1 -1
- package/dist/schema/nodes/cabinet.d.ts +61 -9
- package/dist/schema/nodes/cabinet.d.ts.map +1 -1
- package/dist/schema/nodes/ceiling.d.ts +37 -0
- package/dist/schema/nodes/ceiling.d.ts.map +1 -1
- package/dist/schema/nodes/ceiling.js +8 -0
- package/dist/schema/nodes/chimney.d.ts +26 -0
- package/dist/schema/nodes/chimney.d.ts.map +1 -1
- package/dist/schema/nodes/column.d.ts +126 -0
- package/dist/schema/nodes/column.d.ts.map +1 -1
- package/dist/schema/nodes/column.js +2 -0
- package/dist/schema/nodes/construction-dimension.d.ts +26 -0
- package/dist/schema/nodes/construction-dimension.d.ts.map +1 -1
- package/dist/schema/nodes/cupola.d.ts +26 -0
- package/dist/schema/nodes/cupola.d.ts.map +1 -1
- package/dist/schema/nodes/curtain-wall.d.ts +129 -0
- package/dist/schema/nodes/curtain-wall.d.ts.map +1 -0
- package/dist/schema/nodes/curtain-wall.js +49 -0
- package/dist/schema/nodes/door.d.ts +141 -22
- package/dist/schema/nodes/door.d.ts.map +1 -1
- package/dist/schema/nodes/door.js +18 -33
- package/dist/schema/nodes/dormer.d.ts +28 -2
- package/dist/schema/nodes/dormer.d.ts.map +1 -1
- package/dist/schema/nodes/downspout.d.ts +27 -1
- package/dist/schema/nodes/downspout.d.ts.map +1 -1
- package/dist/schema/nodes/duct-fitting.d.ts +27 -1
- package/dist/schema/nodes/duct-fitting.d.ts.map +1 -1
- package/dist/schema/nodes/duct-segment.d.ts +27 -1
- package/dist/schema/nodes/duct-segment.d.ts.map +1 -1
- package/dist/schema/nodes/duct-terminal.d.ts +26 -0
- package/dist/schema/nodes/duct-terminal.d.ts.map +1 -1
- package/dist/schema/nodes/elevator.d.ts +26 -0
- package/dist/schema/nodes/elevator.d.ts.map +1 -1
- package/dist/schema/nodes/eyebrow-vent.d.ts +26 -0
- package/dist/schema/nodes/eyebrow-vent.d.ts.map +1 -1
- package/dist/schema/nodes/fence-feature.d.ts +141 -0
- package/dist/schema/nodes/fence-feature.d.ts.map +1 -0
- package/dist/schema/nodes/fence-feature.js +21 -0
- package/dist/schema/nodes/fence.d.ts +186 -0
- package/dist/schema/nodes/fence.d.ts.map +1 -1
- package/dist/schema/nodes/fence.js +92 -7
- package/dist/schema/nodes/floor-opening.d.ts +61 -0
- package/dist/schema/nodes/floor-opening.d.ts.map +1 -0
- package/dist/schema/nodes/floor-opening.js +17 -0
- package/dist/schema/nodes/guide.d.ts +26 -0
- package/dist/schema/nodes/guide.d.ts.map +1 -1
- package/dist/schema/nodes/gutter.d.ts +26 -0
- package/dist/schema/nodes/gutter.d.ts.map +1 -1
- package/dist/schema/nodes/hvac-equipment.d.ts +26 -0
- package/dist/schema/nodes/hvac-equipment.d.ts.map +1 -1
- package/dist/schema/nodes/imported-mesh.d.ts +26 -0
- package/dist/schema/nodes/imported-mesh.d.ts.map +1 -1
- package/dist/schema/nodes/item.d.ts +153 -2
- package/dist/schema/nodes/item.d.ts.map +1 -1
- package/dist/schema/nodes/item.js +13 -0
- package/dist/schema/nodes/lean-to-extension.d.ts +26 -0
- package/dist/schema/nodes/lean-to-extension.d.ts.map +1 -1
- package/dist/schema/nodes/level.d.ts +27 -1
- package/dist/schema/nodes/level.d.ts.map +1 -1
- package/dist/schema/nodes/lineset.d.ts +26 -0
- package/dist/schema/nodes/lineset.d.ts.map +1 -1
- package/dist/schema/nodes/liquid-line.d.ts +26 -0
- package/dist/schema/nodes/liquid-line.d.ts.map +1 -1
- package/dist/schema/nodes/measurement.d.ts +26 -0
- package/dist/schema/nodes/measurement.d.ts.map +1 -1
- package/dist/schema/nodes/opening-types.d.ts +41 -0
- package/dist/schema/nodes/opening-types.d.ts.map +1 -0
- package/dist/schema/nodes/opening-types.js +48 -0
- package/dist/schema/nodes/pipe-fitting.d.ts +26 -0
- package/dist/schema/nodes/pipe-fitting.d.ts.map +1 -1
- package/dist/schema/nodes/pipe-segment.d.ts +26 -0
- package/dist/schema/nodes/pipe-segment.d.ts.map +1 -1
- package/dist/schema/nodes/pipe-trap.d.ts +26 -0
- package/dist/schema/nodes/pipe-trap.d.ts.map +1 -1
- package/dist/schema/nodes/ridge-vent.d.ts +26 -0
- package/dist/schema/nodes/ridge-vent.d.ts.map +1 -1
- package/dist/schema/nodes/roof-segment-walls.d.ts.map +1 -1
- package/dist/schema/nodes/roof-segment-walls.js +2 -1
- package/dist/schema/nodes/roof-segment.d.ts +30 -2
- package/dist/schema/nodes/roof-segment.d.ts.map +1 -1
- package/dist/schema/nodes/roof-segment.js +9 -0
- package/dist/schema/nodes/roof.d.ts +101 -0
- package/dist/schema/nodes/roof.d.ts.map +1 -1
- package/dist/schema/nodes/roof.js +6 -0
- package/dist/schema/nodes/scan.d.ts +26 -0
- package/dist/schema/nodes/scan.d.ts.map +1 -1
- package/dist/schema/nodes/separator.d.ts +50 -0
- package/dist/schema/nodes/separator.d.ts.map +1 -0
- package/dist/schema/nodes/separator.js +8 -0
- package/dist/schema/nodes/shelf.d.ts +26 -0
- package/dist/schema/nodes/shelf.d.ts.map +1 -1
- package/dist/schema/nodes/site.d.ts +192 -0
- package/dist/schema/nodes/site.d.ts.map +1 -1
- package/dist/schema/nodes/site.js +178 -1
- package/dist/schema/nodes/skylight.d.ts +30 -4
- package/dist/schema/nodes/skylight.d.ts.map +1 -1
- package/dist/schema/nodes/slab.d.ts +84 -0
- package/dist/schema/nodes/slab.d.ts.map +1 -1
- package/dist/schema/nodes/slab.js +37 -2
- package/dist/schema/nodes/solar-panel.d.ts +26 -0
- package/dist/schema/nodes/solar-panel.d.ts.map +1 -1
- package/dist/schema/nodes/spawn.d.ts +26 -0
- package/dist/schema/nodes/spawn.d.ts.map +1 -1
- package/dist/schema/nodes/stair-construction.d.ts +21 -0
- package/dist/schema/nodes/stair-construction.d.ts.map +1 -0
- package/dist/schema/nodes/stair-construction.js +13 -0
- package/dist/schema/nodes/stair-design-targets.d.ts +9 -0
- package/dist/schema/nodes/stair-design-targets.d.ts.map +1 -0
- package/dist/schema/nodes/stair-design-targets.js +7 -0
- package/dist/schema/nodes/stair-segment.d.ts +72 -4
- package/dist/schema/nodes/stair-segment.d.ts.map +1 -1
- package/dist/schema/nodes/stair-segment.js +13 -0
- package/dist/schema/nodes/stair.d.ts +119 -2
- package/dist/schema/nodes/stair.d.ts.map +1 -1
- package/dist/schema/nodes/stair.js +59 -2
- package/dist/schema/nodes/structural-grid.d.ts +26 -0
- package/dist/schema/nodes/structural-grid.d.ts.map +1 -1
- package/dist/schema/nodes/surface-hole-metadata.d.ts +3 -0
- package/dist/schema/nodes/surface-hole-metadata.d.ts.map +1 -1
- package/dist/schema/nodes/surface-hole-metadata.js +2 -1
- package/dist/schema/nodes/surface-paint-region.d.ts +14 -0
- package/dist/schema/nodes/surface-paint-region.d.ts.map +1 -0
- package/dist/schema/nodes/surface-paint-region.js +12 -0
- package/dist/schema/nodes/turbine-vent.d.ts +26 -0
- package/dist/schema/nodes/turbine-vent.d.ts.map +1 -1
- package/dist/schema/nodes/unit.d.ts +26 -0
- package/dist/schema/nodes/unit.d.ts.map +1 -1
- package/dist/schema/nodes/wall.d.ts +423 -59
- package/dist/schema/nodes/wall.d.ts.map +1 -1
- package/dist/schema/nodes/wall.js +188 -186
- package/dist/schema/nodes/window.d.ts +139 -20
- package/dist/schema/nodes/window.d.ts.map +1 -1
- package/dist/schema/nodes/window.js +12 -14
- package/dist/schema/nodes/zone.d.ts +69 -1
- package/dist/schema/nodes/zone.d.ts.map +1 -1
- package/dist/schema/nodes/zone.js +46 -0
- package/dist/schema/provenance.d.ts +118 -0
- package/dist/schema/provenance.d.ts.map +1 -0
- package/dist/schema/provenance.js +76 -0
- package/dist/schema/source-ref.d.ts +23 -0
- package/dist/schema/source-ref.d.ts.map +1 -0
- package/dist/schema/source-ref.js +29 -0
- package/dist/schema/types.d.ts +3389 -67
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +7 -0
- package/dist/services/__fixtures__/hosting.d.ts +3 -0
- package/dist/services/__fixtures__/hosting.d.ts.map +1 -0
- package/dist/services/__fixtures__/hosting.js +9 -0
- package/dist/services/__fixtures__/shelf-surface-rows.d.ts +4 -0
- package/dist/services/__fixtures__/shelf-surface-rows.d.ts.map +1 -0
- package/dist/services/__fixtures__/shelf-surface-rows.js +18 -0
- package/dist/services/alignment-anchors.d.ts +2 -1
- package/dist/services/alignment-anchors.d.ts.map +1 -1
- package/dist/services/alignment-anchors.js +9 -6
- package/dist/services/hosting.d.ts +3 -0
- package/dist/services/hosting.d.ts.map +1 -1
- package/dist/services/hosting.js +24 -7
- package/dist/services/index.d.ts +4 -4
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +4 -4
- package/dist/services/level-height.d.ts.map +1 -1
- package/dist/services/level-height.js +6 -4
- package/dist/services/snap.d.ts +3 -0
- package/dist/services/snap.d.ts.map +1 -1
- package/dist/services/snap.js +11 -0
- package/dist/services/storey.d.ts +21 -1
- package/dist/services/storey.d.ts.map +1 -1
- package/dist/services/storey.js +94 -8
- package/dist/services/surface-hosting.d.ts +6 -2
- package/dist/services/surface-hosting.d.ts.map +1 -1
- package/dist/services/surface-hosting.js +51 -11
- package/dist/store/actions/node-actions.d.ts +4563 -8
- package/dist/store/actions/node-actions.d.ts.map +1 -1
- package/dist/store/actions/node-actions.js +497 -269
- package/dist/store/derived-node-guard.d.ts +84 -0
- package/dist/store/derived-node-guard.d.ts.map +1 -0
- package/dist/store/derived-node-guard.js +586 -0
- package/dist/store/history-control.d.ts +34 -0
- package/dist/store/history-control.d.ts.map +1 -1
- package/dist/store/history-control.js +99 -1
- package/dist/store/history-drafts.d.ts +48 -0
- package/dist/store/history-drafts.d.ts.map +1 -0
- package/dist/store/history-drafts.js +403 -0
- package/dist/store/history-invalidation.d.ts.map +1 -1
- package/dist/store/history-invalidation.js +1 -0
- package/dist/store/item-interaction.d.ts +28 -0
- package/dist/store/item-interaction.d.ts.map +1 -0
- package/dist/store/item-interaction.js +34 -0
- package/dist/store/registered-node-defaults.d.ts +11 -0
- package/dist/store/registered-node-defaults.d.ts.map +1 -0
- package/dist/store/registered-node-defaults.js +25 -0
- package/dist/store/scene-annotations.d.ts +8969 -0
- package/dist/store/scene-annotations.d.ts.map +1 -0
- package/dist/store/scene-annotations.js +107 -0
- package/dist/store/use-interactive.d.ts +23 -1
- package/dist/store/use-interactive.d.ts.map +1 -1
- package/dist/store/use-interactive.js +128 -5
- package/dist/store/use-scene.d.ts +68 -12
- package/dist/store/use-scene.d.ts.map +1 -1
- package/dist/store/use-scene.js +429 -306
- package/dist/systems/elevator/elevator-opening-sync.d.ts.map +1 -1
- package/dist/systems/elevator/elevator-opening-sync.js +4 -6
- package/dist/systems/elevator/elevator-opening-system.d.ts.map +1 -1
- package/dist/systems/elevator/elevator-opening-system.js +12 -6
- package/dist/systems/elevator/elevator-service.d.ts.map +1 -1
- package/dist/systems/elevator/elevator-service.js +8 -3
- package/dist/systems/fence/fence-centerline.d.ts.map +1 -1
- package/dist/systems/fence/fence-centerline.js +6 -5
- package/dist/systems/fence/fence-features.d.ts +36 -0
- package/dist/systems/fence/fence-features.d.ts.map +1 -0
- package/dist/systems/fence/fence-features.js +105 -0
- package/dist/systems/fence/fence-spline.d.ts +8 -5
- package/dist/systems/fence/fence-spline.d.ts.map +1 -1
- package/dist/systems/fence/fence-spline.js +51 -16
- package/dist/systems/owned-floor-openings.d.ts +9 -0
- package/dist/systems/owned-floor-openings.d.ts.map +1 -0
- package/dist/systems/owned-floor-openings.js +326 -0
- package/dist/systems/reconcile-owned-floor-openings.d.ts +3 -0
- package/dist/systems/reconcile-owned-floor-openings.d.ts.map +1 -0
- package/dist/systems/reconcile-owned-floor-openings.js +25 -0
- package/dist/systems/slab/__fixtures__/doorway-steps.d.ts +8 -0
- package/dist/systems/slab/__fixtures__/doorway-steps.d.ts.map +1 -0
- package/dist/systems/slab/__fixtures__/doorway-steps.js +62 -0
- package/dist/systems/slab/__fixtures__/floor-step.d.ts +5636 -0
- package/dist/systems/slab/__fixtures__/floor-step.d.ts.map +1 -0
- package/dist/systems/slab/__fixtures__/floor-step.js +66 -0
- package/dist/systems/slab/__fixtures__/raised-room.d.ts +5775 -0
- package/dist/systems/slab/__fixtures__/raised-room.d.ts.map +1 -0
- package/dist/systems/slab/__fixtures__/raised-room.js +54 -0
- package/dist/systems/slab/ensure-slab-openings.d.ts +9 -0
- package/dist/systems/slab/ensure-slab-openings.d.ts.map +1 -0
- package/dist/systems/slab/ensure-slab-openings.js +41 -0
- package/dist/systems/slab/slab-support.d.ts +25 -6
- package/dist/systems/slab/slab-support.d.ts.map +1 -1
- package/dist/systems/slab/slab-support.js +471 -54
- package/dist/systems/stair/stair-base-elevation.d.ts +3 -0
- package/dist/systems/stair/stair-base-elevation.d.ts.map +1 -0
- package/dist/systems/stair/stair-base-elevation.js +49 -0
- package/dist/systems/stair/stair-clearance.d.ts +39 -0
- package/dist/systems/stair/stair-clearance.d.ts.map +1 -0
- package/dist/systems/stair/stair-clearance.js +508 -0
- package/dist/systems/stair/stair-construction.d.ts +37 -0
- package/dist/systems/stair/stair-construction.d.ts.map +1 -0
- package/dist/systems/stair/stair-construction.js +314 -0
- package/dist/systems/stair/stair-detail-budget.d.ts +13 -0
- package/dist/systems/stair/stair-detail-budget.d.ts.map +1 -0
- package/dist/systems/stair/stair-detail-budget.js +64 -0
- package/dist/systems/stair/stair-flight.d.ts +2 -2
- package/dist/systems/stair/stair-flight.d.ts.map +1 -1
- package/dist/systems/stair/stair-flight.js +4 -3
- package/dist/systems/stair/stair-floor-footprints.d.ts +7 -0
- package/dist/systems/stair/stair-floor-footprints.d.ts.map +1 -0
- package/dist/systems/stair/stair-floor-footprints.js +113 -0
- package/dist/systems/stair/stair-footprint.d.ts +3 -1
- package/dist/systems/stair/stair-footprint.d.ts.map +1 -1
- package/dist/systems/stair/stair-footprint.js +97 -44
- package/dist/systems/stair/stair-layout.d.ts +39 -0
- package/dist/systems/stair/stair-layout.d.ts.map +1 -0
- package/dist/systems/stair/stair-layout.js +58 -0
- package/dist/systems/stair/stair-opening-preview.d.ts +1650 -84
- package/dist/systems/stair/stair-opening-preview.d.ts.map +1 -1
- package/dist/systems/stair/stair-opening-sync.d.ts +8 -2
- package/dist/systems/stair/stair-opening-sync.d.ts.map +1 -1
- package/dist/systems/stair/stair-opening-sync.js +136 -315
- package/dist/systems/stair/stair-opening-system.d.ts.map +1 -1
- package/dist/systems/stair/stair-opening-system.js +40 -8
- package/dist/systems/stair/stair-presets.d.ts +276 -0
- package/dist/systems/stair/stair-presets.d.ts.map +1 -0
- package/dist/systems/stair/stair-presets.js +151 -0
- package/dist/systems/stair/stair-rail-budget.d.ts +6 -0
- package/dist/systems/stair/stair-rail-budget.d.ts.map +1 -0
- package/dist/systems/stair/stair-rail-budget.js +36 -0
- package/dist/systems/stair/stair-rail-path.d.ts +22 -0
- package/dist/systems/stair/stair-rail-path.d.ts.map +1 -0
- package/dist/systems/stair/stair-rail-path.js +497 -0
- package/dist/systems/stair/stair-rise-edit.d.ts +9 -0
- package/dist/systems/stair/stair-rise-edit.d.ts.map +1 -0
- package/dist/systems/stair/stair-rise-edit.js +46 -0
- package/dist/systems/stair/stair-rise-query.d.ts +24 -0
- package/dist/systems/stair/stair-rise-query.d.ts.map +1 -0
- package/dist/systems/stair/stair-rise-query.js +125 -0
- package/dist/systems/stair/stair-rise.d.ts +4 -19
- package/dist/systems/stair/stair-rise.d.ts.map +1 -1
- package/dist/systems/stair/stair-rise.js +8 -71
- package/dist/systems/stair/stair-sizing.d.ts +414 -0
- package/dist/systems/stair/stair-sizing.d.ts.map +1 -0
- package/dist/systems/stair/stair-sizing.js +255 -0
- package/dist/systems/stair/stair-sweep-edit.d.ts +7 -0
- package/dist/systems/stair/stair-sweep-edit.d.ts.map +1 -0
- package/dist/systems/stair/stair-sweep-edit.js +8 -0
- package/dist/systems/stair/stair-walking-line.d.ts +5 -0
- package/dist/systems/stair/stair-walking-line.d.ts.map +1 -0
- package/dist/systems/stair/stair-walking-line.js +91 -0
- package/dist/systems/stair/stair-winder.d.ts +36 -0
- package/dist/systems/stair/stair-winder.d.ts.map +1 -0
- package/dist/systems/stair/stair-winder.js +173 -0
- package/dist/systems/wall/wall-assembly.d.ts +234 -0
- package/dist/systems/wall/wall-assembly.d.ts.map +1 -0
- package/dist/systems/wall/wall-assembly.js +854 -0
- package/dist/systems/wall/wall-curve.d.ts +2 -1
- package/dist/systems/wall/wall-curve.d.ts.map +1 -1
- package/dist/systems/wall/wall-curve.js +21 -5
- package/dist/systems/wall/wall-finish.d.ts +102 -0
- package/dist/systems/wall/wall-finish.d.ts.map +1 -0
- package/dist/systems/wall/wall-finish.js +264 -0
- package/dist/systems/wall/wall-footprint.d.ts +3 -0
- package/dist/systems/wall/wall-footprint.d.ts.map +1 -1
- package/dist/systems/wall/wall-footprint.js +15 -13
- package/dist/systems/wall/wall-frame.d.ts +45 -0
- package/dist/systems/wall/wall-frame.d.ts.map +1 -0
- package/dist/systems/wall/wall-frame.js +162 -0
- package/dist/systems/wall/wall-layer-bands.d.ts +38 -0
- package/dist/systems/wall/wall-layer-bands.d.ts.map +1 -0
- package/dist/systems/wall/wall-layer-bands.js +109 -0
- package/dist/systems/wall/wall-merge.d.ts +57 -0
- package/dist/systems/wall/wall-merge.d.ts.map +1 -0
- package/dist/systems/wall/wall-merge.js +411 -0
- package/dist/systems/wall/wall-mitering.d.ts +6 -5
- package/dist/systems/wall/wall-mitering.d.ts.map +1 -1
- package/dist/systems/wall/wall-mitering.js +70 -20
- package/dist/systems/wall/wall-operations.d.ts +28 -0
- package/dist/systems/wall/wall-operations.d.ts.map +1 -0
- package/dist/systems/wall/wall-operations.js +146 -0
- package/dist/systems/wall/wall-paint-plan.d.ts +30 -0
- package/dist/systems/wall/wall-paint-plan.d.ts.map +1 -0
- package/dist/systems/wall/wall-paint-plan.js +167 -0
- package/dist/systems/wall/wall-room-sides.d.ts +6 -0
- package/dist/systems/wall/wall-room-sides.d.ts.map +1 -0
- package/dist/systems/wall/wall-room-sides.js +14 -0
- package/dist/systems/wall/wall-step-openings.d.ts +17 -0
- package/dist/systems/wall/wall-step-openings.d.ts.map +1 -0
- package/dist/systems/wall/wall-step-openings.js +32 -0
- package/dist/systems/wall/wall-top.d.ts +2 -6
- package/dist/systems/wall/wall-top.d.ts.map +1 -1
- package/dist/systems/wall/wall-top.js +3 -9
- package/dist/systems/wall/wall-topology.d.ts +28 -0
- package/dist/systems/wall/wall-topology.d.ts.map +1 -1
- package/dist/systems/wall/wall-topology.js +458 -9
- package/dist/utils/clone-scene-graph.d.ts +6 -0
- package/dist/utils/clone-scene-graph.d.ts.map +1 -1
- package/dist/utils/clone-scene-graph.js +123 -15
- package/dist/utils/ensure-scene-openings.d.ts +8965 -0
- package/dist/utils/ensure-scene-openings.d.ts.map +1 -0
- package/dist/utils/ensure-scene-openings.js +29 -0
- package/dist/utils/exterior-threshold-migration.d.ts +4 -0
- package/dist/utils/exterior-threshold-migration.d.ts.map +1 -0
- package/dist/utils/exterior-threshold-migration.js +114 -0
- package/dist/utils/floor-follow-migration.d.ts +3 -0
- package/dist/utils/floor-follow-migration.d.ts.map +1 -0
- package/dist/utils/floor-follow-migration.js +29 -0
- package/dist/utils/floor-opening-migration.d.ts +13 -0
- package/dist/utils/floor-opening-migration.d.ts.map +1 -0
- package/dist/utils/floor-opening-migration.js +148 -0
- package/dist/utils/floor-piece-adoption.d.ts +50 -0
- package/dist/utils/floor-piece-adoption.d.ts.map +1 -0
- package/dist/utils/floor-piece-adoption.js +182 -0
- package/dist/utils/floor-plate-migration.d.ts +4507 -0
- package/dist/utils/floor-plate-migration.d.ts.map +1 -0
- package/dist/utils/floor-plate-migration.js +1360 -0
- package/dist/utils/heal-plan-coordinates.d.ts +2 -0
- package/dist/utils/heal-plan-coordinates.d.ts.map +1 -0
- package/dist/utils/heal-plan-coordinates.js +69 -0
- package/dist/utils/heal-scene-graph.d.ts +20 -6
- package/dist/utils/heal-scene-graph.d.ts.map +1 -1
- package/dist/utils/heal-scene-graph.js +61 -16
- package/dist/utils/legacy-material-slots.d.ts +23 -0
- package/dist/utils/legacy-material-slots.d.ts.map +1 -0
- package/dist/utils/legacy-material-slots.js +120 -0
- package/dist/utils/legacy-opening-datums.d.ts +11 -0
- package/dist/utils/legacy-opening-datums.d.ts.map +1 -0
- package/dist/utils/legacy-opening-datums.js +92 -0
- package/dist/utils/legacy-wall-datums.d.ts +6 -0
- package/dist/utils/legacy-wall-datums.d.ts.map +1 -0
- package/dist/utils/legacy-wall-datums.js +199 -0
- package/dist/utils/load-migration.d.ts +28 -0
- package/dist/utils/load-migration.d.ts.map +1 -0
- package/dist/utils/load-migration.js +89 -0
- package/dist/utils/node-defaults.d.ts +37 -0
- package/dist/utils/node-defaults.d.ts.map +1 -0
- package/dist/utils/node-defaults.js +96 -0
- package/dist/utils/normalize-legacy-structure.d.ts +2 -0
- package/dist/utils/normalize-legacy-structure.d.ts.map +1 -0
- package/dist/utils/normalize-legacy-structure.js +61 -0
- package/dist/utils/omit-undefined.d.ts +2 -0
- package/dist/utils/omit-undefined.d.ts.map +1 -0
- package/dist/utils/omit-undefined.js +17 -0
- package/dist/utils/owned-floor-opening-migration.d.ts +4489 -0
- package/dist/utils/owned-floor-opening-migration.d.ts.map +1 -0
- package/dist/utils/owned-floor-opening-migration.js +365 -0
- package/dist/utils/reconcile-structure-on-load.d.ts +8965 -0
- package/dist/utils/reconcile-structure-on-load.d.ts.map +1 -0
- package/dist/utils/reconcile-structure-on-load.js +307 -0
- package/dist/utils/room-zone-migration.d.ts +18 -0
- package/dist/utils/room-zone-migration.d.ts.map +1 -0
- package/dist/utils/room-zone-migration.js +258 -0
- package/dist/utils/scene-migrations.d.ts +16 -1
- package/dist/utils/scene-migrations.d.ts.map +1 -1
- package/dist/utils/scene-migrations.js +15 -1
- package/dist/utils/structure-id.d.ts +4 -0
- package/dist/utils/structure-id.d.ts.map +1 -0
- package/dist/utils/structure-id.js +115 -0
- package/dist/utils/vertical-scene-migration.d.ts +8 -8
- package/dist/utils/vertical-scene-migration.d.ts.map +1 -1
- package/dist/utils/vertical-scene-migration.js +18 -8
- package/dist/utils/wall-assembly-migration.d.ts +14 -0
- package/dist/utils/wall-assembly-migration.d.ts.map +1 -0
- package/dist/utils/wall-assembly-migration.js +23 -0
- package/dist/utils/wall-face-migration.d.ts +23 -0
- package/dist/utils/wall-face-migration.d.ts.map +1 -0
- package/dist/utils/wall-face-migration.js +246 -0
- package/dist/validation/opening-bounds.d.ts +36 -0
- package/dist/validation/opening-bounds.d.ts.map +1 -0
- package/dist/validation/opening-bounds.js +34 -0
- package/dist/validation/validate-build-json.d.ts +2 -0
- package/dist/validation/validate-build-json.d.ts.map +1 -1
- package/dist/validation/validate-build-json.js +48 -1
- package/package.json +37 -4
- package/dist/services/surface-hosting-procedural-parity.fixtures.d.ts +0 -13
- package/dist/services/surface-hosting-procedural-parity.fixtures.d.ts.map +0 -1
- package/dist/services/surface-hosting-procedural-parity.fixtures.js +0 -4691
- package/dist/services/surface-hosting-shelf-parity.fixtures.d.ts +0 -1060
- package/dist/services/surface-hosting-shelf-parity.fixtures.d.ts.map +0 -1
- package/dist/services/surface-hosting-shelf-parity.fixtures.js +0 -3127
|
@@ -0,0 +1,1360 @@
|
|
|
1
|
+
import { isFloorAnchoredOpening } from '../lib/floor-opening-footprints.js';
|
|
2
|
+
import { floorPlateId } from '../lib/floor-plate-id.js';
|
|
3
|
+
import { buildFloorPlates, footprintIoU, parseSlabConstruction, slabFootprint, warnPlateFailure, } from '../lib/floor-plates.js';
|
|
4
|
+
import { floorRoomFaces } from '../lib/floor-room-faces.js';
|
|
5
|
+
import { plateFootprint } from '../lib/level-footprints.js';
|
|
6
|
+
import { getOpeningFloorDatum, wallSupportForNodes } from '../lib/opening-floor-datum.js';
|
|
7
|
+
import { replacementPlateFor } from '../lib/plate-reference.js';
|
|
8
|
+
import { computePlateSurfacePartition } from '../lib/plate-surface.js';
|
|
9
|
+
import { area, containsPoint, difference, distanceToBoundary, intersection, union, } from '../lib/polygon-boolean.js';
|
|
10
|
+
import { autoRoomVerticalPlacements } from '../lib/room-vertical-placement.js';
|
|
11
|
+
import { getRenderableSlabPolygon, prepareSlabPolygonContext } from '../lib/slab-polygon.js';
|
|
12
|
+
import { DEFAULT_SLAB_ELEVATION } from '../schema/nodes/slab.js';
|
|
13
|
+
import { getStoredLevelHeight } from '../services/storey.js';
|
|
14
|
+
import { wallOverlapsSlabFootprint } from '../systems/slab/slab-support.js';
|
|
15
|
+
import { getWallCurveLength } from '../systems/wall/wall-curve.js';
|
|
16
|
+
import { calculateLevelMiters, getWallPlanFootprint } from '../systems/wall/wall-footprint.js';
|
|
17
|
+
import { resolveWallTop } from '../systems/wall/wall-top.js';
|
|
18
|
+
import { floorPieceFinish, PIECE_GAP_WIDTH, PIECE_TRIM_DEPTH, partWidth, planFloorPieceAdoption, } from './floor-piece-adoption.js';
|
|
19
|
+
import { legacyWallElevations } from './legacy-wall-datums.js';
|
|
20
|
+
import { loadMigration } from './load-migration.js';
|
|
21
|
+
import { omitUndefined } from './omit-undefined.js';
|
|
22
|
+
function visibleFloorTopAreas(slabs, walls) {
|
|
23
|
+
let covered = union(walls);
|
|
24
|
+
const tops = new Map();
|
|
25
|
+
for (const slab of [...slabs].sort((a, b) => b.elevation - a.elevation)) {
|
|
26
|
+
if (slab.visible === false || slab.support === 'open' || slab.recessed)
|
|
27
|
+
continue;
|
|
28
|
+
const footprint = difference({ outer: slab.polygon, holes: [] }, union((slab.holes ?? []).map((hole) => ({ outer: hole, holes: [] }))));
|
|
29
|
+
const visible = difference(footprint, covered);
|
|
30
|
+
const top = Math.round(slab.elevation * 1000) / 1000;
|
|
31
|
+
tops.set(top, (tops.get(top) ?? 0) + area(visible));
|
|
32
|
+
covered = union([...covered, ...footprint]);
|
|
33
|
+
}
|
|
34
|
+
return tops;
|
|
35
|
+
}
|
|
36
|
+
function visibleFloorTopChange(before, after, walls) {
|
|
37
|
+
const old = visibleFloorTopAreas(before, walls);
|
|
38
|
+
const next = visibleFloorTopAreas(after, walls);
|
|
39
|
+
for (const [oldTop] of old)
|
|
40
|
+
for (const [nextTop, nextArea] of next) {
|
|
41
|
+
if (Math.abs(oldTop - nextTop) > 0.02 + 1e-9)
|
|
42
|
+
continue;
|
|
43
|
+
const oldArea = old.get(oldTop);
|
|
44
|
+
const shared = Math.min(oldArea, nextArea);
|
|
45
|
+
old.set(oldTop, oldArea - shared);
|
|
46
|
+
next.set(nextTop, nextArea - shared);
|
|
47
|
+
if (old.get(oldTop) <= 1e-6)
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
return Math.min([...old.values()].reduce((sum, value) => sum + value, 0), [...next.values()].reduce((sum, value) => sum + value, 0));
|
|
51
|
+
}
|
|
52
|
+
export function associateLegacyManualFloors(source, legacy = source, finalize = true) {
|
|
53
|
+
const bounds = (ring) => ({
|
|
54
|
+
minX: Math.min(...ring.map(([x]) => x)),
|
|
55
|
+
maxX: Math.max(...ring.map(([x]) => x)),
|
|
56
|
+
minZ: Math.min(...ring.map(([, z]) => z)),
|
|
57
|
+
maxZ: Math.max(...ring.map(([, z]) => z)),
|
|
58
|
+
});
|
|
59
|
+
const nearby = (a, b) => a.minX < b.maxX && b.minX < a.maxX && a.minZ < b.maxZ && b.minZ < a.maxZ;
|
|
60
|
+
let nodes = source;
|
|
61
|
+
for (const level of Object.values(source)) {
|
|
62
|
+
if (level.type !== 'level' || level.metadata?.floorOwnershipMigrated === true)
|
|
63
|
+
continue;
|
|
64
|
+
const children = Object.values(source).filter((node) => node.parentId === level.id);
|
|
65
|
+
const authored = children.filter((node) => node.type === 'slab' &&
|
|
66
|
+
!node.autoFromWalls &&
|
|
67
|
+
node.boundary !== 'auto' &&
|
|
68
|
+
node.support !== 'open' &&
|
|
69
|
+
!node.recessed);
|
|
70
|
+
const manual = union(authored.map(slabFootprint));
|
|
71
|
+
const original = Object.values(legacy).filter((node) => node.type === 'slab' &&
|
|
72
|
+
node.parentId === level.id &&
|
|
73
|
+
node.visible !== false &&
|
|
74
|
+
node.support !== 'open' &&
|
|
75
|
+
!node.recessed);
|
|
76
|
+
const originalFaces = original.map((slab) => ({
|
|
77
|
+
slab,
|
|
78
|
+
footprint: slabFootprint(slab),
|
|
79
|
+
coverageFootprint: {
|
|
80
|
+
outer: slab.polygon,
|
|
81
|
+
holes: (slab.holes ?? []).filter((_, index) => slab.holeMetadata?.[index]?.source !== 'stair' &&
|
|
82
|
+
slab.holeMetadata?.[index]?.source !== 'elevator'),
|
|
83
|
+
},
|
|
84
|
+
bounds: bounds(slab.polygon),
|
|
85
|
+
}));
|
|
86
|
+
const rooms = children.filter((node) => node.type === 'zone' && node.spaceRole === 'room');
|
|
87
|
+
const wallBand = Math.max(0, ...children
|
|
88
|
+
.filter((node) => node.type === 'wall')
|
|
89
|
+
.map((wall) => (wall.thickness ?? 0.1) / 2)) + 0.005;
|
|
90
|
+
for (const slab of authored) {
|
|
91
|
+
const associatedZoneIds = rooms
|
|
92
|
+
.filter((room) => area(intersection(slabFootprint(room), slabFootprint(slab))) > 1e-4)
|
|
93
|
+
.map((room) => room.id)
|
|
94
|
+
.sort();
|
|
95
|
+
if (JSON.stringify(slab.associatedZoneIds) === JSON.stringify(associatedZoneIds))
|
|
96
|
+
continue;
|
|
97
|
+
if (nodes === source)
|
|
98
|
+
nodes = { ...source };
|
|
99
|
+
nodes[slab.id] = { ...slab, associatedZoneIds };
|
|
100
|
+
}
|
|
101
|
+
for (const zone of children) {
|
|
102
|
+
if (zone.type !== 'zone' ||
|
|
103
|
+
zone.spaceRole !== 'room' ||
|
|
104
|
+
zone.hasFloor === false ||
|
|
105
|
+
zone.floor?.support === 'open' ||
|
|
106
|
+
zone.floor?.sourceSlabId)
|
|
107
|
+
continue;
|
|
108
|
+
const face = slabFootprint(zone);
|
|
109
|
+
const faceArea = area([face]);
|
|
110
|
+
if (faceArea <= 0)
|
|
111
|
+
continue;
|
|
112
|
+
const faceBounds = bounds(zone.polygon);
|
|
113
|
+
const originalOverlaps = originalFaces
|
|
114
|
+
.filter((entry) => nearby(faceBounds, entry.bounds))
|
|
115
|
+
.map((entry) => ({
|
|
116
|
+
...entry,
|
|
117
|
+
overlap: intersection(face, entry.coverageFootprint),
|
|
118
|
+
}));
|
|
119
|
+
const supportArea = area(union(originalOverlaps.flatMap((entry) => entry.overlap)));
|
|
120
|
+
if (supportArea <= 1e-4) {
|
|
121
|
+
if (nodes === source)
|
|
122
|
+
nodes = { ...source };
|
|
123
|
+
nodes[zone.id] = { ...zone, hasFloor: false };
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const nearWholeAutoPlate = originalOverlaps.some((entry) => {
|
|
127
|
+
const plateBounds = entry.bounds;
|
|
128
|
+
return (entry.slab.autoFromWalls &&
|
|
129
|
+
area(entry.overlap) >= faceArea * 0.8 &&
|
|
130
|
+
Math.abs(plateBounds.minX - faceBounds.minX) <= wallBand &&
|
|
131
|
+
Math.abs(plateBounds.maxX - faceBounds.maxX) <= wallBand &&
|
|
132
|
+
Math.abs(plateBounds.minZ - faceBounds.minZ) <= wallBand &&
|
|
133
|
+
Math.abs(plateBounds.maxZ - faceBounds.maxZ) <= wallBand);
|
|
134
|
+
});
|
|
135
|
+
if (!nearWholeAutoPlate &&
|
|
136
|
+
supportArea > 1e-4 &&
|
|
137
|
+
faceArea - supportArea > Math.max(0.02, faceArea * 0.01)) {
|
|
138
|
+
const provider = originalOverlaps
|
|
139
|
+
.filter((entry) => area(entry.overlap) > 1e-4)
|
|
140
|
+
.sort((a, b) => b.slab.elevation - a.slab.elevation ||
|
|
141
|
+
area(b.overlap) - area(a.overlap) ||
|
|
142
|
+
a.slab.id.localeCompare(b.slab.id))[0]?.slab;
|
|
143
|
+
// A partial provider that became a generated plate supplies no authored floor.
|
|
144
|
+
if (provider && !nodes[provider.id]?.plateRole) {
|
|
145
|
+
if (nodes === source)
|
|
146
|
+
nodes = { ...source };
|
|
147
|
+
nodes[zone.id] = { ...zone, floor: { ...zone.floor, sourceSlabId: provider.id } };
|
|
148
|
+
}
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (area(intersection(face, manual)) <= 1e-4)
|
|
152
|
+
continue;
|
|
153
|
+
const provider = authored
|
|
154
|
+
.filter((slab) => nearby(faceBounds, bounds(slab.polygon)))
|
|
155
|
+
.map((slab) => ({ slab, overlap: area(intersection(face, slabFootprint(slab))) }))
|
|
156
|
+
.filter(({ slab, overlap }) => overlap >= faceArea * 0.05 ||
|
|
157
|
+
(overlap > 1e-4 &&
|
|
158
|
+
slab.metadata?.plateMigration?.demoted !==
|
|
159
|
+
undefined))
|
|
160
|
+
.sort((a, b) => b.slab.elevation - a.slab.elevation ||
|
|
161
|
+
b.overlap - a.overlap ||
|
|
162
|
+
a.slab.id.localeCompare(b.slab.id))[0]?.slab;
|
|
163
|
+
if (!provider)
|
|
164
|
+
continue;
|
|
165
|
+
const providerCoverage = area(intersection(face, slabFootprint(provider)));
|
|
166
|
+
const automaticCover = originalFaces
|
|
167
|
+
.filter((entry) => entry.slab.autoFromWalls && nearby(faceBounds, entry.bounds))
|
|
168
|
+
.reduce((best, entry) => Math.max(best, area(intersection(face, entry.footprint))), 0);
|
|
169
|
+
if (automaticCover >= faceArea * 0.95 && providerCoverage < faceArea * 0.95)
|
|
170
|
+
continue;
|
|
171
|
+
const finishOnly = provider.metadata?.plateMigration?.demoted ===
|
|
172
|
+
undefined &&
|
|
173
|
+
providerCoverage >= faceArea * 0.95 &&
|
|
174
|
+
Object.values(legacy).some((node) => node.type === 'slab' &&
|
|
175
|
+
node.parentId === level.id &&
|
|
176
|
+
node.autoFromWalls &&
|
|
177
|
+
Math.abs(node.elevation - provider.elevation) <= 0.02 + 1e-9 &&
|
|
178
|
+
provider.thickness <= node.thickness + 0.02 + 1e-9 &&
|
|
179
|
+
area(difference(slabFootprint(provider), slabFootprint(node))) <=
|
|
180
|
+
Math.max(1e-6, area([slabFootprint(provider)]) * 0.01));
|
|
181
|
+
if (finishOnly)
|
|
182
|
+
continue;
|
|
183
|
+
if (nodes === source)
|
|
184
|
+
nodes = { ...source };
|
|
185
|
+
nodes[zone.id] = { ...zone, floor: { ...zone.floor, sourceSlabId: provider.id } };
|
|
186
|
+
}
|
|
187
|
+
if (finalize) {
|
|
188
|
+
if (nodes === source)
|
|
189
|
+
nodes = { ...source };
|
|
190
|
+
const hadLegacyAutoPlate = Object.values(legacy).some((node) => node.type === 'slab' &&
|
|
191
|
+
node.parentId === level.id &&
|
|
192
|
+
node.autoFromWalls &&
|
|
193
|
+
!node.plateRole);
|
|
194
|
+
nodes[level.id] = {
|
|
195
|
+
...level,
|
|
196
|
+
metadata: {
|
|
197
|
+
...level.metadata,
|
|
198
|
+
floorOwnershipMigrated: true,
|
|
199
|
+
...(hadLegacyAutoPlate ? { legacyAutoOpeningsMigrated: true } : {}),
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return nodes;
|
|
205
|
+
}
|
|
206
|
+
function convertLegacyFinishSlabs(source) {
|
|
207
|
+
let nodes = source;
|
|
208
|
+
const slabs = Object.values(source).filter((node) => node.type === 'slab');
|
|
209
|
+
for (const slab of slabs) {
|
|
210
|
+
if (slab.autoFromWalls ||
|
|
211
|
+
slab.boundary === 'auto' ||
|
|
212
|
+
slab.plateRole ||
|
|
213
|
+
slab.support === 'open' ||
|
|
214
|
+
slab.recessed ||
|
|
215
|
+
slab.visible === false ||
|
|
216
|
+
slab.holes?.length ||
|
|
217
|
+
!slab.parentId)
|
|
218
|
+
continue;
|
|
219
|
+
const finish = slab.slots?.surface ?? slab.material ?? slab.materialPreset;
|
|
220
|
+
if (finish === undefined)
|
|
221
|
+
continue;
|
|
222
|
+
if (Object.values(source).some((node) => node.id !== slab.id &&
|
|
223
|
+
(node.supportSlabId === slab.id ||
|
|
224
|
+
node.deckSlabId === slab.id)))
|
|
225
|
+
continue;
|
|
226
|
+
const footprint = slabFootprint(slab);
|
|
227
|
+
const auto = slabs.filter((other) => other.parentId === slab.parentId &&
|
|
228
|
+
(other.autoFromWalls || other.boundary === 'auto') &&
|
|
229
|
+
!other.plateRole &&
|
|
230
|
+
Math.abs(other.elevation - slab.elevation) <= 0.02 + 1e-9 &&
|
|
231
|
+
slab.thickness <= other.thickness + 0.02 + 1e-9);
|
|
232
|
+
if (!auto.length || area(difference(footprint, union(auto.map(slabFootprint)))) > 1e-4)
|
|
233
|
+
continue;
|
|
234
|
+
const rooms = Object.values(nodes).filter((node) => node.type === 'zone' &&
|
|
235
|
+
node.parentId === slab.parentId &&
|
|
236
|
+
node.spaceRole === 'room' &&
|
|
237
|
+
node.hasFloor !== false);
|
|
238
|
+
const pieces = rooms.flatMap((room) => intersection(footprint, slabFootprint(room)).map((part) => ({ room, part })));
|
|
239
|
+
if (pieces.some(({ part }) => part.holes.length) ||
|
|
240
|
+
area(difference(footprint, union(pieces.map(({ part }) => part)))) > 1e-4)
|
|
241
|
+
continue;
|
|
242
|
+
if (nodes === source)
|
|
243
|
+
nodes = { ...source };
|
|
244
|
+
for (const room of rooms) {
|
|
245
|
+
const regions = pieces
|
|
246
|
+
.filter((piece) => piece.room.id === room.id)
|
|
247
|
+
.map(({ part }, index) => ({
|
|
248
|
+
id: pieces.length === 1 ? slab.id : `${slab.id}_${room.id}_${index}`,
|
|
249
|
+
polygon: part.outer,
|
|
250
|
+
finish,
|
|
251
|
+
}));
|
|
252
|
+
if (!regions.length)
|
|
253
|
+
continue;
|
|
254
|
+
const { sourceSlabId, ...floor } = room.floor ?? {};
|
|
255
|
+
nodes[room.id] = {
|
|
256
|
+
...room,
|
|
257
|
+
floor: {
|
|
258
|
+
...floor,
|
|
259
|
+
...(sourceSlabId && sourceSlabId !== slab.id ? { sourceSlabId } : {}),
|
|
260
|
+
regions: [...(floor.regions ?? []), ...regions],
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
const level = nodes[slab.parentId];
|
|
265
|
+
if (level?.type === 'level')
|
|
266
|
+
nodes[level.id] = { ...level, children: level.children.filter((id) => id !== slab.id) };
|
|
267
|
+
delete nodes[slab.id];
|
|
268
|
+
}
|
|
269
|
+
return nodes;
|
|
270
|
+
}
|
|
271
|
+
function absorbCompleteManualFloors(source) {
|
|
272
|
+
let nodes = source;
|
|
273
|
+
const slabs = Object.values(source).filter((node) => node.type === 'slab');
|
|
274
|
+
for (const slab of slabs) {
|
|
275
|
+
if (slab.autoFromWalls ||
|
|
276
|
+
slab.boundary === 'auto' ||
|
|
277
|
+
slab.plateRole ||
|
|
278
|
+
slab.support === 'open' ||
|
|
279
|
+
slab.recessed ||
|
|
280
|
+
slab.visible === false ||
|
|
281
|
+
slab.metadata?.plateMigration?.demoted !== undefined ||
|
|
282
|
+
!slab.parentId)
|
|
283
|
+
continue;
|
|
284
|
+
const rooms = Object.values(source).filter((node) => node.type === 'zone' &&
|
|
285
|
+
node.parentId === slab.parentId &&
|
|
286
|
+
node.spaceRole === 'room' &&
|
|
287
|
+
node.floor?.sourceSlabId === slab.id);
|
|
288
|
+
if (!rooms.length || rooms.length !== slab.associatedZoneIds?.length)
|
|
289
|
+
continue;
|
|
290
|
+
const levelSlabs = slabs.filter((other) => other.parentId === slab.parentId);
|
|
291
|
+
const levelRooms = Object.values(source).filter((node) => node.type === 'zone' && node.parentId === slab.parentId && node.spaceRole === 'room');
|
|
292
|
+
const completeLevel = levelRooms.length > 0 &&
|
|
293
|
+
levelSlabs.every((other) => !other.autoFromWalls &&
|
|
294
|
+
other.boundary !== 'auto' &&
|
|
295
|
+
!other.plateRole &&
|
|
296
|
+
!other.recessed &&
|
|
297
|
+
Math.abs(other.elevation - slab.elevation) <= 1e-6 &&
|
|
298
|
+
Math.abs(other.thickness - slab.thickness) <= 1e-6 &&
|
|
299
|
+
levelRooms.some((room) => room.floor?.sourceSlabId === other.id)) &&
|
|
300
|
+
levelRooms.every((room) => levelSlabs.some((other) => room.floor?.sourceSlabId === other.id));
|
|
301
|
+
if (!completeLevel)
|
|
302
|
+
continue;
|
|
303
|
+
if (rooms.some((room) => room.floor?.elevation !== undefined &&
|
|
304
|
+
Math.abs(room.floor.elevation - slab.elevation) > 0.02 + 1e-9) ||
|
|
305
|
+
slabs.some((other) => other.id !== slab.id &&
|
|
306
|
+
other.parentId === slab.parentId &&
|
|
307
|
+
area(intersection(slabFootprint(other), slabFootprint(slab))) > 1e-4))
|
|
308
|
+
continue;
|
|
309
|
+
const footprint = union(rooms.map(slabFootprint));
|
|
310
|
+
const outside = { outer: slab.polygon, holes: [] };
|
|
311
|
+
const tolerance = Math.max(1e-4, area([outside]) * 1e-4);
|
|
312
|
+
try {
|
|
313
|
+
if (area(difference(outside, footprint, { throwOnError: true })) > tolerance ||
|
|
314
|
+
area(difference(footprint, outside, { throwOnError: true })) > tolerance)
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
if (nodes === source)
|
|
321
|
+
nodes = { ...source };
|
|
322
|
+
nodes[slab.id] = {
|
|
323
|
+
...parseSlabConstruction(slab),
|
|
324
|
+
boundary: 'auto',
|
|
325
|
+
plateRole: 'base',
|
|
326
|
+
autoFromWalls: true,
|
|
327
|
+
zoneIds: rooms.map((room) => room.id).sort(),
|
|
328
|
+
associatedZoneIds: undefined,
|
|
329
|
+
referenceFloorElevation: slab.elevation,
|
|
330
|
+
foundation: slab.fillToTerrain ? { type: 'solid' } : { type: 'none' },
|
|
331
|
+
fillToTerrain: undefined,
|
|
332
|
+
};
|
|
333
|
+
for (const room of rooms) {
|
|
334
|
+
const { sourceSlabId: _sourceSlabId, ...floor } = room.floor ?? {};
|
|
335
|
+
nodes[room.id] = {
|
|
336
|
+
...room,
|
|
337
|
+
floor: {
|
|
338
|
+
...floor,
|
|
339
|
+
elevation: floor.elevation ?? slab.elevation,
|
|
340
|
+
finish: floor.finish ?? slab.slots?.surface ?? slab.material ?? slab.materialPreset,
|
|
341
|
+
},
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return nodes;
|
|
346
|
+
}
|
|
347
|
+
function clearDanglingFloorSources(nodes) {
|
|
348
|
+
let changed = false;
|
|
349
|
+
for (const zone of Object.values(nodes)) {
|
|
350
|
+
if (zone.type !== 'zone' || !zone.floor?.sourceSlabId)
|
|
351
|
+
continue;
|
|
352
|
+
if (nodes[zone.floor.sourceSlabId]?.type === 'slab')
|
|
353
|
+
continue;
|
|
354
|
+
const { sourceSlabId: _missing, ...floor } = zone.floor;
|
|
355
|
+
nodes[zone.id] = { ...zone, floor };
|
|
356
|
+
changed = true;
|
|
357
|
+
}
|
|
358
|
+
return changed;
|
|
359
|
+
}
|
|
360
|
+
/** A level whose hand-drawn floor pieces cannot be adopted exactly: migrate it without them. */
|
|
361
|
+
class AdoptionRejected extends Error {
|
|
362
|
+
}
|
|
363
|
+
function migrateFloorPlatesOnView(sourceNodes) {
|
|
364
|
+
// Adoption is all-or-nothing per level: a level whose pieces are not all
|
|
365
|
+
// consumed migrates exactly as it would without adoption.
|
|
366
|
+
const skip = new Set();
|
|
367
|
+
for (;;) {
|
|
368
|
+
const adoption = planFloorPieceAdoption(sourceNodes, skip);
|
|
369
|
+
const result = runFloorPlateMigration(sourceNodes, adoption);
|
|
370
|
+
const failed = [...adoption.levels.keys()].filter((levelId) => [...adoption.pieces].some(([id, level]) => level === levelId &&
|
|
371
|
+
result.nodes[id]?.type === 'slab' &&
|
|
372
|
+
!result.nodes[id].plateRole));
|
|
373
|
+
if (!failed.length)
|
|
374
|
+
return result;
|
|
375
|
+
for (const levelId of failed)
|
|
376
|
+
skip.add(levelId);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function runFloorPlateMigration(sourceNodes, adoption) {
|
|
380
|
+
const slotMigration = migrateSlabSlots(sourceNodes);
|
|
381
|
+
const nodes = { ...slotMigration.nodes };
|
|
382
|
+
for (const id of adoption.pieces.keys())
|
|
383
|
+
nodes[id] = { ...nodes[id], autoFromWalls: true };
|
|
384
|
+
const plateIds = [];
|
|
385
|
+
const reports = [];
|
|
386
|
+
const remap = new Map();
|
|
387
|
+
let changed = slotMigration.changed;
|
|
388
|
+
if (clearDanglingFloorSources(nodes))
|
|
389
|
+
changed = true;
|
|
390
|
+
for (const level of Object.values(nodes)) {
|
|
391
|
+
if (level.type !== 'level' || !level.metadata?.legacyRoomMigrationPending)
|
|
392
|
+
continue;
|
|
393
|
+
if (Object.values(nodes).some((node) => node.type === 'slab' && node.parentId === level.id))
|
|
394
|
+
continue;
|
|
395
|
+
for (const zone of Object.values(nodes)) {
|
|
396
|
+
if (zone.type !== 'zone' || zone.parentId !== level.id || zone.hasFloor !== undefined)
|
|
397
|
+
continue;
|
|
398
|
+
nodes[zone.id] = { ...zone, hasFloor: false };
|
|
399
|
+
changed = true;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
for (const source of Object.values(nodes)) {
|
|
403
|
+
if (source.type !== 'slab' || !Object.hasOwn(source, 'legacyFloor'))
|
|
404
|
+
continue;
|
|
405
|
+
const { legacyFloor, ...plate } = source;
|
|
406
|
+
nodes[source.id] = {
|
|
407
|
+
...plate,
|
|
408
|
+
referenceFloorElevation: plate.referenceFloorElevation ?? legacyFloor,
|
|
409
|
+
};
|
|
410
|
+
changed = true;
|
|
411
|
+
}
|
|
412
|
+
if (Object.values(nodes).some((node) => node.type === 'slab' && !node.plateRole) &&
|
|
413
|
+
!Object.values(nodes).some((node) => node.type === 'slab' && node.plateRole)) {
|
|
414
|
+
const converted = convertLegacyFinishSlabs(nodes);
|
|
415
|
+
if (converted !== nodes) {
|
|
416
|
+
Object.assign(nodes, converted);
|
|
417
|
+
for (const id of Object.keys(nodes))
|
|
418
|
+
if (!(id in converted))
|
|
419
|
+
delete nodes[id];
|
|
420
|
+
changed = true;
|
|
421
|
+
}
|
|
422
|
+
// Adopted pieces are still hand-drawn history: they neither mark legacy
|
|
423
|
+
// wall-generated openings nor hold back the level's finalisation.
|
|
424
|
+
const history = adoption.pieces.size
|
|
425
|
+
? Object.fromEntries(Object.entries(nodes).map(([id, node]) => [
|
|
426
|
+
id,
|
|
427
|
+
adoption.pieces.has(id) ? { ...node, autoFromWalls: false } : node,
|
|
428
|
+
]))
|
|
429
|
+
: nodes;
|
|
430
|
+
const associated = associateLegacyManualFloors(nodes, history, !Object.values(nodes).some((node) => node.type === 'slab' &&
|
|
431
|
+
node.autoFromWalls &&
|
|
432
|
+
!node.plateRole &&
|
|
433
|
+
!adoption.pieces.has(node.id)));
|
|
434
|
+
if (associated !== nodes) {
|
|
435
|
+
Object.assign(nodes, associated);
|
|
436
|
+
changed = true;
|
|
437
|
+
}
|
|
438
|
+
const absorbed = absorbCompleteManualFloors(nodes);
|
|
439
|
+
if (absorbed !== nodes) {
|
|
440
|
+
Object.assign(nodes, absorbed);
|
|
441
|
+
changed = true;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
for (const level of Object.values(nodes)) {
|
|
445
|
+
if (level.type !== 'level' || !Object.hasOwn(level, 'floorElevation'))
|
|
446
|
+
continue;
|
|
447
|
+
const { floorElevation, ...clean } = level;
|
|
448
|
+
nodes[level.id] = clean;
|
|
449
|
+
for (const plate of Object.values(nodes))
|
|
450
|
+
if (plate.type === 'slab' &&
|
|
451
|
+
plate.parentId === level.id &&
|
|
452
|
+
(plate.plateRole === 'base' ||
|
|
453
|
+
(!plate.plateRole &&
|
|
454
|
+
plate.support !== 'open' &&
|
|
455
|
+
(plate.autoFromWalls || plate.boundary === 'auto'))))
|
|
456
|
+
nodes[plate.id] = { ...plate, floorHeight: floorElevation ?? plate.floorHeight };
|
|
457
|
+
changed = true;
|
|
458
|
+
}
|
|
459
|
+
for (const plate of Object.values(nodes)) {
|
|
460
|
+
if (plate.type !== 'slab' || plate.plateRole !== 'base')
|
|
461
|
+
continue;
|
|
462
|
+
if (!plate.foundation || Object.hasOwn(plate, 'fillToTerrain')) {
|
|
463
|
+
const { fillToTerrain, ...clean } = plate;
|
|
464
|
+
nodes[plate.id] = {
|
|
465
|
+
...clean,
|
|
466
|
+
foundation: plate.foundation ?? {
|
|
467
|
+
type: fillToTerrain ? 'solid' : 'none',
|
|
468
|
+
...(fillToTerrain
|
|
469
|
+
? { material: plate.slots?.edge ?? plate.slots?.side ?? '#cccccc' }
|
|
470
|
+
: {}),
|
|
471
|
+
},
|
|
472
|
+
};
|
|
473
|
+
changed = true;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
for (const plate of Object.values(nodes)) {
|
|
477
|
+
if (plate.type !== 'slab' || plate.support !== 'open' || plate.boundary !== 'auto')
|
|
478
|
+
continue;
|
|
479
|
+
for (const id of plate.zoneIds ?? []) {
|
|
480
|
+
const zone = nodes[id];
|
|
481
|
+
if (zone?.type !== 'zone')
|
|
482
|
+
continue;
|
|
483
|
+
const floorEdgeFinish = zone.floorEdgeFinish ?? plate.slots?.edge;
|
|
484
|
+
const finish = zone.floor?.finish ?? plate.slots?.surface ?? plate.material ?? plate.materialPreset;
|
|
485
|
+
if (floorEdgeFinish === zone.floorEdgeFinish && finish === zone.floor?.finish)
|
|
486
|
+
continue;
|
|
487
|
+
nodes[id] = {
|
|
488
|
+
...zone,
|
|
489
|
+
...(floorEdgeFinish === undefined ? {} : { floorEdgeFinish }),
|
|
490
|
+
...(finish === undefined ? {} : { floor: { ...zone.floor, finish } }),
|
|
491
|
+
};
|
|
492
|
+
changed = true;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
for (const level of Object.values(nodes)
|
|
496
|
+
.filter((node) => node.type === 'level')
|
|
497
|
+
.sort((a, b) => a.level - b.level || a.id.localeCompare(b.id))) {
|
|
498
|
+
const children = Object.values(nodes)
|
|
499
|
+
.filter((node) => node.parentId === level.id)
|
|
500
|
+
.sort((a, b) => a.id.localeCompare(b.id));
|
|
501
|
+
if (!children.some((node) => node.type === 'slab' &&
|
|
502
|
+
(node.autoFromWalls || node.boundary === 'auto') &&
|
|
503
|
+
!node.plateRole &&
|
|
504
|
+
node.support !== 'open'))
|
|
505
|
+
continue;
|
|
506
|
+
const beforeNodes = { ...nodes };
|
|
507
|
+
const beforeRemap = new Map(remap);
|
|
508
|
+
const beforePlateCount = plateIds.length;
|
|
509
|
+
const beforeChanged = changed;
|
|
510
|
+
try {
|
|
511
|
+
const recessed = children.filter((node) => node.type === 'slab' && node.autoFromWalls && !node.boundary && node.recessed);
|
|
512
|
+
if (recessed.length)
|
|
513
|
+
warnPlateFailure(level.id, recessed.map((node) => node.id), 'recessed-legacy: preserved verbatim');
|
|
514
|
+
const demotionReasons = new Map();
|
|
515
|
+
const demoteUnmatched = (reason) => {
|
|
516
|
+
for (const node of children) {
|
|
517
|
+
if (node.type !== 'slab' ||
|
|
518
|
+
(!node.autoFromWalls && node.boundary !== 'auto') ||
|
|
519
|
+
node.recessed ||
|
|
520
|
+
!nodes[node.id] ||
|
|
521
|
+
nodes[node.id].plateRole)
|
|
522
|
+
continue;
|
|
523
|
+
// Unmatched legacy geometry is authored construction, not a room generator.
|
|
524
|
+
nodes[node.id] = {
|
|
525
|
+
...nodes[node.id],
|
|
526
|
+
autoFromWalls: false,
|
|
527
|
+
boundary: undefined,
|
|
528
|
+
metadata: {
|
|
529
|
+
...node.metadata,
|
|
530
|
+
plateMigration: {
|
|
531
|
+
demoted: demotionReasons.get(node.id) === 'has-floor-disabled'
|
|
532
|
+
? 'has-floor-disabled'
|
|
533
|
+
: (reason ?? demotionReasons.get(node.id)),
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
};
|
|
537
|
+
changed = true;
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
const adopted = adoption.levels.get(level.id);
|
|
541
|
+
const reject = () => {
|
|
542
|
+
if (adopted)
|
|
543
|
+
throw new AdoptionRejected();
|
|
544
|
+
};
|
|
545
|
+
const legacy = children
|
|
546
|
+
.filter((node) => node.type === 'slab' &&
|
|
547
|
+
(node.autoFromWalls || node.boundary === 'auto') &&
|
|
548
|
+
!node.plateRole &&
|
|
549
|
+
node.support !== 'open' &&
|
|
550
|
+
!node.recessed)
|
|
551
|
+
.map((node) => parseSlabConstruction(node));
|
|
552
|
+
if (!legacy.length)
|
|
553
|
+
continue;
|
|
554
|
+
const walls = children.filter((node) => node.type === 'wall');
|
|
555
|
+
const separators = children.filter((node) => node.type === 'separator');
|
|
556
|
+
const zones = children.filter((node) => node.type === 'zone' &&
|
|
557
|
+
node.spaceRole === 'room' &&
|
|
558
|
+
node.enclosureStatus !== 'open' &&
|
|
559
|
+
node.floor?.support !== 'open');
|
|
560
|
+
const faces = floorRoomFaces([...walls, ...separators]);
|
|
561
|
+
const boundsOf = (ring) => ({
|
|
562
|
+
minX: Math.min(...ring.map(([x]) => x)),
|
|
563
|
+
maxX: Math.max(...ring.map(([x]) => x)),
|
|
564
|
+
minZ: Math.min(...ring.map(([, z]) => z)),
|
|
565
|
+
maxZ: Math.max(...ring.map(([, z]) => z)),
|
|
566
|
+
});
|
|
567
|
+
const intersectsBounds = (a, b) => a.minX <= b.maxX && b.minX <= a.maxX && a.minZ <= b.maxZ && b.minZ <= a.maxZ;
|
|
568
|
+
const boundedFaces = faces.map((face) => ({
|
|
569
|
+
face,
|
|
570
|
+
bounds: boundsOf(face.referencePolygon),
|
|
571
|
+
}));
|
|
572
|
+
const boundedLegacy = legacy.map((slab) => ({ slab, bounds: boundsOf(slab.polygon) }));
|
|
573
|
+
const miters = calculateLevelMiters(walls);
|
|
574
|
+
const context = {
|
|
575
|
+
revision: 0,
|
|
576
|
+
walls: new Map(walls.map((wall) => [wall.id, wall])),
|
|
577
|
+
wallFootprints: new Map(walls.map((wall) => [
|
|
578
|
+
wall.id,
|
|
579
|
+
getWallPlanFootprint(wall, miters).map(({ x, y }) => [x, y]),
|
|
580
|
+
])),
|
|
581
|
+
};
|
|
582
|
+
const allSlabs = children.filter((node) => node.type === 'slab');
|
|
583
|
+
const manualCoverage = union(allSlabs
|
|
584
|
+
.filter((slab) => !slab.autoFromWalls && slab.boundary !== 'auto')
|
|
585
|
+
.map(slabFootprint));
|
|
586
|
+
for (const slab of legacy) {
|
|
587
|
+
const surface = union([slabFootprint(slab)]);
|
|
588
|
+
const disabled = zones.some((zone) => zone.hasFloor === false &&
|
|
589
|
+
footprintIoU(slabFootprint(zone), slabFootprint(slab)) >= 0.6);
|
|
590
|
+
demotionReasons.set(slab.id, disabled
|
|
591
|
+
? 'has-floor-disabled'
|
|
592
|
+
: area(surface) > 0 &&
|
|
593
|
+
area(intersection(surface, manualCoverage)) >= area(surface) * 0.6
|
|
594
|
+
? 'manual-coverage'
|
|
595
|
+
: faces.length
|
|
596
|
+
? walls.some((wall) => wall.curveOffset)
|
|
597
|
+
? 'curved-face-mismatch'
|
|
598
|
+
: 'stale-or-unmatched-straight'
|
|
599
|
+
: 'no-detected-room');
|
|
600
|
+
}
|
|
601
|
+
const linked = new Set(allSlabs
|
|
602
|
+
.filter((slab) => slab.boundary === 'auto' && slab.plateRole)
|
|
603
|
+
.flatMap((slab) => slab.zoneIds ?? []));
|
|
604
|
+
const wallArea = union([...context.wallFootprints.values()]);
|
|
605
|
+
const renderContext = prepareSlabPolygonContext({ walls, siblingSlabs: allSlabs });
|
|
606
|
+
const renderedSlabs = new Map(allSlabs.map((slab) => [slab.id, getRenderableSlabPolygon(slab, renderContext)]));
|
|
607
|
+
const legacySurfaces = new Map(legacy.map((slab) => [
|
|
608
|
+
slab.id,
|
|
609
|
+
{
|
|
610
|
+
outer: renderedSlabs.get(slab.id),
|
|
611
|
+
holes: [],
|
|
612
|
+
},
|
|
613
|
+
]));
|
|
614
|
+
const sources = new Map();
|
|
615
|
+
const rooms = [];
|
|
616
|
+
for (const zone of zones) {
|
|
617
|
+
if (linked.has(zone.id))
|
|
618
|
+
continue;
|
|
619
|
+
const zoneFootprint = slabFootprint(zone);
|
|
620
|
+
const zoneBounds = boundsOf(zone.polygon);
|
|
621
|
+
const face = boundedFaces
|
|
622
|
+
.filter((entry) => intersectsBounds(zoneBounds, entry.bounds))
|
|
623
|
+
.map(({ face }) => ({
|
|
624
|
+
face,
|
|
625
|
+
iou: footprintIoU(zoneFootprint, {
|
|
626
|
+
outer: face.referencePolygon,
|
|
627
|
+
holes: face.holes,
|
|
628
|
+
}),
|
|
629
|
+
}))
|
|
630
|
+
.sort((a, b) => b.iou - a.iou)[0];
|
|
631
|
+
if (!face || face.iou < 0.9 || zone.hasFloor === false)
|
|
632
|
+
continue;
|
|
633
|
+
const candidates = boundedLegacy
|
|
634
|
+
.filter((entry) => intersectsBounds(zoneBounds, entry.bounds))
|
|
635
|
+
.map(({ slab }) => ({
|
|
636
|
+
slab,
|
|
637
|
+
overlap: area(intersection(slabFootprint(slab), zoneFootprint)),
|
|
638
|
+
iou: footprintIoU(slabFootprint(slab), zoneFootprint),
|
|
639
|
+
}))
|
|
640
|
+
.filter(({ overlap }) => overlap > 0)
|
|
641
|
+
.sort((a, b) => b.overlap - a.overlap || b.iou - a.iou || a.slab.id.localeCompare(b.slab.id));
|
|
642
|
+
const source = candidates[0]?.slab;
|
|
643
|
+
const boundaryWalls = union([...new Set(face.face.spans.map((span) => span.boundaryId))].flatMap((id) => context.wallFootprints.has(id) ? [context.wallFootprints.get(id)] : []));
|
|
644
|
+
let clear = union([slabFootprint(zone)]);
|
|
645
|
+
try {
|
|
646
|
+
clear = difference(clear, boundaryWalls, { throwOnError: true });
|
|
647
|
+
}
|
|
648
|
+
catch {
|
|
649
|
+
// If wall subtraction fails, require coverage of the entire reference
|
|
650
|
+
// face instead of treating a clipping failure as an empty room.
|
|
651
|
+
}
|
|
652
|
+
if (!clear.length)
|
|
653
|
+
continue;
|
|
654
|
+
// A stale/sliver slab overlap is not evidence that this whole face had a floor.
|
|
655
|
+
// Subtract only nearby surfaces: unioning every legacy slab can fail on
|
|
656
|
+
// distant self-intersections and incorrectly suppress otherwise valid rooms.
|
|
657
|
+
const uncovered = candidates.reduce((remaining, { slab }) => {
|
|
658
|
+
try {
|
|
659
|
+
return difference(remaining, legacySurfaces.get(slab.id), { throwOnError: true });
|
|
660
|
+
}
|
|
661
|
+
catch {
|
|
662
|
+
return remaining;
|
|
663
|
+
}
|
|
664
|
+
}, clear);
|
|
665
|
+
const open = adopted?.voids.length
|
|
666
|
+
? difference(uncovered, union(adopted.voids.map((ring) => ({ outer: ring, holes: [] }))))
|
|
667
|
+
: uncovered;
|
|
668
|
+
if (area(open) > Math.max(1e-6, area(clear) * 0.01))
|
|
669
|
+
continue;
|
|
670
|
+
const recessed = allSlabs.some((slab) => slab.recessed &&
|
|
671
|
+
area(intersection({ outer: slab.polygon, holes: [] }, clear)) >= area(clear) * 0.6);
|
|
672
|
+
if (recessed)
|
|
673
|
+
continue;
|
|
674
|
+
if (!source)
|
|
675
|
+
continue;
|
|
676
|
+
const floor = { ...zone.floor };
|
|
677
|
+
// Partial cover by a piece is an open void in the plate, not an authored floor.
|
|
678
|
+
if (adopted && legacy.some((slab) => slab.id === floor.sourceSlabId))
|
|
679
|
+
delete floor.sourceSlabId;
|
|
680
|
+
const finish = source.slots?.surface ?? source.material ?? source.materialPreset;
|
|
681
|
+
if (finish !== undefined && floor.finish === undefined)
|
|
682
|
+
floor.finish = finish;
|
|
683
|
+
// Keep legacy F even when it matches this room's automatic datum:
|
|
684
|
+
// the connected footprint can inherit a higher automatic datum.
|
|
685
|
+
if (floor.elevation === undefined)
|
|
686
|
+
floor.elevation = source.elevation;
|
|
687
|
+
const updated = Object.keys(floor).length ? { ...zone, floor } : zone;
|
|
688
|
+
nodes[zone.id] = updated;
|
|
689
|
+
sources.set(zone.id, source);
|
|
690
|
+
rooms.push({
|
|
691
|
+
id: zone.id,
|
|
692
|
+
zone: updated,
|
|
693
|
+
polygon: face.face.referencePolygon,
|
|
694
|
+
holes: face.face.holes,
|
|
695
|
+
spans: face.face.spans,
|
|
696
|
+
context,
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
if (!rooms.length) {
|
|
700
|
+
reject();
|
|
701
|
+
demoteUnmatched();
|
|
702
|
+
continue;
|
|
703
|
+
}
|
|
704
|
+
// Legacy support uses rendered slabs, without the new room-face datums.
|
|
705
|
+
const oldSupports = legacyWallElevations(walls, allSlabs, beforeNodes, level.id);
|
|
706
|
+
const derived = autoRoomVerticalPlacements(rooms, nodes);
|
|
707
|
+
const defaultFloor = derived.size ? Math.max(...derived.values()) : DEFAULT_SLAB_ELEVATION;
|
|
708
|
+
const componentFloors = new Map();
|
|
709
|
+
const referenceFloors = new Map();
|
|
710
|
+
for (const component of plateFootprint(rooms)) {
|
|
711
|
+
const members = rooms.filter((room) => area(intersection(slabFootprint(room), component)) > 0);
|
|
712
|
+
const inherited = members
|
|
713
|
+
.map((room) => sources.get(room.id)?.floorHeight)
|
|
714
|
+
.find((height) => height !== undefined);
|
|
715
|
+
const boundaryIds = new Set(members.flatMap((room) => room.spans.map((span) => span.boundaryId)));
|
|
716
|
+
// The footprint keeps the floor height most of its floor area had (on a
|
|
717
|
+
// tie, the one the walls give anyway). The wall-derived datum can differ
|
|
718
|
+
// (a pad under one wall, an authored slab height); re-deriving it sinks
|
|
719
|
+
// the other rooms and lifts walls onto a band with a gap under it.
|
|
720
|
+
const grounded = members.filter((room) => !room.zone.floor?.sourceSlabId);
|
|
721
|
+
const automatic = grounded.length
|
|
722
|
+
? Math.max(...grounded.map((room) => derived.get(room.zone.id) ?? DEFAULT_SLAB_ELEVATION))
|
|
723
|
+
: undefined;
|
|
724
|
+
const candidates = new Map();
|
|
725
|
+
for (const room of grounded) {
|
|
726
|
+
const source = sources.get(room.id);
|
|
727
|
+
if (!source)
|
|
728
|
+
continue;
|
|
729
|
+
const floor = Math.round(source.elevation * 1e6) / 1e6;
|
|
730
|
+
const entry = candidates.get(floor) ?? { area: 0, thickness: source.thickness };
|
|
731
|
+
entry.area += area([slabFootprint(room)]);
|
|
732
|
+
entry.thickness = Math.max(entry.thickness, source.thickness);
|
|
733
|
+
candidates.set(floor, entry);
|
|
734
|
+
}
|
|
735
|
+
const largest = Math.max(0, ...[...candidates.values()].map((entry) => entry.area));
|
|
736
|
+
const [referenceFloor] = [...candidates]
|
|
737
|
+
.filter(([, entry]) => entry.area >= largest * 0.99)
|
|
738
|
+
.sort(([a], [b]) => Math.abs(a - (automatic ?? a)) - Math.abs(b - (automatic ?? b)) || a - b)[0] ?? [];
|
|
739
|
+
if (inherited === undefined &&
|
|
740
|
+
referenceFloor !== undefined &&
|
|
741
|
+
automatic !== undefined &&
|
|
742
|
+
Math.abs(referenceFloor - automatic) > 0.005)
|
|
743
|
+
for (const room of grounded) {
|
|
744
|
+
const source = sources.get(room.id);
|
|
745
|
+
if (source)
|
|
746
|
+
referenceFloors.set(source.id, referenceFloor);
|
|
747
|
+
}
|
|
748
|
+
const weights = new Map();
|
|
749
|
+
for (const wall of walls) {
|
|
750
|
+
if (!boundaryIds.has(wall.id))
|
|
751
|
+
continue;
|
|
752
|
+
const support = oldSupports.get(wall.id);
|
|
753
|
+
const elevation = Math.round((support.elevation - (wall.supportOffset ?? 0)) * 1e6) / 1e6;
|
|
754
|
+
weights.set(elevation, (weights.get(elevation) ?? 0) + getWallCurveLength(wall));
|
|
755
|
+
}
|
|
756
|
+
const height = inherited ??
|
|
757
|
+
[...weights].sort((a, b) => b[1] - a[1] || a[0] - b[0])[0]?.[0] ??
|
|
758
|
+
defaultFloor;
|
|
759
|
+
for (const room of members)
|
|
760
|
+
componentFloors.set(room.id, height);
|
|
761
|
+
}
|
|
762
|
+
for (const room of rooms) {
|
|
763
|
+
const levelFloor = componentFloors.get(room.id) ?? defaultFloor;
|
|
764
|
+
if (Math.abs((sources.get(room.id)?.elevation ?? levelFloor) - levelFloor) > 0.005)
|
|
765
|
+
reports.push({ code: 'floor-moved', nodeId: room.id });
|
|
766
|
+
}
|
|
767
|
+
const preserveWallSupportedLegacy = () => {
|
|
768
|
+
reject();
|
|
769
|
+
for (const room of rooms) {
|
|
770
|
+
const source = sources.get(room.id);
|
|
771
|
+
if (!source)
|
|
772
|
+
continue;
|
|
773
|
+
const zone = nodes[room.id];
|
|
774
|
+
nodes[room.id] = { ...zone, floor: { ...zone.floor, sourceSlabId: source.id } };
|
|
775
|
+
}
|
|
776
|
+
demoteUnmatched('wall-supported-floor');
|
|
777
|
+
};
|
|
778
|
+
const supportedSources = new Set([...oldSupports.values()].flatMap((support) => support.electedSlabId ? [support.electedSlabId] : []));
|
|
779
|
+
if (rooms.some((room) => room.zone.autoFromWalls &&
|
|
780
|
+
supportedSources.has(sources.get(room.id)?.id ?? '') &&
|
|
781
|
+
(sources.get(room.id)?.elevation ?? 0) >
|
|
782
|
+
(componentFloors.get(room.id) ?? defaultFloor) + 0.005)) {
|
|
783
|
+
preserveWallSupportedLegacy();
|
|
784
|
+
continue;
|
|
785
|
+
}
|
|
786
|
+
const converted = legacy
|
|
787
|
+
.filter((slab) => [...sources.values()].some((source) => source.id === slab.id))
|
|
788
|
+
.map((slab) => ({
|
|
789
|
+
...slab,
|
|
790
|
+
boundary: 'auto',
|
|
791
|
+
floorHeight: slab.floorHeight,
|
|
792
|
+
referenceFloorElevation: referenceFloors.get(slab.id),
|
|
793
|
+
foundation: slab.foundation ?? {
|
|
794
|
+
type: slab.fillToTerrain ? 'solid' : 'none',
|
|
795
|
+
...(slab.fillToTerrain
|
|
796
|
+
? { material: slab.slots?.edge ?? slab.slots?.side ?? '#cccccc' }
|
|
797
|
+
: {}),
|
|
798
|
+
},
|
|
799
|
+
zoneIds: rooms
|
|
800
|
+
.filter((room) => sources.get(room.id)?.id === slab.id)
|
|
801
|
+
.map((room) => room.id),
|
|
802
|
+
}));
|
|
803
|
+
// Finish overlays must be consumed before manual coverage can suppress their room.
|
|
804
|
+
const regions = new Set();
|
|
805
|
+
const sourceCoverage = union(converted.map(slabFootprint));
|
|
806
|
+
for (const node of children) {
|
|
807
|
+
if (node.type !== 'slab' || node.autoFromWalls || node.boundary === 'auto' || node.recessed)
|
|
808
|
+
continue;
|
|
809
|
+
const slab = parseSlabConstruction(node);
|
|
810
|
+
const surface = union([slabFootprint(slab)]);
|
|
811
|
+
// A manual floor filling an opening in the old construction is structural,
|
|
812
|
+
// not a finish overlay; deleting it would expose that opening.
|
|
813
|
+
if (area(difference(surface, sourceCoverage)) > Math.max(1e-6, area(surface) * 0.01))
|
|
814
|
+
continue;
|
|
815
|
+
const room = rooms.find(({ zone }) => Math.abs(slab.elevation - (zone.floor?.elevation ?? DEFAULT_SLAB_ELEVATION)) <=
|
|
816
|
+
0.02 + 1e-9 &&
|
|
817
|
+
area(intersection(surface, slabFootprint(zone))) >= area(surface) * (1 - 1e-3));
|
|
818
|
+
if (!room)
|
|
819
|
+
continue;
|
|
820
|
+
const finish = slab.slots?.surface ?? slab.material ?? slab.materialPreset ?? 'library:wood-woodplank48';
|
|
821
|
+
const polygon = slabFootprint(slab);
|
|
822
|
+
const xs = [...new Set(slab.holes.flatMap((hole) => hole.map(([x]) => x)))].sort((a, b) => a - b);
|
|
823
|
+
const minX = Math.min(...slab.polygon.map(([x]) => x));
|
|
824
|
+
const maxX = Math.max(...slab.polygon.map(([x]) => x));
|
|
825
|
+
const minZ = Math.min(...slab.polygon.map(([, z]) => z));
|
|
826
|
+
const maxZ = Math.max(...slab.polygon.map(([, z]) => z));
|
|
827
|
+
const cuts = [...new Set([minX, ...xs, maxX])].sort((a, b) => a - b);
|
|
828
|
+
const regionPolygons = slab.holes.length
|
|
829
|
+
? cuts.slice(1).flatMap((x, i) => intersection(polygon, [
|
|
830
|
+
[cuts[i], minZ],
|
|
831
|
+
[x, minZ],
|
|
832
|
+
[x, maxZ],
|
|
833
|
+
[cuts[i], maxZ],
|
|
834
|
+
]).map((part) => part.outer))
|
|
835
|
+
: [slab.polygon];
|
|
836
|
+
const zone = nodes[room.id];
|
|
837
|
+
nodes[zone.id] = {
|
|
838
|
+
...zone,
|
|
839
|
+
floor: {
|
|
840
|
+
...zone.floor,
|
|
841
|
+
regions: [
|
|
842
|
+
...(zone.floor?.regions ?? []),
|
|
843
|
+
...regionPolygons.map((polygon, i) => ({
|
|
844
|
+
id: i ? `${slab.id}_${i}` : slab.id,
|
|
845
|
+
polygon,
|
|
846
|
+
finish,
|
|
847
|
+
})),
|
|
848
|
+
],
|
|
849
|
+
},
|
|
850
|
+
};
|
|
851
|
+
regions.add(slab.id);
|
|
852
|
+
remap.set(slab.id, sources.get(room.id).id);
|
|
853
|
+
}
|
|
854
|
+
const plan = buildFloorPlates({
|
|
855
|
+
levelId: level.id,
|
|
856
|
+
nodes: Object.fromEntries(Object.entries(nodes).filter(([id]) => !regions.has(id))),
|
|
857
|
+
rooms,
|
|
858
|
+
slabs: [
|
|
859
|
+
...converted,
|
|
860
|
+
...children
|
|
861
|
+
.filter((node) => node.type === 'slab' &&
|
|
862
|
+
!node.autoFromWalls &&
|
|
863
|
+
node.boundary !== 'auto' &&
|
|
864
|
+
!regions.has(node.id))
|
|
865
|
+
.map((slab) => parseSlabConstruction(slab)),
|
|
866
|
+
],
|
|
867
|
+
mintId: (ids, component, role) => floorPlateId(level.id, role ?? 'base', ids, component),
|
|
868
|
+
renderedManualCuts: false,
|
|
869
|
+
});
|
|
870
|
+
for (const source of converted) {
|
|
871
|
+
for (const [index, hole] of (source.holes ?? []).entries()) {
|
|
872
|
+
const holeArea = area([{ outer: hole, holes: [] }]);
|
|
873
|
+
if (holeArea < 1e-4)
|
|
874
|
+
continue;
|
|
875
|
+
const plateIndex = plan.plates.findIndex((plate) => Math.abs(plate.elevation - source.elevation) <= 1e-6 &&
|
|
876
|
+
area(intersection(hole, slabFootprint(plate))) >= holeArea - 1e-4);
|
|
877
|
+
if (plateIndex < 0)
|
|
878
|
+
continue;
|
|
879
|
+
const plate = plan.plates[plateIndex];
|
|
880
|
+
if (plate.holes.some((existing) => area(intersection(existing, hole)) >= holeArea - 1e-4 &&
|
|
881
|
+
Math.abs(area([{ outer: existing, holes: [] }]) - holeArea) <= 1e-4))
|
|
882
|
+
continue;
|
|
883
|
+
plan.plates[plateIndex] = {
|
|
884
|
+
...plate,
|
|
885
|
+
holes: [...plate.holes, hole],
|
|
886
|
+
holeMetadata: [
|
|
887
|
+
...plate.holeMetadata,
|
|
888
|
+
source.holeMetadata?.[index] ?? { source: 'manual' },
|
|
889
|
+
],
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
const expandsLegacySource = plan.plates.some((plate) => {
|
|
894
|
+
const source = legacySurfaces.get(plate.id);
|
|
895
|
+
if (!source)
|
|
896
|
+
return false;
|
|
897
|
+
const added = area(difference(slabFootprint(plate), [source]));
|
|
898
|
+
return area([source]) < 5 && added > Math.max(10, area([source]) * 5);
|
|
899
|
+
});
|
|
900
|
+
if (expandsLegacySource) {
|
|
901
|
+
reject();
|
|
902
|
+
demoteUnmatched('excess-plate-extent');
|
|
903
|
+
continue;
|
|
904
|
+
}
|
|
905
|
+
const retained = allSlabs.filter((slab) => !legacy.some((source) => source.id === slab.id) && !regions.has(slab.id));
|
|
906
|
+
const retainedConstruction = retained.filter((slab) => slab.visible !== false && slab.support !== 'open' && !slab.recessed);
|
|
907
|
+
if (retainedConstruction.length) {
|
|
908
|
+
const retainedFootprint = union(retainedConstruction.map((slab) => ({
|
|
909
|
+
outer: renderedSlabs.get(slab.id),
|
|
910
|
+
holes: slab.holes,
|
|
911
|
+
})));
|
|
912
|
+
const oldOverlap = intersection(retainedFootprint, union(legacy.map((slab) => legacySurfaces.get(slab.id))));
|
|
913
|
+
const newOverlap = intersection(retainedFootprint, union(plan.plates.map(slabFootprint)));
|
|
914
|
+
if (area(difference(newOverlap, oldOverlap)) > 1e-4) {
|
|
915
|
+
preserveWallSupportedLegacy();
|
|
916
|
+
continue;
|
|
917
|
+
}
|
|
918
|
+
const nextRenderContext = prepareSlabPolygonContext({
|
|
919
|
+
walls,
|
|
920
|
+
siblingSlabs: [...retained, ...plan.plates],
|
|
921
|
+
});
|
|
922
|
+
if (retainedConstruction.some((slab) => {
|
|
923
|
+
if (slab.boundary === 'auto')
|
|
924
|
+
return false;
|
|
925
|
+
const before = renderedSlabs.get(slab.id);
|
|
926
|
+
const after = getRenderableSlabPolygon(slab, nextRenderContext);
|
|
927
|
+
return area(difference(before, after)) + area(difference(after, before)) > 1e-4;
|
|
928
|
+
})) {
|
|
929
|
+
preserveWallSupportedLegacy();
|
|
930
|
+
continue;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
const wallSupports = new Set([...oldSupports.values()].flatMap((support) => support.electedSlabId ? [support.electedSlabId] : []));
|
|
934
|
+
if (rooms.some((room) => room.zone.autoFromWalls) &&
|
|
935
|
+
(plan.plates.some((plate) => plate.plateRole !== 'base' &&
|
|
936
|
+
wallSupports.has(plate.id) &&
|
|
937
|
+
legacy.some((source) => source.id === plate.id)) ||
|
|
938
|
+
walls.some((wall) => {
|
|
939
|
+
const sourceId = oldSupports.get(wall.id)?.electedSlabId;
|
|
940
|
+
if (!sourceId || !legacy.some((source) => source.id === sourceId))
|
|
941
|
+
return false;
|
|
942
|
+
const next = plan.plates.find((plate) => plate.id === sourceId);
|
|
943
|
+
return next !== undefined && !wallOverlapsSlabFootprint(wall, next.polygon, next.holes);
|
|
944
|
+
}))) {
|
|
945
|
+
preserveWallSupportedLegacy();
|
|
946
|
+
continue;
|
|
947
|
+
}
|
|
948
|
+
const nextSlabs = [...retained, ...plan.plates];
|
|
949
|
+
const visibleTops = (slabs) => new Set(slabs
|
|
950
|
+
.filter((slab) => slab.visible !== false && slab.support !== 'open' && !slab.recessed)
|
|
951
|
+
.map((slab) => Math.round(slab.elevation * 1000)));
|
|
952
|
+
const oldTops = visibleTops(allSlabs);
|
|
953
|
+
const newTops = visibleTops(nextSlabs);
|
|
954
|
+
const sameSingleTop = oldTops.size === 1 &&
|
|
955
|
+
newTops.size === 1 &&
|
|
956
|
+
Math.abs([...oldTops][0] - [...newTops][0]) <= 20;
|
|
957
|
+
if (!sameSingleTop &&
|
|
958
|
+
visibleFloorTopChange(allSlabs, nextSlabs, [...context.wallFootprints.values()]) > 0.05) {
|
|
959
|
+
for (const room of rooms) {
|
|
960
|
+
const source = sources.get(room.id);
|
|
961
|
+
if (!source)
|
|
962
|
+
continue;
|
|
963
|
+
const zone = nodes[room.id];
|
|
964
|
+
nodes[room.id] = { ...zone, floor: { ...zone.floor, sourceSlabId: source.id } };
|
|
965
|
+
}
|
|
966
|
+
reject();
|
|
967
|
+
demoteUnmatched('visible-floor-top');
|
|
968
|
+
continue;
|
|
969
|
+
}
|
|
970
|
+
const oldFloor = union(allSlabs.map((slab) => ({
|
|
971
|
+
outer: renderedSlabs.get(slab.id),
|
|
972
|
+
holes: slab.holes ?? [],
|
|
973
|
+
})));
|
|
974
|
+
const nextFloor = () => union([
|
|
975
|
+
...retained.map((slab) => ({
|
|
976
|
+
outer: renderedSlabs.get(slab.id),
|
|
977
|
+
holes: slab.holes ?? [],
|
|
978
|
+
})),
|
|
979
|
+
...plan.plates.map(slabFootprint),
|
|
980
|
+
]);
|
|
981
|
+
// A hidden wall hides no floor: pieces are compared on what is seen.
|
|
982
|
+
const seenWalls = adopted
|
|
983
|
+
? union(walls
|
|
984
|
+
.filter((wall) => wall.visible !== false)
|
|
985
|
+
.map((wall) => ({ outer: context.wallFootprints.get(wall.id), holes: [] })))
|
|
986
|
+
: wallArea;
|
|
987
|
+
const visibleBefore = difference(oldFloor, seenWalls);
|
|
988
|
+
let visibleAfter = difference(nextFloor(), seenWalls);
|
|
989
|
+
// Hand-drawn pieces: floor the plate would add stays open (a hole) unless
|
|
990
|
+
// it is a narrow drawing gap; floor it drops must be a thin strip drawn
|
|
991
|
+
// past the walls, outside every room.
|
|
992
|
+
let trimmed = [];
|
|
993
|
+
let voidHoles = 0;
|
|
994
|
+
// No measurable old floor (invalid piece geometry): nothing proves the plate matches it.
|
|
995
|
+
if (adopted && !oldFloor.length)
|
|
996
|
+
reject();
|
|
997
|
+
if (adopted) {
|
|
998
|
+
for (const part of difference(visibleAfter, visibleBefore)) {
|
|
999
|
+
if (area([part]) <= 1e-4 || partWidth(part) <= PIECE_GAP_WIDTH + 1e-9)
|
|
1000
|
+
continue;
|
|
1001
|
+
const plate = plan.plates.find((candidate) => candidate.plateRole === 'base' &&
|
|
1002
|
+
area(difference(part, slabFootprint(candidate))) <= 1e-6);
|
|
1003
|
+
// A hole survives re-derivation; a notch in the plate's outline would not.
|
|
1004
|
+
if (!plate ||
|
|
1005
|
+
part.holes.length ||
|
|
1006
|
+
part.outer.some((point) => distanceToBoundary([{ outer: plate.polygon, holes: [] }], point) <= 1e-3))
|
|
1007
|
+
reject();
|
|
1008
|
+
plate.holes = [...plate.holes, part.outer];
|
|
1009
|
+
plate.holeMetadata = [...plate.holeMetadata, { source: 'manual' }];
|
|
1010
|
+
voidHoles++;
|
|
1011
|
+
}
|
|
1012
|
+
visibleAfter = difference(nextFloor(), seenWalls);
|
|
1013
|
+
const kept = union([...visibleAfter, ...seenWalls]);
|
|
1014
|
+
const roomArea = union(zones.map(slabFootprint));
|
|
1015
|
+
trimmed = difference(visibleBefore, visibleAfter).filter((part) => area([part]) > 1e-6);
|
|
1016
|
+
for (const part of trimmed)
|
|
1017
|
+
if (area(intersection(part, roomArea)) > 1e-4 ||
|
|
1018
|
+
partWidth(part) > PIECE_TRIM_DEPTH ||
|
|
1019
|
+
part.outer.some((point) => !containsPoint(kept, point) &&
|
|
1020
|
+
distanceToBoundary(kept, point) > PIECE_TRIM_DEPTH + 1e-6))
|
|
1021
|
+
reject();
|
|
1022
|
+
if (area(difference(visibleAfter, visibleBefore)) > Math.max(1e-4, area(visibleBefore) * 0.02))
|
|
1023
|
+
reject();
|
|
1024
|
+
}
|
|
1025
|
+
else if (oldFloor.length &&
|
|
1026
|
+
(area(difference(visibleAfter, visibleBefore)) > 1e-4 ||
|
|
1027
|
+
area(difference(visibleBefore, visibleAfter)) > 1e-4)) {
|
|
1028
|
+
preserveWallSupportedLegacy();
|
|
1029
|
+
continue;
|
|
1030
|
+
}
|
|
1031
|
+
for (const [component, plate] of plan.plates.entries()) {
|
|
1032
|
+
const source = converted.find((source) => source.id === plate.id);
|
|
1033
|
+
if (!source)
|
|
1034
|
+
continue;
|
|
1035
|
+
let preservesSource = false;
|
|
1036
|
+
try {
|
|
1037
|
+
const original = difference(slabFootprint(source), [], { throwOnError: true });
|
|
1038
|
+
const visibleSource = difference({ ...legacySurfaces.get(source.id), holes: source.holes }, wallArea, { throwOnError: true });
|
|
1039
|
+
preservesSource = [original, visibleSource].every((surface) => area(difference(surface, union(plan.plates.map(slabFootprint)), { throwOnError: true })) <= Math.max(1e-6, area(surface) * 0.01));
|
|
1040
|
+
}
|
|
1041
|
+
catch {
|
|
1042
|
+
demotionReasons.set(source.id, 'coverage-error');
|
|
1043
|
+
}
|
|
1044
|
+
if (!preservesSource) {
|
|
1045
|
+
const id = floorPlateId(level.id, plate.plateRole ?? 'open', plate.zoneIds ?? [], component);
|
|
1046
|
+
plan.remap.set(source.id, id);
|
|
1047
|
+
plate.id = id;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
const generated = new Map();
|
|
1051
|
+
for (const plate of plan.plates) {
|
|
1052
|
+
const id = plate.id;
|
|
1053
|
+
const majority = converted
|
|
1054
|
+
.map((source) => ({
|
|
1055
|
+
source,
|
|
1056
|
+
area: area(intersection(slabFootprint(source), slabFootprint(plate))),
|
|
1057
|
+
}))
|
|
1058
|
+
.sort((a, b) => b.area - a.area || a.source.id.localeCompare(b.source.id))[0]?.source;
|
|
1059
|
+
// An unfinished piece showed the default slab top; its room must not
|
|
1060
|
+
// inherit another piece's finish through the plate's own surface.
|
|
1061
|
+
const surface = adopted &&
|
|
1062
|
+
rooms.some((room) => plate.zoneIds?.includes(room.id) &&
|
|
1063
|
+
nodes[room.id].floor?.finish === undefined)
|
|
1064
|
+
? undefined
|
|
1065
|
+
: majority;
|
|
1066
|
+
const slots = { ...plate.slots };
|
|
1067
|
+
delete slots.surface;
|
|
1068
|
+
if (surface?.slots?.surface)
|
|
1069
|
+
slots.surface = surface.slots.surface;
|
|
1070
|
+
nodes[id] = {
|
|
1071
|
+
...plate,
|
|
1072
|
+
id,
|
|
1073
|
+
// A hand-drawn floor's top was authored, not derived from support.
|
|
1074
|
+
...(plate.plateRole === 'base' &&
|
|
1075
|
+
plate.referenceFloorElevation === undefined &&
|
|
1076
|
+
(adopted || Math.abs(plate.elevation - DEFAULT_SLAB_ELEVATION) > 0.02)
|
|
1077
|
+
? { referenceFloorElevation: plate.elevation }
|
|
1078
|
+
: {}),
|
|
1079
|
+
slots: plate.plateRole === 'base' || plate.support === 'open' ? slots : undefined,
|
|
1080
|
+
material: surface?.material,
|
|
1081
|
+
materialPreset: surface?.materialPreset,
|
|
1082
|
+
};
|
|
1083
|
+
changed = true;
|
|
1084
|
+
plateIds.push(id);
|
|
1085
|
+
generated.set(plate.id, id);
|
|
1086
|
+
}
|
|
1087
|
+
const partitionContext = {
|
|
1088
|
+
walls,
|
|
1089
|
+
zones: rooms.map((room) => nodes[room.id]),
|
|
1090
|
+
slabs: plan.plates,
|
|
1091
|
+
openings: Object.values(nodes).filter((node) => node.type === 'door' || node.type === 'window'),
|
|
1092
|
+
};
|
|
1093
|
+
const needsSidePaint = [...sources.values()].some((source) => source.slots?.riser || source.slots?.edge);
|
|
1094
|
+
const migratedSides = needsSidePaint
|
|
1095
|
+
? plan.plates.flatMap((plate) => computePlateSurfacePartition(plate, partitionContext)?.sides ?? [])
|
|
1096
|
+
: [];
|
|
1097
|
+
for (const room of rooms) {
|
|
1098
|
+
const source = sources.get(room.id);
|
|
1099
|
+
if (!source)
|
|
1100
|
+
continue;
|
|
1101
|
+
const sides = migratedSides.filter((side) => side.zoneId === room.id);
|
|
1102
|
+
const zone = nodes[room.id];
|
|
1103
|
+
nodes[room.id] = {
|
|
1104
|
+
...zone,
|
|
1105
|
+
...(zone.floorStepFinish === undefined &&
|
|
1106
|
+
source.slots?.riser &&
|
|
1107
|
+
sides.some((s) => s.role === 'riser')
|
|
1108
|
+
? { floorStepFinish: source.slots.riser }
|
|
1109
|
+
: {}),
|
|
1110
|
+
...(zone.floorEdgeFinish === undefined &&
|
|
1111
|
+
source.slots?.edge &&
|
|
1112
|
+
sides.some((s) => s.role === 'edge')
|
|
1113
|
+
? { floorEdgeFinish: source.slots.edge }
|
|
1114
|
+
: {}),
|
|
1115
|
+
};
|
|
1116
|
+
}
|
|
1117
|
+
for (const source of converted) {
|
|
1118
|
+
if (plan.plates.some((plate) => plate.id === source.id))
|
|
1119
|
+
continue;
|
|
1120
|
+
const replacements = adopted
|
|
1121
|
+
? plan.plates
|
|
1122
|
+
: plan.plates.filter((plate) => plate.zoneIds?.some((id) => source.zoneIds.includes(id)));
|
|
1123
|
+
const replacementCoverage = union(replacements.map(slabFootprint));
|
|
1124
|
+
// Stale slabs can extend beyond every current room. Keep that authored
|
|
1125
|
+
// surface until its remaining area can be represented, rather than erase it.
|
|
1126
|
+
let covered = false;
|
|
1127
|
+
let reason = replacements.length ? 'matched-source-residual' : 'manual-coverage';
|
|
1128
|
+
try {
|
|
1129
|
+
const original = difference(slabFootprint(source), [], { throwOnError: true });
|
|
1130
|
+
const visibleSource = difference({ ...legacySurfaces.get(source.id), holes: source.holes }, wallArea, { throwOnError: true });
|
|
1131
|
+
covered = adopted
|
|
1132
|
+
? area(difference(difference(visibleSource, replacementCoverage), trimmed)) <= 1e-4
|
|
1133
|
+
: [original, visibleSource].every((surface) => area(difference(surface, replacementCoverage, { throwOnError: true })) <=
|
|
1134
|
+
Math.max(1e-6, area(surface) * 0.01));
|
|
1135
|
+
}
|
|
1136
|
+
catch {
|
|
1137
|
+
// A failed coverage calculation cannot justify deleting stored construction.
|
|
1138
|
+
reason = 'coverage-error';
|
|
1139
|
+
}
|
|
1140
|
+
if (!covered) {
|
|
1141
|
+
demotionReasons.set(source.id, reason);
|
|
1142
|
+
continue;
|
|
1143
|
+
}
|
|
1144
|
+
const target = generated.get(source.id) ?? generated.get(plan.remap.get(source.id) ?? '');
|
|
1145
|
+
remap.set(source.id, target);
|
|
1146
|
+
delete nodes[source.id];
|
|
1147
|
+
changed = true;
|
|
1148
|
+
}
|
|
1149
|
+
if (adopted) {
|
|
1150
|
+
const cover = union(plan.plates.map(slabFootprint));
|
|
1151
|
+
for (const [id, levelId] of adoption.pieces) {
|
|
1152
|
+
if (levelId !== level.id || !nodes[id] || generated.has(id))
|
|
1153
|
+
continue;
|
|
1154
|
+
// A piece no room took as its source (a finish laid on another piece).
|
|
1155
|
+
const surface = difference({ outer: renderedSlabs.get(id), holes: [] }, wallArea);
|
|
1156
|
+
if (area(difference(difference(surface, cover), trimmed)) > 1e-4)
|
|
1157
|
+
reject();
|
|
1158
|
+
const [target] = plan.plates
|
|
1159
|
+
.map((plate) => ({ plate, overlap: area(intersection(surface, slabFootprint(plate))) }))
|
|
1160
|
+
.sort((a, b) => b.overlap - a.overlap || a.plate.id.localeCompare(b.plate.id));
|
|
1161
|
+
remap.set(id, target?.plate.id);
|
|
1162
|
+
delete nodes[id];
|
|
1163
|
+
changed = true;
|
|
1164
|
+
}
|
|
1165
|
+
const finishOf = (slab) => JSON.stringify(floorPieceFinish(slab) ?? null);
|
|
1166
|
+
for (const room of rooms) {
|
|
1167
|
+
const zone = nodes[room.id];
|
|
1168
|
+
const own = JSON.stringify(zone.floor?.finish ?? null);
|
|
1169
|
+
const same = union(legacy
|
|
1170
|
+
.filter((slab) => finishOf(slab) === own)
|
|
1171
|
+
.map((slab) => ({ outer: renderedSlabs.get(slab.id), holes: [] })));
|
|
1172
|
+
const regions = legacy.flatMap((slab) => {
|
|
1173
|
+
const finish = floorPieceFinish(slab);
|
|
1174
|
+
if (finish === undefined || finishOf(slab) === own)
|
|
1175
|
+
return [];
|
|
1176
|
+
const parts = difference(intersection({ outer: renderedSlabs.get(slab.id), holes: [] }, slabFootprint(zone)), same).filter((part) => area([part]) > 0.01 && partWidth(part) > PIECE_GAP_WIDTH);
|
|
1177
|
+
return parts.map((part, i) => ({
|
|
1178
|
+
id: `${slab.id}_${room.id}${i ? `_${i}` : ''}`,
|
|
1179
|
+
polygon: part.outer,
|
|
1180
|
+
finish,
|
|
1181
|
+
}));
|
|
1182
|
+
});
|
|
1183
|
+
if (regions.length)
|
|
1184
|
+
nodes[room.id] = {
|
|
1185
|
+
...zone,
|
|
1186
|
+
floor: { ...zone.floor, regions: [...(zone.floor?.regions ?? []), ...regions] },
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
// Every wall-generated slab and piece is consumed, or the level keeps its slabs.
|
|
1190
|
+
if (legacy.some((slab) => nodes[slab.id] && !nodes[slab.id].plateRole))
|
|
1191
|
+
reject();
|
|
1192
|
+
reports.push({
|
|
1193
|
+
code: 'floor-pieces-absorbed',
|
|
1194
|
+
nodeId: level.id,
|
|
1195
|
+
pieces: [...adoption.pieces].flatMap(([id, levelId]) => levelId === level.id ? [id] : []),
|
|
1196
|
+
trimmed: Math.round(area(trimmed) * 1e4) / 1e4,
|
|
1197
|
+
closed: Math.round(area(difference(visibleAfter, visibleBefore)) * 1e4) / 1e4,
|
|
1198
|
+
holes: voidHoles,
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
demoteUnmatched();
|
|
1202
|
+
for (const id of regions)
|
|
1203
|
+
delete nodes[id];
|
|
1204
|
+
const newSupportNodes = { ...nodes };
|
|
1205
|
+
for (const wall of walls) {
|
|
1206
|
+
const old = oldSupports.get(wall.id);
|
|
1207
|
+
const next = wallSupportForNodes(wall, newSupportNodes);
|
|
1208
|
+
const oldTop = wall.height === undefined
|
|
1209
|
+
? getStoredLevelHeight(level)
|
|
1210
|
+
: (wall.supportSlabId === 'ground' ? old.elevation : Math.max(0, old.elevation)) +
|
|
1211
|
+
wall.height;
|
|
1212
|
+
const newTop = resolveWallTop(wall, getStoredLevelHeight(level), next.elevation);
|
|
1213
|
+
if (wall.height !== undefined && Math.abs(oldTop - newTop) > 0.001)
|
|
1214
|
+
nodes[wall.id] = { ...wall, height: oldTop - next.elevation };
|
|
1215
|
+
for (const id of wall.children ?? []) {
|
|
1216
|
+
const opening = nodes[id];
|
|
1217
|
+
if ((opening?.type !== 'door' && opening?.type !== 'window') ||
|
|
1218
|
+
isFloorAnchoredOpening(opening))
|
|
1219
|
+
continue;
|
|
1220
|
+
const delta = old.elevation - getOpeningFloorDatum(wall, opening, newSupportNodes);
|
|
1221
|
+
if (Math.abs(delta) > 1e-6)
|
|
1222
|
+
nodes[id] = {
|
|
1223
|
+
...opening,
|
|
1224
|
+
...(opening.position[1] + delta - opening.height / 2 <= 0.01
|
|
1225
|
+
? { verticalAnchor: 'wall' }
|
|
1226
|
+
: {}),
|
|
1227
|
+
position: [
|
|
1228
|
+
opening.position[0],
|
|
1229
|
+
Math.round((opening.position[1] + delta) * 1e6) / 1e6,
|
|
1230
|
+
opening.position[2],
|
|
1231
|
+
],
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
const delta = old.elevation - next.elevation;
|
|
1235
|
+
if (wall.faceRegions?.length && Math.abs(delta) > 1e-6)
|
|
1236
|
+
nodes[wall.id] = {
|
|
1237
|
+
...nodes[wall.id],
|
|
1238
|
+
faceRegions: wall.faceRegions.map((region) => ({
|
|
1239
|
+
...region,
|
|
1240
|
+
...(region.v0 === undefined
|
|
1241
|
+
? {}
|
|
1242
|
+
: { v0: Math.round((region.v0 + delta) * 1e6) / 1e6 }),
|
|
1243
|
+
...(region.v1 === undefined
|
|
1244
|
+
? {}
|
|
1245
|
+
: { v1: Math.round((region.v1 + delta) * 1e6) / 1e6 }),
|
|
1246
|
+
})),
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
if (level.type === 'level')
|
|
1250
|
+
nodes[level.id] = {
|
|
1251
|
+
...level,
|
|
1252
|
+
children: [
|
|
1253
|
+
...level.children.filter((id) => !!nodes[id]),
|
|
1254
|
+
...[...generated.values()].filter((id) => !level.children.includes(id)),
|
|
1255
|
+
],
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1258
|
+
catch (error) {
|
|
1259
|
+
const rejected = error instanceof AdoptionRejected;
|
|
1260
|
+
for (const id of Object.keys(nodes))
|
|
1261
|
+
delete nodes[id];
|
|
1262
|
+
Object.assign(nodes, beforeNodes);
|
|
1263
|
+
remap.clear();
|
|
1264
|
+
for (const [id, target] of beforeRemap)
|
|
1265
|
+
remap.set(id, target);
|
|
1266
|
+
plateIds.length = beforePlateCount;
|
|
1267
|
+
changed = beforeChanged;
|
|
1268
|
+
if (!rejected)
|
|
1269
|
+
warnPlateFailure(level.id, Object.values(beforeNodes)
|
|
1270
|
+
.filter((node) => node.parentId === level.id)
|
|
1271
|
+
.map((node) => node.id), error);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
for (const node of Object.values(nodes)) {
|
|
1275
|
+
const data = { ...node };
|
|
1276
|
+
let changed = false;
|
|
1277
|
+
for (const field of ['supportSlabId', 'deckSlabId']) {
|
|
1278
|
+
let host = data[field];
|
|
1279
|
+
const seen = new Set();
|
|
1280
|
+
while (host && remap.has(host) && !seen.has(host)) {
|
|
1281
|
+
seen.add(host);
|
|
1282
|
+
host = remap.get(host);
|
|
1283
|
+
}
|
|
1284
|
+
if (host !== data[field]) {
|
|
1285
|
+
data[field] = replacementPlateFor(node, field, Object.values(nodes).filter((n) => n.type === 'slab'), { ...sourceNodes, ...nodes });
|
|
1286
|
+
changed = true;
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
if (changed)
|
|
1290
|
+
nodes[node.id] = data;
|
|
1291
|
+
}
|
|
1292
|
+
if (Object.values(sourceNodes).some((node) => node.type === 'slab' &&
|
|
1293
|
+
(node.autoFromWalls || node.boundary === 'auto') &&
|
|
1294
|
+
!node.plateRole)) {
|
|
1295
|
+
const associated = associateLegacyManualFloors(nodes, sourceNodes);
|
|
1296
|
+
if (associated !== nodes) {
|
|
1297
|
+
Object.assign(nodes, associated);
|
|
1298
|
+
changed = true;
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
if (!Object.values(sourceNodes).some((node) => node.plateRole)) {
|
|
1302
|
+
const absorbed = absorbCompleteManualFloors(nodes);
|
|
1303
|
+
if (absorbed !== nodes) {
|
|
1304
|
+
Object.assign(nodes, absorbed);
|
|
1305
|
+
changed = true;
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
if (clearDanglingFloorSources(nodes))
|
|
1309
|
+
changed = true;
|
|
1310
|
+
if (changed)
|
|
1311
|
+
for (const [id, node] of Object.entries(nodes))
|
|
1312
|
+
if (node !== sourceNodes[id])
|
|
1313
|
+
nodes[id] = omitUndefined(node);
|
|
1314
|
+
const visibleFinishes = new Set(Object.values(nodes)
|
|
1315
|
+
.flatMap((node) => {
|
|
1316
|
+
if (node.type === 'zone')
|
|
1317
|
+
return [
|
|
1318
|
+
node.floor?.finish,
|
|
1319
|
+
node.floorStepFinish,
|
|
1320
|
+
node.floorEdgeFinish,
|
|
1321
|
+
...(node.floor?.regions ?? []).map((region) => region.finish),
|
|
1322
|
+
];
|
|
1323
|
+
if (node.type === 'slab')
|
|
1324
|
+
return [node.material, node.materialPreset, ...Object.values(node.slots ?? {})];
|
|
1325
|
+
return [];
|
|
1326
|
+
})
|
|
1327
|
+
.filter((value) => value !== undefined)
|
|
1328
|
+
.map((value) => JSON.stringify(value)));
|
|
1329
|
+
for (const source of Object.values(sourceNodes))
|
|
1330
|
+
if (source.type === 'slab' &&
|
|
1331
|
+
(source.autoFromWalls || source.boundary === 'auto') &&
|
|
1332
|
+
!source.plateRole) {
|
|
1333
|
+
for (const finish of new Set([source.material, source.materialPreset, ...Object.values(source.slots ?? {})].filter((value) => value !== undefined)))
|
|
1334
|
+
if (!visibleFinishes.has(JSON.stringify(finish)))
|
|
1335
|
+
reports.push({ code: 'finish-not-visible', nodeId: source.id, finish });
|
|
1336
|
+
}
|
|
1337
|
+
return { nodes: changed ? nodes : sourceNodes, plateIds, reports };
|
|
1338
|
+
}
|
|
1339
|
+
function migrateSlabSlotsOnView(sourceNodes) {
|
|
1340
|
+
const nodes = { ...sourceNodes };
|
|
1341
|
+
let changed = false;
|
|
1342
|
+
for (const node of Object.values(nodes)) {
|
|
1343
|
+
if (node.type !== 'slab' || !node.slots?.side)
|
|
1344
|
+
continue;
|
|
1345
|
+
if (['edge', 'riser', 'underside'].every((key) => node.slots[key] !== undefined))
|
|
1346
|
+
continue;
|
|
1347
|
+
const slots = { ...node.slots };
|
|
1348
|
+
for (const key of ['edge', 'riser', 'underside'])
|
|
1349
|
+
if (slots[key] === undefined)
|
|
1350
|
+
slots[key] = slots.side;
|
|
1351
|
+
nodes[node.id] = omitUndefined({ ...node, slots });
|
|
1352
|
+
changed = true;
|
|
1353
|
+
}
|
|
1354
|
+
return { nodes: changed ? nodes : sourceNodes, changed };
|
|
1355
|
+
}
|
|
1356
|
+
export const migrateFloorPlates = loadMigration('floor plates', migrateFloorPlatesOnView, (nodes) => ({ nodes, plateIds: [], reports: [] }));
|
|
1357
|
+
export const migrateSlabSlots = loadMigration('slab slots', migrateSlabSlotsOnView, (nodes) => ({
|
|
1358
|
+
nodes,
|
|
1359
|
+
changed: false,
|
|
1360
|
+
}));
|