diff --git a/src/App.tsx b/src/App.tsx index d14d399a..ea81d311 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1243,7 +1243,6 @@ export default function App() { rooms: (p.rooms ?? []).filter((r) => !rmids.has(r.id)), extrudedSolids: (p.extrudedSolids ?? []).filter((s) => !exids.has(s.id)), columns: (p.columns ?? []).filter((c) => !colids.has(c.id)), - doors: p.doors.filter((dr) => !wids.has(dr.hostWallId)), // Öffnungen: eigene Auswahl löschen UND alle, deren Host-Wand entfällt. openings: (p.openings ?? []).filter( (o) => !oids.has(o.id) && !wids.has(o.hostWallId), diff --git a/src/cli/__golden__/ansicht.svg b/src/cli/__golden__/ansicht.svg index ef11fdfa..07f3bff7 100644 --- a/src/cli/__golden__/ansicht.svg +++ b/src/cli/__golden__/ansicht.svg @@ -41,6 +41,10 @@ + + + + @@ -52,10 +56,6 @@ - - - - diff --git a/src/commands/cmds/arc.test.ts b/src/commands/cmds/arc.test.ts index c48014d1..a0300642 100644 --- a/src/commands/cmds/arc.test.ts +++ b/src/commands/cmds/arc.test.ts @@ -21,7 +21,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/array.test.ts b/src/commands/cmds/array.test.ts index 8412932c..443804a4 100644 --- a/src/commands/cmds/array.test.ts +++ b/src/commands/cmds/array.test.ts @@ -22,7 +22,6 @@ function project(extra: Drawing2D[] = []): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/bezier.test.ts b/src/commands/cmds/bezier.test.ts index 723f3bc5..a64ca39d 100644 --- a/src/commands/cmds/bezier.test.ts +++ b/src/commands/cmds/bezier.test.ts @@ -20,7 +20,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/block.test.ts b/src/commands/cmds/block.test.ts index 7d60a71e..624f4ab9 100644 --- a/src/commands/cmds/block.test.ts +++ b/src/commands/cmds/block.test.ts @@ -25,7 +25,6 @@ function project(blockDefs: BlockDef[] = []): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/break.test.ts b/src/commands/cmds/break.test.ts index fc469997..152548d1 100644 --- a/src/commands/cmds/break.test.ts +++ b/src/commands/cmds/break.test.ts @@ -21,7 +21,6 @@ function project(drawings: Drawing2D[]): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/chamfer.test.ts b/src/commands/cmds/chamfer.test.ts index b874095d..02c8f227 100644 --- a/src/commands/cmds/chamfer.test.ts +++ b/src/commands/cmds/chamfer.test.ts @@ -21,7 +21,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/circle.test.ts b/src/commands/cmds/circle.test.ts index a87a0baf..3b52addf 100644 --- a/src/commands/cmds/circle.test.ts +++ b/src/commands/cmds/circle.test.ts @@ -22,7 +22,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/defblock.test.ts b/src/commands/cmds/defblock.test.ts index bf6c672d..d7b0e083 100644 --- a/src/commands/cmds/defblock.test.ts +++ b/src/commands/cmds/defblock.test.ts @@ -22,7 +22,6 @@ function project(drawings: Drawing2D[]): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/detailref.test.ts b/src/commands/cmds/detailref.test.ts index 6bf72a92..c6b58a50 100644 --- a/src/commands/cmds/detailref.test.ts +++ b/src/commands/cmds/detailref.test.ts @@ -21,7 +21,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/dimension.test.ts b/src/commands/cmds/dimension.test.ts index e9b06175..b92cd01a 100644 --- a/src/commands/cmds/dimension.test.ts +++ b/src/commands/cmds/dimension.test.ts @@ -25,7 +25,6 @@ function project(extra: Drawing2D[] = []): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/ellipse.test.ts b/src/commands/cmds/ellipse.test.ts index af45fdae..e3ded949 100644 --- a/src/commands/cmds/ellipse.test.ts +++ b/src/commands/cmds/ellipse.test.ts @@ -21,7 +21,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/extend.test.ts b/src/commands/cmds/extend.test.ts index 5c0cf2a3..9caa0d5f 100644 --- a/src/commands/cmds/extend.test.ts +++ b/src/commands/cmds/extend.test.ts @@ -22,7 +22,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], @@ -103,7 +102,6 @@ function bulgeProject(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/fillet.test.ts b/src/commands/cmds/fillet.test.ts index 2b37cc9e..9a5ef1d2 100644 --- a/src/commands/cmds/fillet.test.ts +++ b/src/commands/cmds/fillet.test.ts @@ -21,7 +21,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/kote.test.ts b/src/commands/cmds/kote.test.ts index 7bc5c514..9ccdf3eb 100644 --- a/src/commands/cmds/kote.test.ts +++ b/src/commands/cmds/kote.test.ts @@ -20,7 +20,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/leader.test.ts b/src/commands/cmds/leader.test.ts index 95bd3f99..56292579 100644 --- a/src/commands/cmds/leader.test.ts +++ b/src/commands/cmds/leader.test.ts @@ -22,7 +22,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/line.test.ts b/src/commands/cmds/line.test.ts index 9df379db..6b78f5a5 100644 --- a/src/commands/cmds/line.test.ts +++ b/src/commands/cmds/line.test.ts @@ -31,7 +31,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/multiline.test.ts b/src/commands/cmds/multiline.test.ts index 220cb5ac..4ff20416 100644 --- a/src/commands/cmds/multiline.test.ts +++ b/src/commands/cmds/multiline.test.ts @@ -22,7 +22,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/pointmarker.test.ts b/src/commands/cmds/pointmarker.test.ts index 6c48add8..3bf0ac06 100644 --- a/src/commands/cmds/pointmarker.test.ts +++ b/src/commands/cmds/pointmarker.test.ts @@ -21,7 +21,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/polygon.test.ts b/src/commands/cmds/polygon.test.ts index e67f4446..ba96b9f4 100644 --- a/src/commands/cmds/polygon.test.ts +++ b/src/commands/cmds/polygon.test.ts @@ -20,7 +20,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/ray.test.ts b/src/commands/cmds/ray.test.ts index 147fcd0c..61fc4173 100644 --- a/src/commands/cmds/ray.test.ts +++ b/src/commands/cmds/ray.test.ts @@ -21,7 +21,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/rect.test.ts b/src/commands/cmds/rect.test.ts index 8c39f3c0..1d6a4e46 100644 --- a/src/commands/cmds/rect.test.ts +++ b/src/commands/cmds/rect.test.ts @@ -22,7 +22,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/revcloud.test.ts b/src/commands/cmds/revcloud.test.ts index 2714f7a2..0cbcf35c 100644 --- a/src/commands/cmds/revcloud.test.ts +++ b/src/commands/cmds/revcloud.test.ts @@ -20,7 +20,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/scalebar.test.ts b/src/commands/cmds/scalebar.test.ts index f4598d68..56d56360 100644 --- a/src/commands/cmds/scalebar.test.ts +++ b/src/commands/cmds/scalebar.test.ts @@ -21,7 +21,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/spline.test.ts b/src/commands/cmds/spline.test.ts index e0702fb6..528292b4 100644 --- a/src/commands/cmds/spline.test.ts +++ b/src/commands/cmds/spline.test.ts @@ -21,7 +21,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/text.test.ts b/src/commands/cmds/text.test.ts index 4a20799b..bb680246 100644 --- a/src/commands/cmds/text.test.ts +++ b/src/commands/cmds/text.test.ts @@ -22,7 +22,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/textbox.test.ts b/src/commands/cmds/textbox.test.ts index 58ead23b..5b5fc508 100644 --- a/src/commands/cmds/textbox.test.ts +++ b/src/commands/cmds/textbox.test.ts @@ -24,7 +24,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/textpath.test.ts b/src/commands/cmds/textpath.test.ts index d305170f..1b8e55e0 100644 --- a/src/commands/cmds/textpath.test.ts +++ b/src/commands/cmds/textpath.test.ts @@ -20,7 +20,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/trim.test.ts b/src/commands/cmds/trim.test.ts index 02daca42..ed00bf11 100644 --- a/src/commands/cmds/trim.test.ts +++ b/src/commands/cmds/trim.test.ts @@ -23,7 +23,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/wall.test.ts b/src/commands/cmds/wall.test.ts index 7e1795a2..b2a78c44 100644 --- a/src/commands/cmds/wall.test.ts +++ b/src/commands/cmds/wall.test.ts @@ -33,7 +33,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Wände", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/wipeout.test.ts b/src/commands/cmds/wipeout.test.ts index 31b831d3..13714ea8 100644 --- a/src/commands/cmds/wipeout.test.ts +++ b/src/commands/cmds/wipeout.test.ts @@ -21,7 +21,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/commands/cmds/xline.test.ts b/src/commands/cmds/xline.test.ts index 87d1db7b..99b9190d 100644 --- a/src/commands/cmds/xline.test.ts +++ b/src/commands/cmds/xline.test.ts @@ -20,7 +20,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/editors/elementClipboard.test.ts b/src/editors/elementClipboard.test.ts index dce9e0ea..18718a19 100644 --- a/src/editors/elementClipboard.test.ts +++ b/src/editors/elementClipboard.test.ts @@ -76,7 +76,6 @@ function project(): Project { ], layers: [{ code: "20", name: "Wand", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [wall("w1")], - doors: [], openings: [opening("o1", "w1")], ceilings: [ceiling("c1")], stairs: [], diff --git a/src/export/exportIfc.test.ts b/src/export/exportIfc.test.ts index f926b0c7..39845d94 100644 --- a/src/export/exportIfc.test.ts +++ b/src/export/exportIfc.test.ts @@ -135,7 +135,6 @@ function fixtureProject(): Project { ], layers: [{ code: "20", name: "Wände", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls, - doors: [], openings, ceilings, stairs, diff --git a/src/export/exportMesh.test.ts b/src/export/exportMesh.test.ts index 4ba8b293..7cc29e16 100644 --- a/src/export/exportMesh.test.ts +++ b/src/export/exportMesh.test.ts @@ -23,7 +23,6 @@ function baseProject(): Project { ], layers: [{ code: "20", name: "Wände", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/export/exportSchedule.test.ts b/src/export/exportSchedule.test.ts index b7475588..aeb9d506 100644 --- a/src/export/exportSchedule.test.ts +++ b/src/export/exportSchedule.test.ts @@ -7,7 +7,7 @@ import { describe, it, expect } from "vitest"; import { exportScheduleCsv, scheduleRows } from "./exportSchedule"; -import type { Project, Wall, Ceiling, Door, Opening, Stair, ExtrudedSolid } from "../model/types"; +import type { Project, Wall, Ceiling, Opening, Stair, ExtrudedSolid } from "../model/types"; /** * Minimalprojekt: 2 Wände (1 Wandtyp T=0.4) + 1 Decke (Deckentyp T=0.2) + @@ -52,20 +52,20 @@ function fixtureProject(): Project { ceilingTypeId: "dt", }, ]; - const doors: Door[] = [ + const openings: Opening[] = [ { id: "T1", - type: "door", + type: "opening", hostWallId: "W1", categoryCode: "21", + kind: "door", position: 1, width: 0.9, height: 2.1, // Fläche 1.89 + sillHeight: 0, swing: "left", hinge: "start", }, - ]; - const openings: Opening[] = [ { id: "F1", type: "opening", @@ -120,7 +120,6 @@ function fixtureProject(): Project { ], layers: [{ code: "20", name: "Wände", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls, - doors, openings, ceilings, stairs, @@ -190,7 +189,6 @@ describe("exportScheduleCsv — Bauteilliste", () => { const proj = fixtureProject(); proj.walls = []; proj.ceilings = []; - proj.doors = []; proj.openings = []; proj.stairs = []; proj.extrudedSolids = []; diff --git a/src/export/exportSchedule.ts b/src/export/exportSchedule.ts index e5bab239..c2c2ca1c 100644 --- a/src/export/exportSchedule.ts +++ b/src/export/exportSchedule.ts @@ -14,7 +14,6 @@ import type { Project, Wall, Ceiling, - Door, Opening, Stair, ExtrudedSolid, @@ -154,24 +153,9 @@ function floorIdOfHostWall(project: Project, hostWallId: string): string | undef return project.walls.find((w) => w.id === hostWallId)?.floorId; } -/** Wertet eine Tür für die Bauteilliste aus. */ -function evalDoor(project: Project, door: Door): ScheduleRow { - return { - kind: "Tür", - id: door.id, - typeName: "Tür", - floor: floorOfHostWall(project, door.hostWallId), - floorId: floorIdOfHostWall(project, door.hostWallId), - length: door.width, - heightM: door.height, - thickness: null, - area: door.width * door.height, - }; -} - /** Wertet eine Öffnung (Fenster oder Tür-Öffnung) für die Bauteilliste aus. */ function evalOpening(project: Project, opening: Opening): ScheduleRow { - const kind = opening.kind === "window" ? "Fenster" : "Öffnung"; + const kind = opening.kind === "window" ? "Fenster" : "Tür"; return { kind, id: opening.id, @@ -266,7 +250,6 @@ export function scheduleRows(project: Project): ScheduleRow[] { const rows: ScheduleRow[] = []; for (const w of project.walls ?? []) rows.push(evalWall(project, w)); for (const c of project.ceilings ?? []) rows.push(evalCeiling(project, c)); - for (const d of project.doors ?? []) rows.push(evalDoor(project, d)); for (const o of project.openings ?? []) rows.push(evalOpening(project, o)); for (const s of project.stairs ?? []) rows.push(evalStair(project, s)); for (const e of project.extrudedSolids ?? []) rows.push(evalExtrudedSolid(project, e)); diff --git a/src/io/projectFormat.test.ts b/src/io/projectFormat.test.ts index 0edc7eeb..3d47cff6 100644 --- a/src/io/projectFormat.test.ts +++ b/src/io/projectFormat.test.ts @@ -31,11 +31,11 @@ describe("Projektdatei-Format", () => { expect(!r.ok && r.error).toMatch(/walls/); }); it("tolerant: fehlende Listen ergaenzt, falsche Typen geleert, unbekannte Felder gemeldet und behalten", () => { - const { doors: _d, ...rest } = sampleProject; + const { lineStyles: _l, ...rest } = sampleProject; const r = parseProjectFile(JSON.stringify({ ...rest, hatches: "x", zukunft: 1 })); expect(r.ok).toBe(true); if (!r.ok) return; - expect(r.project.doors).toEqual([]); + expect(r.project.lineStyles).toEqual([]); expect(r.project.hatches).toEqual([]); expect((r.project as unknown as { zukunft: number }).zukunft).toBe(1); expect(r.warnings.join(" ")).toMatch(/hatches/); @@ -45,3 +45,25 @@ describe("Projektdatei-Format", () => { expect(parseProjectFile(JSON.stringify({ ...sampleProject, formatVersion: "1" })).ok).toBe(false); }); }); + +describe("Migration 1 → 2: Legacy-Türen werden Öffnungen", () => { + it("doors → openings (kind door), Feld doors entfällt, Kollisions-ids bleiben eindeutig", () => { + const base = JSON.parse(JSON.stringify(sampleProject)) as Record; + const existing = (base.openings as Array<{ id: string }>)[0].id; + base.formatVersion = 1; + base.doors = [ + { id: "TX", type: "door", hostWallId: "W1", categoryCode: "21", position: 0.5, width: 0.9, height: 2.1, swing: "right", hinge: "end" }, + { id: existing, type: "door", hostWallId: "W1", categoryCode: "21", position: 3, width: 0.8, height: 2, swing: "left", hinge: "start" }, + ]; + const r = parseProjectFile(JSON.stringify(base)); + expect(r.ok).toBe(true); + if (!r.ok) return; + expect(r.migratedFrom).toBe(1); + expect("doors" in r.project).toBe(false); + const ids = (r.project.openings ?? []).map((o) => o.id); + expect(new Set(ids).size).toBe(ids.length); + const tx = r.project.openings!.find((o) => o.id === "TX")!; + expect(tx).toMatchObject({ kind: "door", position: 0.5, width: 0.9, height: 2.1, sillHeight: 0, swing: "right", hinge: "end", type: "opening" }); + expect(r.project.openings!.some((o) => o.id === `${existing}-t` && o.kind === "door")).toBe(true); + }); +}); diff --git a/src/io/projectFormat.ts b/src/io/projectFormat.ts index ec03086e..c0faea96 100644 --- a/src/io/projectFormat.ts +++ b/src/io/projectFormat.ts @@ -15,7 +15,7 @@ import type { Project } from "../model/types"; /** Aktuelle Version des Dateiformats. Bei jeder Formatänderung erhöhen + Migration anhängen. */ -export const PROJECT_FORMAT_VERSION = 1; +export const PROJECT_FORMAT_VERSION = 2; /** * Migrationen: `MIGRATIONS[i]` hebt eine Datei von Version `i` auf `i + 1`. Arbeitet auf dem @@ -24,19 +24,49 @@ export const PROJECT_FORMAT_VERSION = 1; const MIGRATIONS: Array<(raw: Record) => Record> = [ // 0 → 1: Einführung von `formatVersion`; Inhalt unverändert. (raw) => raw, + // 1 → 2: Legacy-Türen (`doors`) werden zu Öffnungen (`openings`, kind "door"). Es gibt nur noch + // EINEN Datensatz-Typ für Türen und Fenster. + (raw) => { + const doors = Array.isArray(raw.doors) ? (raw.doors as Array>) : []; + const { doors: _drop, ...rest } = raw; + if (doors.length === 0) return rest; + const openings = Array.isArray(rest.openings) ? [...(rest.openings as Array>)] : []; + const taken = new Set(openings.map((o) => String(o.id))); + const doorTypes = Array.isArray(rest.doorTypes) ? (rest.doorTypes as Array<{ id?: string }>) : []; + for (const d of doors) { + let id = String(d.id); + while (taken.has(id)) id = `${id}-t`; + taken.add(id); + openings.push({ + id, + type: "opening", + hostWallId: d.hostWallId, + categoryCode: d.categoryCode, + kind: "door", + position: d.position, + width: d.width, + height: d.height, + sillHeight: 0, + swing: d.swing, + hinge: d.hinge, + ...(doorTypes[0]?.id ? { typeId: doorTypes[0].id } : {}), + }); + } + return { ...rest, openings }; + }, ]; /** Pflichtlisten: fehlen sie, ist es kein Dossier-Projekt. */ const REQUIRED_ARRAYS = ["walls", "layers", "drawingLevels"] as const; /** Listen, die bei Fehlen leer ergänzt werden. */ -const DEFAULT_ARRAYS = ["lineStyles", "hatches", "components", "wallTypes", "doors", "drawings2d"] as const; +const DEFAULT_ARRAYS = ["lineStyles", "hatches", "components", "wallTypes", "drawings2d"] as const; /** Bekannte Felder von `Project` (für die Meldung unbekannter Felder). */ const KNOWN_KEYS = new Set([ "formatVersion", "id", "name", "lineStyles", "textStyles", "hatches", "components", "wallTypes", "ceilingTypes", "roofTypes", "blockDefs", "doorTypes", "windowTypes", "stairTypes", "pens", "penSets", "activePenSetId", "customPalettes", "builtinPaletteBanks", "drawingLevels", "layers", - "walls", "ceilings", "roofs", "doors", "openings", "stairs", "rooms", "drawings2d", "context", + "walls", "ceilings", "roofs", "openings", "stairs", "rooms", "drawings2d", "context", "extrudedSolids", "columns", "groups", "parametricWalls", "overrideRules", "viewSnapshots", "viewSnapshotFolders", "layouts", "masterLayouts", "layoutFolders", "referenceElevationMasl", "geoAnchor", diff --git a/src/model/joins.test.ts b/src/model/joins.test.ts index 57b4e6cf..2bff93dd 100644 --- a/src/model/joins.test.ts +++ b/src/model/joins.test.ts @@ -41,7 +41,6 @@ function twoWallProject(w1: Wall, w2: Wall, thickness: number): Project { ], layers: [{ code: "20", name: "Wände", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [w1, w2], - doors: [], openings: [], ceilings: [], stairs: [], @@ -303,7 +302,6 @@ function layeredWallProject(w1: Wall, w2: Wall, w3: Wall): Project { ], layers: [{ code: "20", name: "Wände", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [w1, w2, w3], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/model/layoutModel.test.ts b/src/model/layoutModel.test.ts index 8e41fd21..4adbff36 100644 --- a/src/model/layoutModel.test.ts +++ b/src/model/layoutModel.test.ts @@ -69,7 +69,6 @@ function project(patch?: Partial): Project { drawingLevels: [], layers: [], walls: [], - doors: [], drawings2d: [], ...patch, }; diff --git a/src/model/penSets.test.ts b/src/model/penSets.test.ts index 38649600..7eaf7246 100644 --- a/src/model/penSets.test.ts +++ b/src/model/penSets.test.ts @@ -22,7 +22,6 @@ function baseProject(overrides: Partial = {}): Project { drawingLevels: [], layers: [], walls: [], - doors: [], drawings2d: [], ...overrides, }; diff --git a/src/model/sampleProject.ts b/src/model/sampleProject.ts index ebac3ab5..a4709754 100644 --- a/src/model/sampleProject.ts +++ b/src/model/sampleProject.ts @@ -437,22 +437,25 @@ export const sampleProject: Project = { // West (links) { id: "W8", type: "wall", floorId: "og", categoryCode: "20", start: { x: 0, y: 3 }, end: { x: 0, y: 0 }, wallTypeId: "aw", height: 2.6 }, ], - doors: [ - { - id: "D1", - type: "door", - hostWallId: "W1", - categoryCode: "21", - position: 0.8, // Startkante 0.8 m ab Wand-Start → Tür x 0.8–1.7, links von W9 (x=2.4) - width: 0.9, - height: 2.1, - swing: "left", // schlägt nach innen (in den Raum) auf - hinge: "start", - }, - ], // Öffnungen (Fenster/Türen) — ein Beispiel-Fenster in der EG-Südwand (W1, // frei von der Tür) und in der EG-Nordwand (W3). Kategorie „21" (Türen/Fenster). openings: [ + // Zimmertür in der EG-Südwand (W1), links von W9 (x = 2.4): Anschlag 0.8 m ab Wandstart + // (x 0.8–1.7), schlägt nach innen auf. (Früher ein Legacy-`Door`.) + { + id: "D1", + type: "opening", + hostWallId: "W1", + categoryCode: "21", + kind: "door", + typeId: "door-standard", + position: 0.8, + width: 0.9, + height: 2.1, + sillHeight: 0, + swing: "left", + hinge: "start", + }, { id: "O1", type: "opening", @@ -583,7 +586,6 @@ export const emptyProject: Project = { id: "empty", name: "Leeres Projekt", walls: [], - doors: [], openings: [], ceilings: [], roofs: [], diff --git a/src/model/types.ts b/src/model/types.ts index 3b6c1038..f9fb63d2 100644 --- a/src/model/types.ts +++ b/src/model/types.ts @@ -1698,25 +1698,6 @@ export interface RoomStamp { roundingStep?: number; } -/** Eine Tür, gehostet in einer Wand. Ihr Geschoss ergibt sich aus der Wand. */ -export interface Door { - id: string; - type: "door"; - hostWallId: string; - /** Grafik-Kategorie (Ebene), z. B. "21" für Türen/Fenster. */ - categoryCode: string; - /** Abstand des Türanschlags (erster Pfosten) vom Wand-Startpunkt, in Metern. */ - position: number; - /** Türbreite (lichte Öffnung) in Metern. */ - width: number; - /** Türhöhe in Metern. */ - height: number; - /** Auf welche Seite der Wandachse die Tür aufschlägt. */ - swing: SwingSide; - /** An welchem Pfosten das Scharnier sitzt. */ - hinge: "start" | "end"; -} - // ── Freie 2D-Zeichengeometrie (Drawing2D) ────────────────────────────────── // Ein semantisches 2D-Element (wie Wall/Door), das beim Rendern abgeleitet wird // (keine vorab erzeugten Plan-Primitive). Siehe docs/design/drawing-tools.md §7. @@ -2919,7 +2900,6 @@ export interface Project { ceilings?: Ceiling[]; /** Dächer über (rechteckigen) Grundriss-Umrissen. Optional (Alt-Projekte). */ roofs?: Roof[]; - doors: Door[]; /** * Öffnungen (Fenster/Türen), gehostet in Wänden. Optional, damit bestehende * Projekte/Tests ohne `openings` gültig bleiben (Default: leer behandeln). diff --git a/src/model/wall.test.ts b/src/model/wall.test.ts index 618af64a..b26c515f 100644 --- a/src/model/wall.test.ts +++ b/src/model/wall.test.ts @@ -41,7 +41,6 @@ function makeProject(overrides?: Partial): Project { ], layers: [{ code: "30", name: "Decken", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/column.test.ts b/src/plan/column.test.ts index 1ceb3089..769cd163 100644 --- a/src/plan/column.test.ts +++ b/src/plan/column.test.ts @@ -33,7 +33,6 @@ function projectWithColumn(column: Column): Project { { code: "50", name: "Tragwerk", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }, ], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.cache.test.ts b/src/plan/generatePlan.cache.test.ts index 9e88bdde..92ec45d2 100644 --- a/src/plan/generatePlan.cache.test.ts +++ b/src/plan/generatePlan.cache.test.ts @@ -34,7 +34,6 @@ function project(drawings: Drawing2D[]): Project { ], layers: SHARED.layers, walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.ceilingOpenings.test.ts b/src/plan/generatePlan.ceilingOpenings.test.ts index ff41dea4..2ca3902c 100644 --- a/src/plan/generatePlan.ceilingOpenings.test.ts +++ b/src/plan/generatePlan.ceilingOpenings.test.ts @@ -37,7 +37,6 @@ function projectWithCeiling(openings?: Ceiling["openings"]): Project { ], layers: [{ code: "30", name: "Decken", color: "#0a0a0a", lw: 0.3, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [ceiling], stairs: [], diff --git a/src/plan/generatePlan.context.test.ts b/src/plan/generatePlan.context.test.ts index beb5d883..f92c7058 100644 --- a/src/plan/generatePlan.context.test.ts +++ b/src/plan/generatePlan.context.test.ts @@ -20,7 +20,6 @@ function projectWith(context: Project["context"]): Project { ], layers: [], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.corner.test.ts b/src/plan/generatePlan.corner.test.ts index bf91ed55..4df43c69 100644 --- a/src/plan/generatePlan.corner.test.ts +++ b/src/plan/generatePlan.corner.test.ts @@ -52,7 +52,6 @@ function cornerProject(): Project { wall("W1", { x: 0, y: 0 }, { x: 5, y: 0 }), wall("W2", { x: 5, y: 0 }, { x: 5, y: 4 }), ], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.detailref.test.ts b/src/plan/generatePlan.detailref.test.ts index f41b8a61..060f83e1 100644 --- a/src/plan/generatePlan.detailref.test.ts +++ b/src/plan/generatePlan.detailref.test.ts @@ -35,7 +35,6 @@ function project(drawings: Drawing2D[], layouts: Layout[] = []): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.doorwindow.test.ts b/src/plan/generatePlan.doorwindow.test.ts index ea31f91b..f03f03e7 100644 --- a/src/plan/generatePlan.doorwindow.test.ts +++ b/src/plan/generatePlan.doorwindow.test.ts @@ -51,7 +51,6 @@ function project( { code: "21", name: "Öffnungen", color: "#0a0a0a", lw: 0.3, visible: true, locked: false }, ], walls: [wall], - doors: [], openings, ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.fillOpacity.test.ts b/src/plan/generatePlan.fillOpacity.test.ts index ec9384cf..5ef3844a 100644 --- a/src/plan/generatePlan.fillOpacity.test.ts +++ b/src/plan/generatePlan.fillOpacity.test.ts @@ -28,7 +28,7 @@ const project = (d: Drawing2D): Project => { id: "eg", name: "EG", kind: "floor", visible: true, locked: false, floorHeight: 2.6, cutHeight: 1.0, baseElevation: 0 }, ], layers: [{ code: "60", name: "Zeichnung", color: "#0a0a0a", lw: 0.25, visible: true, locked: false }], - walls: [], doors: [], openings: [], ceilings: [], stairs: [], rooms: [], + walls: [], openings: [], ceilings: [], stairs: [], rooms: [], drawings2d: [d], context: [], }) as unknown as Project; diff --git a/src/plan/generatePlan.leaderBends.test.ts b/src/plan/generatePlan.leaderBends.test.ts index edf9215d..c3ec0144 100644 --- a/src/plan/generatePlan.leaderBends.test.ts +++ b/src/plan/generatePlan.leaderBends.test.ts @@ -38,7 +38,6 @@ function project(drawing: Drawing2D): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.noPrint.test.ts b/src/plan/generatePlan.noPrint.test.ts index cb57d156..6e578358 100644 --- a/src/plan/generatePlan.noPrint.test.ts +++ b/src/plan/generatePlan.noPrint.test.ts @@ -31,7 +31,6 @@ function project(drawings: Drawing2D[]): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.openings.test.ts b/src/plan/generatePlan.openings.test.ts index ba56b735..b7d81911 100644 --- a/src/plan/generatePlan.openings.test.ts +++ b/src/plan/generatePlan.openings.test.ts @@ -37,7 +37,6 @@ function projectWithOpening(opening: Opening): Project { { code: "21", name: "Öffnungen", color: "#0a0a0a", lw: 0.3, visible: true, locked: false }, ], walls: [wall], - doors: [], openings: [opening], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.overrides.test.ts b/src/plan/generatePlan.overrides.test.ts index a8c0aa82..15c02b5d 100644 --- a/src/plan/generatePlan.overrides.test.ts +++ b/src/plan/generatePlan.overrides.test.ts @@ -36,7 +36,6 @@ function project(overrideRules?: OverrideRule[]): Project { { code: "60", name: "Zeichnung", color: "#0a0a0a", lw: 0.25, visible: true, locked: false }, ], walls: [wall], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.pointmarker.test.ts b/src/plan/generatePlan.pointmarker.test.ts index 49f15530..9c044009 100644 --- a/src/plan/generatePlan.pointmarker.test.ts +++ b/src/plan/generatePlan.pointmarker.test.ts @@ -30,7 +30,6 @@ function project(drawings: Drawing2D[]): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.roof.test.ts b/src/plan/generatePlan.roof.test.ts index e251a41e..a4b375f8 100644 --- a/src/plan/generatePlan.roof.test.ts +++ b/src/plan/generatePlan.roof.test.ts @@ -33,7 +33,6 @@ function baseProject(roofs?: Roof[]): Project { ], layers: [{ code: "35", name: "Dächer", color: "#8a4b32", lw: 0.25, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.scalebar.test.ts b/src/plan/generatePlan.scalebar.test.ts index c1b4832f..a1f042aa 100644 --- a/src/plan/generatePlan.scalebar.test.ts +++ b/src/plan/generatePlan.scalebar.test.ts @@ -31,7 +31,6 @@ function project(drawings: Drawing2D[]): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.sectionLine.test.ts b/src/plan/generatePlan.sectionLine.test.ts index 669c0404..dd467e75 100644 --- a/src/plan/generatePlan.sectionLine.test.ts +++ b/src/plan/generatePlan.sectionLine.test.ts @@ -28,7 +28,6 @@ function baseProject(levels: DrawingLevel[]): Project { drawingLevels: levels, layers: [{ code: "20", name: "Wände", color: "#333", lw: 0.18, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.stairArrow.test.ts b/src/plan/generatePlan.stairArrow.test.ts index da39729b..6e93adbe 100644 --- a/src/plan/generatePlan.stairArrow.test.ts +++ b/src/plan/generatePlan.stairArrow.test.ts @@ -50,7 +50,6 @@ function project(stair: Stair): Project { drawingLevels: [floor], layers: [{ code: "40", name: "Treppen", color: "#333", lw: 0.18, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [stair], diff --git a/src/plan/generatePlan.text.test.ts b/src/plan/generatePlan.text.test.ts index a16cf35f..b6714594 100644 --- a/src/plan/generatePlan.text.test.ts +++ b/src/plan/generatePlan.text.test.ts @@ -43,7 +43,6 @@ function projectWithText(drawing: Drawing2D): Project { { code: "70", name: "Text", color: "#0a0a0a", lw: 0.3, visible: true, locked: false }, ], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.tjunction.test.ts b/src/plan/generatePlan.tjunction.test.ts index dfef5484..7bb06130 100644 --- a/src/plan/generatePlan.tjunction.test.ts +++ b/src/plan/generatePlan.tjunction.test.ts @@ -57,7 +57,6 @@ function tJunctionProject(): Project { wall("WA2", { x: 5, y: 0 }, { x: 10, y: 0 }), wall("WB", { x: 5, y: 0 }, { x: 5, y: 3 }), ], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.ts b/src/plan/generatePlan.ts index cb4685fc..4145b460 100644 --- a/src/plan/generatePlan.ts +++ b/src/plan/generatePlan.ts @@ -81,7 +81,7 @@ import { } from "./generatePlan/drawing2d"; import { drawingBox } from "../geometry/drawingBounds"; import { layersStyleSig } from "./generatePlan/layerSig"; -import { addDoorSymbol, addOpeningSymbol } from "./generatePlan/openings"; +import { addOpeningSymbol } from "./generatePlan/openings"; import { addRoof } from "./generatePlan/roofs"; import { addRoomArea } from "./generatePlan/rooms"; import { addSectionLines } from "./generatePlan/sections"; @@ -511,11 +511,9 @@ export function generatePlan( wallCategory, lwByCode.get(wall.categoryCode) ?? WALL_FALLBACK_MM, ); - // Türen (Legacy) + Öffnungen (Fenster/Türen) am Wandhost: BEIDE sparen die - // Wand-Poché aus. Aus beiden wird eine gemeinsame Lücken-Intervall-Liste. - const doors = project.doors.filter((d) => d.hostWallId === wall.id); + // Öffnungen (Fenster/Türen) am Wandhost sparen die Wand-Poché aus (Lücken-Intervall-Liste). const openings = openingsOfWall(project, wall.id); - const gaps = wallGaps(wall, doors, openings); + const gaps = wallGaps(wall, openings); const cuts = joins.get(wall.id) ?? { startCut: null, endCut: null }; // Schnitt vs. Ansicht nach Schnitthöhe (BIM-Standard): erreicht die Wand die // Grundriss-Schnittebene nicht (z. B. eine Brüstung/ein Podestrand), wird sie @@ -534,15 +532,6 @@ export function generatePlan( // Referenzlinie: dünne gestrichelte Wand-Achslinie (von der Oberleiste // umschaltbar). Wird über der Poché gezeichnet, damit sie sichtbar bleibt. if (showReferenceLines) addReferenceLine(primitives, wall, wallGreyed); - // Tür-Symbol (Legacy-Door) nur, wenn die Kategorie sichtbar ist und der Modus - // sie zeigt. - for (const door of doors) { - const d = categoryDisplay(door.categoryCode); - if (visibleCodes.has(door.categoryCode) && d.render) { - const doorLwMm = lwByCode.get(door.categoryCode) ?? LAYER_LINE_MM; - addDoorSymbol(primitives, wall, door, d.greyed, detail, doorLwMm); - } - } // Öffnungs-Symbole (Fenster/Tür) je Detailgrad + Auswahl-taggbar. for (const o of openings) { const d = categoryDisplay(o.categoryCode); diff --git a/src/plan/generatePlan.underlay.test.ts b/src/plan/generatePlan.underlay.test.ts index f7648511..839db9d3 100644 --- a/src/plan/generatePlan.underlay.test.ts +++ b/src/plan/generatePlan.underlay.test.ts @@ -36,7 +36,6 @@ function project(drawings: Drawing2D[], levels = [level("L1")]): Project { wallTypes: [], drawingLevels: levels, walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan.viewwall.test.ts b/src/plan/generatePlan.viewwall.test.ts index a58862d5..fadbaa99 100644 --- a/src/plan/generatePlan.viewwall.test.ts +++ b/src/plan/generatePlan.viewwall.test.ts @@ -37,7 +37,6 @@ function project(): Project { wall("HI", { x: 0, y: 0 }, { x: 4, y: 0 }, 2.6), // erreicht Schnitt → Poché wall("LOW", { x: 0, y: 2 }, { x: 4, y: 2 }, 0.3), // Brüstung → nur Ansicht ], - doors: [], openings: [], ceilings: [], stairs: [], @@ -143,7 +142,6 @@ function nonSolidWallProject(): Project { ], layers: [{ code: "20", name: "Wände", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [wall], - doors: [], openings: [], ceilings: [], stairs: [], @@ -191,7 +189,6 @@ function ceilingProject(): Project { ], layers: [{ code: "30", name: "Decken", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [ { diff --git a/src/plan/generatePlan.windowFields.test.ts b/src/plan/generatePlan.windowFields.test.ts index f00d409b..d085ecdd 100644 --- a/src/plan/generatePlan.windowFields.test.ts +++ b/src/plan/generatePlan.windowFields.test.ts @@ -54,7 +54,6 @@ function project(opening: Opening, windowTypes?: WindowType[]): Project { { code: "21", name: "Öffnungen", color: "#0a0a0a", lw: 0.3, visible: true, locked: false }, ], walls: [wall], - doors: [], openings: [opening], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan/drawing2d.test.ts b/src/plan/generatePlan/drawing2d.test.ts index 584d6916..7ff543a3 100644 --- a/src/plan/generatePlan/drawing2d.test.ts +++ b/src/plan/generatePlan/drawing2d.test.ts @@ -20,7 +20,6 @@ function project(): Project { drawingLevels: [], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan/openings.ts b/src/plan/generatePlan/openings.ts index b7e48f69..1ba08b7e 100644 --- a/src/plan/generatePlan/openings.ts +++ b/src/plan/generatePlan/openings.ts @@ -20,7 +20,7 @@ import { windowSymbol, } from "../../geometry/opening"; import { wallReferenceOffset } from "../../model/wall"; -import { add, along, dot, leftNormal, normalize, scale, sub } from "../../model/geometry"; +import { add, along, dot, scale, sub } from "../../model/geometry"; import { NO_HATCH, OVERHEAD_DASH, @@ -30,75 +30,6 @@ import { type Primitive, } from "./shared"; -/** - * Tür-Symbol je Detailgrad: - * • grob — nur die gerade Türblatt-Linie (die Öffnungs-Lücke kommt aus der - * ausgesparten Poché). - * • mittel — + Schwenkbogen (geschlossen → offen). - * • fein — + Rahmen/Anschlag-Striche an beiden Pfosten (kurze Striche quer - * zur Wand, die den Türrahmen/-anschlag andeuten). - */ -export function addDoorSymbol( - out: Primitive[], - wall: Wall, - door: Project["doors"][number], - greyed: boolean, - detail: DetailLevel, - _doorLwMm: number, -): void { - const u = normalize(sub(wall.end, wall.start)); - const n = leftNormal(u); // linke Seite der Wandachse - const swingDir = door.swing === "left" ? n : scale(n, -1); - - const jambStart = along(wall.start, wall.end, door.position); - const jambEnd = along(wall.start, wall.end, door.position + door.width); - const hinge = door.hinge === "start" ? jambStart : jambEnd; - const closedDir = door.hinge === "start" ? u : scale(u, -1); - - const openEnd = add(hinge, scale(swingDir, door.width)); - const closedEnd = add(hinge, scale(closedDir, door.width)); - - // Türblatt in geöffneter Stellung (alle Stufen). - out.push({ - kind: "line", - a: hinge, - b: openEnd, - cls: "door-leaf", - weightMm: SYMBOL_HAIRLINE_MM, - greyed, - }); - - // mittel + fein: Schwenkbogen von geschlossen → offen. - if (detail !== "grob") { - out.push({ - kind: "arc", - center: hinge, - from: closedEnd, - to: openEnd, - r: door.width, - cls: "door-swing", - weightMm: SYMBOL_HAIRLINE_MM, - greyed, - }); - } - - // fein: Rahmen/Anschlag-Striche an beiden Pfosten (kurz quer zur Wand, - // symmetrisch um die Achse über eine halbe Wanddicke-Andeutung). - if (detail === "fein") { - const reveal = 0.06; // 6 cm Anschlag-Andeutung je Seite - for (const jamb of [jambStart, jambEnd]) { - out.push({ - kind: "line", - a: add(jamb, scale(n, reveal)), - b: add(jamb, scale(n, -reveal)), - cls: "door-frame", - weightMm: SYMBOL_HAIRLINE_MM, - greyed, - }); - } - } -} - /** * Aufgelöste Rahmen-Parameter (Typ-Bibliothek) einer Tür-/Fenster-Öffnung — * nur vorhanden, wenn die Öffnung einen Bauteil-Typ referenziert (`typeId`). diff --git a/src/plan/generatePlan/structures.column.test.ts b/src/plan/generatePlan/structures.column.test.ts index 96457b11..5f2d63c0 100644 --- a/src/plan/generatePlan/structures.column.test.ts +++ b/src/plan/generatePlan/structures.column.test.ts @@ -43,7 +43,6 @@ function project(overrides: Partial = {}): Project { drawingLevels: [], layers: [category], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/generatePlan/walls.ts b/src/plan/generatePlan/walls.ts index bd70b4fd..06f82a64 100644 --- a/src/plan/generatePlan/walls.ts +++ b/src/plan/generatePlan/walls.ts @@ -45,17 +45,15 @@ export interface WallGap { } /** - * Vereint Legacy-Türen (`Door`) und Öffnungen (`Opening`) einer Wand zu einer + * Wandet die Öffnungen (`Opening`: Fenster und Türen) einer Wand zu einer * sortierten Lücken-Intervall-Liste entlang der Wandachse. Entartete Intervalle * (Breite ≤ 0 oder außerhalb der Achse) werden verworfen. */ export function wallGaps( wall: Wall, - doors: Project["doors"], openings: Opening[], ): WallGap[] { const gaps: WallGap[] = []; - for (const d of doors) gaps.push({ from: d.position, to: d.position + d.width }); for (const o of openings) { const iv = openingInterval(wall, o); if (iv) gaps.push(iv); diff --git a/src/plan/generateVisibleLevelsPlan.test.ts b/src/plan/generateVisibleLevelsPlan.test.ts index 69ca3aa1..65cc4374 100644 --- a/src/plan/generateVisibleLevelsPlan.test.ts +++ b/src/plan/generateVisibleLevelsPlan.test.ts @@ -37,7 +37,6 @@ function baseProject(levels: DrawingLevel[], walls: Wall[]): Project { drawingLevels: levels, layers: [{ code: "20", name: "Wände", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls, - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/plan/pickLabels.test.ts b/src/plan/pickLabels.test.ts index a564c359..b8e36ab5 100644 --- a/src/plan/pickLabels.test.ts +++ b/src/plan/pickLabels.test.ts @@ -11,7 +11,7 @@ const project = { }, ], walls: [{ id: "w1", categoryCode: "20" }], - doors: [{ id: "t1", categoryCode: "20" }], + openings: [{ id: "t1", categoryCode: "20" }], drawings2d: [{ id: "d1", categoryCode: "100" }, { id: "d2", categoryCode: "99" }], } as unknown as Project; diff --git a/src/plan/pickLabels.ts b/src/plan/pickLabels.ts index 7147ff9f..1f050e22 100644 --- a/src/plan/pickLabels.ts +++ b/src/plan/pickLabels.ts @@ -18,7 +18,7 @@ function collection(project: Project, kind: PickKind): readonly WithCategory[] { case "wall": return p.walls ?? []; case "drawing": return p.drawings2d ?? []; case "ceiling": return p.ceilings ?? []; - case "opening": return [...(p.openings ?? []), ...(p.doors ?? [])]; + case "opening": return p.openings ?? []; case "stair": return p.stairs ?? []; case "room": return p.rooms ?? []; case "roof": return p.roofs ?? []; diff --git a/src/plan/planView/underlayAccess.test.ts b/src/plan/planView/underlayAccess.test.ts index f8484f6d..04cae340 100644 --- a/src/plan/planView/underlayAccess.test.ts +++ b/src/plan/planView/underlayAccess.test.ts @@ -35,7 +35,7 @@ const project = (drawings: Drawing2D[]) => components: [], wallTypes: [], drawingLevels: [{ id: "L", name: "L", kind: "drawing", visible: true, locked: false }], layers: [{ code: "60", name: "Z", color: "#000", lw: 0.25, visible: true, locked: false }], - walls: [], doors: [], openings: [], ceilings: [], stairs: [], rooms: [], drawings2d: drawings, context: [], + walls: [], openings: [], ceilings: [], stairs: [], rooms: [], drawings2d: drawings, context: [], }) as unknown as Project; describe("underlayAccess == Primitiv-Varianten", () => { diff --git a/src/plan/toElevation.test.ts b/src/plan/toElevation.test.ts index 84c3995f..9a4e6838 100644 --- a/src/plan/toElevation.test.ts +++ b/src/plan/toElevation.test.ts @@ -295,7 +295,6 @@ function elevationProject(opts: { overhang: boolean }): Project { ], layers: [{ code: "20", name: "Wände", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [w("NEAR", 0), w("FAR", 3)], - doors: [], openings: [], ceilings: opts.overhang ? [ diff --git a/src/plan/toElevation.ts b/src/plan/toElevation.ts index 7119a84a..9bebceae 100644 --- a/src/plan/toElevation.ts +++ b/src/plan/toElevation.ts @@ -42,7 +42,6 @@ import { sashesOfWindowType, wallTypeThickness, } from "../model/types"; -import { wallVerticalExtent } from "../model/wall"; import { openingInterval, openingVerticalExtent } from "../geometry/opening"; import { roofBaseElevation, roofGeometry } from "../geometry/roof"; import { projectToModel3d } from "./toWalls3d"; @@ -721,8 +720,6 @@ function collectOpenings(project: Project, frame: ElevationFrame): ProjectedOpen } catch { thickness = 0.2; } - const { zBottom, zTop } = wallVerticalExtent(project, wall); - const axisLen = Math.hypot(wall.end.x - wall.start.x, wall.end.y - wall.start.y); for (const op of openingsOfWall(project, wall.id)) { const iv = openingInterval(wall, op); if (!iv) continue; @@ -897,18 +894,6 @@ function collectOpenings(project: Project, frame: ElevationFrame): ProjectedOpen } out.push(pr); } - for (const d of project.doors ?? []) { - if (d.hostWallId !== wall.id) continue; - const from = Math.max(0, Math.min(d.position, axisLen)); - const to = Math.max(from, Math.min(d.position + d.width, axisLen)); - const oTop = Math.min(zTop, zBottom + d.height); - const pr = projectOpeningRect(frame, wall, from, to, zBottom, oTop, thickness); - if (pr) { - pr.isDoor = true; - pr.doorLeaf.push(rect(pr.pts, 0.04, 0.96, 0, 0.97)); // Legacy-Tür: kein Typ, kein Glasblatt - out.push(pr); - } - } } return out; } diff --git a/src/plan/toSection.depth.test.ts b/src/plan/toSection.depth.test.ts index 2aed8e00..8c34c3a5 100644 --- a/src/plan/toSection.depth.test.ts +++ b/src/plan/toSection.depth.test.ts @@ -28,7 +28,6 @@ const project = { ceilings: [], roofs: [], openings: [], - doors: [], components: [], wallTypes: [], drawingLevels: [{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false }], diff --git a/src/plan/toSection.roof.test.ts b/src/plan/toSection.roof.test.ts index 767188a1..40102072 100644 --- a/src/plan/toSection.roof.test.ts +++ b/src/plan/toSection.roof.test.ts @@ -43,7 +43,6 @@ function project(r: Roof, extra: Partial = {}): Project { drawingLevels: [], layers: [], walls: [], - doors: [], roofs: [r], ...extra, } as unknown as Project; diff --git a/src/plan/toSection.ts b/src/plan/toSection.ts index 72763721..31f982ed 100644 --- a/src/plan/toSection.ts +++ b/src/plan/toSection.ts @@ -267,14 +267,6 @@ export function wallSegmentOwners(project: Project): Wall[] { const v = openingVerticalExtent(project, wall, op); cutouts.push({ from: iv.from, to: iv.to, oBottom: v.zBottom, oTop: v.zTop }); } - for (const d of project.doors ?? []) { - if (d.hostWallId !== wall.id) continue; - const from = Math.max(0, Math.min(d.position, axisLen)); - const to = Math.max(from, Math.min(d.position + d.width, axisLen)); - if (to - from < OWNER_EPS) continue; - const oTop = Math.min(zTop, zBottom + d.height); - cutouts.push({ from, to, oBottom: zBottom, oTop }); - } cutouts.sort((a, b) => a.from - b.from); if (cutouts.length === 0) { diff --git a/src/plan/toWalls3d.test.ts b/src/plan/toWalls3d.test.ts index 8bc3967d..7b7fb6ff 100644 --- a/src/plan/toWalls3d.test.ts +++ b/src/plan/toWalls3d.test.ts @@ -155,7 +155,6 @@ describe("Öffnungen als echte Löcher in EINEM Körper (3D-Pfad, layeredWalls:t // erscheinen. W1: start (0,0)->(5,0), floor "eg" (baseElevation 0). const twoOffsetWindows: Project = { ...sampleProject, - doors: [], openings: [ { id: "WA", @@ -228,7 +227,6 @@ describe("Öffnungen als echte Löcher in EINEM Körper (3D-Pfad, layeredWalls:t const p: Project = { ...sampleProject, walls: [w1], - doors: [], ceilings: [], context: [], windowTypes: [ @@ -292,7 +290,7 @@ describe("Öffnungen als echte Löcher in EINEM Körper (3D-Pfad, layeredWalls:t it("Tür = Loch bis zur Wand-UK (zBottom == baseElevation)", () => { // Eine Tür (D1 auf W1) muss im 3D-Pfad als Loch bis zum Boden erscheinen: // zBottom des Lochs == Wand-UK (0), NICHT ab einer Brüstung. - const p: Project = { ...sampleProject, openings: [] }; + const p: Project = { ...sampleProject, openings: (sampleProject.openings ?? []).filter((o) => o.id === "D1") }; const w1 = projectToWalls3d(p, true).filter((w) => w.wallId === "W1"); // W1 ist Durchgangswand für W9 (T-Stoss) -> innerste Putzschicht span-cutout- // gebrochen. Zusätzlich spaltet die Decke C1 (Beton 100) den Backstein (50) im @@ -380,7 +378,6 @@ describe("Fenster-Glasscheiben (emitOpeningGlass)", () => { const p: Project = { ...sampleProject, openings: (sampleProject.openings ?? []).filter((o) => o.id === "O1"), - doors: sampleProject.doors, context: [], }; const { meshes } = projectToModel3d(p); @@ -419,26 +416,6 @@ describe("Fenster-Glasscheiben (emitOpeningGlass)", () => { expect(a.max).toBeLessThanOrEqual(b.min + 1e-9); }); - it("Legacy-Tür (project.doors, ohne Öffnungs-Typsystem) bekommt ein Blatt-Panel statt eines blanken Lochs", () => { - // D1 ist eine LEGACY-Tür (project.doors, kein typeId/Öffnungs-Typsystem) — - // vor der Behebung durchliefen emitOpeningGlass/emitOpeningFrames nur - // project.openings, D1 blieb im 3D ein reines Loch in der Wand (Nutzer- - // Report: "Türen fehlen im 3D komplett"). DOOR_LEAF_RGB = [0.93,0.9,0.85]. - const { meshes } = projectToModel3d(sampleProject); - const leafMeshes = meshes.filter( - (m) => m.color[0] === 0.93 && m.color[1] === 0.9 && m.color[2] === 0.85, - ); - expect(leafMeshes.length).toBe(1); - const leaf = leafMeshes[0]; - expect(leaf.positions.length).toBe(24); // Quader: 8 Ecken - expect(leaf.indices.length).toBe(36); // 12 Dreiecke - // D1: height 2.1, sitzt am Wand-UK (0) -> Blatt UK 0 .. OK 2.1. - const zs: number[] = []; - for (let i = 2; i < leaf.positions.length; i += 3) zs.push(leaf.positions[i]); - expect(Math.min(...zs)).toBeCloseTo(0, 6); - expect(Math.max(...zs)).toBeCloseTo(2.1, 6); - }); - it("Türen bekommen keine Scheibe; je Fenster genau 2 (window-standard = zweifach verglast)", () => { // Volles Sample-Projekt: 2 Fenster (O1, O2, beide Typ "window-standard" = // Zweifachverglasung) + 1 Tür (D1), Kontext leer. Neben den Glasscheiben @@ -484,7 +461,6 @@ describe("Fenster-Glasscheiben (emitOpeningGlass)", () => { sillHeight: 0.9, }, ], - doors: [], context: [], }; const { meshes } = projectToModel3d(p); @@ -519,7 +495,6 @@ describe("Rahmen-/Sprossen-Riegel typisierter Öffnungen (emitOpeningFrames)", ( const p: Project = { ...sampleProject, openings: (sampleProject.openings ?? []).filter((o) => o.id === "O1"), - doors: [], context: [], }; const { meshes } = projectToModel3d(p); @@ -540,7 +515,6 @@ describe("Rahmen-/Sprossen-Riegel typisierter Öffnungen (emitOpeningFrames)", ( const p: Project = { ...sampleProject, openings: [{ ...o1, wingCount: 2 }], - doors: [], context: [], }; const frameCount = (detail: "grob" | "mittel" | "fein"): number => @@ -586,7 +560,6 @@ describe("Rahmen-/Sprossen-Riegel typisierter Öffnungen (emitOpeningFrames)", ( sillHeight: 0.9, }, ], - doors: [], context: [], }; const { meshes } = projectToModel3d(p); @@ -645,7 +618,6 @@ describe("Rahmen-/Sprossen-Riegel typisierter Öffnungen (emitOpeningFrames)", ( sillHeight: 0.9, }, ], - doors: [], context: [], }; const withMullions: Project = { @@ -680,7 +652,6 @@ describe("Rahmen-/Sprossen-Riegel typisierter Öffnungen (emitOpeningFrames)", ( sillHeight: 0.9, }, ], - doors: [], context: [], }; const baselineFrames = projectToModel3d(baseline).meshes.filter(isFrame); @@ -727,7 +698,6 @@ describe("Rahmen-/Sprossen-Riegel typisierter Öffnungen (emitOpeningFrames)", ( sillHeight: 0.9, }, ], - doors: [], context: [], }; const withMullions: Project = { @@ -762,7 +732,6 @@ describe("Rahmen-/Sprossen-Riegel typisierter Öffnungen (emitOpeningFrames)", ( sillHeight: 0.9, }, ], - doors: [], context: [], }; const baselineFrames = projectToModel3d(baseline).meshes.filter(isFrame); @@ -807,7 +776,6 @@ describe("Rahmen-/Sprossen-Riegel typisierter Öffnungen (emitOpeningFrames)", ( sillHeight: 0.9, }, ], - doors: [], context: [], }); const fixedCount = projectToModel3d(win("fest")).meshes.filter(isFrame).length; @@ -847,7 +815,6 @@ describe("Rahmen-/Sprossen-Riegel typisierter Öffnungen (emitOpeningFrames)", ( sillHeight: 0, }, ], - doors: [], context: [], }); // Vollglas (ratio 1 / fehlt): Glas über (fast) die ganze Blatthöhe. @@ -921,8 +888,8 @@ describe("Rahmen-/Sprossen-Riegel typisierter Öffnungen (emitOpeningFrames)", ( sillHeight: 0.9, }, ]; - const pFlush: Project = { ...flushWindow(sampleProject), openings: openingWithType("win-flush-test"), doors: [], context: [] }; - const pInset: Project = { ...insetWindow(sampleProject), openings: openingWithType("win-inset-test"), doors: [], context: [] }; + const pFlush: Project = { ...flushWindow(sampleProject), openings: openingWithType("win-flush-test"), context: [] }; + const pInset: Project = { ...insetWindow(sampleProject), openings: openingWithType("win-inset-test"), context: [] }; const minY = (meshes: { positions: number[]; color: [number, number, number] }[]): number => { let m = Infinity; @@ -977,7 +944,6 @@ describe("Rahmen-/Sprossen-Riegel typisierter Öffnungen (emitOpeningFrames)", ( sillHeight: 0.9, }, ], - doors: [], context: [], }; const trueAussenY = -0.345 / 2; @@ -1021,7 +987,6 @@ describe("Rahmen-/Sprossen-Riegel typisierter Öffnungen (emitOpeningFrames)", ( sillHeight: 0.9, }, ], - doors: [], context: [], }; const { meshes } = projectToModel3d(p); @@ -1061,7 +1026,6 @@ describe("VW-fein-Öffnungsdetails: Fensterbank, DIN-Symbole, verschachtelte Fl sillHeight: 0.9, }, ], - doors: [], context: [], }); @@ -1212,7 +1176,6 @@ describe("VW-fein-Öffnungsdetails: Fensterbank, DIN-Symbole, verschachtelte Fl sillHeight: 0, }, ], - doors: [], context: [], }); const baseDoor = { @@ -1273,7 +1236,6 @@ describe("VW-fein-Öffnungsdetails: Fensterbank, DIN-Symbole, verschachtelte Fl sillHeight: 0, }, ], - doors: [], context: [], }); const baseDoor = { @@ -1344,7 +1306,6 @@ describe("VW-fein-Öffnungsdetails: Fensterbank, DIN-Symbole, verschachtelte Fl sillHeight: 0, }, ], - doors: [], context: [], }); const frames = (frameKind: "zarge" | "blockrahmen"): number => @@ -1393,7 +1354,6 @@ describe("VW-fein-Öffnungsdetails: Fensterbank, DIN-Symbole, verschachtelte Fl sillHeight: 0, }, ], - doors: [], context: [], }); // Ohne threshold: der Blendrahmen-Riegel (FRAME_RGB) fehlt bereits (hasSill @@ -1689,7 +1649,6 @@ describe("Dach-Wand-Verschneidung (clipPieceToRoofs) — Wand-Top folgt der Dach ...sampleProject, walls: [gableWall], roofs: [gableRoof], - doors: [], openings: [], ceilings: [], }; @@ -1720,7 +1679,6 @@ describe("Dach-Wand-Verschneidung (clipPieceToRoofs) — Wand-Top folgt der Dach ...sampleProject, walls: [gableWall], roofs: [], - doors: [], openings: [], ceilings: [], }; @@ -1736,7 +1694,6 @@ describe("Dach-Wand-Verschneidung (clipPieceToRoofs) — Wand-Top folgt der Dach ...sampleProject, walls: [gableWall], roofs: [{ ...gableRoof, floorId: "og" }], - doors: [], openings: [], ceilings: [], }; @@ -2492,7 +2449,6 @@ describe("emitOpeningShading (Rollladen-/Sonnenschutzkasten als 3D-Box)", () => sillHeight: 0.9, }, ], - doors: [], context: [], }); diff --git a/src/plan/toWalls3d.ts b/src/plan/toWalls3d.ts index 95136655..7be37d87 100644 --- a/src/plan/toWalls3d.ts +++ b/src/plan/toWalls3d.ts @@ -71,7 +71,7 @@ import { applyVoids3d } from "./toWalls3d/voids3d"; import { emitDrawingLineVerts, pickDrawingSegs } from "./toWalls3d/drawing2d"; import { emitColumns } from "./toWalls3d/columns"; import { emitRoofCutLayers, emitRoofs } from "./toWalls3d/roofs"; -import { emitLegacyDoorLeaves, emitOpeningFrames, emitOpeningGlass, emitOpeningShading } from "./toWalls3d/openings"; +import { emitOpeningFrames, emitOpeningGlass, emitOpeningShading } from "./toWalls3d/openings"; // Re-Export des gemeinsamen Vokabulars — externe Konsumenten (viewport/, // export/, toSection.ts, nativeSync.ts, …) importieren weiterhin @@ -224,7 +224,6 @@ export function projectToModel3d(project: Project, opts: Model3dOptions = {}): R meshes: [ ...emitMeshes(project), ...emitOpeningGlass(project), - ...emitLegacyDoorLeaves(project), ...emitOpeningFrames(project, detail), ...emitOpeningShading(project, detail), ...emitStairMeshes(project), diff --git a/src/plan/toWalls3d/bands.ts b/src/plan/toWalls3d/bands.ts index 705f3bec..87e591ec 100644 --- a/src/plan/toWalls3d/bands.ts +++ b/src/plan/toWalls3d/bands.ts @@ -734,8 +734,7 @@ export function emitWall(out: RWall[], project: Project, wall: Wall, layered = t }; // Aussparungen der Wand als vereinheitlichte Cutouts sammeln: - // • Öffnungen (project.openings, Fenster mit Brüstung/Sturz), - // • Legacy-Türen (project.doors, sitzen am Boden, nur Sturz). + // • Öffnungen (project.openings: Fenster und Türen, mit Brüstung/Sturz). // Jeweils [from..to] auf die Achse geklemmt + vertikale Öffnungs-Ausdehnung. const cutouts: Array<{ from: number; @@ -754,15 +753,6 @@ export function emitWall(out: RWall[], project: Project, wall: Wall, layered = t op.kind === "window" && getWindowType(project, op)?.innerLayerRecess === true; cutouts.push({ from: iv.from, to: iv.to, oBottom: v.zBottom, oTop: v.zTop, recessInnerLayer }); } - for (const d of project.doors ?? []) { - if (d.hostWallId !== wall.id) continue; - const from = Math.max(0, Math.min(d.position, axisLen)); - const to = Math.max(from, Math.min(d.position + d.width, axisLen)); - if (to - from < EPS) continue; - // Tür sitzt am Boden (UK der Wand), reicht bis zur lichten Türhöhe. - const oTop = Math.min(zTop, zBottom + d.height); - cutouts.push({ from, to, oBottom: zBottom, oTop, recessInnerLayer: false }); - } cutouts.sort((a, b) => a.from - b.from); // ── 3D-Viewer-Pfad (layered=true): EIN Körper je Schicht-Band über die volle diff --git a/src/plan/toWalls3d/openings.ts b/src/plan/toWalls3d/openings.ts index 8637bcf6..91256d12 100644 --- a/src/plan/toWalls3d/openings.ts +++ b/src/plan/toWalls3d/openings.ts @@ -6,7 +6,6 @@ import type { FrameCornerJoin, Opening, Project, SashDef, Wall } from "../../model/types"; import { getDoorType, getWindowType, glazingPanesOf, openingsOfWall } from "../../model/types"; import { openingInterval, openingVerticalExtent } from "../../geometry/opening"; -import { wallVerticalExtent } from "../../model/wall"; import type { DetailLevel } from "../../model/viewTypes"; import { EPS, type RMesh, type RRgb } from "./shared"; import { wallThicknessSafe } from "./bands"; @@ -1036,49 +1035,6 @@ export function emitOpeningGlass(project: Project): RMesh[] { return out; } -/** - * Emittiert je LEGACY-Tür (`project.doors` — das alte flache Türfeld VOR dem - * Öffnungs-Typsystem, z. B. `Door.hostWallId/position/width/height` ohne - * `typeId`) EIN Blatt-Panel als rohen Quader. `emitWall` (`../bands.ts`) - * schneidet für diese Türen zwar bereits ein Loch in die Wand, aber - * `emitOpeningGlass`/`emitOpeningFrames` durchlaufen NUR `project.openings` - * (das neue Typsystem) — ohne diese Funktion blieb eine Legacy-Tür ein - * blankes Loch, durch das man hindurchsieht (Nutzer-Report: "Türen fehlen im - * 3D komplett"). Analog zum Alt-Verhalten typloser Fenster - * ({@link emitOpeningGlass}: EINE Vollscheibe ohne Rahmen) — hier EIN - * Vollblatt ohne Rahmen/Zarge (das Rahmen-System gehört exklusiv zu - * `project.openings`, s. {@link resolveOpeningFrame}). `positions` in - * MODELL-Metern. - */ -export function emitLegacyDoorLeaves(project: Project): RMesh[] { - const out: RMesh[] = []; - for (const wall of project.walls) { - const axisLen = Math.hypot(wall.end.x - wall.start.x, wall.end.y - wall.start.y); - if (axisLen < 1e-9) continue; - const { zBottom } = wallVerticalExtent(project, wall); - for (const d of project.doors ?? []) { - if (d.hostWallId !== wall.id) continue; - const from = Math.max(0, Math.min(d.position, axisLen)); - const to = Math.max(from, Math.min(d.position + d.width, axisLen)); - if (to - from <= EPS) continue; - const zTop = zBottom + d.height; - if (zTop - zBottom <= EPS) continue; - const mesh = openingAxisBox( - wall, - from, - to, - zBottom, - zTop, - -DOOR_LEAF_THICK / 2, - DOOR_LEAF_THICK / 2, - DOOR_LEAF_RGB, - ); - if (mesh) out.push(mesh); - } - } - return out; -} - /** * Emittiert je Öffnung MIT auflösbarem Typ (`getDoorType`/`getWindowType`) die * Rahmen-/Sprossen-Riegel (Zarge/Blendrahmen, Sturz, Schwelle, Kämpfer, diff --git a/src/state/groupActions.test.ts b/src/state/groupActions.test.ts index 14e9fe4b..9ebb631f 100644 --- a/src/state/groupActions.test.ts +++ b/src/state/groupActions.test.ts @@ -44,7 +44,6 @@ function project(groups: Group[]): Project { drawingLevels: [], layers: [], walls: [], - doors: [], drawings2d: [], groups, }; diff --git a/src/state/projectSlice.ts b/src/state/projectSlice.ts index 5282caa5..d71d4717 100644 --- a/src/state/projectSlice.ts +++ b/src/state/projectSlice.ts @@ -670,7 +670,6 @@ export function createProjectSlice( ceilings: (p.ceilings ?? []).filter((c) => c.floorId !== id), stairs: (p.stairs ?? []).filter((s) => s.floorId !== id), rooms: (p.rooms ?? []).filter((r) => r.floorId !== id), - doors: p.doors.filter((d) => !removedWallIds.has(d.hostWallId)), openings: (p.openings ?? []).filter( (o) => !removedWallIds.has(o.hostWallId), ), @@ -739,11 +738,10 @@ export function createProjectSlice( if (!src) return p; const codes = new Set(flattenCategories([src]).map((c) => c.code)); const usedByWall = p.walls.some((w) => codes.has(w.categoryCode)); - const usedByDoor = p.doors.some((d) => codes.has(d.categoryCode)); const usedByOpening = (p.openings ?? []).some((o) => codes.has(o.categoryCode), ); - if (usedByWall || usedByDoor || usedByOpening) { + if (usedByWall || usedByOpening) { get().notify(t("alert.layerInUse", { code: src.code, name: src.name }), "warning"); return p; } diff --git a/src/state/projectStore.test.ts b/src/state/projectStore.test.ts index 40d49899..319fcd04 100644 --- a/src/state/projectStore.test.ts +++ b/src/state/projectStore.test.ts @@ -23,7 +23,6 @@ function makeProject(overrides?: Partial): Project { drawingLevels: [], layers: [], walls: [], - doors: [], ...overrides, } as Project; } diff --git a/src/state/selectionInfo.contextImage.test.ts b/src/state/selectionInfo.contextImage.test.ts index 5e7ea00d..f204dfbf 100644 --- a/src/state/selectionInfo.contextImage.test.ts +++ b/src/state/selectionInfo.contextImage.test.ts @@ -22,7 +22,6 @@ function projectWith(context: Project["context"]): Project { ], layers: [], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/state/selectionLayers.test.ts b/src/state/selectionLayers.test.ts index 5ad0a8fc..3baa21d6 100644 --- a/src/state/selectionLayers.test.ts +++ b/src/state/selectionLayers.test.ts @@ -10,7 +10,7 @@ const project = { layers, walls: [{ id: "w1", categoryCode: "20" }], drawings2d: [{ id: "d1", categoryCode: "100" }, { id: "d2", categoryCode: "101" }, { id: "d3", categoryCode: "100" }], - doors: [{ id: "t1", categoryCode: "20" }], + openings: [{ id: "t1", categoryCode: "20" }], } as unknown as Project; describe("Ebenen der Auswahl", () => { diff --git a/src/state/selectionLayers.ts b/src/state/selectionLayers.ts index af555433..1225d7ae 100644 --- a/src/state/selectionLayers.ts +++ b/src/state/selectionLayers.ts @@ -30,7 +30,7 @@ export function selectionCategoryCodes(project: Project, sel: SelectionMembers): [sel.stairIds, p.stairs ?? []], [sel.columnIds, p.columns ?? []], [sel.roofIds, p.roofs ?? []], - [sel.openingIds, [...(p.openings ?? []), ...(p.doors ?? [])]], + [sel.openingIds, p.openings ?? []], ]; const out = new Set(); for (const [ids, objects] of sources) { diff --git a/src/tools/snapping.test.ts b/src/tools/snapping.test.ts index 7cb5d88c..90b3fbbe 100644 --- a/src/tools/snapping.test.ts +++ b/src/tools/snapping.test.ts @@ -47,7 +47,6 @@ function wallProject(wall: Wall): Project { ], layers: [{ code: "20", name: "Wände", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [wall], - doors: [], openings: [], ceilings: [], stairs: [], @@ -160,7 +159,6 @@ function drawProject(geoms: Drawing2D["geom"][]): Project { ], layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }], walls: [], - doors: [], openings: [], ceilings: [], stairs: [], diff --git a/src/tools/transform.test.ts b/src/tools/transform.test.ts index 11f8cac1..2a3e54c1 100644 --- a/src/tools/transform.test.ts +++ b/src/tools/transform.test.ts @@ -23,7 +23,6 @@ function project(drawings: Drawing2D[]): Project { drawingLevels: [], layers: [], walls: [], - doors: [], drawings2d: drawings, }; }