[274] Umbau je Schicht: Sanierung mehrschichtiger Wände über Typ-Paar Bestand → Sanierungstyp
Modell (Rust, gen:types): WallType.renovationTarget/renovationSide/renovationOld/renovationNew, Wand renovation.renovated bzw. renovation.newTypeId (Ausnahme). Kern renovation::build_up: Zuordnung von der Bezugsseite her (Baustoff + Dicke + Lage = Bestand, manuell überschreibbar), gezeigter Aufbau je Filter (alt, neu, überlagert in Teilschichten), Ersatzwand mit Ersatztyp und Achsversatz für Grundriss, Schnitt, Ansicht, Axo, 3D und Kennzahlen; Farben je Schicht, Abbruch-Kanten gestrichelt, im Umbauplan gelbe gestrichelte Kontur über der roten Füllung. Abfragen renovationPair/renovationPairs. Oberfläche: Objekt-Info „Neuer Aufbau (Sanierung)“ mit Streifen Alt/Neu/Ergebnis, Umbau-Panel Abschnitt „Sanierung“ (Typ-Paare, Editor, Sanierungstyp anlegen, alle Wände vom Typ sanieren). Beispiel Umbau: Südwand Beton 20 + Dämmung 10 → Dämmung 20, Schnitt C. Tests: Kern renovation_layers_tests.rs, vitest renovationLayers.test.ts, e2e renovation274.spec.ts; Bilder doc/review-274. Nicht in der Tauri-App/auf dem Mac geprüft, 3D-Bild nicht angesehen.
This commit is contained in:
36 files changed
+2017
-44
No files matched your search
@@ -0,0 +1,51 @@
|
||||
// [274] Vorschau-Streifen einer Sanierung: Alt, Neu und Ergebnis (Umbauplan) mit SIA-Farben, aussen links → innen rechts,
|
||||
// massstäblich zueinander (gleiche Meter je Pixel). Die Teilstücke rechnet der Kern (`renovationPair`).
|
||||
|
||||
import { t } from "../i18n";
|
||||
import type { TranslationKey } from "../i18n";
|
||||
import type { RenovationPair, RenovationStripPiece } from "../core";
|
||||
|
||||
function Bar({ pieces, scale, demolishFill }: { pieces: RenovationStripPiece[]; scale: number; demolishFill: string }) {
|
||||
return (
|
||||
<span className="reno-strip-bar">
|
||||
{pieces.map((q, i) => (
|
||||
<span
|
||||
key={i}
|
||||
className={`reno-strip-piece is-${q.kind}`}
|
||||
data-kind={q.kind}
|
||||
style={{
|
||||
width: `${Math.max(1, q.thickness * scale)}px`,
|
||||
background: q.fill,
|
||||
// Neu über Abbruch: Abbruch als gestrichelte Kontur über der Neu-Füllung.
|
||||
outline: q.kind === "newOverDemolish" ? `1px dashed ${demolishFill}` : undefined,
|
||||
outlineOffset: q.kind === "newOverDemolish" ? "-2px" : undefined,
|
||||
borderStyle: q.kind === "demolish" ? "dashed" : "solid",
|
||||
}}
|
||||
title={`${t(`renovation.fate.${q.kind === "newOverDemolish" ? "new" : q.kind}` as TranslationKey)} ${(q.thickness * 100).toFixed(1)} cm`}
|
||||
/>
|
||||
))}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** Streifen Alt/Neu/Ergebnis eines Typ-Paars; `width` = Pixel für den dicksten Aufbau. */
|
||||
export function RenovationStrip({ pair, width = 150 }: { pair: RenovationPair; width?: number }) {
|
||||
const sum = (v: RenovationStripPiece[]) => v.reduce((a, q) => a + q.thickness, 0);
|
||||
const max = Math.max(sum(pair.oldStrip), sum(pair.newStrip), sum(pair.result), 1e-6);
|
||||
const scale = width / max;
|
||||
const demolishFill = pair.result.find((q) => q.kind === "demolish")?.fill ?? pair.oldStrip.find((q) => q.kind === "demolish")?.fill ?? "#ffd800";
|
||||
const row = (label: string, pieces: RenovationStripPiece[], id: string) => (
|
||||
<div className="reno-strip-row" data-testid={`reno-strip-${id}`}>
|
||||
<span className="reno-strip-label">{label}</span>
|
||||
<Bar pieces={pieces} scale={scale} demolishFill={demolishFill} />
|
||||
<span className="reno-strip-cm">{(sum(pieces) * 100).toFixed(1)} cm</span>
|
||||
</div>
|
||||
);
|
||||
return (
|
||||
<div className="reno-strip" data-testid="reno-strip">
|
||||
{row(t("renovation.strip.old"), pair.oldStrip, "old")}
|
||||
{row(t("renovation.strip.new"), pair.newStrip, "new")}
|
||||
{row(t("renovation.strip.result"), pair.result, "result")}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user