[5] Doppelspur Door/Opening aufgeloest: Formatversion 2 migriert Legacy-Tueren zu Oeffnungen (kind door), Project.doors und Door entfernt, Legacy-Pfade in Plan/Schnitt/Ansicht/3D/Liste gestrichen; Tests angepasst
This commit is contained in:
1 parent
346798eee6
commit
b0270bae3e
94 files changed
+100
-367
No files matched your search
@@ -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),
|
||||
|
||||
@@ -41,6 +41,10 @@
|
||||
<line x1="6.1725" y1="7.08564" x2="6.1725" y2="4.48564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="6.1725" y1="4.48564" x2="6.1725" y2="1.88564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<polygon points="0.8275,1.88564 6.1725,1.88564 6.1725,2.11314 0.8275,2.11314 0.8275,2.11314" fill="#8f959e" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="1.8,7.08564 2.7,7.08564 2.7,4.98564 1.8,4.98564" fill="#d9d9d4" stroke="#2b3039" stroke-width="0.018" stroke-linejoin="round"/>
|
||||
<polygon points="1.836,7.08564 2.664,7.08564 2.664,5.04864 1.836,5.04864" fill="#ede6d9" stroke="#2b3039" stroke-width="0.013" stroke-linejoin="round"/>
|
||||
<polygon points="1.8,5.06564 2.7,5.06564 2.7,4.98564 1.8,4.98564" fill="#a7adb5" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="1.8,7.08564 1.88,7.08564 1.88,5.06564 1.8,5.06564" fill="#a7adb5" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="4,6.18564 5,6.18564 5,4.98564 4,4.98564" fill="#d9d9d4" stroke="#2b3039" stroke-width="0.018" stroke-linejoin="round"/>
|
||||
<polygon points="3.98,6.22064 5.02,6.22064 5.02,6.18564 3.98,6.18564" fill="#cccccb" stroke="#2b3039" stroke-width="0.013" stroke-linejoin="round"/>
|
||||
<polygon points="3.95,6.24564 5.05,6.24564 5.05,6.22064 3.95,6.22064" fill="#cccccb" stroke="#2b3039" stroke-width="0.013" stroke-linejoin="round"/>
|
||||
@@ -52,10 +56,6 @@
|
||||
<line x1="4.88" y1="5.10564" x2="4.12" y2="5.58564" stroke="#7d858f" stroke-width="0.01" stroke-dasharray="0.22 0.18"/>
|
||||
<line x1="4.12" y1="6.06564" x2="4.5" y2="5.10564" stroke="#7d858f" stroke-width="0.01" stroke-dasharray="0.22 0.18"/>
|
||||
<line x1="4.88" y1="6.06564" x2="4.5" y2="5.10564" stroke="#7d858f" stroke-width="0.01" stroke-dasharray="0.22 0.18"/>
|
||||
<polygon points="1.8,7.08564 2.7,7.08564 2.7,4.98564 1.8,4.98564" fill="#d9d9d4" stroke="#2b3039" stroke-width="0.018" stroke-linejoin="round"/>
|
||||
<polygon points="1.836,7.08564 2.664,7.08564 2.664,5.04864 1.836,5.04864" fill="#ede6d9" stroke="#2b3039" stroke-width="0.013" stroke-linejoin="round"/>
|
||||
<polygon points="1.8,5.06564 2.7,5.06564 2.7,4.98564 1.8,4.98564" fill="#a7adb5" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="1.8,7.08564 1.88,7.08564 1.88,5.06564 1.8,5.06564" fill="#a7adb5" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<line x1="0.6" y1="1.88564" x2="6.4" y2="1.88564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="6.4" y1="1.88564" x2="6.4" y2="0.5" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="6.4" y1="0.5" x2="0.6" y2="0.5" stroke="#2b3039" stroke-width="0.013"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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<string, unknown>;
|
||||
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);
|
||||
});
|
||||
});
|
||||
+33
-3
@@ -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<string, unknown>) => Record<string, unknown>> = [
|
||||
// 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<Record<string, unknown>>) : [];
|
||||
const { doors: _drop, ...rest } = raw;
|
||||
if (doors.length === 0) return rest;
|
||||
const openings = Array.isArray(rest.openings) ? [...(rest.openings as Array<Record<string, unknown>>)] : [];
|
||||
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<string>([
|
||||
"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",
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -69,7 +69,6 @@ function project(patch?: Partial<Project>): Project {
|
||||
drawingLevels: [],
|
||||
layers: [],
|
||||
walls: [],
|
||||
doors: [],
|
||||
drawings2d: [],
|
||||
...patch,
|
||||
};
|
||||
|
||||
@@ -22,7 +22,6 @@ function baseProject(overrides: Partial<Project> = {}): Project {
|
||||
drawingLevels: [],
|
||||
layers: [],
|
||||
walls: [],
|
||||
doors: [],
|
||||
drawings2d: [],
|
||||
...overrides,
|
||||
};
|
||||
|
||||
+16
-14
@@ -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: [],
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -41,7 +41,6 @@ function makeProject(overrides?: Partial<Project>): Project {
|
||||
],
|
||||
layers: [{ code: "30", name: "Decken", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }],
|
||||
walls: [],
|
||||
doors: [],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -34,7 +34,6 @@ function project(drawings: Drawing2D[]): Project {
|
||||
],
|
||||
layers: SHARED.layers,
|
||||
walls: [],
|
||||
doors: [],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -20,7 +20,6 @@ function projectWith(context: Project["context"]): Project {
|
||||
],
|
||||
layers: [],
|
||||
walls: [],
|
||||
doors: [],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -36,7 +36,6 @@ function project(drawings: Drawing2D[], levels = [level("L1")]): Project {
|
||||
wallTypes: [],
|
||||
drawingLevels: levels,
|
||||
walls: [],
|
||||
doors: [],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
|
||||
@@ -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: [
|
||||
{
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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`).
|
||||
|
||||
@@ -43,7 +43,6 @@ function project(overrides: Partial<Project> = {}): Project {
|
||||
drawingLevels: [],
|
||||
layers: [category],
|
||||
walls: [],
|
||||
doors: [],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 ?? [];
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
@@ -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
|
||||
? [
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ const project = {
|
||||
ceilings: [],
|
||||
roofs: [],
|
||||
openings: [],
|
||||
doors: [],
|
||||
components: [],
|
||||
wallTypes: [],
|
||||
drawingLevels: [{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false }],
|
||||
|
||||
@@ -43,7 +43,6 @@ function project(r: Roof, extra: Partial<Project> = {}): Project {
|
||||
drawingLevels: [],
|
||||
layers: [],
|
||||
walls: [],
|
||||
doors: [],
|
||||
roofs: [r],
|
||||
...extra,
|
||||
} as unknown as Project;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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: [],
|
||||
});
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -44,7 +44,6 @@ function project(groups: Group[]): Project {
|
||||
drawingLevels: [],
|
||||
layers: [],
|
||||
walls: [],
|
||||
doors: [],
|
||||
drawings2d: [],
|
||||
groups,
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ function makeProject(overrides?: Partial<Project>): Project {
|
||||
drawingLevels: [],
|
||||
layers: [],
|
||||
walls: [],
|
||||
doors: [],
|
||||
...overrides,
|
||||
} as Project;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ function projectWith(context: Project["context"]): Project {
|
||||
],
|
||||
layers: [],
|
||||
walls: [],
|
||||
doors: [],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
@@ -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<string>();
|
||||
for (const [ids, objects] of sources) {
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -23,7 +23,6 @@ function project(drawings: Drawing2D[]): Project {
|
||||
drawingLevels: [],
|
||||
layers: [],
|
||||
walls: [],
|
||||
doors: [],
|
||||
drawings2d: drawings,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user