- Schnittflächen ab 1:100 (mittel; grob immer) als schwarze Fläche ohne Fugen/Schraffur, nur Umriss: Wände, Stützen, Körper im Grundriss, alle geschnittenen Bauteile im Schnitt (style::solid_cut). 1:50 und „fein" schraffiert; Feld cutHatch an Ebene/Ansichtsvorlage übersteuert das 1:100. - Dünne Schichten: gemeinsame Regel in plan/style.rs (unter 0.5 mm Papier, ab 1:50, nicht „fein") für Wände im Grundriss, Schnitt-Schichten und dünne Dämmung. - Raumstempel: Anker = Pol der Unzugänglichkeit (room_area::label_point), Platz aus dem Raumumriss (rect_in_ring) statt Bounding-Box, Ausweichen im Raum, Breite aus Inter-Schriftmetrik (text_layout::text_width_em, stamp_block_size); neue Räume ohne festen Anker. - Goldens neu, TODO.md nachgeführt.
116 lines
3.9 KiB
TypeScript
116 lines
3.9 KiB
TypeScript
/**
|
|
* 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
|
|
* foreground/background/hatchId/strokeWeight(+Source)-Felder auf `Column`
|
|
* müssen tatsächlich bis in die gerenderte Poché durchschlagen.
|
|
*/
|
|
|
|
import { describe, it, expect } from "vitest";
|
|
import { generatePlan } from "./generatePlan";
|
|
import type { Column, Component, LayerCategory, Project } from "../model/types";
|
|
import type { Primitive } from "./generatePlan/shared";
|
|
|
|
const comp: Component = {
|
|
id: "beton",
|
|
name: "Beton",
|
|
color: "#888888",
|
|
hatchId: "sia-concrete",
|
|
joinPriority: 10,
|
|
};
|
|
|
|
const category: LayerCategory = {
|
|
code: "50",
|
|
name: "Tragwerk",
|
|
color: "#333333",
|
|
lw: 0.35,
|
|
visible: true,
|
|
locked: false,
|
|
};
|
|
|
|
function project(overrides: Partial<Project> = {}): Project {
|
|
return {
|
|
id: "t",
|
|
name: "T",
|
|
lineStyles: [],
|
|
hatches: [
|
|
{ id: "sia-concrete", name: "Beton", pattern: "solid" },
|
|
{ id: "sia-other", name: "Sonstiges", pattern: "none" },
|
|
] as unknown as Project["hatches"],
|
|
components: [comp],
|
|
wallTypes: [],
|
|
drawingLevels: [],
|
|
layers: [category],
|
|
walls: [],
|
|
openings: [],
|
|
ceilings: [],
|
|
stairs: [],
|
|
rooms: [],
|
|
drawings2d: [],
|
|
context: [],
|
|
columns: [],
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
function column(overrides: Partial<Column> = {}): Column {
|
|
return {
|
|
id: "col1",
|
|
type: "column",
|
|
floorId: "eg",
|
|
categoryCode: "50",
|
|
position: { x: 0, y: 0 },
|
|
profile: { kind: "rect", width: 0.3, depth: 0.3 },
|
|
rotation: 0,
|
|
height: 2.6,
|
|
componentId: "beton",
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
/** Grundriss des Geschosses „eg" mit genau dieser Stütze (1:50 — ab 1:100 ist die Schnittfläche schwarz, [140]). */
|
|
function planColumn(p: Project, col: Column): Primitive[] {
|
|
return generatePlan({ ...p, columns: [col] }, "eg", new Set(["50"]), undefined, "mittel", false, false, true, 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("Stützen-Poché — Attribut-Override greift", () => {
|
|
it("ohne Override: Bauteil-Schraffur/-Farbe bestimmen die Poché (Default 'Nach Bauteil')", () => {
|
|
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 = 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 catWithHatch: LayerCategory = { ...category, hatch: "sia-other" };
|
|
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 = 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 = 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 = planColumn(project(), column({ foreground: "#00ff88" }));
|
|
expect(polygonOf(out).hatch.color).toBe("#00ff88");
|
|
});
|
|
});
|