Archived
Stütze (Column) bekommt dasselbe By-Layer/By-Object-Attributsystem wie
Wand/Decke Nutzer-Wunsch: "generell sollten alle BIM Teile also 3D die weiteren Attribute haben." Untersucht: Dach/Treppe/Raum/Öffnung haben HEUTE keine Poché-Füllung/Schraffur im Grundriss (reine Linien-/Symbol- Darstellung, bei Raum sogar bewusst so entschieden -- "keine Farbwäsche im Plan"); das Attribut-System dort anzuschliessen würde neue Poché-/Schraffur-Fähigkeiten erfordern, die es dort noch gar nicht gibt. Stütze dagegen hat bereits eine Poché UND nutzte bereits dieselben Resolver wie Wand/Decke (nur mit fest verdrahtetem override=source=undefined) -- Nutzer-Entscheidung nach Rückfrage: nur Stütze jetzt fertig verdrahten, der Rest bleibt vorerst unverändert. model/types.ts: Column bekommt dieselben acht Felder wie Wall (foreground/background/hatchId/strokeWeight × je einer *Source). plan/generatePlan/structures.ts (addColumnPoche): resolveHatchId/ resolveForeground lesen jetzt column.hatchId/column.hatchSource bzw. column.foreground/column.foregroundSource statt hartcodiertem undefined; neuer resolveBackground-Aufruf lässt einen expliziten Hintergrund-Override vor die neutrale SIA-Poché (Tinte/Papier je nach Schraffur-Muster) treten -- exakt das addWallPoche-Muster (bgOverride ?? neutrale Poché). plan/generatePlan.ts: die Strichstärke der Stütze lief bisher IMMER mit hartcodiertem override=source=undefined durch resolveStrokeWeight -- liest jetzt column.strokeWeight/column.strokeWeightSource. state/selectionInfo.ts (columnSelection): effectiveForeground/ effectiveBackground/effectiveHatchId analog wallSelection (Bauteil- Repräsentant ist hier `column.componentId` statt der äussersten Schicht); weightMm war bisher hart auf WALL_FALLBACK_MM gesetzt, läuft jetzt korrekt durch resolveStrokeWeight. panels/AttributesPanel.tsx: weightEditable/fillEditable/pocheEditable um `sel.kind === "column"` erweitert -- Stütze zeigt jetzt dieselben vier Attribut-Zeilen mit vollem 3-Quellen-Dropdown (Nach Ebene/Nach Bauteil/eigener Wert) wie Wand/Decke. +4 Tests (structures.column.test.ts: Default bleibt Bauteil-Schraffur, Hintergrund-Override greift, hatchSource "layer" nutzt die Kategorie- Schraffur, expliziter hatchId-Override gewinnt). tsc/vitest 938/938 grün.
This commit is contained in:
1 parent
85be7173e1
commit
a917e4149a
6 files changed
+213
-12
No files matched your search
@@ -437,7 +437,13 @@ export function generatePlan(
|
||||
const category = catByCode.get(column.categoryCode);
|
||||
const ov = overrideFor(column.categoryCode, columnLabel(column));
|
||||
const lwMm =
|
||||
ov.lineweight ?? resolveStrokeWeight(undefined, undefined, category, lwByCode.get(column.categoryCode) ?? WALL_FALLBACK_MM);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
/**
|
||||
* `addColumnPoche` — 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 { addColumnPoche } from "./structures";
|
||||
import type { Column, Component, LayerCategory, Project } from "../../model/types";
|
||||
import type { Primitive } from "./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: [],
|
||||
doors: [],
|
||||
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,
|
||||
};
|
||||
}
|
||||
|
||||
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", () => {
|
||||
it("ohne Override: Bauteil-Schraffur/-Farbe bestimmen die Poché (Default 'Nach Bauteil')", () => {
|
||||
const out: Primitive[] = [];
|
||||
addColumnPoche(out, project(), column(), false, 0.35, category);
|
||||
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);
|
||||
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,
|
||||
);
|
||||
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,
|
||||
);
|
||||
expect(polygonOf(out).hatch.pattern).toBe("none");
|
||||
});
|
||||
});
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
MONO_INK,
|
||||
NO_HATCH,
|
||||
SYMBOL_HAIRLINE_MM,
|
||||
resolveBackground,
|
||||
resolveForeground,
|
||||
resolveHatch,
|
||||
resolveHatchId,
|
||||
@@ -67,15 +68,19 @@ export function addColumnPoche(
|
||||
try {
|
||||
const comp = getComponent(project, column.componentId);
|
||||
const hatchId =
|
||||
resolveHatchId(undefined, undefined, category, comp.hatchId) ?? comp.hatchId;
|
||||
resolveHatchId(column.hatchId, column.hatchSource, category, comp.hatchId) ?? comp.hatchId;
|
||||
const resolved = resolveHatch(
|
||||
project,
|
||||
hatchId,
|
||||
undefined,
|
||||
resolveForeground(comp, undefined, category, undefined),
|
||||
resolveForeground(comp, column.foreground, category, column.foregroundSource),
|
||||
);
|
||||
hatch = resolved;
|
||||
fill = resolved.pattern === "solid" ? HATCH_INK : HATCH_PAPER;
|
||||
// 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).
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user