[K3d][K4] Grundriss-Domänen aus dem Kern-Dokument: Overrides, Decken, Dächer, Räume, Wände+Öffnungen, Treppen, Stützen, Extrusionen, Kontext, Schnittlinien
Neue Abfrage `planDomains` (src-tauri/core/src/plan/{domains,walls,stairs,context,overrides}.rs)
liefert die fertigen Primitive (JSON wie TS) samt Ausmass; generatePlan ruft sie einmal je
Geschoss und setzt die Primitive an ihre Stelle der Zeichenreihenfolge. Override-Regeln,
Stil-Auflösung (By-Layer/By-Object, Schraffur, Fugen-Linienstil), Verschneidung, Raumstempel-
Daten (roomStampToDoc/ExtraLines, js_number) laufen im Kern.
Gelöscht: generatePlan/{ceilings,roofs,rooms,structures,walls,openings,stairs,context,sections}.ts,
model/joins.ts (+ Test, fehlende Fälle in joins.rs), tote Bindungen und TS-Helfer.
Gleichheit: Primitive-JSON bitgleich zur alten TS-Fassung (Beispiel + 80 Zufallsprojekte,
972 Pläne inkl. Fehlerfälle), CLI-SVG byte-gleich. Nicht in der Tauri-App angesehen.
Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
42 files changed
+1908
-2645
No files matched your search
@@ -172,7 +172,7 @@ function wallDraft(points: Vec2[], cursor: Vec2 | null, thickness: number): Tool
|
||||
* Hängt je Achssegment ein `Wall` des aktiven Typs ans Projekt (immutabel). Höhe
|
||||
* aus dem aktiven Geschoss (floorHeight), Geschoss + Kategorie + Wandtyp aus dem
|
||||
* Context. Null-Strecken werden übersprungen. Gehrung an Ecken entsteht später
|
||||
* automatisch aus computeJoins (generatePlan).
|
||||
* automatisch aus der Verschneidung im Kern (`joins.rs`).
|
||||
*/
|
||||
function appendWalls(
|
||||
p: Project,
|
||||
|
||||
@@ -28,7 +28,8 @@ export type QueryName =
|
||||
| "scheduleRows"
|
||||
| "scheduleCsv"
|
||||
| "pickGeometry"
|
||||
| "model3dParts";
|
||||
| "model3dParts"
|
||||
| "planDomains";
|
||||
|
||||
export class ProjectDocument {
|
||||
private handle = 0;
|
||||
|
||||
@@ -1,454 +0,0 @@
|
||||
/**
|
||||
* Unit-Tests für die Wand-Gehrung (computeJoins / miterLine):
|
||||
* • Rechtwinklige L-Ecke: die Gehrung liegt auf der 45°-Diagonalen und trifft
|
||||
* die korrekten Fläche×Fläche-Apexe.
|
||||
* • SPITZE L-Ecke (Öffnungswinkel < 90°): die Gehrung muss weiterhin Außen mit
|
||||
* Außen und Innen mit Innen paaren. Die frühere Distanz-Heuristik kippte hier
|
||||
* und lieferte eine um 90° verdrehte Gehrung (Kreuz-Overlap der Poché-Bänder);
|
||||
* dieser Test fängt den Regress.
|
||||
* • T-Knoten (drei Wandenden am selben Punkt): das abzweigende Ende bekommt
|
||||
* einen Schnitt auf der zugewandten Fläche der Durchgangswand, die beiden
|
||||
* kollinearen Enden bleiben ungeschnitten.
|
||||
* • Mittelspannen-T-Stoß: ein freies Ende, das mitten auf die Seite einer
|
||||
* anderen Wand trifft, bekommt einen Schnitt auf deren Fläche; ohne Treffer
|
||||
* bleibt es rechtwinklig (null).
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { computeJoins, resolveJoinPriority } from "./joins";
|
||||
import { cross, len, sub } from "./geometry";
|
||||
import type { Line } from "./geometry";
|
||||
import type { Component, Project, Vec2, Wall } from "./types";
|
||||
|
||||
/** Abstand eines Punktes P von der unendlichen Geraden `line`. */
|
||||
function distToLine(line: Line, p: Vec2): number {
|
||||
return Math.abs(cross(line.dir, sub(p, line.point))) / len(line.dir);
|
||||
}
|
||||
|
||||
/** Minimalprojekt aus zwei Wänden mit einem Wandtyp gegebener Gesamtdicke. */
|
||||
function twoWallProject(w1: Wall, w2: Wall, thickness: number): Project {
|
||||
return {
|
||||
id: "t",
|
||||
name: "T",
|
||||
lineStyles: [],
|
||||
hatches: [],
|
||||
components: [{ id: "c", name: "C", color: "#ccc", hatchId: "none", joinPriority: 10 }],
|
||||
wallTypes: [
|
||||
{ id: "aw", name: "AW", layers: [{ componentId: "c", thickness }] },
|
||||
],
|
||||
drawingLevels: [
|
||||
{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false, floorHeight: 2.6, cutHeight: 1.0, baseElevation: 0 },
|
||||
],
|
||||
layers: [{ code: "20", name: "Wände", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }],
|
||||
walls: [w1, w2],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
rooms: [],
|
||||
drawings2d: [],
|
||||
context: [],
|
||||
};
|
||||
}
|
||||
|
||||
/** Minimalprojekt aus drei Wänden mit einem Wandtyp gegebener Gesamtdicke. */
|
||||
function threeWallProject(
|
||||
w1: Wall,
|
||||
w2: Wall,
|
||||
w3: Wall,
|
||||
thickness: number,
|
||||
): Project {
|
||||
const proj = twoWallProject(w1, w2, thickness);
|
||||
proj.walls = [w1, w2, w3];
|
||||
return proj;
|
||||
}
|
||||
|
||||
function wall(id: string, start: Vec2, end: Vec2): Wall {
|
||||
return {
|
||||
id,
|
||||
type: "wall",
|
||||
floorId: "eg",
|
||||
categoryCode: "20",
|
||||
start,
|
||||
end,
|
||||
wallTypeId: "aw",
|
||||
height: 2.6,
|
||||
};
|
||||
}
|
||||
|
||||
describe("computeJoins — Gehrung an der L-Ecke", () => {
|
||||
it("legt die rechtwinklige Gehrung auf die 45°-Diagonale (Fläche×Fläche-Apexe)", () => {
|
||||
// W1 (0,0)→(5,0), W2 (5,0)→(5,4); Knoten (5,0). T=0.4, half=0.2.
|
||||
const proj = twoWallProject(
|
||||
wall("W1", { x: 0, y: 0 }, { x: 5, y: 0 }),
|
||||
wall("W2", { x: 5, y: 0 }, { x: 5, y: 4 }),
|
||||
0.4,
|
||||
);
|
||||
const joins = computeJoins(proj, proj.walls);
|
||||
const cut = joins.get("W1")!.endCut;
|
||||
expect(cut).not.toBeNull();
|
||||
// Außen-Apex (5.2,−0.2) und Innen-Apex (4.8,0.2) liegen auf der Gehrung;
|
||||
// Richtung ist die 45°-Diagonale.
|
||||
expect(distToLine(cut!, { x: 5.2, y: -0.2 })).toBeCloseTo(0, 6);
|
||||
expect(distToLine(cut!, { x: 4.8, y: 0.2 })).toBeCloseTo(0, 6);
|
||||
expect(Math.abs(cut!.dir.x)).toBeCloseTo(Math.abs(cut!.dir.y), 6);
|
||||
});
|
||||
|
||||
it("paart bei SPITZEM Winkel Außen-mit-Außen und Innen-mit-Innen (kein Kreuz-Overlap)", () => {
|
||||
// Symmetrische V-Ecke, Knoten (0,0), Öffnungswinkel 60° (spitz), nach oben.
|
||||
// Beide Wandkörper laufen unter ±30° zur +y-Achse aus:
|
||||
// gA = (−sin30, cos30) = (−0.5, √3/2), gB = (+0.5, √3/2).
|
||||
// W_A: end im Knoten (start = gA·2), W_B: start im Knoten (end = gB·2).
|
||||
const s3 = Math.sqrt(3) / 2;
|
||||
const proj = twoWallProject(
|
||||
wall("WA", { x: -1, y: 2 * s3 }, { x: 0, y: 0 }),
|
||||
wall("WB", { x: 0, y: 0 }, { x: 1, y: 2 * s3 }),
|
||||
0.4,
|
||||
);
|
||||
const joins = computeJoins(proj, proj.walls);
|
||||
// Beide Wände teilen dieselbe Gehrung; WA endet im Knoten, WB startet dort.
|
||||
const cut = joins.get("WA")!.endCut ?? joins.get("WB")!.startCut;
|
||||
expect(cut).not.toBeNull();
|
||||
|
||||
// Korrekt: Außen-Apex (0,−0.4) und Innen-Apex (0,0.4) → vertikale Gehrung
|
||||
// (Richtung parallel zur y-Achse). Die buggy Distanz-Heuristik lieferte
|
||||
// stattdessen eine HORIZONTALE Gehrung (Apexe (±0.23,0)) → hier rot.
|
||||
expect(distToLine(cut!, { x: 0, y: -0.4 })).toBeCloseTo(0, 6);
|
||||
expect(distToLine(cut!, { x: 0, y: 0.4 })).toBeCloseTo(0, 6);
|
||||
// Gehrung vertikal: dir.x ≈ 0 (die falsche, horizontale Gehrung hätte dir.y ≈ 0).
|
||||
const dir = cut!.dir;
|
||||
expect(Math.abs(dir.x) / len(dir)).toBeCloseTo(0, 6);
|
||||
});
|
||||
});
|
||||
|
||||
describe("computeJoins — T-Knoten (drei Wandenden am selben Punkt)", () => {
|
||||
it("schneidet nur das abzweigende Ende, auf der zugewandten Fläche der Durchgangswand", () => {
|
||||
// Durchgangswand in zwei Hälften WA1 (0,0)→(5,0) und WA2 (5,0)→(10,0),
|
||||
// Abzweig WB (5,0)→(5,3) nach oben. T=0.4 → halbe Dicke 0.2.
|
||||
const proj = threeWallProject(
|
||||
wall("WA1", { x: 0, y: 0 }, { x: 5, y: 0 }),
|
||||
wall("WA2", { x: 5, y: 0 }, { x: 10, y: 0 }),
|
||||
wall("WB", { x: 5, y: 0 }, { x: 5, y: 3 }),
|
||||
0.4,
|
||||
);
|
||||
const joins = computeJoins(proj, proj.walls);
|
||||
|
||||
// Die kollinearen Hälften der Durchgangswand bleiben ungeschnitten.
|
||||
expect(joins.get("WA1")!.endCut).toBeNull();
|
||||
expect(joins.get("WA2")!.startCut).toBeNull();
|
||||
|
||||
// Der Abzweig bekommt einen Schnitt auf der ihm zugewandten (oberen)
|
||||
// Fläche der Durchgangswand: die horizontale Gerade y = 0.2.
|
||||
const cut = joins.get("WB")!.startCut;
|
||||
expect(cut).not.toBeNull();
|
||||
expect(distToLine(cut!, { x: 5, y: 0.2 })).toBeCloseTo(0, 6);
|
||||
expect(distToLine(cut!, { x: 0, y: 0.2 })).toBeCloseTo(0, 6);
|
||||
// Gehrungsgerade horizontal (parallel zur Durchgangsachse).
|
||||
expect(Math.abs(cut!.dir.y) / len(cut!.dir)).toBeCloseTo(0, 6);
|
||||
});
|
||||
});
|
||||
|
||||
describe("computeJoins — Mittelspannen-T-Stoß (Ende trifft Wandseite)", () => {
|
||||
it("schneidet ein freies Ende, das auf die Seite einer anderen Wand trifft, entlang deren Fläche", () => {
|
||||
// Durchgangswand W (0,0)→(10,0), T=0.4 → halbe Dicke 0.2. Abzweig WB2
|
||||
// trifft mit seinem freien Ende (4, 0.2) genau auf die obere Fläche.
|
||||
const proj = threeWallProject(
|
||||
wall("W", { x: 0, y: 0 }, { x: 10, y: 0 }),
|
||||
wall("WB2", { x: 4, y: 3 }, { x: 4, y: 0.2 }),
|
||||
wall("Filler", { x: 100, y: 100 }, { x: 100, y: 103 }), // unbeteiligt
|
||||
0.4,
|
||||
);
|
||||
const joins = computeJoins(proj, proj.walls);
|
||||
|
||||
const cut = joins.get("WB2")!.endCut;
|
||||
expect(cut).not.toBeNull();
|
||||
expect(distToLine(cut!, { x: 0, y: 0.2 })).toBeCloseTo(0, 6);
|
||||
expect(distToLine(cut!, { x: 5, y: 0.2 })).toBeCloseTo(0, 6);
|
||||
expect(Math.abs(cut!.dir.y) / len(cut!.dir)).toBeCloseTo(0, 6);
|
||||
|
||||
// Die Wand W selbst bleibt an ihren (freien) Enden ungeschnitten.
|
||||
expect(joins.get("W")!.startCut).toBeNull();
|
||||
expect(joins.get("W")!.endCut).toBeNull();
|
||||
// Das obere, unbeteiligte Ende von WB2 bleibt ebenfalls ungeschnitten.
|
||||
expect(joins.get("WB2")!.startCut).toBeNull();
|
||||
});
|
||||
|
||||
it("lässt ein freies Ende rechtwinklig (null), wenn keine Wand nah genug getroffen wird", () => {
|
||||
// Gleiche Anordnung, aber Abzweig-Ende bei y=0.5 — außerhalb der
|
||||
// Wandfläche (Dicke/2 + Toleranz = 0.201).
|
||||
const proj = twoWallProject(
|
||||
wall("W", { x: 0, y: 0 }, { x: 10, y: 0 }),
|
||||
wall("WB3", { x: 4, y: 3 }, { x: 4, y: 0.5 }),
|
||||
0.4,
|
||||
);
|
||||
const joins = computeJoins(proj, proj.walls);
|
||||
expect(joins.get("WB3")!.endCut).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("computeJoins — „+\"-Kreuzung (zwei kollineare Enden kreuzen eine durchlaufende Wand)", () => {
|
||||
it("schneidet BEIDE kollinearen Hälften gegen die jeweils zugewandte (gegenüberliegende) Fläche der durchlaufenden Wand", () => {
|
||||
// Vertikale Durchgangswand V (6,2)→(6,11), T=0.3 → halbe Dicke 0.15. Zwei
|
||||
// kollineare horizontale Hälften HL (0,6)→(6,6) und HR (6,6)→(12,6) treffen
|
||||
// sich exakt AUF DER ACHSE von V (x=6) — eine reale „+"-Kreuzung, wie sie
|
||||
// beim Zeichnen einer durchlaufenden Trennwand entsteht, die von einer
|
||||
// weiteren durchlaufenden Wand gekreuzt wird (Regressionstest für den per
|
||||
// Massstabsprobe gefundenen Bug: vorher blieb V für Fall 1 unsichtbar, weil
|
||||
// sie an diesem Punkt keinen eigenen Endpunkt hat, und Fall 2 prüfte nur
|
||||
// echte EINZEL-Enden — HL/HR bekamen dadurch gar keinen Schnitt).
|
||||
const proj = threeWallProject(
|
||||
wall("V", { x: 6, y: 2 }, { x: 6, y: 11 }),
|
||||
wall("HL", { x: 0, y: 6 }, { x: 6, y: 6 }),
|
||||
wall("HR", { x: 6, y: 6 }, { x: 12, y: 6 }),
|
||||
0.3,
|
||||
);
|
||||
const joins = computeJoins(proj, proj.walls);
|
||||
|
||||
// Die Durchgangswand V bleibt an ihren (freien) Enden unangetastet.
|
||||
expect(joins.get("V")!.startCut).toBeNull();
|
||||
expect(joins.get("V")!.endCut).toBeNull();
|
||||
|
||||
// HL läuft nach −x aus → Schnitt an der LINKEN Fläche von V (x=5.85).
|
||||
const cutL = joins.get("HL")!.endCut;
|
||||
expect(cutL).not.toBeNull();
|
||||
expect(distToLine(cutL!, { x: 5.85, y: 2 })).toBeCloseTo(0, 6);
|
||||
expect(distToLine(cutL!, { x: 5.85, y: 11 })).toBeCloseTo(0, 6);
|
||||
|
||||
// HR läuft nach +x aus → Schnitt an der RECHTEN Fläche von V (x=6.15) —
|
||||
// die GEGENÜBERLIEGENDE Fläche, nicht dieselbe wie HL (der eigentliche Bug:
|
||||
// beide Enden teilen sich denselben Kreuzungspunkt, `perp` allein kann sie
|
||||
// nicht unterscheiden — erst die eigene Auslaufrichtung tut das).
|
||||
const cutR = joins.get("HR")!.startCut;
|
||||
expect(cutR).not.toBeNull();
|
||||
expect(distToLine(cutR!, { x: 6.15, y: 2 })).toBeCloseTo(0, 6);
|
||||
expect(distToLine(cutR!, { x: 6.15, y: 11 })).toBeCloseTo(0, 6);
|
||||
expect(distToLine(cutL!, { x: 6.15, y: 6 })).not.toBeCloseTo(0, 3);
|
||||
});
|
||||
|
||||
it("lässt einen echten Stern-Knoten (4 Wandenden treffen sich, keine läuft durch) weiterhin rechtwinklig", () => {
|
||||
// Vier Wand-STUMMEL enden alle exakt bei (5,5), keiner läuft darüber
|
||||
// hinaus weiter — kein Durchgang erkennbar, bewusst dokumentierte
|
||||
// Restlücke (s. Kommentar in computeJoins).
|
||||
const proj: Project = twoWallProject(
|
||||
wall("A", { x: 0, y: 5 }, { x: 5, y: 5 }),
|
||||
wall("B", { x: 5, y: 5 }, { x: 10, y: 5 }),
|
||||
0.3,
|
||||
);
|
||||
proj.walls.push(
|
||||
wall("C", { x: 5, y: 5 }, { x: 5, y: 0 }),
|
||||
wall("D", { x: 5, y: 5 }, { x: 5, y: 10 }),
|
||||
);
|
||||
const joins = computeJoins(proj, proj.walls);
|
||||
for (const id of ["A", "B", "C", "D"]) {
|
||||
const c = joins.get(id)!;
|
||||
expect(c.startCut ?? c.endCut).toBeNull();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveJoinPriority — Ordnungslogik zweier Bauteile am Stoss", () => {
|
||||
const brick: Component = { id: "brick", name: "Backstein", color: "#8c5544", hatchId: "none", joinPriority: 50 };
|
||||
const brick2: Component = { id: "brick", name: "Backstein (Kopie)", color: "#000", hatchId: "none", joinPriority: 50 };
|
||||
const render: Component = { id: "render", name: "Putz", color: "#efece6", hatchId: "none", joinPriority: 10 };
|
||||
const insulation: Component = { id: "insulation", name: "Dämmung", color: "#fff", hatchId: "none", joinPriority: 20 };
|
||||
const concrete: Component = { id: "concrete", name: "Beton", color: "#9aa0a6", hatchId: "none", joinPriority: 100 };
|
||||
|
||||
it("verschmilzt bei gleicher Priorität UND gleicher Komponente", () => {
|
||||
expect(resolveJoinPriority(brick, brick2)).toBe("merge");
|
||||
});
|
||||
|
||||
it("koexistiert bei gleicher Priorität, aber verschiedener Komponente", () => {
|
||||
// Zwei fiktive Komponenten mit zufällig gleicher Priorität, aber
|
||||
// unterschiedlicher Identität — keine eindeutige Rangfolge.
|
||||
const other: Component = { id: "other-30", name: "X", color: "#123", hatchId: "none", joinPriority: 20 };
|
||||
expect(resolveJoinPriority(insulation, other)).toBe("coexist");
|
||||
});
|
||||
|
||||
it("lässt die höhere Priorität gewinnen (die niedrigere wird getrimmt)", () => {
|
||||
expect(resolveJoinPriority(render, brick)).toBe("trim-a"); // a=Putz verliert
|
||||
expect(resolveJoinPriority(brick, render)).toBe("trim-b"); // b=Putz verliert
|
||||
expect(resolveJoinPriority(concrete, brick)).toBe("trim-b");
|
||||
expect(resolveJoinPriority(brick, concrete)).toBe("trim-a");
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Minimalprojekt mit einem mehrschichtigen, W9-artigen Wandtyp
|
||||
* (Innenputz/Backstein-Kern/Innenputz, wie `sampleProject`s "iw") — für die
|
||||
* materialbewusste T-Stoss-Erweiterung (layerCuts).
|
||||
*/
|
||||
function layeredWallProject(w1: Wall, w2: Wall, w3: Wall): Project {
|
||||
return {
|
||||
id: "t",
|
||||
name: "T",
|
||||
lineStyles: [],
|
||||
hatches: [],
|
||||
components: [
|
||||
{ id: "render-int", name: "Innenputz", color: "#efece6", hatchId: "none", joinPriority: 10 },
|
||||
{ id: "brick", name: "Backstein", color: "#8c5544", hatchId: "none", joinPriority: 50 },
|
||||
],
|
||||
wallTypes: [
|
||||
{
|
||||
id: "iw",
|
||||
name: "Innenwand",
|
||||
layers: [
|
||||
{ componentId: "render-int", thickness: 0.015 },
|
||||
{ componentId: "brick", thickness: 0.12 },
|
||||
{ componentId: "render-int", thickness: 0.015 },
|
||||
],
|
||||
},
|
||||
],
|
||||
drawingLevels: [
|
||||
{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false, floorHeight: 2.6, cutHeight: 1.0, baseElevation: 0 },
|
||||
],
|
||||
layers: [{ code: "20", name: "Wände", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }],
|
||||
walls: [w1, w2, w3],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
rooms: [],
|
||||
drawings2d: [],
|
||||
context: [],
|
||||
};
|
||||
}
|
||||
|
||||
function iwWall(id: string, start: Vec2, end: Vec2): Wall {
|
||||
return {
|
||||
id,
|
||||
type: "wall",
|
||||
floorId: "eg",
|
||||
categoryCode: "20",
|
||||
start,
|
||||
end,
|
||||
wallTypeId: "iw",
|
||||
height: 2.6,
|
||||
};
|
||||
}
|
||||
|
||||
describe("computeJoins — materialbewusster T-Stoss (layerCuts)", () => {
|
||||
it("W9-artiger T-Knoten: Backstein-Kern des Abzweigs sticht bis zur Rückgrat-Nahfläche durch, Putz wird getrimmt — materialgleicher Nah-Putz ⇒ KEINE L-Trennnaht", () => {
|
||||
// Durchgangswand WA1 (0,0)→(5,0) / WA2 (5,0)→(10,0), Abzweig WB (5,0)→(5,3),
|
||||
// alle vom selben Wandtyp "iw" (Innenputz/Backstein/Innenputz, T=0.15).
|
||||
const proj = layeredWallProject(
|
||||
iwWall("WA1", { x: 0, y: 0 }, { x: 5, y: 0 }),
|
||||
iwWall("WA2", { x: 5, y: 0 }, { x: 10, y: 0 }),
|
||||
iwWall("WB", { x: 5, y: 0 }, { x: 5, y: 3 }),
|
||||
);
|
||||
const joins = computeJoins(proj, proj.walls);
|
||||
const cuts = joins.get("WB")!;
|
||||
|
||||
// Aggregat-Cut bleibt unverändert (bit-identisch zum bisherigen Verhalten).
|
||||
expect(cuts.startCut).not.toBeNull();
|
||||
expect(distToLine(cuts.startCut!, { x: 5, y: 0.075 })).toBeCloseTo(0, 6);
|
||||
|
||||
// layerCuts ist gesetzt (mindestens eine Schicht verschmilzt).
|
||||
expect(cuts.layerCuts).toBeDefined();
|
||||
const lc = cuts.layerCuts!;
|
||||
expect(lc.start.length).toBe(3);
|
||||
|
||||
// Schicht 1 (Backstein-Kern, Index 1) verschmilzt: Cut an der Nahfläche des
|
||||
// Durchgangs-Rückgrats — NICHT null (Achse) und NICHT die Aggregat-Nahfläche
|
||||
// (0.075). Durchgangswand-Halbdicke 0.075 minus Nah-Putz 0.015 → y = 0.06.
|
||||
expect(lc.start[1]).not.toBeNull();
|
||||
expect(distToLine(lc.start[1]!, { x: 5, y: 0.06 })).toBeCloseTo(0, 6);
|
||||
expect(distToLine(lc.start[1]!, { x: 0, y: 0.06 })).toBeCloseTo(0, 6);
|
||||
// Der Kern läuft NICHT bis zur Achse (y=0) durch.
|
||||
expect(distToLine(lc.start[1]!, { x: 5, y: 0 })).not.toBeCloseTo(0, 6);
|
||||
expect(lc.startSide[1]).toBeNull();
|
||||
|
||||
// Schichten 0 und 2 (Innenputz) werden getrimmt: derselbe Nahflächen-Cut
|
||||
// wie das Aggregat...
|
||||
expect(lc.start[0]).not.toBeNull();
|
||||
expect(lc.start[2]).not.toBeNull();
|
||||
expect(distToLine(lc.start[0]!, { x: 5, y: 0.075 })).toBeCloseTo(0, 6);
|
||||
expect(distToLine(lc.start[2]!, { x: 5, y: 0.075 })).toBeCloseTo(0, 6);
|
||||
// ... aber KEINE L-Seitenlinie: der Nah-Putz der Durchgangswand ist
|
||||
// materialgleicher Innenputz und füllt den getrimmten Abzweig-Putz an den
|
||||
// Flanken durchgehend (der spanCutout schneidet nur die Kernbreite aus).
|
||||
// Es entsteht ein durchgehendes Putz-L ohne Trennnaht. Nur bei material-
|
||||
// FREMDEM Nah-Putz stünde hier eine L-Linie.
|
||||
expect(lc.startSide[0]).toBeNull();
|
||||
expect(lc.startSide[2]).toBeNull();
|
||||
|
||||
// Die kollinearen Hälften der Durchgangswand bleiben bei den layerCuts
|
||||
// unangetastet (keine Pro-Schicht-Cuts für sie).
|
||||
expect(joins.get("WA1")!.layerCuts).toBeUndefined();
|
||||
expect(joins.get("WA2")!.layerCuts).toBeUndefined();
|
||||
|
||||
// Die als Durchgang gewählte Wandhälfte bekommt eine Durchgangswand-Aussparung
|
||||
// (Phase 1c): über die Backstein-Kernbreite (0.12) im Nah-Putz-Bereich
|
||||
// (Offset 0.06…0.075). Welche Hälfte den Durchgang bildet, hängt von der
|
||||
// Knoten-Reihenfolge ab — wir prüfen die, die den Cutout trägt.
|
||||
const throughCuts = joins.get("WA1")!.spanCutouts ?? joins.get("WA2")!.spanCutouts;
|
||||
expect(throughCuts).toBeDefined();
|
||||
expect(throughCuts!.length).toBe(1);
|
||||
const sc = throughCuts![0];
|
||||
// Achsen-Intervall: Kernbreite 0.12, zentriert am Knoten (x=5 → [4.94,5.06]).
|
||||
expect(sc.to - sc.from).toBeCloseTo(0.12, 6);
|
||||
// offA = Nahfläche (0.075), offB = Rückgrat-Nahfläche (0.06).
|
||||
expect(sc.offA).toBeCloseTo(0.075, 6);
|
||||
expect(sc.offB).toBeCloseTo(0.06, 6);
|
||||
// Der Abzweig selbst trägt keine Aussparung (die gehört der Durchgangswand).
|
||||
expect(joins.get("WB")!.spanCutouts).toBeUndefined();
|
||||
// L-Ecke bzw. Wände ohne T bleiben cutout-frei (die kollineare Nicht-Durchgangs-
|
||||
// Hälfte hat keinen Cutout).
|
||||
expect(
|
||||
joins.get("WA1")!.spanCutouts === undefined ||
|
||||
joins.get("WA2")!.spanCutouts === undefined,
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("Mittelspannen-T-Stoss: die Durchgangswand bekommt einen spanCutout mit korrekter Kernbreite und Nah-Putz-Offsetzone", () => {
|
||||
// Realer W9-Fall: Durchgangswand als EINE Wand W (0,0)→(10,0), Abzweig WB
|
||||
// trifft mit seinem freien Ende (4,0) mittig auf ihre Seite. Beide iw.
|
||||
const proj = layeredWallProject(
|
||||
iwWall("W", { x: 0, y: 0 }, { x: 10, y: 0 }),
|
||||
iwWall("WB", { x: 4, y: 3 }, { x: 4, y: 0 }),
|
||||
iwWall("Filler", { x: 100, y: 100 }, { x: 100, y: 103 }), // unbeteiligt
|
||||
);
|
||||
const joins = computeJoins(proj, proj.walls);
|
||||
|
||||
const wCuts = joins.get("W")!;
|
||||
expect(wCuts.spanCutouts).toBeDefined();
|
||||
expect(wCuts.spanCutouts!.length).toBe(1);
|
||||
const sc = wCuts.spanCutouts![0];
|
||||
// Intervall um x=4, Breite = Kernbreite 0.12 → [3.94, 4.06].
|
||||
expect(sc.from).toBeCloseTo(3.94, 6);
|
||||
expect(sc.to).toBeCloseTo(4.06, 6);
|
||||
expect(sc.offA).toBeCloseTo(0.075, 6);
|
||||
expect(sc.offB).toBeCloseTo(0.06, 6);
|
||||
// Der Abzweig und die unbeteiligte Wand tragen keine Aussparung.
|
||||
expect(joins.get("WB")!.spanCutouts).toBeUndefined();
|
||||
expect(joins.get("Filler")!.spanCutouts).toBeUndefined();
|
||||
});
|
||||
|
||||
it("L-Ecke und einfacher (nicht materialbewusster) Stoss bekommen KEINEN spanCutout", () => {
|
||||
// Reine L-Ecke zweier Wände: keine Durchgangswand, kein Durchstoss.
|
||||
const proj = twoWallProject(
|
||||
wall("L1", { x: 0, y: 0 }, { x: 5, y: 0 }),
|
||||
wall("L2", { x: 5, y: 0 }, { x: 5, y: 4 }),
|
||||
0.4,
|
||||
);
|
||||
const joins = computeJoins(proj, proj.walls);
|
||||
expect(joins.get("L1")!.spanCutouts).toBeUndefined();
|
||||
expect(joins.get("L2")!.spanCutouts).toBeUndefined();
|
||||
});
|
||||
|
||||
it("setzt layerCuts NICHT, wenn kein Bauteil des Abzweigs mit dem Rückgrat der Durchgangswand übereinstimmt", () => {
|
||||
// Gleiche Anordnung, aber der Abzweig ist eine reine Einschicht-Wand ohne
|
||||
// Materialübereinstimmung zum Backstein-Rückgrat → Default-Verhalten.
|
||||
const proj = layeredWallProject(
|
||||
iwWall("WA1", { x: 0, y: 0 }, { x: 5, y: 0 }),
|
||||
iwWall("WA2", { x: 5, y: 0 }, { x: 10, y: 0 }),
|
||||
iwWall("WB", { x: 5, y: 0 }, { x: 5, y: 3 }),
|
||||
);
|
||||
proj.wallTypes.push({
|
||||
id: "solo",
|
||||
name: "Solo",
|
||||
layers: [{ componentId: "render-int", thickness: 0.1 }],
|
||||
});
|
||||
proj.walls[2] = { ...proj.walls[2], wallTypeId: "solo" };
|
||||
const joins = computeJoins(proj, proj.walls);
|
||||
expect(joins.get("WB")!.layerCuts).toBeUndefined();
|
||||
expect(joins.get("WB")!.startCut).not.toBeNull(); // Aggregat-Cut bleibt normal
|
||||
});
|
||||
});
|
||||
@@ -1,196 +0,0 @@
|
||||
// Wand-Verschneidung (Gehrung): an einer Ecke, wo zwei Wände aufeinander
|
||||
// treffen, sollen sich die Schicht-Bänder nicht überlappen, sondern an einer
|
||||
// gemeinsamen Gehrungslinie sauber stoßen. Pro Wand entstehen die optionalen
|
||||
// Schnittlinien an Start- und Endpunkt.
|
||||
//
|
||||
// Gerechnet wird im Rust-Kern (`src-tauri/core/src/joins.rs`); hier bleiben die
|
||||
// Typen, das Sammeln der Wand-Angaben aus dem `Project` und die flache Übergabe.
|
||||
|
||||
import type { Component, Project, Wall } from "./types";
|
||||
import { getComponent, getWallType } from "./types";
|
||||
import type { Line } from "./geometry";
|
||||
import { core } from "../engine/coreWasm";
|
||||
import { FlatReader, FlatWriter } from "../geometry/coreFlat";
|
||||
|
||||
/**
|
||||
* Pro-Schicht-Override der Nahflächen-Cuts (materialbewusster T-Stoss, siehe
|
||||
* {@link resolveJoinPriority}). Index = Schicht-Index im Wandtyp DIESER Wand
|
||||
* (der Abzweig-Wand). `start`/`end` ersetzen — wo gesetzt — den einheitlichen
|
||||
* `startCut`/`endCut` NUR für die jeweilige Schicht; `null` an einem Index
|
||||
* heisst: diese Schicht bekommt KEINEN Cut (verschmilzt, läuft durch).
|
||||
* `startSide`/`endSide` tragen die zusätzliche seitliche Cut-Linie einer
|
||||
* getrimmten Schicht, die an eine verschmelzende Nachbarschicht angrenzt
|
||||
* (L-Anschluss, z. B. Putz neben durchlaufendem Backstein-Kern).
|
||||
*/
|
||||
export interface LayerCuts {
|
||||
start: (Line | null)[];
|
||||
end: (Line | null)[];
|
||||
startSide: (Line | null)[];
|
||||
endSide: (Line | null)[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Aussparung der DURCHGANGSWAND an einem materialbewussten T-Stoss: über das
|
||||
* Achsen-Intervall `[from,to]` (Meter ab `wall.start` entlang der Achse) und den
|
||||
* Quer-Offsetbereich `[offA,offB]` wird die Nah-Putz-Zone der Durchgangswand
|
||||
* echt ausgeschnitten, damit der durchstechende Abzweig-Kern (Phase 1b) die
|
||||
* Durchgangswand nicht nur übermalt, sondern geometrisch aufbricht.
|
||||
*
|
||||
* OFFSET-KONVENTION (identisch zu den Schicht-Bändern in `addWallPoche`):
|
||||
* `offA`/`offB` sind Querabstände von der Wandachse ENTLANG der linken Normalen
|
||||
* `leftNormal(dir)`, inkl. Referenzversatz — also im selben Bereich wie
|
||||
* `refOff − total/2` (außen) … `refOff + total/2` (innen). `offA` ist stets die
|
||||
* NAHFLÄCHE (Wandoberfläche, `refOff + sign·total/2`), `offB` die dem Abzweig
|
||||
* zugewandte Fläche des Rückgrat-KERNS (`refOff + sign·(total/2 − nearPlaster)`)
|
||||
* — die Zone dazwischen ist exakt der Nah-Putz, den der Abzweig-Kern durchstösst.
|
||||
* `from ≤ to` ist die Projektion der Abzweig-Kernbreite auf die Durchgangsachse.
|
||||
*/
|
||||
export interface SpanCutout {
|
||||
from: number;
|
||||
to: number;
|
||||
offA: number;
|
||||
offB: number;
|
||||
}
|
||||
|
||||
/** Schnittlinien einer Wand an ihren beiden Achsenden. */
|
||||
export interface WallCuts {
|
||||
startCut: Line | null;
|
||||
endCut: Line | null;
|
||||
/**
|
||||
* Additive Erweiterung: fehlt dieses Feld, gilt weiterhin `startCut`/
|
||||
* `endCut` für ALLE Schichten (bisheriges Verhalten, bit-identisch). Wird
|
||||
* nur gesetzt, wenn an einem T-Stoss mindestens eine Schicht materialbewusst
|
||||
* verschmilzt (siehe {@link resolveJoinPriority}).
|
||||
*/
|
||||
layerCuts?: LayerCuts;
|
||||
/**
|
||||
* Additive Erweiterung (Durchgangswand-Seite): Aussparungen der Nah-Putz-Zone,
|
||||
* durch die ein Abzweig-Kern sticht. Fehlt/leer ⇒ die Wand wird unverändert
|
||||
* gezeichnet. Wird nur an der DURCHGANGSWAND gesetzt (nie am Abzweig), analog
|
||||
* additiv zu {@link layerCuts}. Siehe {@link SpanCutout}.
|
||||
*/
|
||||
spanCutouts?: SpanCutout[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Verschneidungs-Entscheidung zweier Bauteile (Komponenten) am Stoss:
|
||||
* • "merge" — gleiche Priorität UND gleiche Komponente (z. B. Backstein-
|
||||
* Kern trifft Backstein-Kern): die Schichten verschmelzen, kein Cut.
|
||||
* • "coexist" — gleiche Priorität, aber VERSCHIEDENE Komponente: keine
|
||||
* eindeutige Rangfolge, bleibt beim heutigen (getrimmten) Verhalten.
|
||||
* • "trim-a" — `b` hat die höhere Priorität und gewinnt; `a` wird getrimmt.
|
||||
* • "trim-b" — `a` hat die höhere Priorität und gewinnt; `b` wird getrimmt.
|
||||
*/
|
||||
export type JoinPriorityResolution = "merge" | "trim-a" | "trim-b" | "coexist";
|
||||
|
||||
const RESOLUTIONS: JoinPriorityResolution[] = ["merge", "trim-a", "trim-b", "coexist"];
|
||||
|
||||
export function resolveJoinPriority(
|
||||
a: Component,
|
||||
b: Component,
|
||||
): JoinPriorityResolution {
|
||||
return RESOLUTIONS[core().join_priority_resolution(a.joinPriority, b.joinPriority, a.id === b.id)] ?? "coexist";
|
||||
}
|
||||
|
||||
/**
|
||||
* Berechnet für jede Wand die Gehrungs-/Anschluss-Schnittlinien.
|
||||
* Behandelt werden: L-Ecken (genau zwei Wandenden treffen sich), T-Knoten
|
||||
* (drei Wandenden treffen sich, zwei davon kollinear), Mittelspannen-T-Stöße
|
||||
* (ein freies Wandende trifft auf die Seite einer anderen Wand) UND „+"-
|
||||
* Kreuzungen (zwei kollineare Wandenden treffen sich exakt auf der Achse einer
|
||||
* dritten, durchlaufenden Wand). Echte Stern-Knoten (vier oder mehr Wand-
|
||||
* STUMMEL am selben Punkt, keiner als Durchgang erkennbar) bleiben rechtwinklig.
|
||||
* An T-Stössen kommen die materialbewussten Pro-Schicht-Cuts (`layerCuts`) und
|
||||
* die Nah-Putz-Aussparungen der Durchgangswand (`spanCutouts`) dazu.
|
||||
*
|
||||
* `walls` ist die bereits gefilterte Wandmenge (z. B. ein Geschoss); die
|
||||
* Gehrung wird nur innerhalb dieser Menge gebildet. Wirft wie früher, wenn ein
|
||||
* benötigter Wandtyp oder ein Bauteil unbekannt ist.
|
||||
*/
|
||||
export function computeJoins(
|
||||
project: Project,
|
||||
walls: Wall[],
|
||||
): Map<string, WallCuts> {
|
||||
const w = new FlatWriter().num(walls.length);
|
||||
const compIndex = new Map<string, number>();
|
||||
for (const wall of walls) {
|
||||
w.num(wall.start.x, wall.start.y, wall.end.x, wall.end.y);
|
||||
if (wall.referenceOffset != null) w.num(3, wall.referenceOffset);
|
||||
else w.num(wall.referenceLine === "left" ? 1 : wall.referenceLine === "right" ? 2 : 0, 0);
|
||||
const wt = project.wallTypes.find((t) => t.id === wall.wallTypeId);
|
||||
if (!wt) {
|
||||
w.num(0, 0);
|
||||
continue;
|
||||
}
|
||||
w.num(1, wt.layers.length);
|
||||
for (const l of wt.layers) {
|
||||
const comp = project.components.find((c) => c.id === l.componentId);
|
||||
let idx = -1;
|
||||
if (comp) {
|
||||
idx = compIndex.get(comp.id) ?? compIndex.size;
|
||||
compIndex.set(comp.id, idx);
|
||||
}
|
||||
w.num(l.thickness, idx, comp ? comp.joinPriority : Number.NaN);
|
||||
}
|
||||
}
|
||||
const out = core().compute_joins_flat(w.done());
|
||||
const r = new FlatReader(out);
|
||||
const status = r.num();
|
||||
if (status === 1) {
|
||||
// Wandtyp oder Bauteil unbekannt: denselben Fehler werfen wie die Modell-Helfer.
|
||||
const bad = walls[r.num()];
|
||||
if (bad) for (const l of getWallType(project, bad).layers) getComponent(project, l.componentId);
|
||||
throw new Error("computeJoins: unbekannter Wandtyp oder Bauteil");
|
||||
}
|
||||
const result = new Map<string, WallCuts>();
|
||||
if (status !== 0) {
|
||||
// Kaputte Eingabe (z. B. NaN-Koordinaten): keine Verschneidung.
|
||||
for (const wall of walls) result.set(wall.id, { startCut: null, endCut: null });
|
||||
return result;
|
||||
}
|
||||
for (const wall of walls) result.set(wall.id, readWallCuts(r));
|
||||
return result;
|
||||
}
|
||||
|
||||
// ── Flache Kodierung der Cuts (s. `joins.rs`), auch für `toWalls3d/bands.ts` ──
|
||||
|
||||
function writeLine(w: FlatWriter, l: Line | null | undefined): void {
|
||||
if (l) w.num(1, l.point.x, l.point.y, l.dir.x, l.dir.y);
|
||||
else w.num(0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
function readLine(r: FlatReader): Line | null {
|
||||
const set = r.num();
|
||||
const point = { x: r.num(), y: r.num() };
|
||||
const dir = { x: r.num(), y: r.num() };
|
||||
return set === 1 ? { point, dir } : null;
|
||||
}
|
||||
|
||||
/** Hängt die Cuts einer Wand flach an (fehlend = keine Cuts). */
|
||||
export function writeWallCuts(w: FlatWriter, cuts: WallCuts | undefined): void {
|
||||
writeLine(w, cuts?.startCut);
|
||||
writeLine(w, cuts?.endCut);
|
||||
const lc = cuts?.layerCuts;
|
||||
const n = lc ? lc.start.length : 0;
|
||||
w.num(n);
|
||||
if (lc) for (const arr of [lc.start, lc.end, lc.startSide, lc.endSide]) for (let i = 0; i < n; i++) writeLine(w, arr[i]);
|
||||
const sc = cuts?.spanCutouts ?? [];
|
||||
w.num(sc.length);
|
||||
for (const s of sc) w.num(s.from, s.to, s.offA, s.offB);
|
||||
}
|
||||
|
||||
/** Liest die Cuts einer Wand; `layerCuts`/`spanCutouts` nur, wenn vorhanden. */
|
||||
export function readWallCuts(r: FlatReader): WallCuts {
|
||||
const cuts: WallCuts = { startCut: readLine(r), endCut: readLine(r) };
|
||||
const n = r.count();
|
||||
if (n > 0) {
|
||||
const arr = () => Array.from({ length: n }, () => readLine(r));
|
||||
cuts.layerCuts = { start: arr(), end: arr(), startSide: arr(), endSide: arr() };
|
||||
}
|
||||
const m = r.count();
|
||||
if (m > 0) {
|
||||
cuts.spanCutouts = [];
|
||||
for (let k = 0; k < m; k++) cuts.spanCutouts.push({ from: r.num(), to: r.num(), offA: r.num(), offB: r.num() });
|
||||
}
|
||||
return cuts;
|
||||
}
|
||||
+1
-103
@@ -1,11 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import {
|
||||
defaultRoomStamp,
|
||||
roomStampToDoc,
|
||||
roomStampExtraLines,
|
||||
roomDisplayName,
|
||||
formatStampArea,
|
||||
} from "./roomStamp";
|
||||
import { defaultRoomStamp, roomDisplayName } from "./roomStamp";
|
||||
import type { Room } from "./types";
|
||||
|
||||
function makeRoom(over: Partial<Room> = {}): Room {
|
||||
@@ -37,102 +31,6 @@ describe("defaultRoomStamp", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("roomStampToDoc", () => {
|
||||
it("eine Zeile ohne nameLine2", () => {
|
||||
const doc = roomStampToDoc({ name: "Bad", showFloorArea: true, showUsage: true });
|
||||
expect(doc.paragraphs).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("zwei Zeilen mit nameLine2", () => {
|
||||
const doc = roomStampToDoc({
|
||||
name: "Bad",
|
||||
nameLine2: "WC",
|
||||
showFloorArea: true,
|
||||
showUsage: true,
|
||||
});
|
||||
expect(doc.paragraphs).toHaveLength(2);
|
||||
});
|
||||
|
||||
it("Nummer als Präfix-Run in Zeile 1", () => {
|
||||
const doc = roomStampToDoc({
|
||||
number: "1.01",
|
||||
name: "Bad",
|
||||
showFloorArea: true,
|
||||
showUsage: true,
|
||||
});
|
||||
expect(doc.paragraphs[0].runs).toHaveLength(2);
|
||||
expect(doc.paragraphs[0].runs[0].text).toBe("1.01 ");
|
||||
expect(doc.paragraphs[0].runs[1].text).toBe("Bad");
|
||||
});
|
||||
});
|
||||
|
||||
describe("roomStampExtraLines", () => {
|
||||
it("beachtet Flags und Präfix", () => {
|
||||
const lines = roomStampExtraLines(
|
||||
{ name: "Bad", showFloorArea: true, showUsage: true, floorAreaPrefix: "BF " },
|
||||
{ netArea: 12.345, siaCategory: "HNF", siaLabel: "Hauptnutzfläche" },
|
||||
);
|
||||
expect(lines[0].text).toBe("BF 12.35 m²");
|
||||
expect(lines[1].text).toBe("HNF · Hauptnutzfläche");
|
||||
});
|
||||
|
||||
it("blendet Zeilen aus, wenn Flags falsch", () => {
|
||||
const lines = roomStampExtraLines(
|
||||
{ name: "Bad", showFloorArea: false, showUsage: false },
|
||||
{ netArea: 12.345, siaCategory: "HNF", siaLabel: "Hauptnutzfläche" },
|
||||
);
|
||||
expect(lines).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("rundet die Fläche auf roundingStep, falls gesetzt", () => {
|
||||
const lines = roomStampExtraLines(
|
||||
{ name: "Bad", showFloorArea: true, showUsage: false, roundingStep: 0.5 },
|
||||
{ netArea: 12.34, siaCategory: "HNF", siaLabel: "Hauptnutzfläche" },
|
||||
);
|
||||
expect(lines[0].text).toBe("12.5 m²");
|
||||
});
|
||||
|
||||
it("nutzt 2 Nachkommastellen ohne roundingStep (Alt-Verhalten)", () => {
|
||||
const lines = roomStampExtraLines(
|
||||
{ name: "Bad", showFloorArea: true, showUsage: false },
|
||||
{ netArea: 12.345, siaCategory: "HNF", siaLabel: "Hauptnutzfläche" },
|
||||
);
|
||||
expect(lines[0].text).toBe("12.35 m²");
|
||||
});
|
||||
|
||||
it("zeigt die Personenzahl als eigene Zeile, wenn gesetzt", () => {
|
||||
const lines = roomStampExtraLines(
|
||||
{ name: "Bad", showFloorArea: false, showUsage: false, occupancy: 4 },
|
||||
{ netArea: 12.345, siaCategory: "HNF", siaLabel: "Hauptnutzfläche" },
|
||||
);
|
||||
expect(lines).toHaveLength(1);
|
||||
expect(lines[0].text).toBe("4 Pers.");
|
||||
expect(lines[0].align).toBe("center");
|
||||
});
|
||||
|
||||
it("blendet die Personenzahl-Zeile aus, wenn occupancy fehlt", () => {
|
||||
const lines = roomStampExtraLines(
|
||||
{ name: "Bad", showFloorArea: false, showUsage: false },
|
||||
{ netArea: 12.345, siaCategory: "HNF", siaLabel: "Hauptnutzfläche" },
|
||||
);
|
||||
expect(lines).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("formatStampArea", () => {
|
||||
it("2 Nachkommastellen ohne roundingStep", () => {
|
||||
expect(formatStampArea(12.345)).toBe("12.35");
|
||||
expect(formatStampArea(12)).toBe("12.00");
|
||||
});
|
||||
|
||||
it("rundet auf das nächste Vielfache von roundingStep", () => {
|
||||
expect(formatStampArea(12.24, 0.5)).toBe("12");
|
||||
expect(formatStampArea(12.26, 0.5)).toBe("12.5");
|
||||
expect(formatStampArea(12.3, 0.1)).toBe("12.3");
|
||||
expect(formatStampArea(12.34, 1)).toBe("12");
|
||||
});
|
||||
});
|
||||
|
||||
describe("roomDisplayName", () => {
|
||||
it("faellt auf room.name zurück ohne Stempel", () => {
|
||||
expect(roomDisplayName(makeRoom())).toBe("Wohnen");
|
||||
|
||||
+4
-92
@@ -1,21 +1,9 @@
|
||||
// Reines Modul für den strukturierten Raum-Stempel (Feldmodell). App-frei und
|
||||
// unit-getestet: baut aus einem RoomStamp das gerenderte Rich-Text-Dokument
|
||||
// (roomStampToDoc) und die Live-Zeilen (roomStampExtraLines), und liefert den
|
||||
// Anzeigenamen für Listen (roomDisplayName). Keine React-/Store-Abhängigkeit.
|
||||
//
|
||||
// Folge-Arbeit: Fensterfläche (braucht Öffnung-in-Raum-Geometrie).
|
||||
// Reines Modul für den strukturierten Raum-Stempel (Feldmodell): Standard-Stempel und Anzeigename
|
||||
// für Listen. Das Stempel-Dokument und die Live-Zeilen (Fläche, Nutzung, Personen) baut der Kern
|
||||
// beim Plan-Aufbau (`src-tauri/core/src/plan/domains.rs`, [K3d]).
|
||||
|
||||
import type { Room, RoomStamp } from "./types";
|
||||
import type { SiaCategory } from "../geometry/roomArea";
|
||||
import type { RichTextDoc, Paragraph, TextRun, Align } from "../text/richText";
|
||||
import { makeRun } from "../text/richText";
|
||||
|
||||
/** Grösse (pt) des Raumnamens (Zeile 1) relativ zur Stempel-Basis. */
|
||||
const NAME_PT = 12;
|
||||
/** Grösse (pt) der kleinen Raumnummer als Präfix. */
|
||||
const NUMBER_PT = 9;
|
||||
/** Grösse (pt) der zweiten Namenszeile. */
|
||||
const LINE2_PT = 9;
|
||||
import type { Align } from "../text/richText";
|
||||
|
||||
/**
|
||||
* Standard-Stempel aus einem Raum ableiten: Name = Raum-Name, Bodenfläche und
|
||||
@@ -29,88 +17,12 @@ export function defaultRoomStamp(room: Room): RoomStamp {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Baut das Rich-Text-Dokument des Stempels:
|
||||
* • Zeile 1: optionale Raumnummer (kleiner Präfix) + Raumname (grösser, fett).
|
||||
* • Zeile 2 (optional): nameLine2 (kursiv, kleiner).
|
||||
* Die Live-Zeilen (Fläche/Nutzung) werden separat als extraLines gesetzt.
|
||||
*/
|
||||
export function roomStampToDoc(stamp: RoomStamp): RichTextDoc {
|
||||
const line1: TextRun[] = [];
|
||||
const number = (stamp.number ?? "").trim();
|
||||
if (number) {
|
||||
line1.push(makeRun(`${number} `, { sizePt: NUMBER_PT }));
|
||||
}
|
||||
line1.push(makeRun(stamp.name, { bold: true, sizePt: NAME_PT }));
|
||||
|
||||
const paragraphs: Paragraph[] = [{ runs: line1, align: stamp.nameAlign }];
|
||||
const line2 = (stamp.nameLine2 ?? "").trim();
|
||||
if (line2) {
|
||||
paragraphs.push({
|
||||
runs: [makeRun(line2, { italic: true, sizePt: LINE2_PT })],
|
||||
align: stamp.line2Align,
|
||||
});
|
||||
}
|
||||
return { version: 1, paragraphs };
|
||||
}
|
||||
|
||||
/** Kontext für die Live-Zeilen (nicht gespeichert, bei jedem Rendern frisch). */
|
||||
export interface RoomStampContext {
|
||||
netArea: number;
|
||||
siaCategory: SiaCategory;
|
||||
siaLabel: string;
|
||||
}
|
||||
|
||||
/** Eine Live-Zeile des Stempels mit Text und Ausrichtung. */
|
||||
export interface RoomStampLine {
|
||||
text: string;
|
||||
align: Align;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formatiert die Bodenfläche für die Stempel-Anzeige: ohne `roundingStep` wie
|
||||
* bisher auf 2 Nachkommastellen; mit `roundingStep` auf das nächste Vielfache
|
||||
* davon gerundet (z. B. 0.5 → halbe m²), ohne Nachkommastellen-Rauschen.
|
||||
*/
|
||||
export function formatStampArea(area: number, roundingStep?: number): string {
|
||||
if (roundingStep && roundingStep > 0) {
|
||||
const rounded = Math.round(area / roundingStep) * roundingStep;
|
||||
// Rundungsfehler aus der Fliesskomma-Division kappen (max. 2 Nachkommastellen).
|
||||
return `${Math.round(rounded * 100) / 100}`;
|
||||
}
|
||||
return area.toFixed(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Die Live-Zeilen unter dem Stempel: Bodenfläche (mit Präfix) wenn showFloorArea,
|
||||
* Nutzung (SIA-Kürzel · Bezeichnung) wenn showUsage, Personenzahl wenn gesetzt.
|
||||
* Die Ausrichtung folgt den Stempel-Feldern; fehlt sie, gilt „zentriert"
|
||||
* (Alt-Verhalten).
|
||||
*/
|
||||
export function roomStampExtraLines(stamp: RoomStamp, ctx: RoomStampContext): RoomStampLine[] {
|
||||
const lines: RoomStampLine[] = [];
|
||||
if (stamp.showFloorArea) {
|
||||
const prefix = stamp.floorAreaPrefix ?? "";
|
||||
lines.push({
|
||||
text: `${prefix}${formatStampArea(ctx.netArea, stamp.roundingStep)} m²`,
|
||||
align: stamp.floorAreaAlign ?? "center",
|
||||
});
|
||||
}
|
||||
if (stamp.showUsage) {
|
||||
lines.push({
|
||||
text: `${ctx.siaCategory} · ${ctx.siaLabel}`,
|
||||
align: stamp.usageAlign ?? "center",
|
||||
});
|
||||
}
|
||||
if (stamp.occupancy != null) {
|
||||
lines.push({
|
||||
text: `${stamp.occupancy} Pers.`,
|
||||
align: "center",
|
||||
});
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Anzeigename für Listen: strukturierter Name (name + optional nameLine2 zu
|
||||
* einem Namen zusammengezogen), sonst der Alt-Raumname.
|
||||
|
||||
+1
-20
@@ -2377,7 +2377,7 @@ export interface ImportedMesh {
|
||||
* Grafik-Kategorie-Code (s. {@link LayerCategory}, `model/contextCategories.ts`)
|
||||
* — steuert Sichtbarkeit/Grau/Sperren wie bei jedem anderen Bauteil (Ebenen-
|
||||
* Panel). Fehlt er (ältere Importe vor dieser Erweiterung), bleibt das Objekt
|
||||
* IMMER sichtbar (Rückwärtskompatibilität), s. `generatePlan/context.ts`.
|
||||
* IMMER sichtbar (Rückwärtskompatibilität), s. `plan/context.rs` im Kern.
|
||||
*/
|
||||
categoryCode?: string;
|
||||
/** Farbe aus der Quelldatei (`#rrggbb`, z. B. IFC-Oberflächenstil/Material); fehlt sie, gilt die Kontext-Grundfarbe. */
|
||||
@@ -3193,21 +3193,6 @@ export const openingLabel = (o: Opening): string =>
|
||||
o.height * 100
|
||||
).toFixed(0)}`;
|
||||
|
||||
/** Alle Treppen eines Geschosses (leere Liste, wenn keine oder `stairs` fehlt). */
|
||||
export const stairsOfFloor = (project: Project, floorId: string): Stair[] =>
|
||||
(project.stairs ?? []).filter((s) => s.floorId === floorId);
|
||||
|
||||
/** Menschenlesbarer Standardname einer Treppe (Grundform + Stufenanzahl). */
|
||||
export const stairLabel = (s: Stair): string => {
|
||||
const shape =
|
||||
s.shape === "straight" ? "Gerade" : s.shape === "L" ? "L-Treppe" : "Wendel";
|
||||
return `${shape} ${s.stepCount} STG`;
|
||||
};
|
||||
|
||||
/** Alle Stützen eines Geschosses (leere Liste, wenn keine oder `columns` fehlt). */
|
||||
export const columnsOfFloor = (project: Project, floorId: string): Column[] =>
|
||||
(project.columns ?? []).filter((c) => c.floorId === floorId);
|
||||
|
||||
/** Menschenlesbarer Standardname einer Stütze (Profil + Masse in cm). */
|
||||
export const columnLabel = (c: Column): string => {
|
||||
if (c.profile.kind === "round") {
|
||||
@@ -3216,10 +3201,6 @@ export const columnLabel = (c: Column): string => {
|
||||
return `Stütze ${(c.profile.width * 100).toFixed(0)}×${(c.profile.depth * 100).toFixed(0)}`;
|
||||
};
|
||||
|
||||
/** Alle Räume eines Geschosses (leere Liste, wenn keine oder `rooms` fehlt). */
|
||||
export const roomsOfFloor = (project: Project, floorId: string): Room[] =>
|
||||
(project.rooms ?? []).filter((r) => r.floorId === floorId);
|
||||
|
||||
/** Liefert ein Bauteil-Material (Component) per ID oder wirft. */
|
||||
export const getComponent = (project: Project, id: string): Component => {
|
||||
const c = project.components.find((co) => co.id === id);
|
||||
|
||||
@@ -18,7 +18,7 @@ import { solidProps } from "../engine/truckSolid";
|
||||
import type { SolidProps, SolidSpec } from "../engine/truckSolid";
|
||||
import { useEffect, useState } from "react";
|
||||
// Anzeige-Fallbacks für die Öffnungs-Linien-Übersteuerung (LineStyleRow) —
|
||||
// dieselben Werte wie POCHE_STROKE/SYMBOL_HAIRLINE_MM in plan/generatePlan.ts
|
||||
// dieselben Werte wie POCHE_STROKE/SYMBOL_HAIRLINE_MM im Grundriss (Kern: plan/style.rs)
|
||||
// (reine UI-Default-Anzeige, kein Re-Export nötig).
|
||||
const OPENING_LINE_DEFAULT_COLOR = "#1a1a1a";
|
||||
const OPENING_LINE_DEFAULT_WEIGHT = 0.02;
|
||||
|
||||
+16
-31
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* `addColumnPoche` — By-Layer/By-Object-Override für Stützen (Nutzer-Wunsch:
|
||||
* Stützen-Poché im Grundriss (Kern: `plan/domains.rs`) — By-Layer/By-Object-Override für Stützen (Nutzer-Wunsch:
|
||||
* "generell sollten alle BIM Teile ... die weiteren Attribute haben" — Stütze
|
||||
* hat bereits eine Poché UND nutzt dieselben Resolver wie Wand/Decke, daher
|
||||
* hier zuerst fertig verdrahtet). Regressionsschutz: die neuen
|
||||
@@ -8,9 +8,9 @@
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { addColumnPoche } from "./structures";
|
||||
import type { Column, Component, LayerCategory, Project } from "../../model/types";
|
||||
import type { Primitive } from "./shared";
|
||||
import { generatePlan } from "./generatePlan";
|
||||
import type { Column, Component, LayerCategory, Project } from "../model/types";
|
||||
import type { Primitive } from "./generatePlan/shared";
|
||||
|
||||
const comp: Component = {
|
||||
id: "beton",
|
||||
@@ -69,62 +69,47 @@ function column(overrides: Partial<Column> = {}): Column {
|
||||
};
|
||||
}
|
||||
|
||||
/** Grundriss des Geschosses „eg" mit genau dieser Stütze. */
|
||||
function planColumn(p: Project, col: Column): Primitive[] {
|
||||
return generatePlan({ ...p, columns: [col] }, "eg", new Set(["50"])).primitives;
|
||||
}
|
||||
|
||||
function polygonOf(out: Primitive[]): Extract<Primitive, { kind: "polygon" }> {
|
||||
const p = out.find((x) => x.kind === "polygon");
|
||||
if (!p || p.kind !== "polygon") throw new Error("kein Poché-Polygon gefunden");
|
||||
return p;
|
||||
}
|
||||
|
||||
describe("addColumnPoche — Attribut-Override greift", () => {
|
||||
describe("Stützen-Poché — Attribut-Override greift", () => {
|
||||
it("ohne Override: Bauteil-Schraffur/-Farbe bestimmen die Poché (Default 'Nach Bauteil')", () => {
|
||||
const out: Primitive[] = [];
|
||||
addColumnPoche(out, project(), column(), false, 0.35, category);
|
||||
const out = planColumn(project(), column());
|
||||
const poly = polygonOf(out);
|
||||
expect(poly.hatch.pattern).toBe("solid");
|
||||
});
|
||||
|
||||
it("mit explizitem background-Override: die Poché-Füllung wird die Override-Farbe", () => {
|
||||
const out: Primitive[] = [];
|
||||
addColumnPoche(out, project(), column({ background: "#ff00ff" }), false, 0.35, category);
|
||||
const out = planColumn(project(), column({ background: "#ff00ff" }));
|
||||
expect(polygonOf(out).fill).toBe("#ff00ff");
|
||||
});
|
||||
|
||||
it("mit hatchSource:'layer': die Kategorie-Schraffur wird verwendet, nicht die Bauteil-Schraffur", () => {
|
||||
const out: Primitive[] = [];
|
||||
const catWithHatch: LayerCategory = { ...category, hatch: "sia-other" };
|
||||
addColumnPoche(
|
||||
out,
|
||||
project({ layers: [catWithHatch] }),
|
||||
column({ hatchSource: "layer" }),
|
||||
false,
|
||||
0.35,
|
||||
catWithHatch,
|
||||
);
|
||||
const out = planColumn(project({ layers: [catWithHatch] }), column({ hatchSource: "layer" }));
|
||||
expect(polygonOf(out).hatch.pattern).toBe("none");
|
||||
});
|
||||
|
||||
it("mit explizitem hatchId-Override: gewinnt gegenüber Bauteil UND Kategorie", () => {
|
||||
const out: Primitive[] = [];
|
||||
addColumnPoche(
|
||||
out,
|
||||
project(),
|
||||
column({ hatchId: "sia-other" }),
|
||||
false,
|
||||
0.35,
|
||||
category,
|
||||
);
|
||||
const out = planColumn(project(), column({ hatchId: "sia-other" }));
|
||||
expect(polygonOf(out).hatch.pattern).toBe("none");
|
||||
});
|
||||
|
||||
it("ohne gesetzten Vordergrund: Schraffurfarbe bleibt die neutrale Tinte (Default unverändert)", () => {
|
||||
const out: Primitive[] = [];
|
||||
addColumnPoche(out, project(), column(), false, 0.35, category);
|
||||
const out = planColumn(project(), column());
|
||||
expect(polygonOf(out).hatch.color).toBe("#0f0f0f");
|
||||
});
|
||||
|
||||
it("mit explizitem foreground-Override: die Schraffurfarbe wird die Override-Farbe (vorher wirkungslos)", () => {
|
||||
const out: Primitive[] = [];
|
||||
addColumnPoche(out, project(), column({ foreground: "#00ff88" }), false, 0.35, category);
|
||||
const out = planColumn(project(), column({ foreground: "#00ff88" }));
|
||||
expect(polygonOf(out).hatch.color).toBe("#00ff88");
|
||||
});
|
||||
});
|
||||
+112
-257
@@ -7,13 +7,14 @@
|
||||
//
|
||||
// Diese Datei ist nur noch der ORCHESTRATOR: `generatePlan()`/
|
||||
// `generateSectionPlan()` sowie die `resolve*SectionStyle`-Helfer (für den
|
||||
// Schnitt-Pfad, `toSection.ts`). Das gemeinsame `Primitive`-Vokabular, die
|
||||
// By-Layer/By-Object-Attribut-Auflösung (`resolveHatch`/`resolveForeground`/…)
|
||||
// und die Papier-mm-/Tinten-Konstanten leben in `generatePlan/shared.ts`; jede
|
||||
// Bauteil-Domäne (Wände, Decken, Öffnungen, Treppen, Dächer, Kontext,
|
||||
// Schnittführung, Räume, sonstige Tragwerks-/Fremdkörper, freie 2D-Geometrie)
|
||||
// hat ihre eigene Datei unter `generatePlan/` — siehe dort für die konkrete
|
||||
// Zeichenlogik je Bauteil.
|
||||
// Schnitt-Pfad, `toSection.ts`). Die Bauteil-Domänen (Decken, Dächer, Räume,
|
||||
// Wände mit Öffnungen, Treppen, Stützen, Extrusionen, Kontext, Schnittführung)
|
||||
// rechnet der Rust-Kern auf dem Projekt-Dokument (`src-tauri/core/src/plan/`,
|
||||
// Abfrage `planDomains`, [K3d]) und liefert fertige `Primitive`. In TS bleiben
|
||||
// die freie 2D-Geometrie (`generatePlan/drawing2d.ts`), Schattenstudie und
|
||||
// Baurecht, die Abzugskörper (`voids.ts`), Mono und der Strichstärken-Massstab.
|
||||
// Das `Primitive`-Vokabular und die Attribut-Auflösung für die übrigen TS-Pfade
|
||||
// leben in `generatePlan/shared.ts`.
|
||||
|
||||
import type {
|
||||
Ceiling,
|
||||
@@ -24,54 +25,34 @@ import type {
|
||||
LayerCategory,
|
||||
OverrideActions,
|
||||
Project,
|
||||
Roof,
|
||||
Room,
|
||||
Stair,
|
||||
Vec2,
|
||||
Wall,
|
||||
} from "../model/types";
|
||||
import {
|
||||
columnLabel,
|
||||
columnsOfFloor,
|
||||
flattenCategories,
|
||||
getCeilingType,
|
||||
getComponent,
|
||||
getLayerCategory,
|
||||
getWallType,
|
||||
openingLabel,
|
||||
openingsOfWall,
|
||||
roomsOfFloor,
|
||||
stairLabel,
|
||||
stairsOfFloor,
|
||||
wallTypeThickness,
|
||||
} from "../model/types";
|
||||
import { roofGeometry } from "../geometry/roof";
|
||||
import { documentFor } from "../core/document";
|
||||
import { effectiveOverrides, hasOverrides } from "../overrides/engine";
|
||||
import { stairVerticalExtent, wallVerticalExtent } from "../model/wall";
|
||||
import { stairGeometry } from "../geometry/stair";
|
||||
import { wallCorners } from "../model/geometry";
|
||||
import { computeJoins } from "../model/joins";
|
||||
import type { SectionOutput } from "./toSection";
|
||||
import {
|
||||
HATCH_INK,
|
||||
HATCH_PAPER,
|
||||
LAYER_LINE_MM,
|
||||
MONO_INK,
|
||||
SHOW_ALL,
|
||||
WALL_FALLBACK_MM,
|
||||
resolveBackground,
|
||||
resolveForeground,
|
||||
resolveHatch,
|
||||
resolveHatchId,
|
||||
resolveStrokeWeight,
|
||||
type CategoryDisplayResolver,
|
||||
type DetailLevel,
|
||||
type HatchRender,
|
||||
type Primitive,
|
||||
} from "./generatePlan/shared";
|
||||
import { addCeilingPoche } from "./generatePlan/ceilings";
|
||||
import { subtractVoidsInPlan } from "./voids";
|
||||
import { addContextContours } from "./generatePlan/context";
|
||||
import { addSunShadow } from "./generatePlan/sunShadow";
|
||||
import { addSiteRules, addSiteViolations } from "./generatePlan/siteRules";
|
||||
import { lineWeightFactor, scalePrimitiveWeights } from "./lineWeightScale";
|
||||
@@ -84,13 +65,6 @@ import {
|
||||
} from "./generatePlan/drawing2d";
|
||||
import { drawingBox } from "../geometry/drawingBounds";
|
||||
import { layersStyleSig } from "./generatePlan/layerSig";
|
||||
import { addOpeningSymbol } from "./generatePlan/openings";
|
||||
import { addRoof } from "./generatePlan/roofs";
|
||||
import { addRoomArea } from "./generatePlan/rooms";
|
||||
import { addSectionLines } from "./generatePlan/sections";
|
||||
import { addStairSymbol } from "./generatePlan/stairs";
|
||||
import { addColumnPoche, addExtrudedSolidOutline } from "./generatePlan/structures";
|
||||
import { addReferenceLine, addWallPoche, buildWallFootprints, wallGaps } from "./generatePlan/walls";
|
||||
|
||||
// Re-Export des gemeinsamen Vokabulars — externe Konsumenten (Export-Pipeline,
|
||||
// PlanView, toSection.ts, toWalls3d.ts, toRenderScene.ts, …) importieren
|
||||
@@ -382,33 +356,6 @@ export function generatePlan(
|
||||
layerCode: categoryCode,
|
||||
objectName,
|
||||
});
|
||||
const wallTypeNameById = new Map(project.wallTypes.map((t) => [t.id, t.name]));
|
||||
const ceilingTypeNameById = new Map(
|
||||
(project.ceilingTypes ?? []).map((t) => [t.id, t.name]),
|
||||
);
|
||||
|
||||
// Sichtbarkeit wie bisher; der Darstellungsmodus verfeinert sie zusätzlich:
|
||||
// render=false blendet die Wand aus, greyed=true dimmt sie.
|
||||
const walls = project.walls
|
||||
.filter(
|
||||
(w) =>
|
||||
w.floorId === floorId &&
|
||||
visibleCodes.has(w.categoryCode) &&
|
||||
categoryDisplay(w.categoryCode).render,
|
||||
)
|
||||
.map((w) => {
|
||||
// Regel-Override gewinnt über den Per-Instanz-Wert (oberste Schicht):
|
||||
// Farbe → Umriss-/Fugenfarbe (Wall.color), Strichstärke → strokeWeight
|
||||
// (der topmost-Wert der bestehenden resolveStrokeWeight-Kette).
|
||||
const ov = overrideFor(w.categoryCode, wallTypeNameById.get(w.wallTypeId));
|
||||
if (!hasOverrides(ov)) return w;
|
||||
return {
|
||||
...w,
|
||||
color: ov.color ?? w.color,
|
||||
strokeWeight: ov.lineweight ?? w.strokeWeight,
|
||||
};
|
||||
});
|
||||
|
||||
// Freie 2D-Zeichengeometrie dieses Geschosses (wie Wände nach sichtbaren
|
||||
// Kategorien + Darstellungsmodus gefiltert). Wird über der Wand-Poché
|
||||
// gezeichnet (am Ende angehängt).
|
||||
@@ -434,169 +381,24 @@ export function generatePlan(
|
||||
};
|
||||
});
|
||||
|
||||
// Decken dieses Geschosses (wie Wände nach sichtbaren Kategorien +
|
||||
// Darstellungsmodus gefiltert). Eine Decke liegt (als Slab) über der
|
||||
// Schnittebene → im Grundriss als gefüllter/schraffierter Umriss dargestellt,
|
||||
// UNTER der Wand-Poché (damit die Wände darüber lesbar bleiben).
|
||||
const ceilings = (project.ceilings ?? [])
|
||||
.filter(
|
||||
(c) =>
|
||||
c.floorId === floorId &&
|
||||
visibleCodes.has(c.categoryCode) &&
|
||||
categoryDisplay(c.categoryCode).render,
|
||||
)
|
||||
.map((c) => {
|
||||
// Decken: nur der Farb-Override wirkt (der Umriss ist eine feste
|
||||
// Überkopf-Haarlinie, siehe addCeilingPoche — keine Strichstärke).
|
||||
const typeName =
|
||||
(c.ceilingTypeId ? ceilingTypeNameById.get(c.ceilingTypeId) : undefined) ??
|
||||
wallTypeNameById.get(c.wallTypeId);
|
||||
const ov = overrideFor(c.categoryCode, typeName);
|
||||
return ov.color !== undefined ? { ...c, color: ov.color } : c;
|
||||
});
|
||||
// Wand-Footprints für das Verdecken der (darunterliegenden) Decken-Umrisse:
|
||||
// die Decke liegt als Slab über der Schnittebene, ihre Umrisslinie soll dort,
|
||||
// wo eine Wand darüber steht, NICHT durch die Wand-Poché schlagen. Nur nötig,
|
||||
// wenn es überhaupt Decken gibt.
|
||||
const wallFootprints = ceilings.length ? buildWallFootprints(project, walls) : [];
|
||||
for (const ceiling of ceilings) {
|
||||
const greyed = categoryDisplay(ceiling.categoryCode).greyed;
|
||||
const category = catByCode.get(ceiling.categoryCode);
|
||||
// Strichstärke wie bei der Wand (Attribut-Override > Kategorie > Fallback);
|
||||
// der Umriss bleibt trotzdem eine gestrichelte Überkopf-Ansichtslinie
|
||||
// (Dash-Muster unverändert, s. addCeilingPoche) — nur die Dicke ist editierbar.
|
||||
const ceilingLwMm = resolveStrokeWeight(
|
||||
ceiling.strokeWeight,
|
||||
ceiling.strokeWeightSource,
|
||||
category,
|
||||
lwByCode.get(ceiling.categoryCode) ?? LAYER_LINE_MM,
|
||||
);
|
||||
addCeilingPoche(primitives, project, ceiling, greyed, detail, category, wallFootprints, ceilingLwMm);
|
||||
}
|
||||
// Decken, Dächer, Räume, Wände mit Öffnungen, Treppen, Stützen und Extrusions-Umrisse rechnet der
|
||||
// Kern auf dem Dokument ([K3d], `plan/{domains,walls,stairs}.rs`): Filter, Override-Regeln,
|
||||
// Verschneidung, Stil und Raumstempel-Daten. Decken, Dächer und Räume liegen unter der Wand-Poché; Stützen folgen
|
||||
// nach den Treppen, Extrusionen nach den 2D-Zeichnungen.
|
||||
const dom = planDomains(project, floorId, visibleCodes, categoryDisplay, detail, showReferenceLines, includeGlobal);
|
||||
for (const pr of dom.ceilings) primitives.push(pr);
|
||||
for (const pr of dom.roofs) primitives.push(pr);
|
||||
for (const pr of dom.rooms) primitives.push(pr);
|
||||
|
||||
// Dächer dieses Geschosses (Dachaufsicht): reine Grundriss-Linien (Traufe/
|
||||
// First/Grat/Knick), kein Poché. Über der Wand-Poché gezeichnet.
|
||||
const roofs = (project.roofs ?? []).filter(
|
||||
(r) =>
|
||||
r.floorId === floorId &&
|
||||
visibleCodes.has(r.categoryCode) &&
|
||||
categoryDisplay(r.categoryCode).render,
|
||||
);
|
||||
for (const roof of roofs) {
|
||||
const greyed = categoryDisplay(roof.categoryCode).greyed;
|
||||
const category = catByCode.get(roof.categoryCode);
|
||||
addRoof(primitives, project, roof, greyed, category);
|
||||
}
|
||||
// Wände (Poché, Referenzlinie) mit ihren Öffnungs-Symbolen, je Wand nacheinander.
|
||||
for (const pr of dom.walls) primitives.push(pr);
|
||||
|
||||
// Räume (SIA-416-Flächen) dieses Geschosses: transluzente Farbfüllung + Stempel
|
||||
// (Name + Fläche + SIA-Tag). UNTER der Wand-Poché gezeichnet, damit die Wände
|
||||
// lesbar bleiben. Der Stempel (Text) entfällt beim Detailgrad „grob".
|
||||
const rooms = roomsOfFloor(project, floorId)
|
||||
.filter(
|
||||
(r) =>
|
||||
visibleCodes.has(r.categoryCode) && categoryDisplay(r.categoryCode).render,
|
||||
)
|
||||
.map((r) => {
|
||||
// Räume: `object_name` matcht den Raum-Namen; der Farb-Override färbt
|
||||
// Fläche + Stempel (Room.color) um.
|
||||
const ov = overrideFor(r.categoryCode, r.name);
|
||||
return ov.color !== undefined ? { ...r, color: ov.color } : r;
|
||||
});
|
||||
for (const room of rooms) {
|
||||
const greyed = categoryDisplay(room.categoryCode).greyed;
|
||||
addRoomArea(primitives, room, greyed, detail);
|
||||
}
|
||||
// Treppen: Tritte + Lauflinie + Auf-/Abpfeil mit dem Grundriss-Schnitt (unter der Schnitthöhe
|
||||
// durchgezogen, darüber gestrichelt + SIA-Bruchlinie), über der Wand-Poché.
|
||||
for (const pr of dom.stairs) primitives.push(pr);
|
||||
|
||||
// Gehrungs-Schnittlinien einmal pro Plan berechnen (auf der gefilterten Menge).
|
||||
const joins = computeJoins(project, walls);
|
||||
|
||||
for (const wall of walls) {
|
||||
const wallGreyed = categoryDisplay(wall.categoryCode).greyed;
|
||||
const wallCategory = catByCode.get(wall.categoryCode);
|
||||
const wallLwMm = resolveStrokeWeight(
|
||||
wall.strokeWeight,
|
||||
wall.strokeWeightSource,
|
||||
wallCategory,
|
||||
lwByCode.get(wall.categoryCode) ?? WALL_FALLBACK_MM,
|
||||
);
|
||||
// Ö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, 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
|
||||
// nur als Ansichts-Umriss gezeichnet — keine Schnitt-Poché. Normale Wände
|
||||
// (Schnittebene liegt in ihrer vertikalen Ausdehnung) sind unberührt. Über
|
||||
// `wallVerticalExtent` aufgelöst (nicht nur `wall.height`), damit ein
|
||||
// `bottom`/`top`-Override (VerticalAnchor) korrekt einfliesst — sonst würde
|
||||
// z. B. eine hochgesetzte Wand (angehobenes UK, Höhe allein sieht „hoch genug"
|
||||
// aus) fälschlich als Schnitt-Poché statt als Ansichts-Umriss gezeichnet.
|
||||
const { zBottom: wallZBottom, zTop: wallZTop } = wallVerticalExtent(project, wall);
|
||||
const cutPlaneZ = (floor?.baseElevation ?? 0) + (floor?.cutHeight ?? 1.0);
|
||||
const wallViewOnly = wallZTop < cutPlaneZ || wallZBottom > cutPlaneZ;
|
||||
addWallPoche(
|
||||
primitives, project, wall, gaps, cuts, wallGreyed, detail, wallLwMm, wallCategory, wallViewOnly,
|
||||
);
|
||||
// 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);
|
||||
// Öffnungs-Symbole (Fenster/Tür) je Detailgrad + Auswahl-taggbar.
|
||||
for (const o of openings) {
|
||||
const d = categoryDisplay(o.categoryCode);
|
||||
if (visibleCodes.has(o.categoryCode) && d.render) {
|
||||
// Override-Regeln: `object_name` matcht das Öffnungs-Label
|
||||
// („Tür 90×210" / „Fenster 120×140").
|
||||
const ov = overrideFor(o.categoryCode, openingLabel(o));
|
||||
const oLwMm =
|
||||
ov.lineweight ?? lwByCode.get(o.categoryCode) ?? LAYER_LINE_MM;
|
||||
const effO = ov.color !== undefined ? { ...o, color: ov.color } : o;
|
||||
// Per-Element-Detailstufe (`Opening.detailLevel`) übersteuert die
|
||||
// ansichtsweite `detail`, sonst gilt Letztere unverändert.
|
||||
const effDetail = o.detailLevel ?? detail;
|
||||
addOpeningSymbol(primitives, project, wall, effO, d.greyed, effDetail, oLwMm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Treppen dieses Geschosses: Tritte + Lauflinie + Auf-/Abpfeil, mit dem
|
||||
// Grundriss-Schnitt (Tritte unter der Schnitthöhe durchgezogen, darüber
|
||||
// gestrichelt/verdeckt + SIA-Bruchlinie). Über der Wand-Poché gezeichnet.
|
||||
const cutHeight = floor?.cutHeight ?? 1.0;
|
||||
const stairs = stairsOfFloor(project, floorId).filter(
|
||||
(s) =>
|
||||
visibleCodes.has(s.categoryCode) && categoryDisplay(s.categoryCode).render,
|
||||
);
|
||||
for (const stair of stairs) {
|
||||
const greyed = categoryDisplay(stair.categoryCode).greyed;
|
||||
// Override-Regeln: `object_name` matcht das Treppen-Label („Gerade 16 STG").
|
||||
const ov = overrideFor(stair.categoryCode, stairLabel(stair));
|
||||
const lwMm =
|
||||
ov.lineweight ?? lwByCode.get(stair.categoryCode) ?? WALL_FALLBACK_MM;
|
||||
const effStair = ov.color !== undefined ? { ...stair, color: ov.color } : stair;
|
||||
addStairSymbol(primitives, project, effStair, greyed, lwMm, cutHeight);
|
||||
}
|
||||
|
||||
// Stützen (Tragwerk) dieses Geschosses: Querschnitt-Poché (Rechteck/Kreis),
|
||||
// um `rotation` gedreht, auf Kategorie „50". Über der Wand-Poché gezeichnet.
|
||||
const columns = columnsOfFloor(project, floorId).filter(
|
||||
(col) =>
|
||||
visibleCodes.has(col.categoryCode) && categoryDisplay(col.categoryCode).render,
|
||||
);
|
||||
for (const column of columns) {
|
||||
const greyed = categoryDisplay(column.categoryCode).greyed;
|
||||
const category = catByCode.get(column.categoryCode);
|
||||
const ov = overrideFor(column.categoryCode, columnLabel(column));
|
||||
const lwMm =
|
||||
ov.lineweight ??
|
||||
resolveStrokeWeight(
|
||||
column.strokeWeight,
|
||||
column.strokeWeightSource,
|
||||
category,
|
||||
lwByCode.get(column.categoryCode) ?? WALL_FALLBACK_MM,
|
||||
);
|
||||
const effCol = ov.color !== undefined ? { ...column, color: ov.color } : column;
|
||||
addColumnPoche(primitives, project, effCol, greyed, lwMm, category);
|
||||
}
|
||||
// Stützen (Tragwerk): Querschnitt-Poché, über der Wand-Poché.
|
||||
for (const pr of dom.columns) primitives.push(pr);
|
||||
|
||||
// 2D-Zeichengeometrie zuletzt (über der Poché).
|
||||
const compact = compactUnderlay && !mono && !forPrint;
|
||||
@@ -636,26 +438,17 @@ export function generatePlan(
|
||||
});
|
||||
for (const grp of underGroups.values()) underlay.push(mkGroup(grp.ds, grp.greyed));
|
||||
|
||||
// Extrudierte Körper (truck-Integration): das Quell-Profil wurde beim
|
||||
// Extrudieren aus `drawings2d` entfernt (s. `extrude.ts` appendExtrudedSolid)
|
||||
// — im Grundriss erscheint stattdessen der Footprint-Umriss des Körpers
|
||||
// selbst (Haarlinie, kein Poché/Schraffur; Farbe wie das 3D-Orange).
|
||||
for (const solid of project.extrudedSolids ?? []) {
|
||||
if (solid.levelId === floorId) addExtrudedSolidOutline(primitives, solid);
|
||||
}
|
||||
// Extrudierte Körper: Footprint-Umriss (Quell-Profil wurde beim Extrudieren entfernt).
|
||||
for (const pr of dom.solids) primitives.push(pr);
|
||||
|
||||
// Kontext-Konturen (Höhenlinien) als dezente Linien zeichnen — UNTER der
|
||||
// Wand-Poché wäre ideal, aber da sie eine eigene gedämpfte Farbe tragen, ist
|
||||
// die Reihenfolge unkritisch; wir hängen sie als Referenz an. Projektglobal
|
||||
// (nicht je Geschoss) → nur beim aktiven Aufruf einer Mehrfach-Überlagerung.
|
||||
if (includeGlobal) {
|
||||
addContextContours(primitives, project, visibleCodes, categoryDisplay);
|
||||
|
||||
// Schnittführungs-Symbole (klassische Schnittlinien) aller Schnitt-/
|
||||
// Ansichtsebenen mit gesetzter Linie — ebenfalls projektglobal. Sichtbarkeit
|
||||
// läuft über die Kategorie "90" (Referenzen), wie jedes andere Bauteil.
|
||||
addSectionLines(primitives, project, visibleCodes, categoryDisplay);
|
||||
}
|
||||
for (const pr of dom.context) primitives.push(pr);
|
||||
// Schnittführungs-Symbole aller Schnitt-/Ansichtsebenen mit Linie — ebenfalls projektglobal,
|
||||
// Sichtbarkeit über die Kategorie "90" (Referenzen).
|
||||
for (const pr of dom.sections) primitives.push(pr);
|
||||
|
||||
// Schwarz-Weiss (mono): nachträglich alle Farben auf reine Tinte zwingen.
|
||||
// Element-/Kategorie-/Hatch-Farben werden ignoriert, Füllungen werden weiss,
|
||||
@@ -697,7 +490,7 @@ export function generatePlan(
|
||||
}));
|
||||
return {
|
||||
primitives: lwf === 1 ? primitives : primitives.map((p) => scalePrimitiveWeights(p, lwf)),
|
||||
bounds: computeBounds(project, walls, drawings, ceilings, stairs, rooms, roofs, primitives.slice(0, underlayCount)),
|
||||
bounds: computeBounds(project, drawings, dom.bounds, primitives.slice(0, underlayCount)),
|
||||
backgroundImages,
|
||||
...(scaledUnderlay.length ? { underlay: scaledUnderlay } : {}),
|
||||
};
|
||||
@@ -1070,14 +863,87 @@ function categoryMap(layers: LayerCategory[]): Map<string, LayerCategory> {
|
||||
return map;
|
||||
}
|
||||
|
||||
/** Primitive der Kern-Domänen (`planDomains` in `queries.rs`). */
|
||||
interface DomainPrims {
|
||||
ceilings: Primitive[];
|
||||
walls: Primitive[];
|
||||
stairs: Primitive[];
|
||||
context: Primitive[];
|
||||
sections: Primitive[];
|
||||
roofs: Primitive[];
|
||||
rooms: Primitive[];
|
||||
columns: Primitive[];
|
||||
solids: Primitive[];
|
||||
bounds?: [number, number, number, number];
|
||||
}
|
||||
|
||||
const NO_DOMAINS: DomainPrims = { ceilings: [], walls: [], stairs: [], context: [], sections: [], roofs: [], rooms: [], columns: [], solids: [] };
|
||||
const DETAIL_CODE: Record<DetailLevel, number> = { grob: 0, mittel: 1, fein: 2 };
|
||||
|
||||
/**
|
||||
* Decken, Dächer, Räume, Wände mit Öffnungen, Treppen, Stützen, Extrusions-Umrisse eines Geschosses
|
||||
* und (mit `global`) Kontext-Konturen und Schnittführungs-Symbole aus dem Kern. Sichtbarkeit und Darstellungsmodus (UI-Zustand) gehen als Code-Mengen mit: `show` =
|
||||
* sichtbar und gezeichnet, `grey` = gedimmt.
|
||||
*/
|
||||
function planDomains(
|
||||
project: Project,
|
||||
floorId: string,
|
||||
visibleCodes: Set<string>,
|
||||
categoryDisplay: CategoryDisplayResolver,
|
||||
detail: DetailLevel,
|
||||
referenceLines: boolean,
|
||||
global: boolean,
|
||||
): DomainPrims {
|
||||
const codes = new Set<string>();
|
||||
let any = false;
|
||||
const take = (list: ReadonlyArray<{ floorId: string; categoryCode: string }> | undefined) => {
|
||||
for (const e of list ?? []) {
|
||||
if (e.floorId !== floorId) continue;
|
||||
codes.add(e.categoryCode);
|
||||
any = true;
|
||||
}
|
||||
};
|
||||
take(project.ceilings);
|
||||
take(project.roofs);
|
||||
take(project.rooms);
|
||||
take(project.columns);
|
||||
take(project.walls);
|
||||
take(project.stairs);
|
||||
if (global) {
|
||||
// Kontext-Objekte ohne Kategorie sind immer sichtbar; Schnittlinien hängen an "90".
|
||||
for (const o of project.context ?? []) {
|
||||
if (o.type === "image") continue;
|
||||
any = true;
|
||||
if (o.categoryCode !== undefined) codes.add(o.categoryCode);
|
||||
}
|
||||
if (project.drawingLevels.some((l) => (l.kind === "section" || l.kind === "elevation") && l.linePoints)) {
|
||||
any = true;
|
||||
codes.add("90");
|
||||
}
|
||||
}
|
||||
if (!any && !(project.extrudedSolids ?? []).some((x) => x.levelId === floorId)) return NO_DOMAINS;
|
||||
for (const o of project.openings ?? []) codes.add(o.categoryCode);
|
||||
const show: string[] = [];
|
||||
const grey: string[] = [];
|
||||
for (const c of codes) {
|
||||
if (!visibleCodes.has(c)) continue;
|
||||
const d = categoryDisplay(c);
|
||||
if (!d.render) continue;
|
||||
show.push(c);
|
||||
if (d.greyed) grey.push(c);
|
||||
}
|
||||
return documentFor(project).query<DomainPrims>(
|
||||
"planDomains",
|
||||
[DETAIL_CODE[detail] ?? 1],
|
||||
JSON.stringify({ floor: floorId, show, grey, referenceLines, global }),
|
||||
);
|
||||
}
|
||||
|
||||
function computeBounds(
|
||||
project: Project,
|
||||
walls: Wall[],
|
||||
drawings: Drawing2D[] = [],
|
||||
ceilings: Ceiling[] = [],
|
||||
stairs: Stair[] = [],
|
||||
rooms: Room[] = [],
|
||||
roofs: Roof[] = [],
|
||||
/** Ausmass der Kern-Domänen (Wand-Ecken, Decken, Räume, Dach-Traufen, Treppen), s. `planDomains`. */
|
||||
domainBox: [number, number, number, number] | undefined = undefined,
|
||||
/** Zusätzlich einzurahmende Primitive (Schatten, Parzelle), damit Druck/Einpassen sie ganz zeigen. */
|
||||
extra: Primitive[] = [],
|
||||
) {
|
||||
@@ -1086,25 +952,14 @@ function computeBounds(
|
||||
minX = Math.min(minX, p.x); minY = Math.min(minY, p.y);
|
||||
maxX = Math.max(maxX, p.x); maxY = Math.max(maxY, p.y);
|
||||
};
|
||||
for (const w of walls) {
|
||||
const t = wallTypeThickness(getWallType(project, w));
|
||||
for (const c of wallCorners(w.start, w.end, t)) acc(c);
|
||||
if (domainBox) {
|
||||
acc({ x: domainBox[0], y: domainBox[1] });
|
||||
acc({ x: domainBox[2], y: domainBox[3] });
|
||||
}
|
||||
for (const c of ceilings) for (const p of c.outline) acc(p);
|
||||
for (const r of rooms) for (const p of r.boundary) acc(p);
|
||||
for (const e of extra) {
|
||||
if (e.kind === "polygon") e.pts.forEach(acc);
|
||||
else if (e.kind === "line") { acc(e.a); acc(e.b); }
|
||||
}
|
||||
// Traufe (inkl. Überstand) statt reinem Umriss, damit ein weit auskragendes
|
||||
// Dach das „Einpassen" korrekt mit einrahmt.
|
||||
for (const roof of roofs) for (const p of roofGeometry(roof, 0).eaves) acc(p);
|
||||
for (const s of stairs) {
|
||||
const { zBottom, zTop } = stairVerticalExtent(project, s);
|
||||
const geo = stairGeometry(s, zTop - zBottom);
|
||||
for (const tr of geo.treads) for (const p of tr.pts) acc(p);
|
||||
if (geo.landing) for (const p of geo.landing) acc(p);
|
||||
}
|
||||
for (const d of drawings) {
|
||||
const g = d.geom;
|
||||
if (g.shape === "line" || g.shape === "polyline") {
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
// Decken-Domäne des Grundriss-Generators: die Decke liegt als Slab ÜBER der
|
||||
// Grundriss-Schnittebene und wird daher als flächiger Aufsicht-Umriss
|
||||
// gezeichnet (nicht als Schicht-Querschnitt wie eine Wand) — die Kante wird
|
||||
// gegen die {@link WallFootprint}s der darunterliegenden Wände geclippt, damit
|
||||
// sie dort nicht durch die Wand-Poché schlägt.
|
||||
|
||||
import type { Ceiling, LayerCategory, Project } from "../../model/types";
|
||||
import { getCeilingType, getComponent } from "../../model/types";
|
||||
import { mergeHoles } from "../../geometry/polygonHoles";
|
||||
import { core } from "../../engine/coreWasm";
|
||||
import {
|
||||
NO_HATCH,
|
||||
OVERHEAD_DASH,
|
||||
POCHE_STROKE,
|
||||
LAYER_DETAIL_FACTOR,
|
||||
pocheFill,
|
||||
resolveBackground,
|
||||
resolveForeground,
|
||||
resolveHatch,
|
||||
resolveHatchId,
|
||||
type DetailLevel,
|
||||
type Primitive,
|
||||
} from "./shared";
|
||||
import type { WallFootprint } from "./walls";
|
||||
|
||||
/**
|
||||
* Decken-Poché im Grundriss: die Decke liegt als Slab ÜBER der Schnittebene und
|
||||
* wird daher als geschlossener Umriss ihres Grundriss-Polygons gezeichnet — eine
|
||||
* gefüllte + schraffierte Fläche plus eine kräftige Umrisslinie. Fill/Schraffur
|
||||
* stammen aus dem BAUTEIL der ersten (obersten) Schicht des Aufbau-Typs (analog
|
||||
* zur Wand-Schichtauflösung); die Umrissfarbe aus der optionalen Decken-Farbe
|
||||
* bzw. dem Poché-Strich. Jedes Polygon trägt die `ceilingId` für die Auswahl.
|
||||
*
|
||||
* BEWUSST FLÄCHIG, auch bei mehrschichtigem Deckentyp: anders als die Wand
|
||||
* (deren Schichten im Grundriss als Querschnitt sichtbar sind) liegt der
|
||||
* Schichtaufbau einer Decke in Z (oben → unten) — von oben unsichtbar. Die
|
||||
* Schichtbänderung erscheint daher NUR im Schnitt (siehe `toSection.ts`), nicht
|
||||
* hier. Im Detailgrad „grob" entfällt die Schraffur (nur Fläche + Umriss);
|
||||
* „mittel"/„fein" zeigen die Ansichts-Schraffur des Bauteils (`viewHatchId`,
|
||||
* Default weiss) — die frontal gesehene Aufsicht ist kein Schnitt. `lwMm` ist
|
||||
* die aufgelöste Umriss-Strichstärke (Attribut-Override > Kategorie > Fallback,
|
||||
* vom Aufrufer via `resolveStrokeWeight` bestimmt, analog zur Wand).
|
||||
*/
|
||||
export function addCeilingPoche(
|
||||
out: Primitive[],
|
||||
project: Project,
|
||||
ceiling: Ceiling,
|
||||
greyed: boolean,
|
||||
detail: DetailLevel,
|
||||
category: LayerCategory | undefined,
|
||||
wallFootprints: WallFootprint[],
|
||||
lwMm: number,
|
||||
): void {
|
||||
const pts = ceiling.outline;
|
||||
if (pts.length < 3) return;
|
||||
// Aussparungen (Treppenauge/Schacht) über den Brücken-Trick in EINEN
|
||||
// einfachen Poché-Ring einfügen: kein `openings` ⇒ `ring === pts` und
|
||||
// `bridgeEdges` leer (exakt heutiger Codepfad, siehe {@link mergeHoles}).
|
||||
const ceilingHoles = ceiling.openings ?? [];
|
||||
const { ring, bridgeEdges } = ceilingHoles.length
|
||||
? mergeHoles(pts, ceilingHoles)
|
||||
: { ring: pts, bridgeEdges: [] as number[] };
|
||||
const wt = getCeilingType(project, ceiling);
|
||||
const comp = wt.layers.length > 0 ? getComponent(project, wt.layers[0].componentId) : null;
|
||||
const stroke = ceiling.color ?? POCHE_STROKE;
|
||||
const ceilingId = ceiling.id;
|
||||
|
||||
// Gefüllte Fläche mit der Ansichts-Schraffur: die Decke wird im Grundriss
|
||||
// frontal von unten gesehen, nicht aufgeschnitten — daher greift hier
|
||||
// NICHT die Schnitt-Schraffur (die gehört auf echte Schnittflächen, siehe
|
||||
// resolveCeilingSectionStyle/splitSlabLayers), sondern `viewHatchId`. Fehlt
|
||||
// sie (Default), bleibt die Aufsicht weiss. Im Detailgrad „grob" entfällt
|
||||
// die Schraffur ganz (nur Fläche + Umriss). Das Attribut-Override
|
||||
// `ceiling.hatchId` (+ `hatchSource`) überschreibt diese Ansichts-Schraffur
|
||||
// genauso wie die Schnitt-Schraffur in {@link resolveCeilingSectionStyle}.
|
||||
const effectiveViewHatchId = resolveHatchId(
|
||||
ceiling.hatchId,
|
||||
ceiling.hatchSource,
|
||||
category,
|
||||
comp?.viewHatchId,
|
||||
);
|
||||
const hatch =
|
||||
detail !== "grob" && comp && effectiveViewHatchId
|
||||
? resolveHatch(
|
||||
project,
|
||||
effectiveViewHatchId,
|
||||
undefined,
|
||||
resolveForeground(comp, ceiling.foreground, category, ceiling.foregroundSource),
|
||||
)
|
||||
: NO_HATCH;
|
||||
// Poché-Füllfarbe: Attribut-Override (By-Layer/By-Object) hat Vorrang vor der
|
||||
// neutralen SIA-Fläche, analog zur Wand-Poché (siehe walls.ts).
|
||||
const bgOverride = comp
|
||||
? resolveBackground(comp, ceiling.background, category, ceiling.backgroundSource)
|
||||
: undefined;
|
||||
// Gefüllte Fläche OHNE eigenen Umriss (stroke:"none"): die Decke liegt unter
|
||||
// der Wand-Poché; ihre Kante wird separat als verdeckungs-geclippte Linie
|
||||
// gezeichnet (s. u.), damit sie nicht durch die darüberstehenden Wände schlägt.
|
||||
// Trägt weiterhin die `ceilingId` für die Links-Klick-Auswahl der Fläche.
|
||||
out.push({
|
||||
kind: "polygon",
|
||||
pts: ring,
|
||||
fill: comp ? bgOverride ?? pocheFill(hatch.pattern) : "none",
|
||||
stroke: "none",
|
||||
strokeWidthMm: 0,
|
||||
hatch,
|
||||
greyed,
|
||||
ceilingId,
|
||||
...(bridgeEdges.length ? { noStrokeEdges: bridgeEdges } : {}),
|
||||
});
|
||||
// Kräftige Umrisslinie NUR dort, wo keine Wand die Decke verdeckt: jede
|
||||
// Umriss-Kante (inkl. Lochränder, die als Teil des Rings automatisch
|
||||
// mitgestrichen werden) gegen die Wand-Footprints clippen und die freien
|
||||
// Teilstücke als Linien ausgeben. Liegt die Decke deckungsgleich unter den
|
||||
// Wänden (Regelfall: Deckenumriss = Gebäude-/Wand-Mittellinien), entfällt
|
||||
// der Umriss ganz; nur Überstände (Vordach/Balkon jenseits der Wand)
|
||||
// bleiben sichtbar. Brückenkanten (künstliche Verbindung Aussenring↔Loch)
|
||||
// werden NICHT gestrichen.
|
||||
// Die freien Teilstücke berechnet der Kern (`plan_walls.rs`, [K3a]).
|
||||
const buf: number[] = [ring.length];
|
||||
for (const p of ring) buf.push(p.x, p.y);
|
||||
buf.push(bridgeEdges.length, ...bridgeEdges, wallFootprints.length);
|
||||
for (const fp of wallFootprints) buf.push(fp.a.x, fp.a.y, fp.u.x, fp.u.y, fp.m.x, fp.m.y, fp.len, fp.half, fp.refOff);
|
||||
const f = core().plan_ceiling_outline_flat(Float64Array.from(buf));
|
||||
for (let i = 0; i < f[0]; i++) {
|
||||
out.push({
|
||||
kind: "line",
|
||||
a: { x: f[1 + 4 * i], y: f[2 + 4 * i] },
|
||||
b: { x: f[3 + 4 * i], y: f[4 + 4 * i] },
|
||||
cls: "ceiling-outline",
|
||||
// Überkopf-Ansichtslinie (Decke liegt als Slab über der Schnittebene) →
|
||||
// gestrichelt statt durchgezogen (BIM-Konvention) — die DICKE folgt
|
||||
// aber ceiling.strokeWeight/-Source wie bei der Wand (s. Aufrufer).
|
||||
weightMm: lwMm * LAYER_DETAIL_FACTOR[detail],
|
||||
dash: OVERHEAD_DASH,
|
||||
color: stroke,
|
||||
greyed,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
// Kontext-Domäne des Grundriss-Generators: zeichnet `project.context`
|
||||
// (Höhenlinien, importierte Gebäude/Terrain-Meshes) als dezente Referenz-
|
||||
// Konturen — für Meshes der Grundriss-Fussabdruck nahe der Objekt-Unterkante,
|
||||
// nicht das volle Drahtgitter. Fussabdruck (Sockelkanten, entdoppelt) und Rahmen berechnet der
|
||||
// Rust-Kern (`src-tauri/core/src/plan_misc.rs`, [K3a]).
|
||||
|
||||
import type { Project } from "../../model/types";
|
||||
import { core } from "../../engine/coreWasm";
|
||||
import { NO_HATCH, SHOW_ALL, type CategoryDisplayResolver, type Primitive } from "./shared";
|
||||
|
||||
/** Dezente Plan-Farbe der Kontext-Konturen (gedämpftes Grau). */
|
||||
const CONTEXT_LINE_COLOR = "#9aa3ad";
|
||||
/** Strichstärke der Kontext-Konturen (mm Papier, dünn). */
|
||||
const CONTEXT_LINE_MM = 0.1;
|
||||
|
||||
/**
|
||||
* Zeichnet die Kontext-Schicht `project.context` in den Grundriss:
|
||||
* • ContourSet (Höhenlinien) → dünne Referenz-Linien (Z ignoriert).
|
||||
* • ImportedMesh (Gebäude) → GRUNDRISS-FUSSABDRUCK: die Dreieckskanten nahe
|
||||
* der Objekt-Unterkante (Sockel), auf die XY-Ebene projiziert und über
|
||||
* quantisierte Endpunkte entdoppelt — so erscheint das importierte Haus als
|
||||
* erkennbarer Umriss im Plan (Nutzer-Wunsch: „ich sehe es sonst nicht"),
|
||||
* ohne das gesamte Dach-Drahtgitter dicht darüberzulegen.
|
||||
* • TerrainMesh → nur der 2D-Umriss (Bounding-Box), da ein volles TIN-Gitter
|
||||
* im Plan unbrauchbar dicht wäre.
|
||||
* Rein additiv — Wand-/Drawing-Darstellung bleibt unberührt.
|
||||
*
|
||||
* SICHTBARKEIT: jedes Objekt trägt (seit der Ebenen-Zuordnung der Kontext-
|
||||
* Schicht) optional eine `categoryCode` (s. `model/contextCategories.ts`) —
|
||||
* genau wie jedes andere Bauteil wird sie gegen `visibleCodes`/
|
||||
* `categoryDisplay` geprüft (Muster 1:1 aus `sections.ts::addSectionLines`).
|
||||
* Objekte OHNE `categoryCode` (ältere Importe vor dieser Erweiterung) bleiben
|
||||
* bewusst IMMER sichtbar (Rückwärtskompatibilität) statt stillschweigend zu
|
||||
* verschwinden.
|
||||
*/
|
||||
export function addContextContours(
|
||||
out: Primitive[],
|
||||
project: Project,
|
||||
visibleCodes?: Set<string>,
|
||||
categoryDisplay: CategoryDisplayResolver = SHOW_ALL,
|
||||
): void {
|
||||
const context = project.context ?? [];
|
||||
for (const obj of context) {
|
||||
const code = obj.categoryCode;
|
||||
if (code !== undefined) {
|
||||
const d = categoryDisplay(code);
|
||||
if ((visibleCodes && !visibleCodes.has(code)) || !d.render) continue;
|
||||
}
|
||||
if (obj.type === "contourSet") {
|
||||
for (const c of obj.contours) {
|
||||
const pts = c.pts;
|
||||
if (pts.length < 2) continue;
|
||||
const segEnd = c.closed ? pts.length : pts.length - 1;
|
||||
for (let i = 0; i < segEnd; i++) {
|
||||
out.push({
|
||||
kind: "line",
|
||||
a: pts[i],
|
||||
b: pts[(i + 1) % pts.length],
|
||||
cls: "context-line",
|
||||
weightMm: CONTEXT_LINE_MM,
|
||||
color: CONTEXT_LINE_COLOR,
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (obj.type === "importedMesh") {
|
||||
addMeshFootprint(out, obj.positions, obj.indices);
|
||||
addContextPickRegion(out, obj.positions, obj.id);
|
||||
} else if (obj.type === "terrainMesh") {
|
||||
addMeshBboxOutline(out, obj.positions);
|
||||
addContextPickRegion(out, obj.positions, obj.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Zeichnet den Grundriss-Fussabdruck eines Meshes: Dreieckskanten nahe der
|
||||
* Unterkante (minZ + 0.6 m), auf XY projiziert, über 1-cm-quantisierte Endpunkte
|
||||
* entdoppelt. `positions` = flaches [x,y,z…]-Array (Modell-Meter, z = Höhe),
|
||||
* `indices` = Dreiecks-Indizes.
|
||||
*/
|
||||
function addMeshFootprint(out: Primitive[], positions: number[], indices: number[]): void {
|
||||
const f = core().context_footprint_flat(Float64Array.from(positions), Float64Array.from(indices));
|
||||
for (let i = 0; i < f[0]; i++) {
|
||||
out.push({
|
||||
kind: "line",
|
||||
a: { x: f[1 + 4 * i], y: f[2 + 4 * i] },
|
||||
b: { x: f[3 + 4 * i], y: f[4 + 4 * i] },
|
||||
cls: "context-line",
|
||||
weightMm: CONTEXT_LINE_MM,
|
||||
color: CONTEXT_LINE_COLOR,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** Grundriss-Rahmen eines Meshes (nur x/y) als vier Eckpunkte, oder `null` ohne Punkte. */
|
||||
function meshBboxCorners(positions: number[]): { x: number; y: number }[] | null {
|
||||
const b = core().context_bbox_flat(Float64Array.from(positions));
|
||||
if (b.length === 0) return null;
|
||||
return [
|
||||
{ x: b[0], y: b[1] },
|
||||
{ x: b[2], y: b[1] },
|
||||
{ x: b[2], y: b[3] },
|
||||
{ x: b[0], y: b[3] },
|
||||
];
|
||||
}
|
||||
|
||||
/** Zeichnet nur den achsenparallelen 2D-Umriss (Bounding-Box) eines Meshes —
|
||||
* für Terrain, dessen volles TIN-Gitter im Plan zu dicht wäre. */
|
||||
function addMeshBboxOutline(out: Primitive[], positions: number[]): void {
|
||||
const corners = meshBboxCorners(positions);
|
||||
if (!corners) return;
|
||||
for (let i = 0; i < 4; i++) {
|
||||
out.push({
|
||||
kind: "line",
|
||||
a: corners[i],
|
||||
b: corners[(i + 1) % 4],
|
||||
cls: "context-line",
|
||||
weightMm: CONTEXT_LINE_MM,
|
||||
color: CONTEXT_LINE_COLOR,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsichtbares Pick-Band (Grundriss-Bounding-Box) für ein Kontext-Objekt
|
||||
* (importiertes Gebäude/Terrain) — klickbar per Punkt-in-Polygon in PlanView,
|
||||
* trägt die `ContextObject.id` (analog `sectionLineId`, s. dort). Macht das
|
||||
* Objekt IRGENDWO innerhalb seiner Grundfläche anklickbar (nicht nur exakt auf
|
||||
* der dünnen Umriss-/Fussabdrucklinie) — wie bei Wänden, deren Poché-Fläche
|
||||
* ebenfalls als Ganzes klickbar ist.
|
||||
*/
|
||||
function addContextPickRegion(out: Primitive[], positions: number[], id: string): void {
|
||||
const pts = meshBboxCorners(positions);
|
||||
if (!pts) return;
|
||||
out.push({
|
||||
kind: "polygon",
|
||||
pts,
|
||||
fill: "none",
|
||||
stroke: "none",
|
||||
strokeWidthMm: 0,
|
||||
hatch: NO_HATCH,
|
||||
contextObjectId: id,
|
||||
});
|
||||
}
|
||||
@@ -1,218 +0,0 @@
|
||||
// Öffnungs-Domäne des Grundriss-Generators: Tür-/Fenstersymbole je Detailgrad
|
||||
// (Blatt/Schwenkbogen/Anschlag bzw. Rahmen/Sprossen/Glas), das optionale
|
||||
// Rahmenband (Zarge/Blockrahmen) samt Schichteinzug aus der Typ-Bibliothek.
|
||||
//
|
||||
// Die Geometrie entsteht im Rust-Kern (`src-tauri/core/src/plan_openings.rs`, [K3a]); hier bleibt
|
||||
// die Auflösung aus dem Modell (Typ-Bibliothek, Linien-Overrides) und die Übersetzung in
|
||||
// `Primitive`-Objekte mit Farbe, Strichstärke und `openingId`. Fällt mit [K3d] weg.
|
||||
|
||||
import type { Opening, Project, Wall } from "../../model/types";
|
||||
import {
|
||||
getDoorType,
|
||||
getWindowType,
|
||||
getWallType,
|
||||
sashesOfWindowType,
|
||||
wallTypeThickness,
|
||||
} from "../../model/types";
|
||||
import { wallReferenceOffset } from "../../model/wall";
|
||||
import { core } from "../../engine/coreWasm";
|
||||
import {
|
||||
NO_HATCH,
|
||||
OVERHEAD_DASH,
|
||||
POCHE_STROKE,
|
||||
SYMBOL_HAIRLINE_MM,
|
||||
type DetailLevel,
|
||||
type Primitive,
|
||||
} from "./shared";
|
||||
|
||||
/** Linienklassen in der Reihenfolge der Kern-Kodierung (`plan_openings.rs`). */
|
||||
const LINE_CLS = [
|
||||
"door-leaf", "door-frame", "door-lintel", "opening-frame", "window-glass", "window-mullion",
|
||||
"window-sash", "window-stulp", "window-sill", "window-frame", "window-shading",
|
||||
] as const;
|
||||
/** Strichmuster (Kern-Kodierung): 1 Sturz, 2 Überkopf, 3 gepunktet. */
|
||||
const DASHES: (number[] | undefined)[] = [undefined, [0.18, 0.09], OVERHEAD_DASH, [0.04, 0.08]];
|
||||
const DETAIL_CODE: Record<DetailLevel, number> = { grob: 0, mittel: 1, fein: 2 };
|
||||
const LINTEL_CODE = { keine: 0, aussen: 1, innen: 2, beide: 3 } as const;
|
||||
const SILL_CODE = { aussen: 1, innen: 2, beide: 3 } as const;
|
||||
|
||||
/**
|
||||
* Aufgelöste Rahmen-Parameter (Typ-Bibliothek) einer Tür-/Fenster-Öffnung —
|
||||
* nur vorhanden, wenn die Öffnung einen Bauteil-Typ referenziert (`typeId`).
|
||||
* Fehlt der Typ, bleibt das heutige Inline-Verhalten unverändert (kein
|
||||
* Rahmenband, kein Oberlicht) — siehe `resolveOpeningFrameSpec`.
|
||||
*/
|
||||
interface OpeningFrameSpec {
|
||||
frameWidth: number;
|
||||
/** Nur bei Türen relevant; Fenster zeichnen stets die schmale Zargen-Optik. */
|
||||
frameKind: "zarge" | "blockrahmen";
|
||||
insetFromFace: number;
|
||||
insetFace: "aussen" | "innen";
|
||||
transomHeight: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Löst die Rahmen-Parameter aus dem referenzierten Tür-/Fenstertyp auf (samt
|
||||
* Defaults); `undefined`, wenn kein Typ referenziert/auflösbar ist — die
|
||||
* Öffnung bleibt dann beim heutigen Inline-Verhalten (rückwärtskompatibel).
|
||||
*/
|
||||
function resolveOpeningFrameSpec(project: Project, o: Opening): OpeningFrameSpec | undefined {
|
||||
if (o.kind === "door") {
|
||||
const t = getDoorType(project, o);
|
||||
if (!t) return undefined;
|
||||
return {
|
||||
frameWidth: t.frameWidth ?? 0.06,
|
||||
frameKind: t.frameKind ?? "zarge",
|
||||
insetFromFace: t.insetFromFace ?? 0,
|
||||
insetFace: t.insetFace ?? "aussen",
|
||||
transomHeight: t.transomHeight ?? 0,
|
||||
};
|
||||
}
|
||||
const t = getWindowType(project, o);
|
||||
if (!t) return undefined;
|
||||
return {
|
||||
frameWidth: t.frameWidth ?? 0.06,
|
||||
frameKind: "zarge",
|
||||
insetFromFace: t.insetFromFace ?? 0,
|
||||
insetFace: t.insetFace ?? "aussen",
|
||||
transomHeight: t.transomHeight ?? 0,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Öffnungs-Symbol (Fenster/Tür) je Detailgrad. Arbeitet über den Kern (`plan_openings.rs`) und
|
||||
* taggt ihre Primitive mit `openingId`, sodass die Öffnung im Plan selektierbar ist.
|
||||
*
|
||||
* Tür:
|
||||
* • grob — gerade Türblatt-Linie (die Lücke kommt aus der ausgesparten Poché).
|
||||
* • mittel — + Schwenkbogen (Öffnungswinkel).
|
||||
* • fein — + Anschlag-Striche an beiden Pfosten.
|
||||
* Fenster:
|
||||
* • grob — eine einzelne Glaslinie über die Lücke.
|
||||
* • mittel — Rahmen-Rechteck (Umriss) + Pfosten/Stulp.
|
||||
* • fein — + Flügelrahmen, Fensterbank, Anschlagkerben.
|
||||
*/
|
||||
export function addOpeningSymbol(
|
||||
out: Primitive[],
|
||||
project: Project,
|
||||
wall: Wall,
|
||||
o: Opening,
|
||||
greyed: boolean,
|
||||
detail: DetailLevel,
|
||||
lwMm: number,
|
||||
): void {
|
||||
const total = wallTypeThickness(getWallType(project, wall));
|
||||
const refOff = wallReferenceOffset(wall, total);
|
||||
const door = o.kind === "door";
|
||||
const wt = door ? undefined : getWindowType(project, o);
|
||||
const frameSpec = door ? resolveOpeningFrameSpec(project, o) : undefined;
|
||||
const sashes = wt ? sashesOfWindowType(wt) : [];
|
||||
const strokeColor = o.color ?? POCHE_STROKE;
|
||||
// Linien-Kategorien einzeln übersteuerbar: Rahmen-Schnitt, Rahmen-Aufsicht, Fenster
|
||||
// (Flügelrahmen/Sprossen), Sims. `undefined` ⇒ Strichfarbe/Haarlinie.
|
||||
const frameColor = o.frameLine?.color ?? strokeColor;
|
||||
const frameWeight = o.frameLine?.weight ?? lwMm;
|
||||
const frameViewWeight = o.frameViewLine?.weight ?? frameWeight;
|
||||
const colors = [
|
||||
"",
|
||||
strokeColor,
|
||||
frameColor,
|
||||
o.frameViewLine?.color ?? frameColor,
|
||||
o.sashLine?.color ?? strokeColor,
|
||||
o.sillLineStyle?.color ?? strokeColor,
|
||||
];
|
||||
const b: number[] = [
|
||||
wall.start.x, wall.start.y, wall.end.x, wall.end.y, total, refOff,
|
||||
o.position, o.width, door ? 1 : 0, DETAIL_CODE[detail],
|
||||
// Tür
|
||||
(o.swing ?? "left") !== "left" ? 1 : 0,
|
||||
(o.openingDir ?? "in") !== "in" ? 1 : 0,
|
||||
(o.hinge ?? "start") !== "start" ? 1 : 0,
|
||||
o.swingAngle ?? Number.NaN,
|
||||
(o.doorType ?? "normal") === "wandoeffnung" ? 1 : 0,
|
||||
door ? Math.max(1, Math.round(getDoorType(project, o)?.leafCount ?? 1)) : 1,
|
||||
LINTEL_CODE[o.lintelLines ?? "beide"],
|
||||
// Rahmenband
|
||||
frameSpec ? 1 : 0,
|
||||
frameSpec?.frameWidth ?? 0,
|
||||
frameSpec?.frameKind === "blockrahmen" ? 1 : 0,
|
||||
frameSpec?.insetFromFace ?? 0,
|
||||
frameSpec?.insetFace === "innen" ? 1 : 0,
|
||||
// Fenster
|
||||
wt ? 1 : 0,
|
||||
wt ? wt.frameWidth ?? 0.06 : 0,
|
||||
wt?.frameDepth ?? Number.NaN,
|
||||
wt?.insetFromFace ?? Number.NaN,
|
||||
wt?.insetFace === "innen" ? 1 : 0,
|
||||
o.wingCount ?? Number.NaN,
|
||||
detail === "fein" ? 2 : 1,
|
||||
wt?.sillLine ? SILL_CODE[wt.sillLine.faces] : 0,
|
||||
wt?.sillLine?.view === "unter" ? 1 : 0,
|
||||
wt?.shading?.create ? 1 : 0,
|
||||
wt?.shading?.box.width ?? 0,
|
||||
wt?.shading?.box.height ?? 0,
|
||||
// Strichstärken
|
||||
SYMBOL_HAIRLINE_MM,
|
||||
o.frameLine?.weight ?? SYMBOL_HAIRLINE_MM,
|
||||
frameViewWeight,
|
||||
o.sashLine?.weight ?? SYMBOL_HAIRLINE_MM,
|
||||
o.sillLineStyle?.weight ?? SYMBOL_HAIRLINE_MM,
|
||||
sashes.length,
|
||||
];
|
||||
for (const s of sashes) {
|
||||
b.push(s.kind === "pfosten" ? 1 : 0, s.autoWidth === false ? 0 : 1, s.width ?? Number.NaN, s.postWidth ?? Number.NaN,
|
||||
s.opening && s.opening !== "fest" ? 1 : 0);
|
||||
}
|
||||
const f = core().plan_opening_flat(Float64Array.from(b));
|
||||
if (f.length === 0) return;
|
||||
const openingId = o.id;
|
||||
const n = f[0];
|
||||
let i = 1;
|
||||
for (let k = 0; k < n; k++) {
|
||||
if (f[i] === 1) {
|
||||
const count = f[i + 4];
|
||||
const pts = new Array<{ x: number; y: number }>(count);
|
||||
for (let j = 0; j < count; j++) pts[j] = { x: f[i + 5 + 2 * j], y: f[i + 6 + 2 * j] };
|
||||
const frame = f[i + 1] === 1;
|
||||
out.push({
|
||||
kind: "polygon",
|
||||
pts,
|
||||
fill: "none",
|
||||
stroke: frame ? colors[f[i + 3]] : "none",
|
||||
strokeWidthMm: f[i + 2],
|
||||
hatch: NO_HATCH,
|
||||
greyed,
|
||||
openingId,
|
||||
});
|
||||
i += 5 + 2 * count;
|
||||
} else if (f[i] === 2) {
|
||||
const slot = f[i + 3];
|
||||
const dash = DASHES[f[i + 4]];
|
||||
out.push({
|
||||
kind: "line",
|
||||
a: { x: f[i + 5], y: f[i + 6] },
|
||||
b: { x: f[i + 7], y: f[i + 8] },
|
||||
cls: LINE_CLS[f[i + 1]],
|
||||
weightMm: f[i + 2],
|
||||
...(dash ? { dash } : {}),
|
||||
...(slot ? { color: colors[slot] } : {}),
|
||||
greyed,
|
||||
openingId,
|
||||
});
|
||||
i += 9;
|
||||
} else {
|
||||
out.push({
|
||||
kind: "arc",
|
||||
center: { x: f[i + 2], y: f[i + 3] },
|
||||
from: { x: f[i + 4], y: f[i + 5] },
|
||||
to: { x: f[i + 6], y: f[i + 7] },
|
||||
r: f[i + 8],
|
||||
cls: "door-swing",
|
||||
weightMm: f[i + 1],
|
||||
greyed,
|
||||
openingId,
|
||||
});
|
||||
i += 9;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
// Dach-Domäne des Grundriss-Generators (Dachaufsicht): reine Linien-Darstellung
|
||||
// ohne Poché — Traufe/First/Grat/Knick aus `roofGeometry`.
|
||||
|
||||
import type { LayerCategory, Project, Roof } from "../../model/types";
|
||||
import { getComponent, roofLayers } from "../../model/types";
|
||||
import { roofGeometry } from "../../geometry/roof";
|
||||
import {
|
||||
NO_HATCH,
|
||||
POCHE_STROKE,
|
||||
ROOF_BREAK_DASH,
|
||||
ROOF_BREAK_MM,
|
||||
ROOF_EAVES_MM,
|
||||
ROOF_HIP_MM,
|
||||
ROOF_RIDGE_MM,
|
||||
resolveHatch,
|
||||
type Primitive,
|
||||
} from "./shared";
|
||||
|
||||
/**
|
||||
* Dach im Grundriss (Dachaufsicht): reine Linien-Darstellung ohne Poché — die
|
||||
* 2D-Geometrie aus `roofGeometry` (First/Grat/Knick hängen NICHT von der
|
||||
* Traufhöhe ab, daher `eavesZ=0`):
|
||||
* • Traufe (`eaves`): geschlossener Umriss-Ring als mittlere Haarlinie.
|
||||
* • First (`ridges`): kräftige Volllinie, etwas stärker als die Traufe.
|
||||
* • Grat (`hips`, Walm/Zelt): Volllinie zwischen Traufe- und First-Stärke.
|
||||
* • Knick (`breaks`, Mansarde): dünne gestrichelte Linie.
|
||||
* Farbe: `roof.color` übersteuert sonst die Kategorie-Farbe (analog Stützen-
|
||||
* Poché), Default die neutrale Poché-Tinte.
|
||||
*/
|
||||
export function addRoof(
|
||||
out: Primitive[],
|
||||
project: Project,
|
||||
roof: Roof,
|
||||
greyed: boolean,
|
||||
category: LayerCategory | undefined,
|
||||
): void {
|
||||
const stroke = roof.color ?? category?.color ?? POCHE_STROKE;
|
||||
const geo = roofGeometry(roof, 0);
|
||||
|
||||
// Ansichts-Poché der Dachaufsicht: das Dach liegt ÜBER der Schnittebene und
|
||||
// wird von oben gesehen (nicht geschnitten) → Ansichts-Schraffur
|
||||
// (viewHatchId) der ÄUSSERSTEN Schicht (Eindeckung) des Dachtyps, analog dem
|
||||
// Decken-Poché (Aufsicht = erste Lage). Ohne Dachtyp/viewHatchId keine
|
||||
// Schraffur (weiss) — die Fläche bleibt trotzdem das Pick-Polygon.
|
||||
let viewHatch = NO_HATCH;
|
||||
const firstLayer = roofLayers(project, roof)[0];
|
||||
if (firstLayer?.componentId) {
|
||||
try {
|
||||
const comp = getComponent(project, firstLayer.componentId);
|
||||
if (comp.viewHatchId) viewHatch = resolveHatch(project, comp.viewHatchId);
|
||||
} catch {
|
||||
viewHatch = NO_HATCH;
|
||||
}
|
||||
}
|
||||
|
||||
// Pick-Polygon über der Traufe-Fläche (macht das Dach über die ganze Fläche
|
||||
// per Links-Klick selektierbar) — trägt jetzt zusätzlich die Ansichts-
|
||||
// Schraffur der Eindeckung (fill bleibt "none": keine Volltonfüllung, nur
|
||||
// Musterlinien). PlanView testet die `pts` (Punkt-in-Polygon).
|
||||
if (geo.eaves.length >= 3) {
|
||||
out.push({
|
||||
kind: "polygon",
|
||||
pts: geo.eaves,
|
||||
fill: "none",
|
||||
stroke: "none",
|
||||
strokeWidthMm: 0,
|
||||
hatch: viewHatch,
|
||||
greyed,
|
||||
roofId: roof.id,
|
||||
});
|
||||
}
|
||||
|
||||
const n = geo.eaves.length;
|
||||
for (let i = 0; i < n; i++) {
|
||||
out.push({
|
||||
kind: "line",
|
||||
a: geo.eaves[i],
|
||||
b: geo.eaves[(i + 1) % n],
|
||||
cls: "roof-eaves",
|
||||
weightMm: ROOF_EAVES_MM,
|
||||
color: stroke,
|
||||
greyed,
|
||||
});
|
||||
}
|
||||
for (const [a, b] of geo.ridges) {
|
||||
out.push({ kind: "line", a, b, cls: "roof-ridge", weightMm: ROOF_RIDGE_MM, color: stroke, greyed });
|
||||
}
|
||||
for (const [a, b] of geo.hips) {
|
||||
out.push({ kind: "line", a, b, cls: "roof-hip", weightMm: ROOF_HIP_MM, color: stroke, greyed });
|
||||
}
|
||||
for (const [a, b] of geo.breaks) {
|
||||
out.push({
|
||||
kind: "line",
|
||||
a,
|
||||
b,
|
||||
cls: "roof-break",
|
||||
weightMm: ROOF_BREAK_MM,
|
||||
dash: ROOF_BREAK_DASH,
|
||||
color: stroke,
|
||||
greyed,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
// Raum-Domäne des Grundriss-Generators (SIA-416-Flächen): eine (unsichtbare,
|
||||
// nur klickbare) Füllfläche + dünne neutrale Umrisslinie + ein Raum-Stempel
|
||||
// (Name, Fläche, SIA-Kürzel) am Anker.
|
||||
|
||||
import type { Room } from "../../model/types";
|
||||
import { evaluateRoom, siaLabel } from "../../geometry/roomArea";
|
||||
import { docFromText } from "../../text/richText";
|
||||
import { roomStampExtraLines, roomStampToDoc } from "../../model/roomStamp";
|
||||
import { LAYER_DETAIL_FACTOR, LAYER_LINE_MM, NO_HATCH, type DetailLevel, type Primitive } from "./shared";
|
||||
|
||||
/**
|
||||
* Deckkraft (0..255) der Raum-Füllung → 2-stelliges Hex-Suffix. Transluzente
|
||||
* Farbfüllung entfällt — Plandarstellung schwarz/grau; Farbe bleibt späteren
|
||||
* Schema-Ebenen vorbehalten. Alpha 0 = unsichtbar; das Polygon bleibt als
|
||||
* `roomId`-Primitiv erhalten (Auswahl per Punkt-in-Polygon in PlanView, NICHT
|
||||
* über die native Pointer-Trefferfläche der Füllung — die volle Fläche bleibt
|
||||
* damit trotz Alpha 0 klickbar).
|
||||
*/
|
||||
const ROOM_FILL_ALPHA = "00";
|
||||
/** Basis-Schriftgrösse des Raum-Stempels in Punkt (pt). */
|
||||
const ROOM_STAMP_PT = 10;
|
||||
|
||||
/** Farbe mit Alpha-Suffix versehen (nur, wenn `color` ein 6-stelliges Hex ist). */
|
||||
function withAlpha(color: string, alphaHex: string): string {
|
||||
return /^#[0-9a-fA-F]{6}$/.test(color) ? `${color}${alphaHex}` : color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Raum (SIA-416-Fläche) im Grundriss: eine (unsichtbare, nur klickbare) Füll-
|
||||
* fläche über dem lichten Umriss + eine dünne neutrale Umrisslinie (beide
|
||||
* `roomId`-getaggt für die Auswahl) + ein Raum-Stempel (Text) am Anker
|
||||
* (Centroid oder `stampAnchor`) mit Name, Fläche „24.30 m²" und SIA-Kürzel.
|
||||
* Keine Farbwäsche — Plandarstellung schwarz/grau, Farbe bleibt späteren
|
||||
* Schema-Ebenen vorbehalten. Der Stempel entfällt beim Detailgrad „grob";
|
||||
* Fläche/Umfang/Schwerpunkt werden aus `boundary` abgeleitet (nie gespeichert).
|
||||
* Wird UNTER der Wand-Poché gezeichnet.
|
||||
*/
|
||||
export function addRoomArea(
|
||||
out: Primitive[],
|
||||
room: Room,
|
||||
greyed: boolean,
|
||||
detail: DetailLevel,
|
||||
): void {
|
||||
const pts = room.boundary;
|
||||
if (pts.length < 3) return;
|
||||
const res = evaluateRoom(pts, room.siaCategory);
|
||||
const stroke = room.color;
|
||||
|
||||
// Unsichtbare Füllfläche (Alpha 0): keine Farbwäsche im Plan, das Polygon
|
||||
// bleibt aber als `roomId`-Primitiv für die Punkt-in-Polygon-Auswahl erhalten.
|
||||
out.push({
|
||||
kind: "polygon",
|
||||
pts,
|
||||
fill: withAlpha(room.color, ROOM_FILL_ALPHA),
|
||||
stroke,
|
||||
strokeWidthMm: LAYER_LINE_MM * LAYER_DETAIL_FACTOR[detail],
|
||||
hatch: NO_HATCH,
|
||||
greyed,
|
||||
roomId: room.id,
|
||||
});
|
||||
|
||||
// Raum-Stempel: frei editierbarer Rich-Text (Name/Notizen) + LIVE-Flächenzeile
|
||||
// + SIA-Kürzel. Anker fix (stampAnchor, sonst Centroid). Nur ab Detailgrad
|
||||
// „mittel". Die Flächenzeile aktualisiert sich unabhängig vom editierten Text.
|
||||
if (detail !== "grob") {
|
||||
const at = room.stampAnchor ?? res.centroid;
|
||||
// Strukturierter Stempel (Feldmodell) hat Vorrang; sonst Alt-Pfad (Rich-Text
|
||||
// bzw. Raum-Name als einfacher Text).
|
||||
const doc = room.stamp
|
||||
? roomStampToDoc(room.stamp)
|
||||
: room.stampDoc ?? docFromText(room.name);
|
||||
const extraLines = room.stamp
|
||||
? roomStampExtraLines(room.stamp, {
|
||||
netArea: res.netArea,
|
||||
siaCategory: room.siaCategory,
|
||||
siaLabel: siaLabel(room.siaCategory),
|
||||
})
|
||||
: [
|
||||
{ text: `${res.netArea.toFixed(2)} m²`, align: "center" as const },
|
||||
{
|
||||
text: `${room.siaCategory} · ${siaLabel(room.siaCategory)}`,
|
||||
align: "center" as const,
|
||||
},
|
||||
];
|
||||
out.push({
|
||||
kind: "text",
|
||||
at,
|
||||
doc,
|
||||
extraLines,
|
||||
basePt: ROOM_STAMP_PT,
|
||||
color: stroke,
|
||||
roomId: room.id,
|
||||
greyed,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
// Schnittführungs-Symbol-Domäne des Grundriss-Generators (klassische
|
||||
// Strichpunkt-Schnittlinie mit Endmarken + Label) — NICHT zu verwechseln mit
|
||||
// `generateSectionPlan()` (der Schnitt-ALS-Plan-Übersetzung, bleibt Orchestrator
|
||||
// in `../generatePlan.ts`): diese Domäne zeichnet nur das Führungssymbol EINER
|
||||
// Schnitt-/Ansichtsebene IM Grundriss. Die Geometrie berechnet der Rust-Kern (`plan_misc.rs`, [K3a]).
|
||||
|
||||
import { core } from "../../engine/coreWasm";
|
||||
import type { Project } from "../../model/types";
|
||||
import { NO_HATCH, SHOW_ALL, type CategoryDisplayResolver, type Primitive } from "./shared";
|
||||
|
||||
/**
|
||||
* Kategorie-Code der Schnittführungs-Symbole — feste Zuordnung zu "90"
|
||||
* (Referenzen), derselben Kategorie wie Kontext-Konturen/Höhenlinien:
|
||||
* Schnittlinien sind Dokumentations-/Referenzelemente, keine Bauteile, und
|
||||
* bekommen deshalb kein eigenes Sichtbarkeits-Flag mehr am DrawingLevel —
|
||||
* sie sind ein Element AUF einer Ebene und werden NUR darüber (Ebenen-Panel,
|
||||
* visibleCodes/categoryDisplay) ein-/ausgeblendet, wie jedes andere Bauteil.
|
||||
*/
|
||||
const SECTION_LINE_CATEGORY = "90";
|
||||
|
||||
/** Tinte der Schnittführungs-Linie/Marken (kräftiges Grau). */
|
||||
const SECTION_LINE_INK = "#1f242c";
|
||||
/** Haarlinie der Strichpunkt-Schnittlinie (mm Papier). */
|
||||
const SECTION_LINE_MM = 0.18;
|
||||
/** Kräftige Endmarken (Querstrich + Pfeil) (mm Papier). */
|
||||
const SECTION_LINE_MARK_MM = 0.5;
|
||||
/** Strichpunkt-Muster der Schnittlinie (lange Striche + Punkt, mm Papier). */
|
||||
const SECTION_LINE_DASH: number[] = [6, 1.5, 0.4, 1.5];
|
||||
/** Schrifthöhe des Schnitt-Labels (Modell-Meter). */
|
||||
const SECTION_LABEL_H = 0.5;
|
||||
|
||||
/**
|
||||
* Kurz-Tag eines Schnitt-Labels: der letzte „Wort"-Teil des Ebenennamens (z. B.
|
||||
* „Schnitt A" → „A"); enthält der Name kein Leerzeichen, der ganze Name. Klassisch
|
||||
* wird der Schnitt an beiden Enden mit diesem Tag beschriftet (A–A).
|
||||
*/
|
||||
function sectionLabelTag(name: string): string {
|
||||
const parts = name.trim().split(/\s+/);
|
||||
return parts.length > 1 ? parts[parts.length - 1] : name.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Zeichnet für jede Schnitt-/Ansichtsebene MIT gesetzter `linePoints` das
|
||||
* klassische Schnittführungs-Symbol in den Grundriss: eine Strichpunkt-Haarlinie
|
||||
* über die volle Länge, an beiden Enden einen kräftigen Querstrich + Richtungspfeil
|
||||
* auf der Blickseite (`directionSign`) und das Schnitt-Label (Kurz-Tag) daneben.
|
||||
* Zusätzlich ein unsichtbares Pick-Band (Polygon mit `sectionLineId`), damit die
|
||||
* Linie im Grundriss anklickbar ist (analog dem Dach-Traufe-Pick-Polygon).
|
||||
*
|
||||
* Sichtbarkeit/Dimmen läuft über die Kategorie "90" (Referenzen) — genau wie
|
||||
* bei Wänden/Decken/Räumen, NICHT über das eigene Sichtbarkeits-Flag der
|
||||
* Schnitt-/Ansichtsebene (Nutzer-Feedback: "diese sollten Elemente sein, die
|
||||
* sich auf einer Ebene befinden und nur damit ein-/ausgeblendet werden").
|
||||
* `visibleCodes`/`categoryDisplay` fehlen sie (Export-/Print-Pfad ohne
|
||||
* Ebenen-Filter) → immer sichtbar, wie bisher.
|
||||
*/
|
||||
export function addSectionLines(
|
||||
out: Primitive[],
|
||||
project: Project,
|
||||
visibleCodes?: Set<string>,
|
||||
categoryDisplay: CategoryDisplayResolver = SHOW_ALL,
|
||||
): void {
|
||||
const d = categoryDisplay(SECTION_LINE_CATEGORY);
|
||||
if ((visibleCodes && !visibleCodes.has(SECTION_LINE_CATEGORY)) || !d.render) return;
|
||||
const greyed = d.greyed;
|
||||
for (const level of project.drawingLevels) {
|
||||
if (level.kind !== "section" && level.kind !== "elevation") continue;
|
||||
const line = level.linePoints;
|
||||
if (!line) continue;
|
||||
const [p0, p1] = line;
|
||||
const f = core().section_line_flat(p0.x, p0.y, p1.x, p1.y, level.directionSign ?? 1);
|
||||
if (f.length === 0) continue;
|
||||
let i = 1;
|
||||
for (let k = 0; k < f[0]; k++) {
|
||||
if (f[i] === 2) {
|
||||
const main = f[i + 1] === 0;
|
||||
out.push({
|
||||
kind: "line",
|
||||
a: { x: f[i + 2], y: f[i + 3] },
|
||||
b: { x: f[i + 4], y: f[i + 5] },
|
||||
cls: "section-line",
|
||||
weightMm: main ? SECTION_LINE_MM : SECTION_LINE_MARK_MM,
|
||||
...(main ? { dash: SECTION_LINE_DASH } : {}),
|
||||
color: SECTION_LINE_INK,
|
||||
greyed,
|
||||
});
|
||||
i += 6;
|
||||
} else if (f[i] === 5) {
|
||||
out.push({
|
||||
kind: "drawingText",
|
||||
at: { x: f[i + 1], y: f[i + 2] },
|
||||
text: sectionLabelTag(level.name),
|
||||
heightM: SECTION_LABEL_H,
|
||||
angle: 0,
|
||||
color: SECTION_LINE_INK,
|
||||
greyed,
|
||||
});
|
||||
i += 3;
|
||||
} else {
|
||||
// Unsichtbares Pick-Band (Rechteck entlang der Linie) — klickbar per Punkt-in-Polygon in
|
||||
// PlanView, trägt die DrawingLevel-Id.
|
||||
out.push({
|
||||
kind: "polygon",
|
||||
pts: [0, 1, 2, 3].map((j) => ({ x: f[i + 1 + 2 * j], y: f[i + 2 + 2 * j] })),
|
||||
fill: "none",
|
||||
stroke: "none",
|
||||
strokeWidthMm: 0,
|
||||
hatch: NO_HATCH,
|
||||
sectionLineId: level.id,
|
||||
});
|
||||
i += 9;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// Gemeinsame Grundlage des Grundriss-Generators: das `Primitive`-Vokabular
|
||||
// (das EINZIGE Austauschformat zwischen `generatePlan()`/`generateSectionPlan()`
|
||||
// und allen Bauteil-Domänen unter `generatePlan/`), die By-Layer/By-Object-
|
||||
// und den Domänen — unter `generatePlan/` in TS, die meisten im Rust-Kern mit
|
||||
// derselben JSON-Form, `src-tauri/core/src/plan/prim.rs`), die By-Layer/By-Object-
|
||||
// Attribut-Auflösung (`resolve*`) sowie die Papier-mm-/Tinten-Konstanten, die
|
||||
// über mehrere Domänen hinweg identisch gelten müssen (SIA-Poché, Haarlinien).
|
||||
//
|
||||
@@ -53,33 +54,8 @@ export const MONO_INK = "#111111";
|
||||
* gleiche Stärke wie die Schraffur-Tinte. Pro Fuge im Wandstil überschreibbar
|
||||
* (z. B. 0.13, wenn zwei massive Materialien aufeinandertreffen). */
|
||||
export const LAYER_LINE_MM = 0.02;
|
||||
/** Haarlinie für Tür-/Fenstersymbole (Flügel, Bogen, Rahmen, Glas) in mm. */
|
||||
export const SYMBOL_HAIRLINE_MM = 0.02;
|
||||
/** Strichmuster (mm Papier) für ÜBERKOPF-Ansichtslinien: Bauteile über der
|
||||
* Grundriss-Schnittebene (Decken-/Slab-Überstände, Unterzüge) werden nach
|
||||
* BIM-Konvention gestrichelt gezeichnet (Aufsicht auf ein Bauteil über einem). */
|
||||
export const OVERHEAD_DASH: number[] = [0.4, 0.25];
|
||||
/** Strichstärken der Dach-Grundrisslinien (mm Papier): Traufe = mittlere
|
||||
* Haarlinie, First etwas kräftiger als die Traufe, Grat dazwischen, Knick dünn
|
||||
* + gestrichelt (vgl. addRoof). */
|
||||
export const ROOF_EAVES_MM = 0.13;
|
||||
export const ROOF_RIDGE_MM = 0.25;
|
||||
export const ROOF_HIP_MM = 0.18;
|
||||
export const ROOF_BREAK_MM = 0.09;
|
||||
/** Strichmuster (mm Papier) der Dach-Knicklinie (Mansarde). */
|
||||
export const ROOF_BREAK_DASH: number[] = [0.12, 0.08];
|
||||
/** Stärke der Wand-Umrisslinie je Detailgrad, als Faktor auf die Ebenen-lw. */
|
||||
export const OUTLINE_DETAIL_FACTOR: Record<DetailLevel, number> = {
|
||||
grob: 1.6, // dickere Sammellinie
|
||||
mittel: 1.0, // wie die Kategorie-Strichstärke
|
||||
fein: 0.6, // feiner
|
||||
};
|
||||
/** Stärke der Schichtfugen je Detailgrad (mittel/fein; grob hat keine Fugen). */
|
||||
export const LAYER_DETAIL_FACTOR: Record<DetailLevel, number> = {
|
||||
grob: 1.0,
|
||||
mittel: 1.0,
|
||||
fein: 0.7,
|
||||
};
|
||||
// Strichstärken und -muster der Bauteil-Domänen (Symbole, Überkopf, Dach, Detailgrad-Faktoren) stehen
|
||||
// seit [K3d] im Kern (`src-tauri/core/src/plan/style.rs`).
|
||||
/** Default-Umrandungs-Strichstärke (mm), falls die Kategorie keine lw trägt
|
||||
(Grundeinstellung für „normale Elemente"). */
|
||||
export const WALL_FALLBACK_MM = 0.18;
|
||||
@@ -611,11 +587,6 @@ export function resolveStrokeWeight(
|
||||
// einheitlich Tinte auf hellem Papier, unabhängig von Material-/Bauteilfarbe.
|
||||
export const HATCH_PAPER = "#f0f0f0";
|
||||
export const HATCH_INK = "#0f0f0f";
|
||||
/** Neutrale Poché-Füllfarbe für ein Muster: "solid" → Tinte, sonst Papier. */
|
||||
export function pocheFill(pattern: HatchPattern): string {
|
||||
return pattern === "solid" ? HATCH_INK : HATCH_PAPER;
|
||||
}
|
||||
|
||||
/** Schraffur-Platzhalter „ohne" (für reine Umriss-/Sammelflächen). */
|
||||
export const NO_HATCH: HatchRender = {
|
||||
pattern: "none",
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
// Treppen-Domäne des Grundriss-Generators (DOSSIER/SIA): Tritte, Lauflinie mit
|
||||
// Auf-/Abpfeil, Zwischenpodest und Aussenlinie — mit dem Grundriss-Schnitt
|
||||
// (Tritte unter der Schnitthöhe durchgezogen, darüber gestrichelt/verdeckt +
|
||||
// SIA-Bruchlinie).
|
||||
//
|
||||
// Die Primitive entstehen im Rust-Kern (`src-tauri/core/src/plan_stairs.rs`, [K3a]); hier nur die
|
||||
// Übersetzung der flachen Liste in `Primitive`-Objekte (Farbe, Graustufen, `stairId`).
|
||||
// Fällt mit [K3d] weg, wenn der Plan-Puffer direkt aus Rust kommt.
|
||||
|
||||
import type { Project, Stair } from "../../model/types";
|
||||
import { stairVerticalExtent } from "../../model/wall";
|
||||
import { encodeStair } from "../../geometry/stair";
|
||||
import { core } from "../../engine/coreWasm";
|
||||
import { NO_HATCH, POCHE_STROKE, type Primitive } from "./shared";
|
||||
|
||||
/** Linienklassen in der Reihenfolge der Kern-Kodierung (`plan_stairs.rs`). */
|
||||
const LINE_CLS = ["stair-outline", "stair-tread", "stair-break", "stair-run", "stair-arrow"] as const;
|
||||
/** Strichmuster der verdeckten Tritte (Meter). */
|
||||
const TREAD_DASH = [0.12, 0.08];
|
||||
|
||||
/**
|
||||
* Treppen-Symbol im Grundriss (DOSSIER/SIA):
|
||||
* • Tritte als Rechtecke: die Tritt-Trennlinien werden gezeichnet — unter der
|
||||
* Schnittebene DURCHGEZOGEN (sichtbar), darüber GESTRICHELT (verdeckt).
|
||||
* • Der erste Tritt oberhalb der Schnittebene trägt die diagonale SIA-Bruchlinie
|
||||
* (Doppelstrich quer über den Lauf).
|
||||
* • Zwischenpodest (L/Wendel) als Umriss-Polygon.
|
||||
* • Lauflinie (Lauflinie) mit Auf-/Abpfeil (Auf-/Abpfeil) und Stufenanzahl-Label.
|
||||
* Alle Primitive tragen `stairId` für die Auswahl.
|
||||
*/
|
||||
export function addStairSymbol(
|
||||
out: Primitive[],
|
||||
project: Project,
|
||||
stair: Stair,
|
||||
greyed: boolean,
|
||||
lwMm: number,
|
||||
cutHeight: number,
|
||||
): void {
|
||||
const { zBottom, zTop } = stairVerticalExtent(project, stair);
|
||||
const f = core().plan_stair_flat(
|
||||
encodeStair(stair),
|
||||
zTop - zBottom,
|
||||
cutHeight,
|
||||
lwMm,
|
||||
stair.arrowStyle === "filled" ? 1 : 0,
|
||||
);
|
||||
if (f.length === 0) return;
|
||||
const stroke = stair.color ?? POCHE_STROKE;
|
||||
const stairId = stair.id;
|
||||
const n = f[0];
|
||||
let i = 1;
|
||||
for (let k = 0; k < n; k++) {
|
||||
switch (f[i]) {
|
||||
case 1: {
|
||||
const count = f[i + 3];
|
||||
const pts = new Array<{ x: number; y: number }>(count);
|
||||
for (let j = 0; j < count; j++) pts[j] = { x: f[i + 4 + 2 * j], y: f[i + 5 + 2 * j] };
|
||||
out.push({
|
||||
kind: "polygon",
|
||||
pts,
|
||||
fill: f[i + 2] ? stroke : "none",
|
||||
stroke,
|
||||
strokeWidthMm: f[i + 1],
|
||||
hatch: NO_HATCH,
|
||||
greyed,
|
||||
stairId,
|
||||
});
|
||||
i += 4 + 2 * count;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
out.push({
|
||||
kind: "line",
|
||||
a: { x: f[i + 4], y: f[i + 5] },
|
||||
b: { x: f[i + 6], y: f[i + 7] },
|
||||
cls: LINE_CLS[f[i + 1]],
|
||||
weightMm: f[i + 2],
|
||||
...(LINE_CLS[f[i + 1]] === "stair-tread" ? { dash: f[i + 3] ? TREAD_DASH : null } : {}),
|
||||
color: stroke,
|
||||
greyed,
|
||||
stairId,
|
||||
});
|
||||
i += 8;
|
||||
break;
|
||||
default:
|
||||
out.push({
|
||||
kind: "arc",
|
||||
center: { x: f[i + 2], y: f[i + 3] },
|
||||
from: { x: f[i + 4], y: f[i + 5] },
|
||||
to: { x: f[i + 6], y: f[i + 7] },
|
||||
r: f[i + 8],
|
||||
cls: "stair-outline",
|
||||
weightMm: f[i + 1],
|
||||
greyed,
|
||||
stairId,
|
||||
});
|
||||
i += 9;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
// Sonstige Tragwerks-/Fremdkörper-Domäne des Grundriss-Generators: Stützen
|
||||
// (Poché-Querschnitt, analog zur Wand-/Deckenschicht-Auflösung) und der
|
||||
// Footprint-Umriss einer truck-Extrusion (Haarlinie ohne Poché/Schraffur, da
|
||||
// Extrusionen noch keine Kategorie-/Bauteil-Zuordnung tragen).
|
||||
|
||||
import type { Column, ExtrudedSolid, LayerCategory, Project } from "../../model/types";
|
||||
import { getComponent } from "../../model/types";
|
||||
import { columnFootprint } from "../../geometry/column";
|
||||
import {
|
||||
HATCH_INK,
|
||||
HATCH_PAPER,
|
||||
MONO_INK,
|
||||
NO_HATCH,
|
||||
SYMBOL_HAIRLINE_MM,
|
||||
resolveBackground,
|
||||
resolveForeground,
|
||||
resolveHatch,
|
||||
resolveHatchId,
|
||||
type HatchRender,
|
||||
type Primitive,
|
||||
} from "./shared";
|
||||
|
||||
/** Footprint-Farbe der truck-Extrusionen im Grundriss (identisch zum 3D-Orange EXTRUSION_RGB in toWalls3d.ts). */
|
||||
const EXTRUSION_STROKE = "#d98c40";
|
||||
|
||||
/**
|
||||
* Footprint-Umriss eines extrudierten Körpers (truck-Integration) im Grundriss:
|
||||
* reine Haarlinie ohne Füllung/Schraffur — analog zur Ansichtslinie einer Wand
|
||||
* unter der Schnitthöhe (`addWallPoche` `viewOnly`), da der Körper (noch)
|
||||
* keine Schnitt-Poché/Kategorie-Zuordnung hat.
|
||||
*/
|
||||
export function addExtrudedSolidOutline(out: Primitive[], solid: ExtrudedSolid): void {
|
||||
if (solid.operation === "subtract") {
|
||||
// Abzugskörper (Aussparung): gestrichelter Umriss + Diagonalkreuz (Durchbruch-Symbol),
|
||||
// darunter eine unsichtbare Fläche für die Auswahl.
|
||||
out.push({
|
||||
kind: "polygon",
|
||||
pts: solid.points,
|
||||
fill: "none",
|
||||
stroke: "none",
|
||||
strokeWidthMm: 0,
|
||||
hatch: NO_HATCH,
|
||||
extrudedSolidId: solid.id,
|
||||
});
|
||||
const n = solid.points.length;
|
||||
const seg = (a: (typeof solid.points)[number], b: (typeof solid.points)[number], dash: number[] | null) =>
|
||||
out.push({ kind: "line", a, b, cls: "void", weightMm: SYMBOL_HAIRLINE_MM, dash, color: EXTRUSION_STROKE });
|
||||
for (let i = 0; i < n; i++) seg(solid.points[i], solid.points[(i + 1) % n], [2, 1]);
|
||||
if (n === 4) {
|
||||
seg(solid.points[0], solid.points[2], null);
|
||||
seg(solid.points[1], solid.points[3], null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
out.push({
|
||||
kind: "polygon",
|
||||
pts: solid.points,
|
||||
fill: "none",
|
||||
stroke: EXTRUSION_STROKE,
|
||||
strokeWidthMm: SYMBOL_HAIRLINE_MM,
|
||||
hatch: NO_HATCH,
|
||||
extrudedSolidId: solid.id,
|
||||
});
|
||||
}
|
||||
|
||||
/** Fallback-Poché-Füllung einer Stütze ohne (auflösbares) Bauteil: neutrale Tinte. */
|
||||
const COLUMN_FALLBACK_FILL = "#3a3f47";
|
||||
|
||||
/**
|
||||
* Grundriss-Querschnitt einer Stütze (Column) als Schnitt-Poché: gefülltes
|
||||
* Polygon (Rechteck bzw. tesselliertes Kreisprofil), an `position` platziert und
|
||||
* um `rotation` gedreht. Trägt — sofern ein Bauteil (`componentId`) auflösbar ist
|
||||
* — dessen Füllung + Schraffur (dieselbe Auflösung wie Wand/Decke, {@link
|
||||
* ./shared.resolveHatch}); sonst eine neutrale Vollton-Poché. `columnId` macht
|
||||
* die Fläche links-klick-selektierbar (analog Extrusion/Raum).
|
||||
*/
|
||||
export function addColumnPoche(
|
||||
out: Primitive[],
|
||||
project: Project,
|
||||
column: Column,
|
||||
greyed: boolean,
|
||||
lwMm: number,
|
||||
category: LayerCategory | undefined,
|
||||
): void {
|
||||
const pts = columnFootprint(column);
|
||||
const stroke = column.color ?? category?.color ?? MONO_INK;
|
||||
let fill = column.color ?? category?.color ?? COLUMN_FALLBACK_FILL;
|
||||
let hatch: HatchRender = NO_HATCH;
|
||||
if (column.componentId) {
|
||||
try {
|
||||
const comp = getComponent(project, column.componentId);
|
||||
const hatchId =
|
||||
resolveHatchId(column.hatchId, column.hatchSource, category, comp.hatchId) ?? comp.hatchId;
|
||||
const resolved = resolveHatch(
|
||||
project,
|
||||
hatchId,
|
||||
undefined,
|
||||
resolveForeground(comp, column.foreground, category, column.foregroundSource),
|
||||
);
|
||||
hatch = resolved;
|
||||
// SIA-Poché: neutraler Hintergrund (Tinte/Papier je nach Muster) statt
|
||||
// Bauteil-Albedo, es sei denn ein expliziter Hintergrund-Override greift
|
||||
// (analog addWallPoche: bgOverride ?? neutrale Poché).
|
||||
const bgOverride = resolveBackground(comp, column.background, category, column.backgroundSource);
|
||||
fill = bgOverride ?? (resolved.pattern === "solid" ? HATCH_INK : HATCH_PAPER);
|
||||
} catch {
|
||||
// Bauteil nicht auflösbar → neutrale Poché (Fallback bleibt bestehen).
|
||||
}
|
||||
}
|
||||
out.push({
|
||||
kind: "polygon",
|
||||
pts,
|
||||
fill,
|
||||
stroke,
|
||||
strokeWidthMm: lwMm,
|
||||
hatch,
|
||||
greyed,
|
||||
columnId: column.id,
|
||||
});
|
||||
}
|
||||
@@ -1,289 +0,0 @@
|
||||
// Wand-Domäne des Grundriss-Generators: Öffnungs-Lücken entlang der Wandachse,
|
||||
// die Wand-Footprints (für das Verdecken darunterliegender Decken-Umrisse, s.
|
||||
// {@link ../ceilings}) und die eigentliche Wand-Poché (Schichten + Umriss +
|
||||
// Öffnungsaussparungen + T-Stoss-/Gehrungs-Behandlung).
|
||||
//
|
||||
// Die Geometrie der Poché entsteht im Rust-Kern (`src-tauri/core/src/plan_walls.rs`, [K3a]); hier
|
||||
// bleibt die Stilauflösung aus dem Modell (Bauteil, Schraffur, Farbe, Fugen-Linienstil) und die
|
||||
// Übersetzung in `Primitive`-Objekte. Fällt mit [K3d] weg.
|
||||
|
||||
import type { LayerCategory, Opening, Project, Vec2, Wall } from "../../model/types";
|
||||
import { getComponent, getWallType, wallTypeThickness } from "../../model/types";
|
||||
import { wallReferenceOffset } from "../../model/wall";
|
||||
import { openingInterval } from "../../geometry/opening";
|
||||
import { leftNormal, normalize, sub } from "../../model/geometry";
|
||||
import type { Line } from "../../model/geometry";
|
||||
import type { WallCuts } from "../../model/joins";
|
||||
import { core } from "../../engine/coreWasm";
|
||||
import {
|
||||
HATCH_INK,
|
||||
HATCH_PAPER,
|
||||
LAYER_DETAIL_FACTOR,
|
||||
LAYER_LINE_MM,
|
||||
NO_HATCH,
|
||||
OUTLINE_DETAIL_FACTOR,
|
||||
POCHE_STROKE,
|
||||
resolveBackground,
|
||||
resolveForeground,
|
||||
resolveHatch,
|
||||
resolveHatchId,
|
||||
type DetailLevel,
|
||||
type HatchRender,
|
||||
type Primitive,
|
||||
} from "./shared";
|
||||
|
||||
/** Ein Öffnungs-Intervall entlang der Wandachse (from..to in Metern). `headHeight`
|
||||
* = Sturzhöhe (OK der Öffnung über der Wand-UK) für die 3D-Aussparung; im Plan
|
||||
* ungenutzt, aber Teil des gemeinsamen Vertrags mit dem 3D-Pfad. */
|
||||
export interface WallGap {
|
||||
from: number;
|
||||
to: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
openings: Opening[],
|
||||
): WallGap[] {
|
||||
const gaps: WallGap[] = [];
|
||||
for (const o of openings) {
|
||||
const iv = openingInterval(wall, o);
|
||||
if (iv) gaps.push(iv);
|
||||
}
|
||||
return gaps.sort((a, b) => a.from - b.from);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wand-Footprint als orientiertes Rechteck (OBB) für das Verdecken der
|
||||
* darunterliegenden Decke im Grundriss: Achs-Startpunkt + Einheits-Richtung `u`
|
||||
* und -Normale `m`, Halbdicke, Referenz-Querversatz (Wandachse↔Bandmitte) und
|
||||
* Achslänge. Die u-Ausdehnung wird beim Test an beiden Enden um die Halbdicke
|
||||
* verlängert, damit auch die Eck-Überlappe (Gehrungen) sicher abgedeckt sind.
|
||||
*/
|
||||
export interface WallFootprint {
|
||||
a: Vec2;
|
||||
u: Vec2;
|
||||
m: Vec2;
|
||||
len: number;
|
||||
half: number;
|
||||
refOff: number;
|
||||
}
|
||||
|
||||
/** Baut die Wand-Footprints (OBBs) aus den gerenderten Wänden. Nicht auflösbarer
|
||||
* Wandtyp ⇒ Default-Dicke 0.2 m (wie der Vollkörper-Fallback im 3D-Emitter). */
|
||||
export function buildWallFootprints(project: Project, walls: Wall[]): WallFootprint[] {
|
||||
const out: WallFootprint[] = [];
|
||||
for (const w of walls) {
|
||||
let t = 0.2;
|
||||
try {
|
||||
t = wallTypeThickness(getWallType(project, w));
|
||||
} catch {
|
||||
// Default-Dicke behalten.
|
||||
}
|
||||
const u = normalize(sub(w.end, w.start));
|
||||
out.push({
|
||||
a: w.start,
|
||||
u,
|
||||
m: leftNormal(u),
|
||||
len: Math.hypot(w.end.x - w.start.x, w.end.y - w.start.y),
|
||||
half: t / 2,
|
||||
refOff: wallReferenceOffset(w, t),
|
||||
});
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
const lineBuf = (l: Line | null | undefined): number[] =>
|
||||
l ? [1, l.point.x, l.point.y, l.dir.x, l.dir.y] : [0, 0, 0, 0, 0];
|
||||
|
||||
/** Eingabe der Kern-Funktion `plan_wall_poche_flat` (Aufbau: `plan_walls.rs`). */
|
||||
function encodeWallPoche(
|
||||
wall: Wall,
|
||||
layerThickness: number[],
|
||||
total: number,
|
||||
refOff: number,
|
||||
gaps: WallGap[],
|
||||
cuts: WallCuts,
|
||||
grob: boolean,
|
||||
viewOnly: boolean,
|
||||
): Float64Array {
|
||||
const b: number[] = [wall.start.x, wall.start.y, wall.end.x, wall.end.y, total, refOff, grob ? 1 : 0, viewOnly ? 1 : 0];
|
||||
b.push(layerThickness.length, ...layerThickness);
|
||||
b.push(...lineBuf(cuts.startCut), ...lineBuf(cuts.endCut));
|
||||
const lc = cuts.layerCuts;
|
||||
b.push(lc ? 1 : 0);
|
||||
if (lc) {
|
||||
for (let i = 0; i < layerThickness.length; i++) {
|
||||
b.push(...lineBuf(lc.start[i]), ...lineBuf(lc.end[i]), ...lineBuf(lc.startSide[i]), ...lineBuf(lc.endSide[i]));
|
||||
}
|
||||
}
|
||||
const sc = cuts.spanCutouts ?? [];
|
||||
b.push(sc.length);
|
||||
for (const c of sc) b.push(c.from, c.to, c.offA, c.offB);
|
||||
b.push(gaps.length);
|
||||
for (const g of gaps) b.push(g.from, g.to);
|
||||
return Float64Array.from(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wand als gefüllte Schnittfläche (Poché), um Öffnungen ausgespart.
|
||||
*
|
||||
* Detailgrad:
|
||||
* • mittel/fein — jede Schicht des Wandtyps als eigenes Band (Füllfarbe +
|
||||
* Schraffur des Bauteils), dazu eine kräftige Wand-Umrisslinie. fein zeichnet
|
||||
* Schichtfugen und Umriss dünner als mittel.
|
||||
* • grob — KEINE Schichten, KEINE Schraffur: eine einzige Sammelfläche über die
|
||||
* volle Wanddicke (Füllung = Farbe des „Backbone"-Bauteils mit höchster
|
||||
* joinPriority) mit dicker Umrisslinie. Bewusst vereinfacht (≙ DOSSIER
|
||||
* „Einfach").
|
||||
*
|
||||
* Segmente, Gehrungsbänder, Schichtfugen und Durchgangswand-Aussparungen berechnet der Kern;
|
||||
* hier kommen nur Stil und Pick-ID (`wallId`) dazu.
|
||||
*/
|
||||
export function addWallPoche(
|
||||
out: Primitive[],
|
||||
project: Project,
|
||||
wall: Wall,
|
||||
gaps: WallGap[],
|
||||
cuts: WallCuts,
|
||||
greyed: boolean,
|
||||
detail: DetailLevel,
|
||||
wallLwMm: number,
|
||||
category: LayerCategory | undefined,
|
||||
// Wand liegt GANZ unter der Grundriss-Schnittebene (z. B. 30-cm-Brüstung bei
|
||||
// 1 m Schnitthöhe) → „von oben gesehen": nur Ansichts-Umriss (Haarlinie), KEINE
|
||||
// Schnitt-Poché/Schraffur/Schichten. Der reguläre Schnittfall bleibt `false`.
|
||||
viewOnly: boolean,
|
||||
): void {
|
||||
const wt = getWallType(project, wall);
|
||||
const total = wallTypeThickness(wt);
|
||||
const refOff = wallReferenceOffset(wall, total);
|
||||
const wallId = wall.id;
|
||||
// Achswinkel der Wand (Modell, Grad) — treibt wandbezogene Schraffuren ({@link resolveHatch}).
|
||||
const wallAngleDeg =
|
||||
(Math.atan2(wall.end.y - wall.start.y, wall.end.x - wall.start.x) * 180) / Math.PI;
|
||||
// Strich-/Umrandungsfarbe der Wand: optionale Übersteuerung (wall.color), sonst der
|
||||
// Default-Poché-Strich. Betrifft NUR die Linienfarbe, nicht die Schicht-Füllfarben/Schraffuren.
|
||||
const stroke = wall.color ?? POCHE_STROKE;
|
||||
const outlineMm = wallLwMm * OUTLINE_DETAIL_FACTOR[detail];
|
||||
const layerLineMm = LAYER_LINE_MM * LAYER_DETAIL_FACTOR[detail];
|
||||
|
||||
const f = core().plan_wall_poche_flat(
|
||||
encodeWallPoche(wall, wt.layers.map((l) => l.thickness), total, refOff, gaps, cuts, detail === "grob", viewOnly),
|
||||
);
|
||||
if (f.length === 0) return;
|
||||
|
||||
// Stil je Schicht erst beim ersten Band lösen (wie zuvor: nur wenn die Wand Segmente hat).
|
||||
const layerStyle = new Map<number, { hatch: HatchRender; fill: string }>();
|
||||
const styleOf = (li: number) => {
|
||||
let st = layerStyle.get(li);
|
||||
if (!st) {
|
||||
const comp = getComponent(project, wt.layers[li].componentId);
|
||||
const layerHatchId =
|
||||
resolveHatchId(wall.hatchId, wall.hatchSource, category, comp.hatchId) ?? comp.hatchId;
|
||||
const hatch = resolveHatch(
|
||||
project,
|
||||
layerHatchId,
|
||||
wallAngleDeg,
|
||||
resolveForeground(comp, wall.foreground, category, wall.foregroundSource),
|
||||
);
|
||||
// SIA-Poché: neutraler Hintergrund (Papier) statt Bauteil-Albedo, die Schichtschraffur
|
||||
// (fest in HATCH_INK, siehe resolveHatch) liegt darüber; Vollmuster ("solid") = Tinten-Poché.
|
||||
const bgOverride = resolveBackground(comp, wall.background, category, wall.backgroundSource);
|
||||
st = { hatch, fill: bgOverride ?? (hatch.pattern === "solid" ? HATCH_INK : HATCH_PAPER) };
|
||||
layerStyle.set(li, st);
|
||||
}
|
||||
return st;
|
||||
};
|
||||
|
||||
const n = f[0];
|
||||
let i = 1;
|
||||
for (let k = 0; k < n; k++) {
|
||||
if (f[i] === 1) {
|
||||
const art = f[i + 1];
|
||||
const li = f[i + 2];
|
||||
const nNo = f[i + 3];
|
||||
const noStrokeEdges = Array.from(f.subarray(i + 4, i + 4 + nNo));
|
||||
const q = i + 4 + nNo;
|
||||
const pts = [0, 1, 2, 3].map((j) => ({ x: f[q + 2 * j], y: f[q + 2 * j + 1] }));
|
||||
i = q + 8;
|
||||
if (art === 2) {
|
||||
const st = styleOf(li);
|
||||
out.push({
|
||||
kind: "polygon",
|
||||
pts,
|
||||
fill: st.fill,
|
||||
// Band ohne Umriss: keine Schichtfuge über die Bandkante, keine 45°-Naht am Knoten.
|
||||
// Die Fugen kommen als separate `line`-Primitive.
|
||||
stroke: "none",
|
||||
strokeWidthMm: 0,
|
||||
hatch: st.hatch,
|
||||
greyed,
|
||||
noStrokeEdges,
|
||||
wallId,
|
||||
});
|
||||
} else {
|
||||
out.push({
|
||||
kind: "polygon",
|
||||
pts,
|
||||
// Grob: immer Vollschwarz-Füllung gemäss SIA 400 Anhang B.9, Figur 36.
|
||||
fill: art === 1 ? HATCH_INK : "none",
|
||||
stroke,
|
||||
strokeWidthMm: art === 0 ? layerLineMm : outlineMm,
|
||||
hatch: NO_HATCH,
|
||||
greyed,
|
||||
noStrokeEdges,
|
||||
wallId,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const art = f[i + 1];
|
||||
const li = f[i + 2];
|
||||
const a = { x: f[i + 3], y: f[i + 4] };
|
||||
const b = { x: f[i + 5], y: f[i + 6] };
|
||||
i += 7;
|
||||
if (art === 0) {
|
||||
out.push({ kind: "line", a, b, cls: "layer-joint-l", weightMm: layerLineMm, color: stroke, greyed });
|
||||
} else if (art === 1) {
|
||||
// Innere Schichtfuge: Stil aus layer.jointLineStyleId (Gewicht/Farbe/Strich), Rückfall =
|
||||
// Haarlinie in Wandfarbe.
|
||||
const id = wt.layers[li].jointLineStyleId;
|
||||
const jls = id ? project.lineStyles.find((l) => l.id === id) : undefined;
|
||||
out.push({
|
||||
kind: "line",
|
||||
a,
|
||||
b,
|
||||
cls: "layer-joint",
|
||||
weightMm: jls ? jls.weight * LAYER_DETAIL_FACTOR[detail] : layerLineMm,
|
||||
color: jls ? jls.color : stroke,
|
||||
dash: jls ? jls.dash : null,
|
||||
zigzag: jls?.kind === "zigzag" ? jls.zigzag : undefined,
|
||||
motif: jls?.kind === "custom" ? jls.motif : undefined,
|
||||
greyed,
|
||||
});
|
||||
} else {
|
||||
out.push({ kind: "line", a, b, cls: "wall-outline", weightMm: outlineMm, color: stroke, greyed });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Referenzlinie einer Wand: dünne, gestrichelte Achslinie entlang der Wandachse
|
||||
* (start → end). Von der Oberleiste umschaltbar; rein darstellend.
|
||||
*/
|
||||
export function addReferenceLine(out: Primitive[], wall: Wall, greyed: boolean): void {
|
||||
out.push({
|
||||
kind: "line",
|
||||
a: wall.start,
|
||||
b: wall.end,
|
||||
cls: "wall-axis",
|
||||
weightMm: 0.13,
|
||||
dash: [0.18, 0.06, 0.04, 0.06], // Strich-Punkt-Achse in mm Papier
|
||||
greyed,
|
||||
});
|
||||
}
|
||||
@@ -399,8 +399,8 @@ export function useSelectAllAndDeleteShortcut(opts: {
|
||||
.filter((r) => r.floorId === activeLevelId)
|
||||
.map((r) => r.id);
|
||||
// Schnittführungs-Symbole sind projektweit (kein floorId-Bezug — sie
|
||||
// werden auf JEDEM Grundriss gezeichnet, s. generatePlan/sections.ts::
|
||||
// addSectionLines), anders als die übrigen, geschossgefilterten Kanäle.
|
||||
// werden auf JEDEM Grundriss gezeichnet, s. plan/context.rs im Kern,
|
||||
// plan_section_lines), anders als die übrigen, geschossgefilterten Kanäle.
|
||||
const sectionLineIds = project.drawingLevels
|
||||
.filter((l) => (l.kind === "section" || l.kind === "elevation") && l.linePoints)
|
||||
.map((l) => l.id);
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ const selectTool: Tool = {
|
||||
|
||||
// ── Wall ─────────────────────────────────────────────────────────────────────
|
||||
// Zeichnet eine Achs-Polylinie; jedes Segment wird ein eigenständiges Wall.
|
||||
// Die Gehrung an Ecken entsteht automatisch aus computeJoins (generatePlan).
|
||||
// Die Gehrung an Ecken entsteht automatisch aus der Verschneidung im Kern (`joins.rs`).
|
||||
|
||||
interface WallDrawing {
|
||||
phase: "drawing";
|
||||
|
||||
Reference in new issue
Block a user