[271] Umbaufilter: Status Bestand/Abbruch/Neu mit Etappen, Filter wie Archicad in Grundriss, Schnitt, Ansicht, Axo, 3D, Kennzahlen, DXF und IFC

Modell (Rust, gen:types): `renovation: {status, phase?}` an Wand, Öffnung (ohne eigenen Status
folgt sie der Wand), Decke, Dach, Treppe, Stütze, Körper und Raum (Raum nur Sichtbarkeit und
Flächen, keine Farbe); `Project.renovation` (Etappen, Farben, eigene Filter, KNOWN_KEYS);
`renovationFilter`/`renovationPhase` an DrawingLevel, ViewTemplate und ViewSnapshot — der Filter
gehört zur Ebene wie die Modelldarstellung [173], damit je Reiter, Ausschnitt und Vorlage.

Kern `renovation.rs` als ein Ort für „sichtbar/wie gezeichnet im Filter“: Vorgaben Bestand,
Abbruch, Neubau, Umbauplan, Endzustand; SIA-400-Farben (Bestand grau, Abbruch gelb gestrichelt,
Neu rot), anpassbar; Etappe „bis n“; neue Öffnung in Bestandswand = Abbruch-Stück, zugemauerte
Öffnung = Ausfachung (die Wand schliesst, wo die Öffnung ausgeblendet ist, wie bei der Regel
„Ausblenden“). Angebunden: Grundriss (Ctx.hidden, Farben je Element-Bereich, nur Schnittflächen
gefüllt, Symbole in Linienfarbe), Schnitt (without_elements + CutRules::with_renovation), Ansicht,
Vektor-Axo, 3D (model3dParts mit Filter, 3D-Fenster nimmt den Filter der aktiven Ebene),
Kennzahlen/Flächen (Text = Zustand), DXF (Layer <Klasse>_Abbruch/_Neu), IFC (Status im
Pset_*Common, Etappe in Dossier_Umbau). Tusche behält die Umbau-Farben (extras::KeepColors).
Neue Bauteile der Zeichenbefehle tragen den Zeichen-Status (commands::stamp_renovation).

Bedienung: Objekt-Info/Objekteinstellungen „Umbau“ und „Etappe“ (Mehrfachauswahl, ein
Undo-Schritt), Statusleiste „Umbau: …“ mit Zeichen-Status und Umbaufilter der Ansicht (im
Überlauf „⋯“ mit der Pausfolie), Befehl `umbau` (B/A/N; getippte Options-Kürzel mit Enter),
Ressourcen-Tab „Umbau“ (Etappen, Farben), Flächenbilanz „Zustand“, Vorlage „Beispiel Umbau“
(CLI :umbau), CLI --renovation/--phase für plan, section, elevation, axo, model3d, kennzahlen.

Tests: Kern renovation_tests.rs (20: Vorgaben, Etappen, Öffnungen in Bestandswand, Grundriss,
Schnitt, Ansicht, Kennzahlen, DXF, IFC, 3D, Tusche, Zeichen-Status, Unsinn), Robustheit (Plan,
Schnitt, Ansicht, Kennzahlen, 3D mit Filter), vitest model/renovation.test.ts und
commands/cmds/renovation.test.ts, e2e renovation271.spec.ts (2× grün). Goldens unverändert.
Bilder doc/review-271 (CLI-SVG --hatch in Chromium, App). Nur im Linux-Container geprüft, nicht
in der Tauri-App/auf dem Mac (Prüfschritt RELEASE-1.0 13.37). Offen: TODO [271].
This commit is contained in:
Claude committed 2026-11-17 11:44:28 +00:00
1 parent c1f9e91d28
commit fb0c932b53
73 files changed
+2888 -56

No files matched your search

+3
View File
@@ -25,6 +25,7 @@ export interface AppMenuBarProps {
onNewProjectFromSample: () => void;
onNewProjectFromComplexSample: () => void;
onNewProjectFromWettbewerbSample: () => void;
onNewProjectFromUmbauSample?: () => void;
onNewProjectFromTemplate: () => void;
onOpenProject: () => void;
onSaveProject: () => void;
@@ -75,6 +76,7 @@ export const AppMenuBar = memo(function AppMenuBar({
onNewProjectFromSample,
onNewProjectFromComplexSample,
onNewProjectFromWettbewerbSample,
onNewProjectFromUmbauSample,
onNewProjectFromTemplate,
onOpenProject,
onSaveProject,
@@ -111,6 +113,7 @@ export const AppMenuBar = memo(function AppMenuBar({
{ label: t("file.newFromSample"), onSelect: onNewProjectFromSample },
{ label: t("file.newFromComplexSample"), onSelect: onNewProjectFromComplexSample },
{ label: t("file.newFromWettbewerbSample"), onSelect: onNewProjectFromWettbewerbSample },
...(onNewProjectFromUmbauSample ? [{ label: t("file.newFromUmbauSample"), onSelect: onNewProjectFromUmbauSample }] : []),
{ label: t("file.newFromTemplateFile"), onSelect: onNewProjectFromTemplate },
{ divider: true },
{ label: t("file.open"), onSelect: onOpenProject },
+147
View File
@@ -0,0 +1,147 @@
// [271] Umbau in der Statusleiste: zeigt den aktuellen Zeichen-Status (neue Bauteile tragen ihn) und den Umbaufilter der
// aktiven Ansicht; das Popover stellt beides ein (Status und Etappe zum Zeichnen; Filter und Etappe der Ebene — wie die
// Modelldarstellung ein Feld der Ebene, darum je Reiter/Ausschnitt eigen und mit Undo). Bei wenig Platz wandert es
// mit der Pausfolie in „⋯“ ([263]).
import { useEffect, useMemo, useRef, useState } from "react";
import { t } from "../i18n";
import type { TranslationKey } from "../i18n";
import { useStore } from "../state/appStore";
import { BUILTIN_RENOVATION_FILTERS, patchItem, renovationPhases, RENOVATION_STATUSES } from "../core";
import type { RenovationStatus } from "../model/types";
/** Anzeigename eines Filters (eingebaut übersetzt, eigene mit ihrem Namen). */
export function renovationFilterLabel(id: string, own: readonly { id: string; name: string }[]): string {
if ((BUILTIN_RENOVATION_FILTERS as readonly string[]).includes(id)) return t(`renovation.filter.${id}` as TranslationKey);
return own.find((f) => f.id === id)?.name ?? id;
}
export function RenovationControl() {
const project = useStore((s) => s.project);
const activeLevelId = useStore((s) => s.activeLevelId);
const draw = useStore((s) => s.drawRenovation);
const setDraw = useStore((s) => s.setDrawRenovation);
const applyChange = useStore((s) => s.applyChange);
const [open, setOpen] = useState(false);
const wrapRef = useRef<HTMLSpanElement | null>(null);
useEffect(() => {
if (!open) return;
const onDown = (e: MouseEvent) => {
if (wrapRef.current && !wrapRef.current.contains(e.target as Node)) setOpen(false);
};
const onKey = (e: KeyboardEvent) => e.key === "Escape" && setOpen(false);
document.addEventListener("mousedown", onDown);
document.addEventListener("keydown", onKey);
return () => {
document.removeEventListener("mousedown", onDown);
document.removeEventListener("keydown", onKey);
};
}, [open]);
const level = project.drawingLevels.find((l) => l.id === activeLevelId);
const phases = renovationPhases(project);
const own = useMemo(() => project.renovation?.filters ?? [], [project.renovation?.filters]);
const filter = level?.renovationFilter ?? "";
const levelEditable = !!level && (level.kind === "floor" || level.kind === "section" || level.kind === "elevation" || level.kind === "ceiling");
const setLevel = (patch: { renovationFilter?: string; renovationPhase?: string }) => {
if (!level) return;
applyChange((p) =>
patchItem(p, "drawingLevels", level.id, (l) => {
const next = { ...l, ...patch };
if (!next.renovationFilter) delete next.renovationFilter;
if (!next.renovationPhase || !next.renovationFilter) delete next.renovationPhase;
return next;
}),
);
};
const statusLabel = t(`renovation.status.${draw.status}` as TranslationKey);
const filterLabel = filter ? renovationFilterLabel(filter, own) : t("renovation.filter.none");
return (
<span className="sb-snap-wrap" ref={wrapRef}>
<button
type="button"
className={`sb-toggle${open ? " active" : ""}${filter ? " sb-renovation-on" : ""}`}
data-testid="renovation-toggle"
aria-haspopup="true"
aria-expanded={open}
title={t("renovation.status.hint", { status: statusLabel, filter: filterLabel })}
onClick={() => setOpen((v) => !v)}
>
<span className={`sb-renovation-dot sb-renovation-${draw.status}`} aria-hidden="true" />
{t("renovation.short", { status: statusLabel })}
</button>
{open && (
<div className="sb-snap-popover sb-renovation-popover" role="dialog" aria-label={t("renovation.title")} data-testid="renovation-panel">
<div className="sb-snap-row sb-snap-head">{t("renovation.drawStatus")}</div>
<label className="sb-snap-row sb-snap-row-num">
<span>{t("renovation.label")}</span>
<select
value={draw.status}
aria-label={t("renovation.drawStatus")}
data-testid="renovation-draw-status"
onChange={(e) => setDraw(e.target.value as RenovationStatus, draw.phase)}
>
{RENOVATION_STATUSES.map((s) => (
<option key={s} value={s}>
{t(`renovation.status.${s}` as TranslationKey)}
</option>
))}
</select>
</label>
{phases.length > 0 && (
<label className="sb-snap-row sb-snap-row-num">
<span>{t("renovation.phase")}</span>
<select value={draw.phase ?? ""} aria-label={t("renovation.phase")} onChange={(e) => setDraw(draw.status, e.target.value || undefined)}>
<option value="">{t("renovation.phase.none")}</option>
{phases.map((p) => (
<option key={p.id} value={p.id}>
{p.name}
</option>
))}
</select>
</label>
)}
<div className="sb-snap-row sb-snap-head">{t("renovation.filter")}</div>
<label className="sb-snap-row sb-snap-row-num">
<span>{t("renovation.filter")}</span>
<select
value={filter}
disabled={!levelEditable}
aria-label={t("renovation.filter")}
data-testid="renovation-filter"
onChange={(e) => setLevel({ renovationFilter: e.target.value || undefined, renovationPhase: level?.renovationPhase })}
>
<option value="">{t("renovation.filter.none")}</option>
{BUILTIN_RENOVATION_FILTERS.map((id) => (
<option key={id} value={id}>
{t(`renovation.filter.${id}` as TranslationKey)}
</option>
))}
{own.map((f) => (
<option key={f.id} value={f.id}>
{f.name}
</option>
))}
</select>
</label>
{phases.length > 0 && filter && (
<label className="sb-snap-row sb-snap-row-num">
<span>{t("renovation.filterPhase")}</span>
<select
value={level?.renovationPhase ?? ""}
aria-label={t("renovation.filterPhase")}
onChange={(e) => setLevel({ renovationFilter: filter, renovationPhase: e.target.value || undefined })}
>
<option value="">{t("renovation.phase.all")}</option>
{phases.map((p) => (
<option key={p.id} value={p.id}>
{p.name}
</option>
))}
</select>
</label>
)}
</div>
)}
</span>
);
}
+6 -1
View File
@@ -46,6 +46,8 @@ import { ViewTemplatesTab } from "./resourceManager/ViewTemplatesTab";
import type { ViewTemplateHandlers } from "./resourceManager/ViewTemplatesTab";
import { ModelViewsTab } from "./resourceManager/ModelViewsTab";
import type { ModelViewHandlers } from "./resourceManager/ModelViewsTab";
import { RenovationTab } from "./resourceManager/RenovationTab";
import type { RenovationHandlers } from "./resourceManager/RenovationTab";
import { PenSetsTab } from "./resourceManager/PenSetsTab";
import { PalettesTab } from "./resourceManager/PalettesTab";
import { TextStylesTab } from "./resourceManager/TextStylesTab";
@@ -69,6 +71,7 @@ export type TabId =
| "overrides"
| "viewTemplates"
| "modelViews"
| "renovation"
| "pens"
| "palettes";
@@ -89,10 +92,11 @@ const TABS: { id: TabId; labelKey: string }[] = [
{ id: "overrides", labelKey: "resources.tab.overrides" },
{ id: "viewTemplates", labelKey: "resources.tab.viewTemplates" },
{ id: "modelViews", labelKey: "resources.tab.modelViews" },
{ id: "renovation", labelKey: "resources.tab.renovation" },
];
/** Bündel der immutablen Mutationen (von App über setProject bereitgestellt). */
export interface ResourceManagerHandlers extends ViewTemplateHandlers, ModelViewHandlers {
export interface ResourceManagerHandlers extends ViewTemplateHandlers, ModelViewHandlers, RenovationHandlers {
onPatchComponent: (id: string, patch: Partial<Component>) => void;
onAddComponent: () => void;
onDeleteComponent: (id: string) => void;
@@ -491,6 +495,7 @@ export function ResourceManager({
{tab === "materials" && <MaterialsTab />}
{tab === "viewTemplates" && <ViewTemplatesTab project={project} handlers={handlers} />}
{tab === "modelViews" && <ModelViewsTab project={project} handlers={handlers} />}
{tab === "renovation" && <RenovationTab project={project} handlers={handlers} />}
{tab === "overrides" && (
<OverridesTab
project={project}
+6 -2
View File
@@ -15,6 +15,7 @@ import { useEffect, useLayoutEffect, useRef, useState, memo } from "react";
import type { SnapSettings } from "../tools/types";
import { t } from "../i18n";
import { TraceControl } from "./TraceControl";
import { RenovationControl } from "./RenovationControl";
import { BUILD_INFO, formatBuildShort } from "../update/buildInfo";
export interface StatusBarProps {
@@ -424,7 +425,7 @@ export const StatusBar = memo(function StatusBar({
const pickHint = usePickHint();
// [263] Schriftbreite ist nicht planbar (Ersatzschriften je System): passt der Cluster nicht, wird er nach Priorität
// gekürzt — nie abgeschnitten. Stufe 1: Beschriftungen weg (nur Werte, Tooltip bleibt) · 2: Einheit und Build weg ·
// 3: Linien-Darstellung nach „⋯“ · 4: Pausfolie nach „⋯“ · 5: Fang und Referenzlinien nach „⋯“.
// 3: Linien-Darstellung nach „⋯“ · 4: Pausfolie und Umbau ([271]) nach „⋯“ · 5: Fang und Referenzlinien nach „⋯“.
const footerRef = useRef<HTMLElement | null>(null);
const clusterRef = useRef<HTMLDivElement | null>(null);
const innerRef = useRef<HTMLSpanElement | null>(null);
@@ -486,6 +487,7 @@ export const StatusBar = memo(function StatusBar({
<LineModeToggle lineMode={lineMode} onLineModeChange={onLineModeChange} lineModeEnabled={lineModeEnabled} />
);
const traceEl = <TraceControl enabled={!!traceEnabled} onRunCommand={onRunCommand} />;
const renovationEl = <RenovationControl />;
const snapEl = <SnapControl snap={snap} onSnapChange={onSnapChange} />;
const refEl = (
<button
@@ -502,7 +504,7 @@ export const StatusBar = memo(function StatusBar({
// Was in „⋯“ wandert (Reihenfolge = Wegfall-Priorität von oben nach unten).
const inMore: React.ReactNode[] = [];
if (level >= 3) inMore.push(<span key="lm">{lineModeEl}</span>);
if (level >= 4) inMore.push(<span key="tr">{traceEl}</span>);
if (level >= 4) inMore.push(<span key="tr">{traceEl}</span>, <span key="ren">{renovationEl}</span>);
if (level >= 5) {
inMore.push(<span key="sn">{snapEl}</span>, <span key="rf">{refEl}</span>);
}
@@ -531,6 +533,8 @@ export const StatusBar = memo(function StatusBar({
<>
{traceEl}
<Sep />
{renovationEl}
<Sep />
</>
)}
{level < 5 && (
+99
View File
@@ -0,0 +1,99 @@
// [271] Ressourcen-Tab „Umbau“: Etappen (Name, Reihenfolge, hinzufügen/entfernen) und Umbau-Farben je Status
// (Füllung, Linie, gestrichelt; Vorgabe SIA 400: Bestand grau, Abbruch gelb gestrichelt, Neu rot).
// Reine Darstellung über Handler (wie die anderen Tabs, auch im macOS-Nebenfenster).
import { t } from "../../i18n";
import type { TranslationKey } from "../../i18n";
import type { Project, RenovationPhase, RenovationStatus, RenovationStyle, RenovationStyles } from "../../model/types";
import { DEFAULT_RENOVATION_STYLES, newPhaseId, RENOVATION_STATUSES, renovationPhases } from "../../core";
export interface RenovationHandlers {
/** Etappen-Liste ersetzen (Elemente einer entfernten Etappe verlieren sie). */
onSetRenovationPhases?: (phases: RenovationPhase[]) => void;
/** Umbau-Farben ersetzen (`undefined` = SIA-Vorgabe). */
onSetRenovationStyles?: (styles: RenovationStyles | undefined) => void;
}
export function RenovationTab({ project, handlers }: { project: Project; handlers: RenovationHandlers }) {
const phases = renovationPhases(project);
const styles = project.renovation?.styles ?? {};
const setPhases = handlers.onSetRenovationPhases;
const setStyles = handlers.onSetRenovationStyles;
const move = (i: number, d: number) => {
const j = i + d;
if (!setPhases || j < 0 || j >= phases.length) return;
const next = [...phases];
[next[i], next[j]] = [next[j], next[i]];
setPhases(next);
};
const patchStyle = (s: RenovationStatus, patch: Partial<RenovationStyle> | null) => {
if (!setStyles) return;
const next: RenovationStyles = { ...styles };
if (patch === null) delete next[s];
else next[s] = { ...(styles[s] ?? {}), ...patch };
setStyles(Object.keys(next).length ? next : undefined);
};
return (
<div className="rm-renovation" data-testid="rm-renovation">
<h4 className="rm-subhead">{t("renovation.phases.title")}</h4>
<p className="rm-hint">{t("renovation.phases.hint")}</p>
{phases.length === 0 && <div className="rm-empty">{t("renovation.phases.empty")}</div>}
{phases.map((ph, i) => (
<div className="rm-row" key={ph.id} data-testid="rm-renovation-phase">
<input
type="text"
value={ph.name}
aria-label={t("renovation.phase")}
disabled={!setPhases}
onChange={(e) => setPhases?.(phases.map((x) => (x.id === ph.id ? { ...x, name: e.target.value } : x)))}
/>
<button type="button" className="rm-icon-btn" disabled={!setPhases || i === 0} title={t("renovation.phases.up")} aria-label={t("renovation.phases.up")} onClick={() => move(i, -1)}>
▲
</button>
<button type="button" className="rm-icon-btn" disabled={!setPhases || i === phases.length - 1} title={t("renovation.phases.down")} aria-label={t("renovation.phases.down")} onClick={() => move(i, 1)}>
▼
</button>
<button type="button" className="rm-icon-btn" disabled={!setPhases} title={t("renovation.phases.remove")} aria-label={t("renovation.phases.remove")} onClick={() => setPhases?.(phases.filter((x) => x.id !== ph.id))}>
✕
</button>
</div>
))}
<button
type="button"
className="rm-add-btn"
disabled={!setPhases}
data-testid="rm-renovation-add-phase"
onClick={() => setPhases?.([...phases, { id: newPhaseId(project), name: t("renovation.phases.defaultName", { n: String(phases.length + 1) }) }])}
>
{t("renovation.phases.add")}
</button>
<h4 className="rm-subhead">{t("renovation.styles.title")}</h4>
<p className="rm-hint">{t("renovation.styles.hint")}</p>
{RENOVATION_STATUSES.map((s) => {
const d = DEFAULT_RENOVATION_STYLES[s];
const own = styles[s] ?? {};
return (
<div className="rm-row" key={s} data-testid={`rm-renovation-style-${s}`}>
<span className="rm-label">{t(`renovation.status.${s}` as TranslationKey)}</span>
<label className="rm-inline">
{t("renovation.styles.fill")}
<input type="color" value={own.fill ?? d.fill} disabled={!setStyles} onChange={(e) => patchStyle(s, { fill: e.target.value })} />
</label>
<label className="rm-inline">
{t("renovation.styles.line")}
<input type="color" value={own.line ?? d.line ?? "#000000"} disabled={!setStyles} onChange={(e) => patchStyle(s, { line: e.target.value })} />
</label>
<label className="rm-inline">
<input type="checkbox" checked={own.dashed ?? d.dashed} disabled={!setStyles} onChange={(e) => patchStyle(s, { dashed: e.target.checked })} />
{t("renovation.styles.dashed")}
</label>
<button type="button" className="rm-icon-btn" disabled={!setStyles || !styles[s]} title={t("renovation.styles.reset")} aria-label={t("renovation.styles.reset")} onClick={() => patchStyle(s, null)}>
↺
</button>
</div>
);
})}
</div>
);
}
+2
View File
@@ -30,6 +30,7 @@ export type TopBarEvents = Required<
| "onNewProjectFromSample"
| "onNewProjectFromComplexSample"
| "onNewProjectFromWettbewerbSample"
| "onNewProjectFromUmbauSample"
| "onNewProjectFromTemplate"
| "onOpenProject"
| "onSaveProject"
@@ -133,6 +134,7 @@ export function useTopBarElements(opts: {
onNewProjectFromSample={ev.onNewProjectFromSample}
onNewProjectFromComplexSample={ev.onNewProjectFromComplexSample}
onNewProjectFromWettbewerbSample={ev.onNewProjectFromWettbewerbSample}
onNewProjectFromUmbauSample={ev.onNewProjectFromUmbauSample}
onNewProjectFromTemplate={ev.onNewProjectFromTemplate}
onOpenProject={ev.onOpenProject}
onSaveProject={ev.onSaveProject}