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].
72 lines
3.1 KiB
TypeScript
72 lines
3.1 KiB
TypeScript
// [271] Objekt-Info und Objekteinstellungen: „Umbau“ — Status (Bestand, Abbruch, Neu) und Etappe der Auswahl.
|
|
// Mehrfachauswahl: alle gewählten Bauteile in einem Undo-Schritt; verschiedene Werte zeigen „gemischt“.
|
|
|
|
import { useMemo } from "react";
|
|
import { t } from "../../i18n";
|
|
import type { RenovationStatus } from "../../model/types";
|
|
import { commonRenovation, renovatableIds, renovationPhases, RENOVATION_STATUSES, setRenovationOps } from "../../core";
|
|
import { useStore } from "../../state/appStore";
|
|
import type { Selection } from "../../state/selection";
|
|
import { Dropdown } from "../../ui/Dropdown";
|
|
|
|
const MIXED = "__mixed";
|
|
const NO_PHASE = "";
|
|
|
|
/** Ids der Auswahl, die einen Umbau-Status tragen (Wände, Öffnungen, Decken, Dächer, Treppen, Stützen, Körper, Räume). */
|
|
export function selectionRenovationIds(sel: Selection): string[] {
|
|
return [...sel.walls, ...sel.openings, ...sel.ceilings, ...sel.roofs, ...sel.stairs, ...sel.columns, ...sel.solids, ...sel.rooms];
|
|
}
|
|
|
|
export function RenovationField() {
|
|
const project = useStore((s) => s.project);
|
|
const selection = useStore((s) => s.selection);
|
|
const applyChange = useStore((s) => s.applyChange);
|
|
const ids = useMemo(() => renovatableIds(project, selectionRenovationIds(selection)), [project, selection]);
|
|
const common = useMemo(() => commonRenovation(project, ids), [project, ids]);
|
|
if (ids.length === 0) return null;
|
|
const phases = renovationPhases(project);
|
|
const statusValue = common.status === "mixed" || common.status === null ? MIXED : common.status;
|
|
const phaseValue = common.phase === "mixed" ? MIXED : (common.phase ?? NO_PHASE);
|
|
const statusOptions = [
|
|
...(statusValue === MIXED ? [{ value: MIXED, label: t("renovation.mixed") }] : []),
|
|
...RENOVATION_STATUSES.map((s) => ({ value: s, label: t(`renovation.status.${s}`) })),
|
|
];
|
|
const phaseOptions = [
|
|
...(phaseValue === MIXED ? [{ value: MIXED, label: t("renovation.mixed") }] : []),
|
|
{ value: NO_PHASE, label: t("renovation.phase.none") },
|
|
...phases.map((p) => ({ value: p.id, label: p.name })),
|
|
];
|
|
return (
|
|
<>
|
|
<div className="objinfo-field" data-testid="objinfo-renovation">
|
|
<span className="objinfo-flabel">{t("renovation.label")}</span>
|
|
<Dropdown
|
|
value={statusValue}
|
|
onChange={(v) => {
|
|
if (v === MIXED) return;
|
|
applyChange((p) => setRenovationOps(p, ids, v as RenovationStatus));
|
|
}}
|
|
options={statusOptions}
|
|
title={t("renovation.label")}
|
|
width={150}
|
|
/>
|
|
</div>
|
|
{phases.length > 0 && (
|
|
<div className="objinfo-field" data-testid="objinfo-renovation-phase">
|
|
<span className="objinfo-flabel">{t("renovation.phase")}</span>
|
|
<Dropdown
|
|
value={phaseValue}
|
|
onChange={(v) => {
|
|
if (v === MIXED) return;
|
|
applyChange((p) => setRenovationOps(p, ids, undefined, v === NO_PHASE ? null : v));
|
|
}}
|
|
options={phaseOptions}
|
|
title={t("renovation.phase")}
|
|
width={150}
|
|
/>
|
|
</div>
|
|
)}
|
|
</>
|
|
);
|
|
}
|