Merge [275] Umbau-Farben: Farbe oder Stift, gedämpfte Vorgabe, eigene Farben je Etappe

This commit is contained in:
Claude committed 2026-11-17 20:22:23 +00:00
commit ff7d80432d
40 files changed
+955 -143

No files matched your search

+1
View File
@@ -75,6 +75,7 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC.
- ◐ **[270]** Blickrichtungen überall gleich, Marken weichen aus (17.11.). **Befund:** das 3D-Fenster (render3d, Browser und Metal) zeigte das Modell **gespiegelt**: Bauteile liegen in der Welt (x, Höhe, y), ein Achsentausch (Determinante −1), und `look_at` ist rechtshändig — von Süden gesehen lag der Erker im Osten links, die Draufsicht stand kopfüber (Süden oben). Gelände, Importe/Verbau und Punktwolken negierten y (Fix 24.9. „swisstopo gespiegelt“) und lagen damit an y = 0 gespiegelt unter dem Haus. Vektor-Axonometrie, Cycles, Blender, glTF/OBJ und die Ansichten Nord/Ost/Süd/West waren seitenrichtig, aber die Namen widersprachen sich: `iso` = von Nordost (3D, Axo-Alias), von Südwest (Cycles/Blender); `front` = von Norden (3D, Axo) bzw. Süden (Cycles); „Axonometrie Südost“ im Musterhaus komplex stand auf `isoFrontLeft`. **Behoben:** eine Tabelle `render3d/src/view_dir.rs` für 3D-Presets (`math::preset_camera`), Axonometrie (`plan/axo.rs::preset`), Cycles (`cycles_scene.rs::preset`, CLI `render --view` nimmt auch `southeast` …), Blender-Skript (Kopie, per vitest geprüft): vorne = Süden, rechts = Osten, `iso` = Südost, `isoFrontLeft` = Südwest, `isoBackRight` = Nordost, `isoBackLeft` = Nordwest, `top` mit Norden oben; Beschriftungen „Isometrie Südost“, „Südwest“ … Die Spiegelung gleicht die Kamera an einer Stelle aus (`math::view_matrix`: Bild-rechts = oben × Blick; Culling `FrontFace::Cw`; Pathtracer-Strahlen; TS `screenRight`/`orbitRight` für Pick-Strahl, Griffe, Pan, Zoom zum Cursor, Begehen, Orbit-Richtung); Gelände/Import/Punktwolke/Luftbild ohne y-Negation. Ausschnitt „Axonometrie Südost“ → `iso`. **Marken ([266]/8):** Ansichtsmarken werden nach den Schnitten gesetzt und weichen Schnittlinien, -pfeilen und anderen Ansichtsmarken aus (zusätzlich seitlich entlang ihrer Linie, bis 15 mm; `plan/context.rs::view_marker`); Schnittpfeile sind Hindernis für Beschriftungen. Tests: Rust render3d `kamera_zeigt_modell_seitenrichtig` (vorher rot), `aussenflaechen_erscheinen_im_uhrzeigersinn`, `view_dir::tests`; Kern `axo::testhaus_seitenrichtig_in_allen_vorgaben`, `cycles_scene::voreinstellungen_heissen_wie_im_3d`, `context::ansichtsmarken_weichen_schnittmarken_aus` (vorher rot); vitest `view270.test.ts`, `viewDirections.test.ts`. Bilder und Testhaus (Erker Ost, Garage West, Turm Nordwest; `testhaus.py`) in `doc/review-270/`. **Offen:** 3D-Bild nur numerisch (Kameramatrix, Pick-Strahl) geprüft, kein Bild aus render3d unter Linux, nicht auf dem Mac/Metal (Prüfschritt `doc/RELEASE-1.0.md` 13.36); natives Spike-Fenster `src-tauri/src/native.rs` (Orbit-Richtung) nicht angepasst; gespeicherte Ausschnitte mit `isoBackRight`/`isoFrontLeft` zeigen jetzt die Richtung ihres Namens (keine produktiven Projekte). · M
- ◐ **[271]** Umbaufilter wie Archicad (Wunsch Maintainer 17.11.). **Modell:** `renovation: {status: existing|demolish|new, phase?}` an Wand, Öffnung (ohne eigenen Status folgt sie der Wand), Decke, Dach, Treppe, Stütze, Körper und Raum (Raum nur Sichtbarkeit/Flächen, keine Farbe — kein Bauteil); `Project.renovation` (Etappen, Farben, eigene Filter); `DrawingLevel`/`ViewTemplate`/`ViewSnapshot.renovationFilter`+`renovationPhase` (der Filter gehört zur Ebene wie die Modelldarstellung [173], damit je Reiter/Ausschnitt/Vorlage). **Kern** `renovation.rs` (ein Ort, `doc/ARCHITEKTUR.md` 3.8): Vorgaben Bestand/Abbruch/Neubau/Umbauplan/Endzustand, SIA-400-Farben (Bestand grau, Abbruch gelb gestrichelt, Neu rot, anpassbar), Etappen „bis n“ (Neues früherer Etappen = Bestand, Abbruch früherer weg, spätere Neue fehlen), Öffnung neu in Bestandswand = Abbruch-Stück bzw. zugemauerte Öffnung = Ausfachung (Wand zu, wo die Öffnung ausgeblendet ist). Umbau-Farben bleiben auch in Tusche (Schwarz-Weiss, `extras::KeepColors`); gefüllt werden nur Schnittflächen (Wand, Stütze), Symbole (Fenster, Türflügel, Tritte) nur in Linienfarbe. Angebunden: Grundriss, Schnitt, Ansicht, Vektor-Axo, 3D-Fenster (Filter der aktiven Ebene) und `model3d`, Kennzahlen/Flächen (Zustand Bestand/Endzustand im Panel), DXF (Layer `<Klasse>_Abbruch`/`_Neu`), IFC (`Status` NEW/EXISTING/DEMOLISH im `Pset_*Common`, Etappe in `Dossier_Umbau`). **Bedienung:** Objekt-Info/Objekteinstellungen „Umbau“ + „Etappe“ (Mehrfachauswahl, ein Undo-Schritt), Statusleiste „Umbau: …“ (Zeichen-Status neuer Bauteile, Vorgabe Bestand, Kern `commands::stamp_renovation`; Umbaufilter und Etappe der Ansicht; mit der Pausfolie im Überlauf „⋯“), Befehl `umbau` (B/A/N; die Befehlszeile nimmt getippte Options-Kürzel jetzt auch mit Enter an, `engine.ts`), Ressourcen-Tab „Umbau“ (Etappen, Farben), Vorlage „Beispiel Umbau“ (`model/sampleProjectUmbau.ts`, CLI `:umbau`), CLI `--renovation`/`--phase` (plan, section, elevation, axo, model3d, kennzahlen). Tests: Kern `renovation_tests.rs` (19), Robustheit, vitest `model/renovation.test.ts`, `commands/cmds/renovation.test.ts`, e2e `renovation271.spec.ts` (2× grün, Port 5195; dazu `uxReview263`, `objectSettings`, `modelViews`, `release10`, `editing` grün); Bilder `doc/review-271/` (CLI-SVG `--hatch` in Chromium, App-Screenshot). **Offen:** 3D-Fenster nur im Code angebunden (Kern-Teile per Test geprüft, Bild nicht angesehen: kein render3d unter Linux); Blender-Paket ohne Umbau-Farben (nur Ausblenden); Ansichtsleiste/Werkzeugleiste ohne eigene Filter-Wahl (Statusleiste und Panel Umbau); eigene Filter nur im Modell (keine Bearbeitung in der Oberfläche); Tauri/Mac nicht geprüft (Prüfschritt `doc/RELEASE-1.0.md` 13.37). **Nachtrag 17.11. (Panel):** eigenes Dock-Panel „Umbau“ (`panels/RenovationPanel.tsx`, Reiter rechts oben neben Objekt-Info/Flächenbilanz, Layout v16): Zeichen-Status Bestand/Abbruch/Neu mit SIA-Farbmuster + Etappe, Umbaufilter der aktiven Ansicht als Liste mit Vorschau je Status (wie gezeichnet/ausgeblendet/Umbau-Farbe) + „bis Etappe“, Status der Auswahl (gemischt-Marke) mit Setzen und Etappe (ein Undo-Schritt), „Nach Status wählen“ (Geschoss), Etappenliste (anlegen, umbenennen, Reihenfolge, Löschen mit Rückfrage über `ui/ConfirmDialog`, Verweis auf die Farben in den Ressourcen). Statusleisten-Popover und Objekt-Info teilen Zustand und Aktionen mit dem Panel (`state/renovationHook.ts`, keine Doppelspur) und lesen nur schmale Teile des Projekts: behebt die 45 Renders je Wand-Änderung in `renderCount.spec.ts` (jetzt 42, Grenze unverändert; `RenovationField` ist `memo`). Filter-Vorschau der eingebauten Filter spiegelt `renovation::builtin` in `model/renovation.ts` (vitest prüft gegen den Plan des Kerns; sauberer wäre, die Anteile in `filter_list` mitzuliefern). Tests: vitest `model/renovation.test.ts` (+3), e2e `renovationPanel271.spec.ts` (Port 5193); Bild `doc/review-271/05-panel-umbau.png`. Nicht geprüft: Tauri/Mac. **Offen:** Panel-Bild nur hell/1280×800 angesehen (dunkel ebenfalls ok, schmale Leiste nicht eigens). **Nachtrag 17.11. (Exporte und Rendering folgen der Ansicht, mit [272]):** neue gemeinsame Ansicht `export/exportView.ts` (`levelExportView` = Umbaufilter, Etappe und Variantenkombination der aktiven Ebene; `exportViewText` = Text der Kern-Abfragen, `renovation::view_from_text`), die EIN Weg für IFC (`exportIfcSpf({view})`), OBJ/STL/glTF (`MeshOptions.view`), STEP (`exportProjectStep(…, view)`), Blender-Paket (`RenderOptions.view`) und Cycles-Szene ist. Ausgeblendetes fehlt dort; die Cycles-Szene malt Umbau-Farben nur auf Wunsch (Option `renovationColors`, `cycles_scene_styled`; Vorgabe Materialfarben). App: Export-Dialog (IFC, OBJ, STL, glTF, STEP) und Rendering-Dialog zeigen die Ansicht der aktiven Ebene („Umbau: …“, „Variante: …“) und lassen „Hauptvarianten/kein Filter“ wählen; Rendering mit Cycles hat das HäkchenLine truncated
- ◐ **[274]** Umbau je Schicht: Sanierung mehrschichtiger Bauteile (Feedback Maintainer 17.11., typbasiert nach Rückfrage). **Modell:** `WallType.renovationTarget` (Sanierungstyp), `renovationSide` (Bezugsseite innen/aussen), `renovationOld`/`renovationNew` (manuelle Zuordnung je Schicht, Vorgabe „auto“); Wand `renovation.renovated` (nutzt den Sanierungstyp ihres Typs) bzw. `renovation.newTypeId` (Ausnahme); wirkt nur beim Status Bestand, Etappe = `renovation.phase`; ohne Umbaufilter gilt der Bestandstyp. **Kern** `renovation::build_up` (ein Ort, `doc/ARCHITEKTUR.md` 3.8): Zuordnung von der Bezugsseite her (gleicher Baustoff + Dicke + Lage = Bestand, nur alt = Abbruch, nur neu = Neu; manuell überschreibbar, weil z. B. ein ersetzter Baustoff gleicher Dicke sonst als Bestand gälte; das automatisch gepaarte Gegenstück folgt), gezeigter Aufbau je Filter (Abbruch sichtbar ⇒ alt, Neu sichtbar ⇒ neu, beide ⇒ überlagert in Teilschichten), Ersatzwand mit Ersatztyp und Achsversatz (Bezugsseite bleibt stehen, Achse bleibt) für Grundriss, Schnitt, Ansicht, Axo, 3D, Kennzahlen/GF, IFC-Schichten; Farben je Schicht (Grundriss über die Schicht-Aktionen [33], Kanten der Abbruch-Schichten gestrichelt, im Umbauplan Abbruch als gelbe gestrichelte Kontur über der roten Füllung; Schnitt je Schnittfläche; Ansicht/Axo/3D Farbe der äussersten Schicht); Öffnungsleibungen folgen dem gezeigten Aufbau. Abfragen `renovationPair`/`renovationPairs`. **Bedienung:** Objekt-Info/Objekteinstellungen „Neuer Aufbau (Sanierung)“ (keiner / wie Typ / anderer Wandtyp; Mehrfachauswahl ein Undo-Schritt) mit Streifen Alt/Neu/Ergebnis in SIA-Farben (`ui/RenovationStrip.tsx`); Umbau-Panel Abschnitt „Sanierung“ (`panels/RenovationSanierung.tsx`): Zähler „Sanierte Bauteile“, Typ-Paare mit „x von n Wänden saniert“, „Alle Wände vom Typ sanieren“ (ein Undo-Schritt), „Sanierungstyp anlegen …“ (Kopie des Bestandstyps), Typ-Paar-Editor (Alt/Neu nebeneinander, Zuordnung je Schicht, Bezugsseite, Ergebnis-Streifen). Status/Etappe setzen und Etappe löschen behalten die Sanierung. Beispiel Umbau: Südwand W1 Beton 20 + Dämmung 10 + Putz → Dämmung 20 + Putz (Etappe 1), neuer Schnitt C durch die Wand. Tests: Kern `renovation_layers_tests.rs` (11: Zuordnung inkl. gleicher Baustoff andere Dicke, vertauscht, Bezugsseite aussen, manuell, NaN/leer/fehlender Typ; Grundriss und Schnitt je Filter; Kennzahlen je Zustand; Öffnung; 3D/Ansicht; Umstellen idempotent; Abfragen), vitest `model/renovationLayers.test.ts`, e2e `renovation274.spec.ts` (2× grün, Port 5195; dazu `renovation271`, `renovationPanel271`, `objectSettings`, `renderCount` 2× grün, Renders je Wand-Änderung 43 bei unveränderter Grenze); Bilder `doc/review-274/` (CLI-SVG `--hatch` Grundriss 1:50/1:100 und Schnitt C in allen fünf Filtern, Chromium; App-Screenshots Feld und Panel). **Offen:** Decken und Dächer ohne Sanierung je Schicht (Modell-Felder nur am Wandtyp); Bogenwände ohne gestrichelte Abbruch-Kanten (Füllung je Schicht ja); im Schnitt Abbruch-Kontur schwarz gestrichelt statt gelb, Aussenkante der Abbruch-Schicht unter der schweren Schnittkante durchgezogen (wie [271]); 3D/Ansicht nur Farbe der äussersten Schicht (Teile je Schicht im 3D wären möglich), 3D-Bild nicht angesehen; IFC: Endzustand-Aufbau als Materialschichten über die Ersatzwand (Weg wie Kennzahlen, nicht eigens geprüft), kein Status je Schicht als Eigenschaft; DXF: Schichten nicht auf eigenen Umbau-Layern (Wand-Layer nach Wand-Status); Instanz-Schichtliste (eigene Schichten je Wand) bewusst nicht, nur anderer Typ als Ausnahme; Achse auf der bewegten Seite bei dünnerem neuem Aufbau bleibt in der Wand (Bezugsseite verschiebt sich dann); Tauri/Mac nicht geprüft (Prüfschritt `doc/RELEASE-1.0.md` 13.39). **Zusammenführung mit [271]-Rest (17.11.):** sanierte Wände zeigen auch die Projektionslinien des Schnitts in der Farbe ihrer äussersten Schicht (`CutRules::edge` über `Resolved::faces`); die Ersatzstücke der Öffnungen in Schnitt und Ansicht rechnen aus dem Projekt mit allem, aber mit dem gezeigten Aufbau (`renovation::apply` ohne Ausgeblendetes); Beispiel `:umbau` vereint Südwand W1/Schnitt C mit Möbeln, Bäumen und Ansicht West. · M
- ◐ **[275]** Umbau-Farben als Farbe oder Stift, gedämpfte Vorgabe, eigene Farben je Etappe (Wunsch Maintainer 17.11.: „eine Farbe oder ein Stift … weniger leuchtendes Gelb und Rot“). **Vorgabe** (`renovation::default_style`, Konstanten `DEMOLISH_FILL`/`NEW_FILL`/`NEW_LINE`): Abbruch ruhiges Ocker-Gelb `#e8c35a` (statt `#ffd800`), Neu gedämpftes Ziegelrot `#c8524a`, Linie `#9e3a33` (statt `#e3001b`/`#c00016`), Bestand `#a6a6a6` unverändert; gilt überall über `renovation::style` (Plan, Schnitt, Ansicht, Axo, 3D, Cycles-Umbaufarben, Panel/Statusleiste; CSS über `--reno-*`). **Modell:** `RenovationStyle.fillPen`/`linePen` (ColorPen-Id; Farbe aus dem aktiven Stiftsatz, beim Lesen aufgelöst, nicht eingebacken — S/W-Stiftsatz färbt den Umbauplan um; Stift ohne Eintrag ⇒ freie Farbe/Vorgabe), `RenovationPhase.styles` (eigene Farben der Etappe über der Projektfarbe; `View::treat` nimmt sie, solange das Element seinen eigenen Status zeigt, Ersatzstücke nach der Etappe ihrer Öffnung). Abfrage `renovationStyles` (Vorgabe/Projekt/Etappen aufgelöst) — die Oberfläche rechnet keine Farben mehr selbst (`DEFAULT_RENOVATION_STYLES` in TS entfernt). `project_refs` prüft die Stifte. **Oberfläche:** gemeinsamer Editor `ui/RenovationStyleEditor.tsx` (je Status Füllung/Linie mit dem `PenColorField` der App: Frei/Stift, „gestrichelt“, Zurücksetzen) im Umbau-Panel (Abschnitt „Darstellung“ mit Knopf „SIA-Vorgabe“; je Etappe Farbmuster-Knopf mit eigenem Editor und „Farben des Projekts verwenden“) und im Ressourcen-Tab „Umbau“ (ersetzt die `input type=color`); Ops `setRenovationStylesOps`/`setPhaseStylesOps`/`patchRenovationStyles` (Farbe und Stift schliessen sich aus). Beispiel `:umbau`: Etappe 2 (Anbau) Neu gedämpft blau `#5b84b1`. Tests: Kern `renovation_style_tests.rs` (6: Vorgabe, Stift + Stiftsatz-Wechsel, Etappe inkl. „bis Etappe“, Ersatzstück, Unsinn, Abfrage), vitest `model/renovationStyles.test.ts` (4), e2e `renovationStyles275.spec.ts` (Port 5196); Bilder `doc/review-275/` (CLI-SVG `--hatch` Grundriss EG 1:50 und Schnitt C vorher/nachher, Etappe 2 blau; App-Panel hell/dunkel). **Offen:** dünnes Strichwerk im Abbruch (Möbel, Baum „zu fällen“) bleibt auf weissem Papier blass (Linie = Füllfarbe; mit eigener Abbruch-Linie z. B. dunklem Ocker kräftiger, dann aber auch die Wandkontur ocker statt schwarz gestrichelt — bewusst nicht als Vorgabe); Etappen-Farben nur für Neu/Abbruch in der Oberfläche (Modell kennt auch Bestand); Stift-Strichstärke wirkt nicht (nur Farbe); Tauri/Mac und 3D-Fenster (render3d) nicht angesehen. · S
- ◐ **[269]** Pläne schöner, Befunde aus Screenshots des Koordinators (16.11.; CLI `plan|section|elevation --hatch --template "Eingabeplan 1:100"`, SVG → Chromium; Bilder vorher/nachher `doc/review-269/`). **Behoben 17.11.:** (1) **Ausschnitt mit Parzelle:** das Plan-Ausmass endet bei Parzelle + 5 m (`SITE_MARGIN_M`) vereinigt mit Haus ± Marken-Reichweite und den nicht weitreichenden Zeichnungen (Titel, Massstab, Bemassung; Kataster/Strassen/Höhenlinien/Bäume/Kontext-Klassen zählen nicht, `drawings::is_far_class`); keine Beschneidung im Situationsplan und bei sichtbarem Schatten (`extras::site_clip`, in beiden Puffer-Wegen von `domains.rs`). Wettbewerb EG 1:200: SVG 85 × 54.9 m → 46 × 37.9 m; Musterhaus komplex EG 99 × 63.6 → 55 × 46.6 m. Layout-Viewports/Plakat croppen schon über [208] (`crop`, Haus + 20 mm) und ändern sich praktisch nicht; Einpassen beim Öffnen nutzt `house`. Die Linien ausserhalb bleiben im SVG (werden von der viewBox abgeschnitten), nicht geometrisch gekappt. (2) **Gartenkörper:** Brunnen, Loft, Rotationskörper im Musterhaus komplex lagen auf „20 Wände“, jetzt Klasse „24 Fahrzeuge & Freiflächen“ (`GARDEN_CLASS`) — in Grundriss, Schnitt und Ansicht ausschaltbar. Die Vorlage „Eingabeplan 1:100“ blendet 24 NICHT aus (würde auch Parkfelder/Fahrzeuge im Grundriss ausblenden; fachlicher Entscheid offen für den Maintainer); im Nachher-Bild `--hide …,24`. Der Standard für neue freie Körper bleibt die aktive Klasse. (3) **Dachziegel/Ansichtsschraffur:** Musterlinien in der Ansicht nie enger als 2.5 mm Papier (`PATTERN_MIN_PAPER_MM`, dünnt bei 1:100 und 1:200 gleich aus, vorher 0.7 mm), Standardstärke 0.05 statt 0.1 mm (höchstens 0.09), Vorgabefarbe unverändert. (4) **Hinweistext:** im Beispiel jetzt im Wohnraum über der Hebeschiebetür mit kurzer Führungslinie; Führungslinien setzen vor Masszahlen, Texten und Koten aus (`cut_at_gaps`, mit Wächter gegen Rekursion in der Hindernisberechnung — erste Fassung stürzte im WASM mit Stack-Überlauf ab, im nativen Test nicht); Titel „Erdgeschoss“ und Massstabsbalken rücken ans Haus. Tests: Rust `ausmass_endet_an_parzelle_plus_rand`, `fuehrungslinie_setzt_vor_masszahlen_aus`, `ansichtsschraffur_massstabsgerecht_und_fein`; Goldens `komplex-ansicht-ansicht-sued`, `komplex-grundriss-eg-100/-50` (Hinweis/Titel/Massstab verschoben, Ansichtsschraffur dünner und seltener). **Offen:** Ausschnitt nur Linux/CLI angesehen (nicht in der App/Metal), Beschriftung am Rand (z. B. „Kat.-Nr. 1188“) kann angeschnitten sein; Schnitt/Ansicht-Ausmass nicht beschnitten (Gelände); Eingabeplan-Klasse 24 s. o.; Stossfugen-Muster (Läuferverband) in der Ansicht nicht eigens geprüft. · S
- ◐ **[268]** Review der Änderungen vom 15./16.11. auf echte Fehler vor der Beta (16.11.; [256] [260] [261] [262] [263] [264] [265] [266] [267] [170] [30]). **Behoben 16.11.:** (1) **Datenverlust nach Sprachwechsel** ([264] `LanguageRoot` baut die App neu auf): zuletzt gespeicherter Stand, Pfad, Lock und Autosave-Stand lagen in `useRef` von `useProjectFileActions` und wurden zurückgesetzt — danach galten ungespeicherte Änderungen als gespeichert, Neu/Öffnen/Fenster schliessen verwarfen sie ohne Rückfrage, Cmd+S fragte neu nach dem Pfad, der Lock der offenen Datei blieb liegen; zudem erschien die Autosave-Kopie der laufenden Sitzung als „Ungesicherte Arbeit gefunden“. Jetzt Sitzungszustand ausserhalb von React (`FileSession`), Suche nach Kopien einmal je Seitenladen; e2e `languageSwitch268.spec.ts` (vorher rot, beide Fälle). (2) **Release-Skript** (`scripts/release-gitea.mjs`): jeder Fehler beim Lesen von `versions.json` (Netz, 5xx, Proxy) galt als „leer“ — `--publish` überschrieb den Versionsverlauf mit nur der neuen Version; ein nicht lesbares `SHA256SUMS.txt` der anderen Plattform fiel stillschweigend aus den Prüfsummen. Jetzt nur 404 = leer, sonst Abbruch (`fetchExisting`, `parseSums` in `release-gitea-lib.cjs`, Test `releaseGitea.test.ts`). **Offen (Verdacht ohne Nachweis, Befund · Ort · Szenario · Grösse):** ~~a.~~ **Behoben 16.11. (Electron-Links):** `setWindowOpenHandler` (nie ein Kindfenster; https/mailto → `shell.openExternal`, sonst verwerfen), `will-navigate`/`will-redirect` nur im App-Ursprung (`dossier://app`, Dev-Server `localhost:5187`; fremdes https → System-Browser), CSP in `onHeadersReceived` nur für den App-Ursprung; Entscheide als reine Funktionen in `scripts/electron-links.cjs` (im Paket, `electron-builder.yml`), Test `src/native/electronLinks.test.ts` und e2e `linuxApp170.spec.ts` („Externe Links“: `window.open`/Navigation erzeugen kein Fenster, `shell.openExternal` im Hauptprozess abgefangen; mit gebautem AppImage grün). `openExternalUrl` (Fehler melden, Blender laden) nutzt unter Electron `window.open` und landet damit im System-Browser, keine App-Änderung nötig. Offen: Tauri/Mac unberührt (dort `plugin-shell`), echter Browser-Start nicht geprüft (nur Hook). b. Sprachwechsel setzt weiteren UI-Zustand zurück: Fang-Einstellungen (`useDrawingToolState`, `DEFAULT_SNAP`), aktives Werkzeug, laufender Befehl, Element-Zwischenablage (`useSelectionState`), offene Dialoge ausser Einstellungen · kein Datenverlust, aber z. B. ausgeschalteter Ortho-Fang ist danach wieder an · S. ~~c.~~ **Behoben 16.11.:** `uploadAsset` lädt beim Ersetzen erst unter `<name>.upload-<ms>` hoch, löscht dann den alten Anhang und benennt per PATCH um (`latest.json` fehlt nie; Rest `.upload-…` bei Abbruch in Gitea löschen; gegen echte Gitea-API nicht geprüft, nur `--dry-run`). ~~d.~~ **Behoben 16.11.:** ohne `--publish` auf ein veröffentlichtes Release Abbruch, bewusst mit `--replace-published` (`preflight` in `release-gitea-lib.cjs`, läuft vor dem Anlegen des Entwurfs). ~~e.~~ **Behoben 16.11.:** `--publish` ohne Mac-Pakete (weder im Ordner noch am Release) bricht ab, bewusst nur Linux mit `--linux-only`; Tests `releaseGitea.test.ts`, README „Release auf Gitea“ nachgeführt. **Geprüft ohne Befund:** `elevation_set.rs` (Faltung, Namen, vorhandene Seiten), `kernel2d/src/rooms.rs` (Offset je Kante, NaN), `standards_names.rs`/Standards-Abgleich (kein Duplikat, „Aktualisieren“ hält englische Namen), `stamp_place.rs` `cut_out` (NaN ohne Panic), [262] Offline-Pfade und Host-/CSP-Listen (Overpass, http-Fähigkeit Gitea), [261] `build-number.cjs`, Kurzanleitung (`miniMarkdown` ohne HTML), Dock-Einklappen (`reconcileLayout`), Electron-Argumentdatei (`take-open-file` einmalig). Nicht geprüft: Mac/Tauri, Electron-Paket, GPU-Renderer über mehrere Sprachwechsel (Speicher), [216] Erker und [208] DXF-MTEXT im Detail.
- ◐ **[263]** Visuelle und UX-Prüfung des Referenz-Ablaufs (15.11., Wunsch Maintainer „prüfe auch visuell und UX“): Chromium/Linux, Screenshots 1280×800 (de hell, de dunkel, en hell, 1440×900 und 1920×1080 stichprobenweise) von Start, Neues Projekt, allen Dock-Reitern, Menüs, Einstellungen/Über/Kürzel/Ressourcen/Verlauf/BCF/3D-Bild/Rendering/DXF-/IFC-Export/Standort-Import, Musterhaus, Musterhaus komplex, Wettbewerb (Plan, Objekt-Info, Taste T, Mappe, Plakat-Blatt, Publikationssatz). Automatisch geprüft: Symbolknöpfe ohne Tooltip (0 Funde), rohe Übersetzungs-Schlüssel (0), abgeschnittene Texte, Esc/Enter an Dialogen (alle modalen Dialoge schliessen mit Esc). **Behoben 15.11.:** (1) unbekannter Befehl in der Befehlszeile tat nichts, jetzt Meldung „Unbekannter Befehl …“ (`engine.ts`, `cmd.unknown`); (2) Layout-Werkzeugleiste: Tabellen-Auswahl auf den Pfeil geschrumpft und „Einpassen“ ausserhalb, jetzt Umbruch; (3) Attribute-Panel: Quellen-Auswahl neben der Strichstärke zeigte „e ▾“ (Label-Spalte höchstens 42 %); (4) Standort-Import: Platzhalter der Bezugspunkt-Felder abgeschnitten; (5) Ansichtsleiste: Ausblendung am rechten Rand, wenn dort noch Bedienelemente liegen; (6) Schreibweise: de „Schließen/Maßstab/Außen“ gemischt mit „Schliessen/Massstab/Aussen“ → überall Schweizer „ss“ (Test `src/i18n/spelling.test.ts`), „Snap-/Endpunkt-Farbe“ → „Fang-“, en „room program“/„colour“ → „room programme“/„color“. e2e: `e2e/uxReview263.spec.ts`. **Nachtrag 17.11. (Statusleiste, in GitHub Actions rot):** Der Wertcluster schnitt bei breiteren System-Schriften (ubuntu-latest) Felder ab. Jetzt kürzt sich die Leiste nach Priorität (`StatusBar.tsx`, gemessen per `scrollWidth`/ResizeObserver, kein Abschneiden mehr): 1 Beschriftungen weg (Tooltip bleibt, X/Y und LV95 behalten sie) · 2 Einheit und Build weg · 3 Linien-Darstellung, 4 Pausfolie, 5 Fang und Referenzlinien in ein Überlauf-Menü „⋯“ (Popover nach oben, Esc schliesst); Geschoss und Ebene bleiben immer. Der Cluster-Rand ist nicht mehr `overflow: hidden` (Popover wurden sonst beschnitten). e2e simuliert die CI-Schrift (DejaVu Sans + Zeichenabstand) bei 1280, 1440 und 1024 px (vorher rot). Nicht auf dem Mac geprüft. **Offen (nach Wichtigkeit, Grösse):**
+6
View File
@@ -488,6 +488,12 @@ Farbe im Strichwerk über `drawings::emit` (Linienfarbe, sonst Füllfarbe; Abbru
[149]: bestehend/neu/zu fällen) IST der Umbau-Status (`tree_renovation`: bestehend = Bestand, zu fällen = Abbruch, neu = Neu) — ein Feld, keine
zweite Wahrheit; der Baum trägt kein eigenes `renovation` und keine Etappe.
**Umbau-Farben ([275]):** `renovation::style` (Projekt über SIA-Vorgabe `default_style`, gedämpft: Abbruch `#e8c35a`, Neu `#c8524a`/`#9e3a33`)
und `phase_style` (eigene `RenovationPhase.styles` über der Projektfarbe). Je Status Farbe ODER Stift (`fillPen`/`linePen` = `ColorPen.id`,
gelesen im aktiven Stiftsatz, nicht eingebacken — ein S/W-Plot-Stiftsatz färbt so auch den Umbauplan um). `View::treat` nimmt die Farbe der Etappe
des Elements, solange es seinen eigenen Status zeigt (im Stand einer späteren Etappe ist es Bestand in Projektfarbe); Ersatzstücke gehören zur
Etappe ihrer Öffnung. Die Oberfläche liest die aufgelösten Farben über die Abfrage `renovationStyles` (keine zweite Rechnung in TS).
**Sanierung je Schicht ([274], `renovation::build_up`):** typbasiert. Der Bestands-Wandtyp trägt seinen Sanierungstyp
(`WallType.renovationTarget`), die Bezugsseite (`renovationSide`, Vorgabe innen) und die manuelle Zuordnung je Schicht
(`renovationOld`/`renovationNew`, „auto“ = automatisch); eine Bestandswand mit `renovation.renovated` nutzt ihn (Ausnahme je Wand:
Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

+2 -2
View File
@@ -4,8 +4,8 @@
import { blurFocus, discardIfAsked, expect, fileMenu, openTab, test, typeCommand } from "./app";
const GREY = "#a6a6a6";
const YELLOW = "#ffd800";
const RED = "#e3001b";
const YELLOW = "#e8c35a";
const RED = "#c8524a";
test("Umbaufilter, Status setzen und Undo ([271])", async ({ page }) => {
await page.goto("/?dossierTest");
+1 -1
View File
@@ -6,7 +6,7 @@ import { blurFocus, discardIfAsked, expect, fileMenu, openTab, test } from "./ap
test.use({ viewport: { width: 1280, height: 800 } });
const RED = "#e3001b";
const RED = "#c8524a";
test("Sanierung je Schicht: Feld, Typ-Paar, alle sanieren ([274])", async ({ page }) => {
await page.goto("/?dossierTest");
+2 -2
View File
@@ -4,8 +4,8 @@ import { blurFocus, commandInput, expect, finishCommand, openTab, test, typeComm
test.use({ viewport: { width: 1280, height: 800 } });
const RED = "#e3001b";
const YELLOW = "#ffd800";
const RED = "#c8524a";
const YELLOW = "#e8c35a";
test("Umbau-Panel: Zeichen-Status, Filter, Auswahl, Etappen ([271])", async ({ page }) => {
await page.goto("/?dossierTest");
+116
View File
@@ -0,0 +1,116 @@
// [275] Umbau-Panel, Abschnitt „Darstellung“: Farbe einer Status-Füllung ändern (Plan folgt, Undo), Stift statt Farbe,
// „SIA-Vorgabe“, gestrichelt beim Abbruch, eigene Farbe einer Etappe. Port: E2E_PORT=5196.
import type { Locator, Page } from "@playwright/test";
import { blurFocus, commandInput, expect, finishCommand, openTab, test, typeCommand } from "./app";
test.use({ viewport: { width: 1280, height: 900 } });
const RED = "#c8524a";
const OWN = "#336699";
const PHASE = "#5b84b1";
/** Füllfarbe im Popover des Farb-/Stiftfelds als Hex setzen. */
async function setHex(page: Page, field: Locator, hex: string) {
const pop = page.locator(".pen-color-popover");
await field.scrollIntoViewIfNeeded();
// Ein Scrollen des Panels schliesst das Popover (PenColorField): bis es offen bleibt.
await expect(async () => {
if (!(await pop.isVisible())) await field.locator(".pen-color-swatch").click();
await expect(pop).toBeVisible({ timeout: 1000 });
}).toPass({ timeout: 10_000 });
await pop.getByRole("button", { name: "Frei", exact: true }).click();
await pop.locator("input.pen-color-input").fill(hex);
await page.keyboard.press("Escape");
await page.mouse.click(5, 895);
}
test("Umbau-Panel Darstellung: Farbe oder Stift je Status, SIA-Vorgabe, Etappen-Farbe ([275])", async ({ page }) => {
test.setTimeout(120_000);
await page.goto("/?dossierTest");
await page.getByRole("button", { name: /Neues Projekt/ }).first().click();
await expect(page.getByRole("group", { name: "Befehlszeile" })).toBeVisible();
const ren = () => page.evaluate(() => window.__dossierTest!.renovation());
const fills = async () => Object.keys(await page.evaluate(() => window.__dossierTest!.planFillColors()));
await openTab(page, "Umbau");
const panel = page.getByTestId("renovation-dock");
await panel.getByTestId("reno-draw-new").click();
await page.getByRole("button", { name: "Wand", exact: true }).click();
await commandInput(page).focus();
await typeCommand(page, "0,0");
await typeCommand(page, "5,0");
await finishCommand(page);
await blurFocus(page);
await panel.getByTestId("reno-filter-umbauplan").click();
await expect.poll(fills).toContain(RED);
// Abschnitt Darstellung: Neu zeigt die gedämpfte Vorgabe.
const styles = panel.getByTestId("reno-styles");
await expect(styles).toBeVisible();
const rowNew = styles.getByTestId("reno-style-new");
await expect(rowNew).toHaveAttribute("data-fill", RED);
await expect(styles.getByTestId("reno-style-sia")).toBeDisabled();
await styles.scrollIntoViewIfNeeded();
await page.screenshot({ path: "test-results/renovation275-darstellung-hell.png" });
// Freie Farbe: Plan folgt; ein Undo-Schritt stellt zurück.
await setHex(page, styles.getByTestId("reno-style-new-fill"), OWN);
await expect(rowNew).toHaveAttribute("data-fill", OWN);
await expect.poll(fills).toContain(OWN);
await expect.poll(fills).not.toContain(RED);
await blurFocus(page);
await page.keyboard.press("ControlOrMeta+z");
await expect(rowNew).toHaveAttribute("data-fill", RED);
await expect.poll(fills).toContain(RED);
// Stift statt Farbe: die Füllung nimmt die Farbe des Stifts im aktiven Stiftsatz; Plan zeigt sie.
await styles.getByTestId("reno-style-new-fill").locator(".pen-color-swatch").click();
const pop = page.locator(".pen-color-popover");
await pop.getByRole("button", { name: "Stift", exact: true }).click();
await page.keyboard.press("Escape");
await page.mouse.click(5, 895);
await expect(styles.getByTestId("reno-style-new-fill").locator(".pen-color-badge")).toBeVisible();
const penFill = await rowNew.getAttribute("data-fill");
expect(penFill).toMatch(/^#[0-9a-f]{6}$/i);
await expect.poll(fills).toContain(penFill!);
// SIA-Vorgabe setzt alles zurück.
await expect(styles.getByTestId("reno-style-sia")).toBeEnabled();
await styles.getByTestId("reno-style-sia").click();
await expect(rowNew).toHaveAttribute("data-fill", RED);
await expect(styles.getByTestId("reno-style-sia")).toBeDisabled();
await expect.poll(fills).toContain(RED);
// Gestrichelt nur beim Abbruch angeboten.
await expect(styles.getByTestId("reno-style-demolish-dashed")).toBeChecked();
await expect(styles.getByTestId("reno-style-new-dashed")).toHaveCount(0);
await styles.getByTestId("reno-style-demolish-dashed").uncheck();
await expect(styles.getByTestId("reno-style-demolish")).toHaveAttribute("data-dashed", "false");
await styles.getByTestId("reno-style-demolish-reset").click();
await expect(styles.getByTestId("reno-style-demolish")).toHaveAttribute("data-dashed", "true");
// Etappe mit eigener Farbe: Wand in Etappe 1, deren Neu-Farbe blau.
await panel.getByTestId("reno-phase-add").click();
const wallId = Object.keys((await ren()).walls)[0];
await page.evaluate((id) => window.__dossierTest!.select({ walls: [id] }), wallId);
const phaseId = await panel.getByTestId("reno-sel-phase").locator("option").nth(1).getAttribute("value");
await panel.getByTestId("reno-sel-phase").selectOption(phaseId!);
await panel.getByTestId("reno-phase-style").click();
const phaseBox = panel.getByTestId("reno-phase-styles");
await expect(phaseBox).toBeVisible();
await setHex(page, phaseBox.getByTestId("reno-phase-style-new-fill"), PHASE);
await expect(phaseBox.getByTestId("reno-phase-style-new")).toHaveAttribute("data-fill", PHASE);
await expect.poll(fills).toContain(PHASE);
await expect.poll(fills).not.toContain(RED);
// Projektfarbe bleibt unverändert.
await expect(rowNew).toHaveAttribute("data-fill", RED);
await phaseBox.scrollIntoViewIfNeeded();
await page.screenshot({ path: "test-results/renovation275-etappe.png" });
await page.evaluate(() => document.documentElement.setAttribute("data-theme", "dark"));
await styles.scrollIntoViewIfNeeded();
await page.screenshot({ path: "test-results/renovation275-darstellung-dunkel.png" });
await page.evaluate(() => document.documentElement.setAttribute("data-theme", "light"));
await phaseBox.getByTestId("reno-phase-style-reset").click();
await expect.poll(fills).toContain(RED);
await expect.poll(fills).not.toContain(PHASE);
});
+1 -1
View File
@@ -66,7 +66,7 @@ fn cycles_umbaufarben_nur_auf_wunsch() {
mit_opts["renovationColors"] = json!(true);
let mit = scene(&p, &mit_opts.to_string());
let xml = mit["xml"].as_str().unwrap();
assert!(xml.contains("Umbau-ffd800"), "Abbruch gelb");
assert!(xml.contains(&format!("Umbau-{}", &crate::renovation::DEMOLISH_FILL[1..])), "Abbruch gelb");
// Geometrie bleibt gleich.
assert_eq!(ohne["triangles"], mit["triangles"]);
// Ohne Filter keine Farben, auch mit dem Schalter.
+15
View File
@@ -3049,6 +3049,11 @@ pub enum LayerRenovation {
pub struct RenovationPhase {
pub id: String,
pub name: String,
/// [275] Eigene Umbau-Farben der Etappe (Neu/Abbruch dieser Etappe, z. B. Neubau Etappe 2 blau); fehlende Felder
/// ⇒ die Farben des Projekts (`RenovationSettings.styles`), dann die SIA-Vorgabe.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub styles: Option<RenovationStyles>,
#[serde(flatten)]
#[ts(skip)]
pub extra: Extra,
@@ -3073,15 +3078,25 @@ pub enum RenovationShow {
}
/// [271] Umbau-Farbe eines Status: Füllung der Schnittflächen, Linienfarbe, gestrichelt. Fehlende Felder ⇒ SIA-Vorgabe.
/// [275] Statt einer freien Farbe ein Stift (`ColorPen.id`): seine Farbe aus dem aktiven Stiftsatz geht der freien
/// Farbe vor (ein S/W-Plot-Stiftsatz färbt so auch die Umbau-Farben um; Stift ohne Eintrag ⇒ freie Farbe/Vorgabe).
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize, TS)]
#[serde(default)]
pub struct RenovationStyle {
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub fill: Option<String>,
/// [275] Stift der Füllung.
#[serde(rename = "fillPen", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub fill_pen: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub line: Option<String>,
/// [275] Stift der Linien.
#[serde(rename = "linePen", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub line_pen: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub dashed: Option<bool>,
+10
View File
@@ -137,6 +137,16 @@ pub fn dangling_refs(p: &Project) -> Vec<String> {
for c in p.flat_categories() {
check_pens(&mut out, &pens, "Kategorie", &c.code, [&c.color_pen_id, &none, &none]);
}
// [275] Stifte der Umbau-Farben (Projekt und Etappen).
if let Some(r) = &p.renovation {
let phases = r.phases.as_deref().unwrap_or(&[]);
let sets = std::iter::once(("Projekt", p.id.as_str(), r.styles.as_ref())).chain(phases.iter().map(|x| ("Etappe", x.id.as_str(), x.styles.as_ref())));
for (what, owner, st) in sets {
for s in st.into_iter().flat_map(|s| [&s.existing, &s.demolish, &s.new]).flatten() {
check_pens(&mut out, &pens, what, owner, [&s.fill_pen, &s.line_pen, &none]);
}
}
}
let pen_sets = ids(p.pen_sets.as_deref().unwrap_or(&[]), |s| s.id.as_str());
miss(&mut out, "Projekt", &p.id, "Stiftsatz", p.active_pen_set_id.as_deref().unwrap_or(""), &pen_sets);
for l in p.layouts.as_deref().unwrap_or(&[]) {
+2
View File
@@ -91,6 +91,8 @@ pub fn run(p: &Project, name: &str, args: &[f64], text: &str) -> Result<String,
("areaTable", _) => json(&flaechen::area_table(&renovation_state(p, text))),
// [271] Umbaufilter (eingebaute und eigene) für die Oberfläche.
("renovationFilters", _) => json(&crate::renovation::filter_list(p)),
// [275] Aufgelöste Umbau-Farben (Vorgabe, Projekt, Etappen) für Muster in der Oberfläche.
("renovationStyles", _) => Ok(crate::renovation::styles_json(p).to_string()),
// [274] Typ-Paar Bestand → Sanierungstyp (Editor, Vorschau) bzw. alle Paare mit Zählern (Umbau-Panel).
("renovationPair", _) => json(&crate::renovation::build_up::pair_json(p, text)),
("renovationPairs", _) => json(&crate::renovation::build_up::pairs_json(p)),
+129 -35
View File
@@ -147,37 +147,105 @@ pub fn ghost_style() -> Style {
Style { fill: "#e3e3e3".into(), line: Some("#a8a8a8".into()), dashed: false, ghost: true }
}
/// SIA-400-Vorgabe: Bestand grau, Abbruch gelb und gestrichelt, Neu rot.
/// [275] Vorgabe Bestand: mittleres Grau (SIA 400).
pub const EXISTING_FILL: &str = "#a6a6a6";
/// [275] Vorgabe Abbruch: ruhiges Ocker-Gelb statt Signalgelb (#ffd800, Wunsch Maintainer 17.11.: „weniger leuchtend“) —
/// auf weissem Papier noch klar gelb, neben dem Grau des Bestands unterscheidbar, im dunklen Thema nicht grell.
pub const DEMOLISH_FILL: &str = "#e8c35a";
/// [275] Vorgabe Neu: gedämpftes Ziegelrot statt Signalrot (#e3001b), Linie eine Stufe dunkler.
pub const NEW_FILL: &str = "#c8524a";
pub const NEW_LINE: &str = "#9e3a33";
/// SIA-400-Vorgabe: Bestand grau, Abbruch gelb und gestrichelt, Neu rot ([275] gedämpfte Töne).
pub fn default_style(s: RenovationStatus) -> Style {
match s {
RenovationStatus::Demolish => Style { fill: "#ffd800".into(), line: None, dashed: true, ghost: false },
RenovationStatus::New => Style { fill: "#e3001b".into(), line: Some("#c00016".into()), dashed: false, ghost: false },
_ => Style { fill: "#a6a6a6".into(), line: None, dashed: false, ghost: false },
RenovationStatus::Demolish => Style { fill: DEMOLISH_FILL.into(), line: None, dashed: true, ghost: false },
RenovationStatus::New => Style { fill: NEW_FILL.into(), line: Some(NEW_LINE.into()), dashed: false, ghost: false },
_ => Style { fill: EXISTING_FILL.into(), line: None, dashed: false, ghost: false },
}
}
/// [275] Farbe eines Stifts (`ColorPen.id`) im aktiven Stiftsatz; `None` ohne aktiven Satz oder Eintrag (dann gilt die
/// freie Farbe bzw. die Vorgabe — anders als bei Bauteilen kein Ersatz-Grau, damit ein Umbau-Plan nie grau wird).
fn pen_color(p: &Project, pen: &str) -> Option<String> {
let pen = pen.trim();
if pen.is_empty() {
return None;
}
let active = p.active_pen_set_id.as_deref()?;
let set = p.pen_sets.as_deref()?.iter().find(|s| s.id == active)?;
let c = set.pens.get(pen)?.color.trim();
(!c.is_empty()).then(|| c.to_string())
}
fn pick(x: &RenovationStyles, s: RenovationStatus) -> Option<&RenovationStyle> {
match s {
RenovationStatus::Demolish => x.demolish.as_ref(),
RenovationStatus::New => x.new.as_ref(),
_ => x.existing.as_ref(),
}
}
/// Eigene Angaben `o` über `st` legen: Stift vor freier Farbe, fehlende Felder lassen `st` stehen.
fn apply_own(p: &Project, st: &mut Style, o: &RenovationStyle) {
let free = |v: &Option<String>| v.as_deref().map(str::trim).filter(|f| !f.is_empty()).map(str::to_string);
if let Some(f) = o.fill_pen.as_deref().and_then(|x| pen_color(p, x)).or_else(|| free(&o.fill)) {
st.fill = f;
}
if let Some(l) = o.line_pen.as_deref().and_then(|x| pen_color(p, x)) {
st.line = Some(l);
} else if let Some(l) = o.line.as_deref().map(str::trim) {
st.line = (!l.is_empty()).then(|| l.to_string());
}
if let Some(d) = o.dashed {
st.dashed = d;
}
}
/// Umbau-Farbe eines Status im Projekt.
pub fn style(p: &Project, s: RenovationStatus) -> Style {
let mut st = default_style(s);
let own = p.renovation.as_ref().and_then(|r| r.styles.as_ref()).and_then(|x| match s {
RenovationStatus::Demolish => x.demolish.as_ref(),
RenovationStatus::New => x.new.as_ref(),
_ => x.existing.as_ref(),
});
if let Some(o) = own {
if let Some(f) = o.fill.as_deref().map(str::trim).filter(|f| !f.is_empty()) {
st.fill = f.to_string();
}
if let Some(l) = o.line.as_deref().map(str::trim) {
st.line = (!l.is_empty()).then(|| l.to_string());
}
if let Some(d) = o.dashed {
st.dashed = d;
}
if let Some(o) = p.renovation.as_ref().and_then(|r| r.styles.as_ref()).and_then(|x| pick(x, s)) {
apply_own(p, &mut st, o);
}
st
}
/// [275] Umbau-Farbe eines Status für Elemente der Etappe `ph`: deren eigene Angaben über der Projektfarbe;
/// `None`, wenn die Etappe für diesen Status nichts Eigenes hat.
pub fn phase_style(p: &Project, s: RenovationStatus, ph: &RenovationPhase) -> Option<Style> {
let o = ph.styles.as_ref().and_then(|x| pick(x, s))?;
let mut st = style(p, s);
apply_own(p, &mut st, o);
Some(st)
}
const STATUSES: [RenovationStatus; 3] = [RenovationStatus::Existing, RenovationStatus::Demolish, RenovationStatus::New];
/// [275] Eigene Farben je Etappe (Index der Etappe → je Status), nur Etappen mit eigenen Angaben.
fn phase_styles(p: &Project) -> HashMap<usize, [Option<Style>; 3]> {
phases(p)
.iter()
.enumerate()
.filter(|(_, ph)| ph.styles.is_some())
.map(|(i, ph)| (i, STATUSES.map(|s| phase_style(p, s, ph))))
.filter(|(_, a)| a.iter().any(Option::is_some))
.collect()
}
/// [275] Aufgelöste Umbau-Farben für die Oberfläche (Abfrage `renovationStyles`): SIA-Vorgabe, Projekt und Etappen mit
/// eigenen Angaben (Id → je Status), damit Muster im Panel/in der Legende genau die Farben des Plans zeigen.
pub fn styles_json(p: &Project) -> serde_json::Value {
use serde_json::{json, Map, Value};
let one = |st: &Style| json!({"fill": st.fill, "line": st.line, "dashed": st.dashed});
let set = |f: &dyn Fn(RenovationStatus) -> Style| json!({"existing": one(&f(STATUSES[0])), "demolish": one(&f(STATUSES[1])), "new": one(&f(STATUSES[2]))});
let mut ph = Map::new();
for x in phases(p).iter().filter(|x| x.styles.is_some()) {
ph.insert(x.id.clone(), set(&|s| phase_style(p, s, x).unwrap_or_else(|| style(p, s))));
}
json!({"defaults": set(&default_style), "project": set(&|s| style(p, s)), "phases": Value::Object(ph)})
}
/// Wie ein Element im Filter erscheint.
#[derive(Clone, Debug, PartialEq)]
pub enum Treat {
@@ -199,6 +267,8 @@ pub struct View {
pub edit: Option<crate::design_options::Edit>,
phases: HashMap<String, usize>,
styles: [Style; 3],
/// [275] Eigene Farben je Etappe (Index → je Status).
phase_styles: HashMap<usize, [Option<Style>; 3]>,
}
impl View {
@@ -226,7 +296,7 @@ impl View {
let upto = if filter.is_some() { phase.filter(|s| !s.trim().is_empty()).and_then(|s| phase_index(p, s)) } else { None };
let phases = phases(p).iter().enumerate().map(|(i, x)| (x.id.clone(), i)).collect();
let styles = [style(p, RenovationStatus::Existing), style(p, RenovationStatus::Demolish), style(p, RenovationStatus::New)];
Some(View { filter, options, upto, phases, styles, edit: None })
Some(View { filter, options, upto, phases, styles, phase_styles: phase_styles(p), edit: None })
}
/// [272] Mit Bearbeitungsvariante (Stift, nur Bildschirm-Anfragen `designOptionEdit`): die Variante ist sichtbar (geht
@@ -236,7 +306,7 @@ impl View {
let Some(e) = edit else { return v };
let mut v = v.unwrap_or_else(|| {
let styles = [style(p, RenovationStatus::Existing), style(p, RenovationStatus::Demolish), style(p, RenovationStatus::New)];
View { filter: None, options: None, upto: None, phases: HashMap::new(), styles, edit: None }
View { filter: None, options: None, upto: None, phases: HashMap::new(), styles, phase_styles: HashMap::new(), edit: None }
});
let c = v.options.get_or_insert_with(|| crate::design_options::Combination::primary(p));
c.choice.insert(e.set.clone(), e.option.clone());
@@ -268,8 +338,13 @@ impl View {
}
}
/// Darstellung eines Zustands im Filter.
/// Darstellung eines Zustands im Filter (mit den Farben des Projekts).
pub fn treat_state(&self, s: Option<RenovationStatus>) -> Treat {
self.treat_in(s, None)
}
/// Darstellung eines Zustands, mit den Farben der Etappe `phase` (Index), sofern sie eigene hat.
fn treat_in(&self, s: Option<RenovationStatus>, phase: Option<usize>) -> Treat {
let Some(s) = s else { return Treat::Hide };
let Some(filter) = &self.filter else { return Treat::Show };
let (show, k) = match s {
@@ -279,14 +354,20 @@ impl View {
};
match show {
RenovationShow::Hide => Treat::Hide,
RenovationShow::Override => Treat::Style(self.styles[k].clone()),
RenovationShow::Override => {
let own = phase.and_then(|i| self.phase_styles.get(&i)).and_then(|a| a[k].as_ref());
Treat::Style(own.unwrap_or(&self.styles[k]).clone())
}
_ => Treat::Show,
}
}
/// Darstellung eines Elements mit diesen Umbau-Angaben.
/// Darstellung eines Elements mit diesen Umbau-Angaben. [275] Zeigt es noch seinen eigenen Status (nicht schon als
/// Bestand einer späteren Etappe), gelten die eigenen Farben seiner Etappe.
pub fn treat(&self, r: Option<&Renovation>) -> Treat {
self.treat_state(self.state(r))
let s = self.state(r);
let own = if s == Some(status_of(r)) { r.and_then(|r| r.phase.as_deref()).and_then(|id| self.phases.get(id).copied()) } else { None };
self.treat_in(s, own)
}
/// Ist ein Element mit diesen Angaben im Filter sichtbar?
@@ -353,7 +434,7 @@ impl View {
continue;
}
}
put(&w.id, self.treat_state(s), out);
put(&w.id, self.treat(w.renovation.as_ref()), out);
}
for o in p.openings.iter().flatten() {
let host = wall_state.get(o.host_wall_id.as_str()).copied().flatten();
@@ -361,8 +442,9 @@ impl View {
out.hidden.insert(o.id.clone());
continue;
}
let s = self.state(opening_renovation(p, o));
put(&o.id, self.treat_state(s), out);
let r = opening_renovation(p, o);
let s = self.state(r);
put(&o.id, self.treat(r), out);
// Ersatzstück nur, wenn die Öffnung einen anderen Zustand hat als ihre (Bestands-)Wand.
if o.renovation.is_none() || host != Some(RenovationStatus::Existing) {
continue;
@@ -372,7 +454,8 @@ impl View {
Some(RenovationStatus::Demolish) => RenovationStatus::New,
_ => continue,
};
if let Treat::Style(st) = self.treat_state(Some(virt)) {
// [275] Das Stück gehört zur Etappe der Öffnung (deren eigene Farben).
if let Treat::Style(st) = self.treat(Some(&Renovation { status: virt, phase: r.and_then(|r| r.phase.clone()), ..Default::default() })) {
out.patches.push(Patch { opening_id: o.id.clone(), wall_id: o.host_wall_id.clone(), status: virt, style: st, closed: out.hidden.contains(&o.id) });
}
}
@@ -410,10 +493,13 @@ impl View {
pub fn colors(&self) -> Vec<String> {
let mut out = Vec::new();
let Some(f) = &self.filter else { return out };
for (show, st) in [(f.existing, &self.styles[0]), (f.demolish, &self.styles[1]), (f.new, &self.styles[2])] {
for (k, show) in [f.existing, f.demolish, f.new].into_iter().enumerate() {
if show == RenovationShow::Override {
out.push(st.fill.clone());
out.extend(st.line.clone());
// [275] Dazu die eigenen Farben der Etappen.
for st in std::iter::once(&self.styles[k]).chain(self.phase_styles.values().filter_map(|a| a[k].as_ref())) {
out.push(st.fill.clone());
out.extend(st.line.clone());
}
}
}
out
@@ -424,7 +510,11 @@ impl View {
let opts = self.options.as_ref().map_or(String::new(), |c| c.key());
let edit = self.edit.as_ref().map_or(String::new(), |e| format!("|edit:{}", e.key()));
match &self.filter {
Some(f) => format!("{}:{:?}{:?}{:?}:{:?}:{:?}|{opts}{edit}", f.id, f.existing, f.demolish, f.new, self.upto, self.styles),
Some(f) => {
let mut ph: Vec<_> = self.phase_styles.iter().collect();
ph.sort_by_key(|(i, _)| **i);
format!("{}:{:?}{:?}{:?}:{:?}:{:?}{ph:?}|{opts}{edit}", f.id, f.existing, f.demolish, f.new, self.upto, self.styles)
}
None => format!("-|{opts}{edit}"),
}
}
@@ -1188,8 +1278,8 @@ pub mod build_up {
let (old, new, side, m) = pair(p, w)?;
let phase = w.renovation.as_ref().and_then(|r| r.phase.clone());
let virt = |status| Renovation { status, phase: phase.clone(), ..Default::default() };
let td = v.treat_state(v.state(Some(&virt(RenovationStatus::Demolish))));
let tn = v.treat_state(v.state(Some(&virt(RenovationStatus::New))));
let td = v.treat(Some(&virt(RenovationStatus::Demolish)));
let tn = v.treat(Some(&virt(RenovationStatus::New)));
let tk = v.treat(w.renovation.as_ref());
let shown = match (td != Treat::Hide, tn != Treat::Hide) {
(true, false) => Shown::Old,
@@ -1412,3 +1502,7 @@ mod tests2;
#[cfg(test)]
#[path = "renovation_layers_tests.rs"]
mod layers_tests;
#[cfg(test)]
#[path = "renovation_style_tests.rs"]
mod style_tests;
@@ -0,0 +1,142 @@
//! [275] Umbau-Farben: gedämpfte Vorgabe, Stift statt Farbe (aktiver Stiftsatz), eigene Farben je Etappe.
use super::tests::{fills_of, plan_with, project, umbau_fixture};
use super::*;
use serde_json::{json, Value};
/// Fixture mit zwei Stiftsätzen (Farbe und S/W) und Stiften 7 (Füllung) und 8 (Linie).
fn with_pens(mut v: Value, active: &str) -> Value {
v["pens"] = json!([{"id": "7", "name": "Umbau Neu"}, {"id": "8", "name": "Umbau Linie"}]);
v["penSets"] = json!([
{"id": "farbe", "name": "Farbe", "pens": {"7": {"color": "#3366cc", "weight": 0.25}, "8": {"color": "#112244", "weight": 0.35}}},
{"id": "sw", "name": "Plot S/W", "pens": {"7": {"color": "#bbbbbb", "weight": 0.25}, "8": {"color": "#000000", "weight": 0.35}}}
]);
v["activePenSetId"] = json!(active);
v
}
#[test]
fn gedaempfte_vorgabe() {
// Abbruch ruhiges Ocker, Neu gedämpftes Ziegelrot mit dunklerer Linie, Bestand unverändert grau.
let d = default_style(RenovationStatus::Demolish);
let n = default_style(RenovationStatus::New);
assert_eq!((d.fill.as_str(), d.line.as_deref(), d.dashed), (DEMOLISH_FILL, None, true));
assert_eq!((n.fill.as_str(), n.line.as_deref(), n.dashed), (NEW_FILL, Some(NEW_LINE), false));
assert_eq!(default_style(RenovationStatus::Existing).fill, "#a6a6a6");
// Nicht mehr die leuchtenden Werte.
for c in [&d.fill, &n.fill, n.line.as_ref().unwrap()] {
assert!(!["#ffd800", "#e3001b", "#c00016"].contains(&c.as_str()), "{c}");
}
}
#[test]
fn stift_statt_farbe_folgt_dem_aktiven_stiftsatz() {
let mut v = with_pens(umbau_fixture(), "farbe");
v["renovation"]["styles"] = json!({"new": {"fill": "#ff00ff", "fillPen": "7", "linePen": "8"}});
let p = project(&v);
let s = style(&p, RenovationStatus::New);
// Stift geht der freien Farbe vor.
assert_eq!((s.fill.as_str(), s.line.as_deref()), ("#3366cc", Some("#112244")));
// Anderer Stiftsatz aktiv: die Umbau-Farbe wechselt mit.
let p = project(&with_pens(v.clone(), "sw"));
let s = style(&p, RenovationStatus::New);
assert_eq!((s.fill.as_str(), s.line.as_deref()), ("#bbbbbb", Some("#000000")));
// Im Plan: W9 (Neu) in der Stift-Farbe.
let u = plan_with(&p, json!({"renovation": "umbauplan"}));
assert!(fills_of(&u, "W9").iter().any(|f| f == "#bbbbbb"), "{:?}", fills_of(&u, "W9"));
// Stift ohne Eintrag im aktiven Satz bzw. ohne aktiven Satz: freie Farbe, sonst Vorgabe.
let mut w = v.clone();
w["activePenSetId"] = json!("fehlt");
let p = project(&w);
assert_eq!(style(&p, RenovationStatus::New).fill, "#ff00ff");
assert_eq!(style(&p, RenovationStatus::New).line.as_deref(), Some(NEW_LINE));
w["renovation"]["styles"]["new"] = json!({"fillPen": "99"});
w["activePenSetId"] = json!("farbe");
assert_eq!(style(&project(&w), RenovationStatus::New).fill, NEW_FILL);
}
#[test]
fn eigene_farbe_je_etappe() {
let mut v = umbau_fixture();
// W9 ist Neu in Etappe 2; Etappe 2 bekommt Blau (nur Füllung), Etappe 1 nichts Eigenes.
v["renovation"]["phases"][1]["styles"] = json!({"new": {"fill": "#2f6db5"}, "demolish": {"dashed": false}});
// Eine zweite neue Wand ohne Etappe behält die Projektfarbe.
for w in v["walls"].as_array_mut().unwrap() {
if w["id"] == "W3" {
w["renovation"] = json!({"status": "new"});
}
}
let p = project(&v);
let view = View::new(&p, Some("umbauplan"), None).unwrap();
let r = view.resolve(&p);
assert_eq!(r.styled["W9"].fill, "#2f6db5");
// Fehlende Felder der Etappe: Linie aus dem Projekt bzw. der Vorgabe.
assert_eq!(r.styled["W9"].line.as_deref(), Some(NEW_LINE));
assert_eq!(r.styled["W3"].fill, NEW_FILL);
// Abbruch ohne Etappe bleibt gestrichelt.
assert!(r.styled["W2"].dashed);
// Farben, die in Schwarz-Weiss erhalten bleiben, enthalten die der Etappe.
assert!(view.colors().contains(&"#2f6db5".to_string()));
// Cache-Schlüssel ändert sich mit der Etappen-Farbe.
let mut v2 = v.clone();
v2["renovation"]["phases"][1]["styles"]["new"]["fill"] = json!("#000080");
assert_ne!(view.key(), View::new(&project(&v2), Some("umbauplan"), None).unwrap().key());
// Im Grundriss.
let u = plan_with(&p, json!({"renovation": "umbauplan"}));
assert!(fills_of(&u, "W9").iter().any(|f| f == "#2f6db5"), "{:?}", fills_of(&u, "W9"));
// Filter bis Etappe 2 zeigt W9 als Neu der Etappe (eigene Farbe); im Stand einer späteren Etappe ist es Bestand.
let r = View::new(&p, Some("umbauplan"), Some("e2")).unwrap().resolve(&p);
assert_eq!(r.styled["W9"].fill, "#2f6db5");
let mut v3 = v.clone();
v3["renovation"]["phases"].as_array_mut().unwrap().push(json!({"id": "e3", "name": "Etappe 3"}));
let p3 = project(&v3);
let r = View::new(&p3, Some("umbauplan"), Some("e3")).unwrap().resolve(&p3);
assert_eq!(r.styled["W9"], style(&p3, RenovationStatus::Existing));
}
#[test]
fn etappe_mit_stift_und_ersatzstueck() {
let mut v = with_pens(umbau_fixture(), "farbe");
// O1 (neue Öffnung in Bestandswand W1) in Etappe 2: ihr Abbruch-Stück nimmt die Abbruch-Farbe der Etappe.
for o in v["openings"].as_array_mut().unwrap() {
if o["id"] == "O1" {
o["renovation"] = json!({"status": "new", "phase": "e2"});
}
}
v["renovation"]["phases"][1]["styles"] = json!({"demolish": {"fillPen": "7"}});
let p = project(&v);
let r = View::new(&p, Some("umbauplan"), None).unwrap().resolve(&p);
let o1 = r.patches.iter().find(|x| x.opening_id == "O1").unwrap();
assert_eq!(o1.style.fill, "#3366cc");
// O2 (ohne Etappe) behält die Projekt-Vorgabe.
let o2 = r.patches.iter().find(|x| x.opening_id == "O2").unwrap();
assert_eq!(o2.style.fill, NEW_FILL);
}
#[test]
fn unsinn_robust() {
let mut v = umbau_fixture();
v["renovation"]["styles"] = json!({"new": {"fill": " ", "fillPen": "", "linePen": " "}, "demolish": {"fillPen": null}});
v["renovation"]["phases"][0]["styles"] = json!({"new": {"fillPen": "x", "fill": ""}});
v["penSets"] = json!([{"id": "a", "name": "A", "pens": {"x": {"color": "", "weight": 0.1}}}]);
v["activePenSetId"] = json!("a");
let p = project(&v);
assert_eq!(style(&p, RenovationStatus::New).fill, NEW_FILL);
assert_eq!(style(&p, RenovationStatus::Demolish).fill, DEMOLISH_FILL);
let view = View::new(&p, Some("umbauplan"), None).unwrap();
let _ = view.resolve(&p);
let _ = plan_with(&p, json!({"renovation": "umbauplan"}));
}
#[test]
fn abfrage_renovation_styles() {
let mut v = with_pens(umbau_fixture(), "farbe");
v["renovation"]["phases"][1]["styles"] = json!({"new": {"fillPen": "7"}});
let p = project(&v);
let out: Value = serde_json::from_str(&crate::queries::run(&p, "renovationStyles", &[], "").unwrap()).unwrap();
assert_eq!(out["defaults"]["demolish"]["fill"], DEMOLISH_FILL);
assert_eq!(out["project"]["new"]["fill"], NEW_FILL);
assert_eq!(out["project"]["demolish"]["dashed"], true);
assert_eq!(out["phases"]["e2"]["new"]["fill"], "#3366cc");
assert!(out["phases"].get("e1").is_none());
}
+4 -4
View File
@@ -57,7 +57,7 @@ fn vorgaben_je_status() {
assert_eq!(View::new(&p, Some("umbauplan"), None).unwrap().treat(None), ex(RenovationStatus::Existing));
// SIA: Abbruch gelb gestrichelt, Neu rot.
assert!(default_style(RenovationStatus::Demolish).dashed);
assert!(default_style(RenovationStatus::New).fill.starts_with("#e3"));
assert_eq!(default_style(RenovationStatus::New).fill, NEW_FILL);
}
#[test]
@@ -198,7 +198,7 @@ fn restyle_flaechen_und_linien() {
assert_eq!(q.len(), 5);
match &q[0] {
Primitive::Polygon { fill, stroke, opening_id, .. } => {
assert_eq!(fill, "#ffd800");
assert_eq!(fill, DEMOLISH_FILL);
assert_eq!(stroke, "none");
assert_eq!(opening_id.as_deref(), Some("O1"));
}
@@ -219,7 +219,7 @@ fn restyle_flaechen_und_linien() {
use crate::plan::domains::{plan_domains, PlanArgs};
fn plan_with(p: &Project, extra: Value) -> Vec<Primitive> {
pub(crate) fn plan_with(p: &Project, extra: Value) -> Vec<Primitive> {
let codes: Vec<String> = (0..100).map(|k| format!("{k:02}")).collect();
let mut t = json!({"floor": "eg", "show": codes, "scale": 100});
for (k, x) in extra.as_object().unwrap() {
@@ -240,7 +240,7 @@ fn has_opening(prims: &[Primitive], id: &str) -> bool {
})
}
fn fills_of(prims: &[Primitive], id: &str) -> Vec<String> {
pub(crate) fn fills_of(prims: &[Primitive], id: &str) -> Vec<String> {
prims
.iter()
.filter_map(|q| match q {
+1 -1
View File
@@ -254,7 +254,7 @@ echo "Finished Rendering."
expect((await quiet(() => base(["--renovation", "umbauplan"]))).result).toBe(0);
expect(sceneXml()).not.toContain("Umbau-");
expect((await quiet(() => base(["--renovation", "umbauplan", "--renovation-colors"]))).result).toBe(0);
expect(sceneXml()).toContain("Umbau-ffd800");
expect(sceneXml()).toContain("Umbau-e8c35a");
const vb = (extra: string[]) => run([":varianten", "render", "--engine", "cycles", "--cycles", fakeCycles, "--out", join(dir, "var.png"), "--samples", "8", "--size", "8x4", "--no-context", ...extra]);
expect((await quiet(() => vb([]))).result).toBe(0);
const studie1 = sceneXml();
+1
View File
@@ -184,6 +184,7 @@ export type QueryName =
| "kennzahlen"
| "areaTable"
| "renovationFilters"
| "renovationStyles"
| "renovationPair"
| "renovationPairs"
| "designOptionInfo"
+3 -1
View File
@@ -125,11 +125,13 @@ export type { CostResult, CostRow, CostQuantities, CostEstimate, CostGroup, Cost
export { buildCostReport, costGroupLabel, costUnitLabel } from "../export/costReport";
// [271] Umbau: Status je Bauteil, Etappen, Umbaufilter (Regeln im Kern `renovation.rs`)
export {
BUILTIN_RENOVATION_FILTERS, RENOVATION_STATUSES, RENOVATION_COLLECTIONS, DEFAULT_RENOVATION_STYLES, renovationFilterList, renovationStatus, renovationPhases,
BUILTIN_RENOVATION_FILTERS, RENOVATION_STATUSES, RENOVATION_COLLECTIONS, renovationFilterList, renovationStatus, renovationPhases,
renovationForNew, setRenovationOps, renovatableIds, commonRenovation, setPhasesOps, newPhaseId,
renovationFilterShows, renovationStyleOf, idsByRenovationStatus, renovationCounts, phaseUsage,
resolvedRenovationStyles, patchRenovationStyles, setRenovationStylesOps, setPhaseStylesOps,
} from "../model/renovation";
export type { RenovationFilterEntry, RenovationCollection } from "../model/renovation";
export type { RenovationStyleView, RenovationStyleSet, ResolvedRenovationStyles } from "../model/renovation";
// [274] Sanierung je Schicht: Typ-Paar Bestand → Sanierungstyp
export {
wallBuildUp, buildUpKey, parseBuildUpKey, setBuildUpOps, commonBuildUp, renovateAllOfTypeOps, createRenovationTypeOps, setTypePairOps,
+1 -1
View File
@@ -91,7 +91,7 @@ describe("Exporte folgen der Ansicht", () => {
const plan = { ...base, renovation: "umbauplan" };
expect(cyclesSceneInfo(u, plan).xml).not.toContain("Umbau-");
const farbig = cyclesSceneInfo(u, { ...plan, renovationColors: true });
expect(farbig.xml).toContain("Umbau-ffd800");
expect(farbig.xml).toContain("Umbau-e8c35a");
expect(farbig.triangles).toBe(cyclesSceneInfo(u, plan).triangles);
const v = buildVariantenSampleProject();
+7
View File
@@ -4758,6 +4758,13 @@ export const de = {
"renovation.panel.phases.deleteMessageUnused": "Etappe „{name}“ löschen?",
"renovation.panel.phases.delete": "Löschen",
"renovation.panel.colors": "Umbau-Farben in den Ressourcen …",
"renovation.panel.styles.title": "Darstellung",
"renovation.panel.styles.hint": "Je Status Füllung und Linie als Farbe oder Stift: ein Stift nimmt die Farbe aus dem aktiven Stiftsatz (z. B. Plot S/W).",
"renovation.panel.styles.sia": "SIA-Vorgabe",
"renovation.panel.styles.siaHint": "Umbau-Farben auf die Vorgabe nach SIA 400 zurücksetzen (Bestand grau, Abbruch gelb gestrichelt, Neu rot)",
"renovation.panel.phases.styles": "Eigene Farben der Etappe",
"renovation.panel.phases.stylesHint": "Abbruch und Neu der Etappe „{name}“ in eigener Farbe; leer = Farben des Projekts.",
"renovation.panel.phases.stylesReset": "Farben des Projekts verwenden",
"renovation.buildUp": "Neuer Aufbau (Sanierung)",
"renovation.buildUp.none": "keiner",
"renovation.buildUp.type": "wie Typ: {name}",
+7
View File
@@ -4744,6 +4744,13 @@ export const en: Record<TranslationKey, string> = {
"renovation.panel.phases.deleteMessageUnused": "Delete phase “{name}”?",
"renovation.panel.phases.delete": "Delete",
"renovation.panel.colors": "Renovation colors in the resources …",
"renovation.panel.styles.title": "Appearance",
"renovation.panel.styles.hint": "Fill and line per status as a color or a pen: a pen takes its color from the active pen set (e.g. plot B/W).",
"renovation.panel.styles.sia": "SIA default",
"renovation.panel.styles.siaHint": "Reset renovation colors to the SIA 400 default (existing grey, demolition yellow dashed, new red)",
"renovation.panel.phases.styles": "Own colors of the phase",
"renovation.panel.phases.stylesHint": "Demolition and new elements of phase “{name}” in their own color; empty = project colors.",
"renovation.panel.phases.stylesReset": "Use project colors",
"renovation.buildUp": "New build-up (refurbishment)",
"renovation.buildUp.none": "none",
"renovation.buildUp.type": "as type: {name}",
+5 -5
View File
@@ -54,13 +54,13 @@ describe("[271] Umbau", () => {
const p = buildUmbauSampleProject();
expect(renovationFilterList(p).map((f) => f.id)).toEqual(["bestand", "abbruch", "neubau", "umbauplan", "endzustand"]);
// Ohne Filter keine Umbau-Farben; Umbauplan grau, gelb und rot.
expect(fills(p)).not.toContain("#e3001b");
expect(fills(p)).not.toContain("#c8524a");
const u = fills(p, "umbauplan");
for (const c of ["#a6a6a6", "#ffd800", "#e3001b"]) expect(u).toContain(c);
for (const c of ["#a6a6a6", "#e8c35a", "#c8524a"]) expect(u).toContain(c);
// Neubau: kein Gelb (Abbruch weg), Rot da.
const n = fills(p, "neubau");
expect(n).not.toContain("#ffd800");
expect(n).toContain("#e3001b");
expect(n).not.toContain("#e8c35a");
expect(n).toContain("#c8524a");
// Kennzahlen: der Anbau zählt nur im Endzustand.
const b = computeKennzahlen(p, "bestand");
const e = computeKennzahlen(p, "endzustand");
@@ -81,7 +81,7 @@ describe("[271] Umbau", () => {
// ── Panel „Umbau“ ──
it("Panel: Vorschau je Filter stimmt mit dem Grundriss des Kerns überein (Override = Farbe da, Hide/Show = keine)", () => {
const p = buildUmbauSampleProject();
const colour = { existing: "#a6a6a6", demolish: "#ffd800", new: "#e3001b" } as const;
const colour = { existing: "#a6a6a6", demolish: "#e8c35a", new: "#c8524a" } as const;
for (const f of renovationFilterList(p)) {
const shows = renovationFilterShows(p, f.id)!;
const got = fills(p, f.id);
+74 -12
View File
@@ -4,7 +4,7 @@
import type { CoreOp } from "../core/ops";
import { documentFor } from "../core/document";
import { addItems, patchItem, patchItems, setField } from "../core/opsBuild";
import type { LayerRenovation, Project, Renovation, RenovationPhase, RenovationShow, RenovationSide, RenovationStatus, Tree, TreeStatus, WallType } from "./types";
import type { LayerRenovation, Project, Renovation, RenovationPhase, RenovationShow, RenovationSide, RenovationStatus, RenovationStyle, RenovationStyles, Tree, TreeStatus, WallType } from "./types";
/** Eingebaute Umbaufilter (Ids; Namen über `t("renovation.filter.<id>")`). */
export const BUILTIN_RENOVATION_FILTERS = ["bestand", "abbruch", "neubau", "umbauplan", "endzustand"] as const;
@@ -26,12 +26,75 @@ export type RenovationCollection = (typeof RENOVATION_COLLECTIONS)[number];
const TREE_STATUS_OF: Record<RenovationStatus, TreeStatus> = { existing: "existing", demolish: "remove", new: "new" };
export const treeRenovationStatus = (t: Tree): RenovationStatus => (t.status === "remove" ? "demolish" : t.status === "new" ? "new" : "existing");
/** SIA-400-Vorgabe der Umbau-Farben (gleich wie `renovation::default_style` im Kern). */
export const DEFAULT_RENOVATION_STYLES: Record<RenovationStatus, { fill: string; line?: string; dashed: boolean }> = {
existing: { fill: "#a6a6a6", dashed: false },
demolish: { fill: "#ffd800", dashed: true },
new: { fill: "#e3001b", line: "#c00016", dashed: false },
};
/** Aufgelöste Umbau-Farbe eines Status (Stift schon in Farbe übersetzt). */
export interface RenovationStyleView {
fill: string;
line?: string;
dashed: boolean;
}
export type RenovationStyleSet = Record<RenovationStatus, RenovationStyleView>;
/** [275] Umbau-Farben, wie der Kern sie auflöst: SIA-Vorgabe, Projekt, Etappen mit eigenen Farben (Id → je Status). */
export interface ResolvedRenovationStyles {
defaults: RenovationStyleSet;
project: RenovationStyleSet;
phases: Record<string, RenovationStyleSet>;
}
type RawStyle = { fill: string; line: string | null; dashed: boolean };
const cleanSet = (x: Record<RenovationStatus, RawStyle>): RenovationStyleSet =>
Object.fromEntries(RENOVATION_STATUSES.map((s) => [s, { fill: x[s].fill, ...(x[s].line ? { line: x[s].line } : {}), dashed: x[s].dashed }])) as RenovationStyleSet;
/**
* [275] Umbau-Farben des Projekts (Kern-Abfrage `renovationStyles`, `renovation::style`/`phase_style`): eine Wahrheit
* für Plan und Muster der Oberfläche — Stifte (aktiver Stiftsatz) und Etappen-Farben sind schon aufgelöst.
*/
export function resolvedRenovationStyles(project: Project): ResolvedRenovationStyles {
const raw = documentFor(project).query<{ defaults: Record<RenovationStatus, RawStyle>; project: Record<RenovationStatus, RawStyle>; phases: Record<string, Record<RenovationStatus, RawStyle>> }>("renovationStyles");
return {
defaults: cleanSet(raw.defaults),
project: cleanSet(raw.project),
phases: Object.fromEntries(Object.entries(raw.phases ?? {}).map(([k, v]) => [k, cleanSet(v)])),
};
}
/**
* [275] Eine Umbau-Farbe ändern (`patch`; `null` = zurück auf die Vorgabe): fehlende Felder gelten als „wie Vorgabe“,
* Farbe und Stift schliessen sich aus (wer eine freie Farbe setzt, löst den Stift und umgekehrt). `undefined` = leer.
*/
export function patchRenovationStyles(styles: RenovationStyles | undefined, status: RenovationStatus, patch: Partial<RenovationStyle> | null): RenovationStyles | undefined {
const next: RenovationStyles = { ...(styles ?? {}) };
if (patch === null) delete next[status];
else {
const merged: RenovationStyle = { ...(next[status] ?? {}), ...patch };
if ("fill" in patch && patch.fill !== undefined) delete merged.fillPen;
if ("fillPen" in patch && patch.fillPen !== undefined) delete merged.fill;
if ("line" in patch && patch.line !== undefined) delete merged.linePen;
if ("linePen" in patch && patch.linePen !== undefined) delete merged.line;
for (const k of Object.keys(merged) as (keyof RenovationStyle)[]) if (merged[k] === undefined) delete merged[k];
if (Object.keys(merged).length) next[status] = merged;
else delete next[status];
}
return Object.keys(next).length ? next : undefined;
}
/** [275] Ops: Umbau-Farben des Projekts ersetzen (`undefined` = SIA-Vorgabe). */
export function setRenovationStylesOps(project: Project, styles: RenovationStyles | undefined): CoreOp[] {
const next = { ...(project.renovation ?? {}) };
if (styles) next.styles = styles;
else delete next.styles;
return [setField("renovation", Object.keys(next).length ? next : undefined)];
}
/** [275] Ops: eigene Umbau-Farben einer Etappe ersetzen (`undefined` = Farben des Projekts). */
export function setPhaseStylesOps(project: Project, phaseId: string, styles: RenovationStyles | undefined): CoreOp[] {
const phases = renovationPhases(project).map((ph) => {
if (ph.id !== phaseId) return ph;
const { styles: _drop, ...rest } = ph;
void _drop;
return styles ? { ...rest, styles } : rest;
});
return setPhasesOps(project, phases);
}
export interface RenovationFilterEntry {
id: string;
@@ -187,11 +250,10 @@ export function renovationFilterShows(project: Project, id: string): Record<Reno
return BUILTIN_FILTER_SHOWS[id] ?? null;
}
/** Umbau-Farbe eines Status (Projekt-Vorgabe über SIA-400-Vorgabe). */
export function renovationStyleOf(project: Project, status: RenovationStatus): { fill: string; line?: string; dashed: boolean } {
const d = DEFAULT_RENOVATION_STYLES[status];
const o = project.renovation?.styles?.[status];
return { fill: o?.fill ?? d.fill, line: o?.line ?? d.line, dashed: o?.dashed ?? d.dashed };
/** Umbau-Farbe eines Status (Etappe `phaseId` mit eigenen Farben, sonst Projekt, sonst SIA-Vorgabe; Kern löst auf). */
export function renovationStyleOf(project: Project, status: RenovationStatus, phaseId?: string | null): RenovationStyleView {
const r = resolvedRenovationStyles(project);
return (phaseId ? r.phases[phaseId]?.[status] : undefined) ?? r.project[status];
}
/** Möbel und Symbole (Objekte der Bibliothek, Blöcke): nehmen ohne Angabe als Bestand am Umbaufilter teil. */
+1 -1
View File
@@ -89,7 +89,7 @@ describe("[274] Sanierung je Schicht", () => {
expect(pr?.result.map((q) => q.kind)).toEqual(["new", "new", "newOverDemolish", "newOverDemolish", "kept"]);
expect(renovationPairs(p).renovated).toBe(1);
// Grundriss: Abbruch gelb, Umbauplan mit gelber gestrichelter Kontur über Rot.
const dashedYellow = (prims: ReturnType<typeof plan>) => prims.some((x) => x.kind === "line" && !!x.dash && x.color === "#ffd800");
const dashedYellow = (prims: ReturnType<typeof plan>) => prims.some((x) => x.kind === "line" && !!x.dash && x.color === "#e8c35a");
expect(dashedYellow(plan(p, "umbauplan"))).toBe(true);
expect(dashedYellow(plan(p, "endzustand"))).toBe(false);
// GF im Endzustand: die Südwand ist 10 cm dicker als ohne Sanierung (die Aussenkante rückt nach aussen).
+80
View File
@@ -0,0 +1,80 @@
// [275] Umbau-Farben: gedämpfte Vorgabe, Farbe ODER Stift (aktiver Stiftsatz), eigene Farben je Etappe — Auflösung im Kern
// (`renovationStyles`), Ops der Oberfläche, und dass der Grundriss genau die Farben der Muster zeigt.
import { describe, expect, it } from "vitest";
import { applyOps } from "../core/ops";
import { generatePlan } from "../plan/generatePlan";
import { buildUmbauSampleProject } from "./sampleProjectUmbau";
import { patchRenovationStyles, renovationStyleOf, resolvedRenovationStyles, setPhaseStylesOps, setRenovationStylesOps } from "./renovation";
import type { Project } from "./types";
const ALL = new Set(["20", "21", "30", "31", "40", "60"]);
function fills(p: Project, filter: string): string[] {
const q = { ...p, drawingLevels: p.drawingLevels.map((l) => (l.id === "eg" ? { ...l, renovationFilter: filter } : l)) };
return generatePlan(q, "eg", ALL).primitives.flatMap((x) => (x.kind === "polygon" ? [x.fill] : []));
}
describe("[275] Umbau-Farben", () => {
it("Vorgabe gedämpft: Ocker-Gelb, Ziegelrot, Grau", () => {
const r = resolvedRenovationStyles(buildUmbauSampleProject());
expect(r.defaults.demolish).toEqual({ fill: "#e8c35a", dashed: true });
expect(r.defaults.new).toEqual({ fill: "#c8524a", line: "#9e3a33", dashed: false });
expect(r.defaults.existing.fill).toBe("#a6a6a6");
});
it("Farbe und Stift schliessen sich aus; leer = Vorgabe", () => {
let s = patchRenovationStyles(undefined, "new", { fill: "#123456" });
expect(s).toEqual({ new: { fill: "#123456" } });
s = patchRenovationStyles(s, "new", { fillPen: "3" });
expect(s).toEqual({ new: { fillPen: "3" } });
s = patchRenovationStyles(s, "new", { line: "#000000" });
s = patchRenovationStyles(s, "new", { linePen: "4" });
expect(s).toEqual({ new: { fillPen: "3", linePen: "4" } });
s = patchRenovationStyles(s, "demolish", { dashed: false });
expect(patchRenovationStyles(patchRenovationStyles(s, "new", null), "demolish", null)).toBeUndefined();
});
it("Stift: Farbe aus dem aktiven Stiftsatz, ein S/W-Satz färbt den Umbauplan um", () => {
const base = buildUmbauSampleProject();
const withPens: Project = {
...base,
pens: [...(base.pens ?? []), { id: "u1", name: "Umbau Neu" }],
penSets: [
{ id: "farbe", name: "Farbe", pens: { u1: { color: "#3366cc", weight: 0.25 } } },
{ id: "sw", name: "S/W", pens: { u1: { color: "#999999", weight: 0.25 } } },
],
activePenSetId: "farbe",
};
const p = applyOps(withPens, setRenovationStylesOps(withPens, { new: { fillPen: "u1" } }));
expect(renovationStyleOf(p, "new").fill).toBe("#3366cc");
expect(fills(p, "umbauplan")).toContain("#3366cc");
const sw = { ...p, activePenSetId: "sw" };
expect(renovationStyleOf(sw, "new").fill).toBe("#999999");
expect(fills(sw, "umbauplan")).toContain("#999999");
expect(fills(sw, "umbauplan")).not.toContain("#3366cc");
// SIA-Vorgabe zurück.
const back = applyOps(p, setRenovationStylesOps(p, undefined));
expect(back.renovation?.styles).toBeUndefined();
expect(renovationStyleOf(back, "new").fill).toBe("#c8524a");
});
it("Etappe mit eigener Farbe: Neu der Etappe 2 im Beispiel in eigener Farbe, Projektfarbe bleibt", () => {
const p0 = buildUmbauSampleProject();
const e2 = p0.renovation!.phases![1];
// Das Beispiel zeigt Etappe 2 schon in eigener Farbe.
expect(e2.styles?.new).toBeTruthy();
const own = renovationStyleOf(p0, "new", e2.id).fill;
expect(own).not.toBe(renovationStyleOf(p0, "new").fill);
expect(fills(p0, "umbauplan")).toContain(own);
// Zurück auf die Projektfarben: nur die Etappe ändert sich (Name, Reihenfolge, Elemente bleiben).
const p1 = applyOps(p0, setPhaseStylesOps(p0, e2.id, undefined));
expect(p1.renovation!.phases![1]).toEqual({ id: e2.id, name: e2.name });
expect(resolvedRenovationStyles(p1).phases[e2.id]).toBeUndefined();
expect(fills(p1, "umbauplan")).not.toContain(own);
expect(p1.walls.map((w) => w.renovation)).toEqual(p0.walls.map((w) => w.renovation));
// Neue eigene Farbe für Abbruch der Etappe.
const p2 = applyOps(p1, setPhaseStylesOps(p1, e2.id, { demolish: { fill: "#7a5c99" } }));
expect(resolvedRenovationStyles(p2).phases[e2.id].demolish.fill).toBe("#7a5c99");
expect(resolvedRenovationStyles(p2).phases[e2.id].new.fill).toBe("#c8524a");
});
});
+3 -1
View File
@@ -126,7 +126,9 @@ export function buildUmbauSampleProject(): Project {
renovation: {
phases: [
{ id: "etappe-1", name: "Etappe 1" },
{ id: "etappe-2", name: "Etappe 2" },
// [275] Etappe 2 (Anbau) mit eigener Farbe: Neues gedämpft blau statt rot, damit die zwei Etappen im Umbauplan
// auseinanderzuhalten sind.
{ id: "etappe-2", name: "Etappe 2", styles: { new: { fill: "#5b84b1", line: "#3e6390" } } },
],
},
};
+20 -2
View File
@@ -3439,7 +3439,15 @@ export type RenovationFilter = {
};
/** [271] Eine Bau-Etappe (Reihenfolge = Reihenfolge der Liste). */
export type RenovationPhase = { id: string; name: string };
export type RenovationPhase = {
id: string;
name: string;
/**
* [275] Eigene Umbau-Farben der Etappe (Neu/Abbruch dieser Etappe, z. B. Neubau Etappe 2 blau); fehlende Felder
* ⇒ die Farben des Projekts (`RenovationSettings.styles`), dann die SIA-Vorgabe.
*/
styles?: RenovationStyles;
};
/** [271] Umbau-Einstellungen des Projekts. */
export type RenovationSettings = {
@@ -3466,8 +3474,18 @@ export type RenovationStatus = "existing" | "demolish" | "new";
/**
* [271] Umbau-Farbe eines Status: Füllung der Schnittflächen, Linienfarbe, gestrichelt. Fehlende Felder ⇒ SIA-Vorgabe.
* [275] Statt einer freien Farbe ein Stift (`ColorPen.id`): seine Farbe aus dem aktiven Stiftsatz geht der freien
* Farbe vor (ein S/W-Plot-Stiftsatz färbt so auch die Umbau-Farben um; Stift ohne Eintrag ⇒ freie Farbe/Vorgabe).
*/
export type RenovationStyle = { fill?: string; line?: string; dashed?: boolean };
export type RenovationStyle = {
fill?: string;
/** [275] Stift der Füllung. */
fillPen?: string;
line?: string;
/** [275] Stift der Linien. */
linePen?: string;
dashed?: boolean;
};
/** [271] Umbau-Farben je Status (fehlt ⇒ SIA-400-Vorgabe, `renovation::default_style`). */
export type RenovationStyles = { existing?: RenovationStyle; demolish?: RenovationStyle; new?: RenovationStyle };
+89 -18
View File
@@ -1,7 +1,8 @@
// Dock-Panel „Umbau“ ([271], Wunsch Maintainer 17.11., wie Archicads Palette Umbau): Zeichen-Status neuer Bauteile,
// Umbaufilter der aktiven Ansicht (mit Vorschau je Status), Status der Auswahl samt „nach Status wählen“ und die
// Etappen. Zustand und Aktionen teilt es mit dem Popover der Statusleiste (`state/renovationHook.ts`); Änderungen
// gehen als Ops über `applyChange` (ein Undo-Schritt je Aktion).
// gehen als Ops über `applyChange` (ein Undo-Schritt je Aktion). [275] Abschnitt „Darstellung“: Umbau-Farben je Status
// als Farbe oder Stift, „SIA-Vorgabe“; je Etappe eigene Farben (Muster in der Etappenliste).
//
// Bezeichner englisch, UI-Text/Kommentare deutsch (CONVENTIONS.md).
@@ -16,20 +17,23 @@ import {
phaseUsage,
renovationCounts,
renovationFilterShows,
renovationStyleOf,
resolvedRenovationStyles,
RENOVATION_STATUSES,
setPhasesOps,
setPhaseStylesOps,
setRenovationStylesOps,
} from "../core";
import type { Project, RenovationShow, RenovationStatus } from "../model/types";
import type { RenovationStyleView } from "../core";
import type { RenovationPhase, RenovationShow, RenovationStatus } from "../model/types";
import { ConfirmDialog } from "../ui/ConfirmDialog";
import { RenovationStyleEditor } from "../ui/RenovationStyleEditor";
import { usePanelHostAction } from "./host";
import { RenovationSanierung } from "./RenovationSanierung";
const MIXED = "__mixed";
/** Farbfeld eines Status (SIA-Farbmuster: Füllung, Linie, gestrichelt wie im Plan). */
function Swatch({ project, status, show }: { project: Project; status: RenovationStatus; show?: RenovationShow }) {
const st = renovationStyleOf(project, status);
/** Farbfeld eines Status (Umbau-Farbe: Füllung, Linie, gestrichelt wie im Plan). */
function Swatch({ st, show }: { st: RenovationStyleView; show?: RenovationShow }) {
const hidden = show === "hide";
const plain = show === "show";
return (
@@ -45,10 +49,10 @@ function Swatch({ project, status, show }: { project: Project; status: Renovatio
);
}
function ShowChip({ project, status, show }: { project: Project; status: RenovationStatus; show: RenovationShow }) {
function ShowChip({ st, status, show }: { st: RenovationStyleView; status: RenovationStatus; show: RenovationShow }) {
return (
<span className="reno-chip" data-testid={`reno-chip-${status}`} data-show={show}>
<Swatch project={project} status={status} show={show} />
<Swatch st={st} show={show} />
<span className="reno-chip-text">
<span className="reno-chip-status">{t(`renovation.status.${status}` as TranslationKey)}</span>
<span className="reno-chip-show">{t(`renovation.show.${show}` as TranslationKey)}</span>
@@ -63,7 +67,12 @@ export function RenovationPanel() {
const sel = useRenovationSelection();
const applyChange = useStore((s) => s.applyChange);
const openResources = usePanelHostAction("onOpenResources");
const saveColor = usePanelHostAction("onAddColorToCustomPalette");
const [confirmId, setConfirmId] = useState<string | null>(null);
const [stylePhase, setStylePhase] = useState<string | null>(null);
const rs = resolvedRenovationStyles(project);
const sw = rs.project;
const ownStyles = project.renovation?.styles;
const counts = renovationCounts(project, sel.floorId);
const shows = filter ? renovationFilterShows(project, filter) : null;
const filterIds = ["", ...BUILTIN_RENOVATION_FILTERS, ...own.map((f) => f.id)];
@@ -71,7 +80,7 @@ export function RenovationPanel() {
const statusValue = sel.common.status === "mixed" || sel.common.status === null ? null : sel.common.status;
const phaseValue = sel.common.phase === "mixed" ? MIXED : (sel.common.phase ?? "");
const setPhases = (next: { id: string; name: string }[], key?: string) => applyChange((p) => setPhasesOps(p, next), key);
const setPhases = (next: RenovationPhase[], key?: string) => applyChange((p) => setPhasesOps(p, next), key);
const move = (i: number, d: number) => {
const j = i + d;
if (j < 0 || j >= phases.length) return;
@@ -98,7 +107,7 @@ export function RenovationPanel() {
data-testid={`reno-draw-${s}`}
onClick={() => setDraw(s, draw.phase)}
>
<Swatch project={project} status={s} />
<Swatch st={sw[s]} />
<span>{t(`renovation.status.${s}` as TranslationKey)}</span>
</button>
))}
@@ -139,7 +148,7 @@ export function RenovationPanel() {
>
<span className="reno-filter-name">{id ? renovationFilterLabel(id, own) : t("renovation.filter.none")}</span>
<span className="reno-filter-sw">
{fs && RENOVATION_STATUSES.map((s) => <Swatch key={s} project={project} status={s} show={fs[s]} />)}
{fs && RENOVATION_STATUSES.map((s) => <Swatch key={s} st={sw[s]} show={fs[s]} />)}
</span>
</button>
</li>
@@ -167,12 +176,38 @@ export function RenovationPanel() {
{shows && (
<div className="reno-preview" aria-label={t("renovation.panel.filter.preview")} data-testid="reno-preview">
{RENOVATION_STATUSES.map((s) => (
<ShowChip key={s} project={project} status={s} show={shows[s]} />
<ShowChip key={s} st={sw[s]} status={s} show={shows[s]} />
))}
</div>
)}
</div>
{/* [275] Darstellung: Umbau-Farben je Status (Farbe oder Stift) */}
<div className="reno-block" data-testid="reno-styles">
<div className="reno-head">{t("renovation.panel.styles.title")}</div>
<RenovationStyleEditor
project={project}
styles={ownStyles}
shown={sw}
testId="reno-style"
onSaveColor={saveColor}
onChange={(next, s) => applyChange((p) => setRenovationStylesOps(p, next), `reno-style-${s}`)}
/>
<div className="reno-style-actions">
<button
type="button"
className="reno-link-btn"
disabled={!ownStyles}
data-testid="reno-style-sia"
title={t("renovation.panel.styles.siaHint")}
onClick={() => applyChange((p) => setRenovationStylesOps(p, undefined))}
>
{t("renovation.panel.styles.sia")}
</button>
</div>
<div className="reno-hint">{t("renovation.panel.styles.hint")}</div>
</div>
{/* Auswahl */}
<div className="reno-block">
<div className="reno-head">{t("renovation.panel.selection.title")}</div>
@@ -183,7 +218,7 @@ export function RenovationPanel() {
) : (
<>
<div className="reno-sel-state" data-testid="reno-sel-state" data-status={statusValue ?? "mixed"}>
{statusValue ? <Swatch project={project} status={statusValue} /> : <span className="reno-swatch is-mixed" aria-hidden="true" />}
{statusValue ? <Swatch st={sw[statusValue]} /> : <span className="reno-swatch is-mixed" aria-hidden="true" />}
<span>{statusValue ? t(`renovation.status.${statusValue}` as TranslationKey) : t("renovation.mixed")}</span>
<span className="reno-sel-count">{t("renovation.panel.selection.count", { n: String(sel.ids.length) })}</span>
</div>
@@ -196,7 +231,7 @@ export function RenovationPanel() {
data-testid={`reno-set-${s}`}
onClick={() => sel.setStatus(s)}
>
<Swatch project={project} status={s} />
<Swatch st={sw[s]} />
<span>{t("renovation.panel.set", { status: t(`renovation.status.${s}` as TranslationKey) })}</span>
</button>
))}
@@ -232,7 +267,7 @@ export function RenovationPanel() {
data-testid={`reno-select-${s}`}
onClick={() => sel.selectByStatus(s)}
>
<Swatch project={project} status={s} />
<Swatch st={sw[s]} />
{t("renovation.panel.selectAll", { status: t(`renovation.status.${s}` as TranslationKey), n: String(counts[s]) })}
</button>
))}
@@ -246,8 +281,25 @@ export function RenovationPanel() {
<div className="reno-block">
<div className="reno-head">{t("renovation.phases.title")}</div>
{phases.length === 0 && <div className="reno-hint">{t("renovation.phases.empty")}</div>}
{phases.map((ph, i) => (
<div className="reno-phase-row" key={ph.id} data-testid="reno-phase-row">
{phases.map((ph, i) => {
const pst = rs.phases[ph.id] ?? sw;
const own = !!rs.phases[ph.id];
const open = stylePhase === ph.id;
return (
<div className="reno-phase-item" key={ph.id}>
<div className="reno-phase-row" data-testid="reno-phase-row">
<button
type="button"
className={`reno-phase-sw${own ? " is-own" : ""}${open ? " active" : ""}`}
aria-expanded={open}
title={t("renovation.panel.phases.styles")}
aria-label={t("renovation.panel.phases.styles")}
data-testid="reno-phase-style"
onClick={() => setStylePhase(open ? null : ph.id)}
>
<Swatch st={pst.demolish} />
<Swatch st={pst.new} />
</button>
<input
type="text"
value={ph.name}
@@ -265,7 +317,26 @@ export function RenovationPanel() {
✕
</button>
</div>
))}
{open && (
<div className="reno-phase-styles" data-testid="reno-phase-styles">
<div className="reno-hint">{t("renovation.panel.phases.stylesHint", { name: ph.name })}</div>
<RenovationStyleEditor
project={project}
styles={ph.styles}
shown={pst}
statuses={["demolish", "new"]}
testId="reno-phase-style"
onSaveColor={saveColor}
onChange={(next, s) => applyChange((p) => setPhaseStylesOps(p, ph.id, next), `reno-phase-style-${ph.id}-${s}`)}
/>
<button type="button" className="reno-link-btn" disabled={!ph.styles} data-testid="reno-phase-style-reset" onClick={() => applyChange((p) => setPhaseStylesOps(p, ph.id, undefined))}>
{t("renovation.panel.phases.stylesReset")}
</button>
</div>
)}
</div>
);
})}
<button
type="button"
className="reno-add-btn"
+15 -2
View File
@@ -14,8 +14,9 @@ import {
idsByRenovationStatus,
patchItem,
setRenovationOps,
resolvedRenovationStyles,
} from "../core";
import type { RenovationStatus } from "../model/types";
import type { RenovationPhase, 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 {
@@ -28,7 +29,7 @@ export function selectionRenovationIds(sel: Selection): string[] {
return [...sel.walls, ...sel.openings, ...sel.ceilings, ...sel.roofs, ...sel.stairs, ...sel.columns, ...sel.solids, ...sel.rooms, ...sel.drawings, ...sel.trees];
}
const NO_PHASES: readonly { id: string; name: string }[] = [];
const NO_PHASES: readonly RenovationPhase[] = [];
const NO_FILTERS: readonly { id: string; name: string }[] = [];
/**
@@ -83,3 +84,15 @@ export function useRenovationSelection() {
};
return { ids, common, floorId, setStatus, setPhase, selectByStatus };
}
/**
* [275] Umbau-Farben des Projekts (aufgelöst im Kern, Stifte inklusive) für Muster ausserhalb des Panels (Statusleiste).
* Hört nur auf Umbau-Einstellungen und Stiftsätze, nicht auf jede Op.
*/
export function useRenovationSwatches() {
const reno = useStore((s) => s.project.renovation);
const penSets = useStore((s) => s.project.penSets);
const active = useStore((s) => s.project.activePenSetId);
// eslint-disable-next-line react-hooks/exhaustive-deps
return useMemo(() => resolvedRenovationStyles(getState().project).project, [reno, penSets, active]);
}
+2 -8
View File
@@ -18,7 +18,7 @@ import type { useProjectActions } from "./useProjectActions";
import type { useTopBarState } from "./useTopBarState";
import { useViewTemplateHandlers } from "./useViewTemplateHandlers";
import { modelViewHandlers } from "./useModelViewHandlers";
import { setField, setPhasesOps, addDesignOptionSetOps, renameDesignOptionSetOps, addDesignOptionOps, renameDesignOptionOps, setPrimaryOptionOps, acceptDesignOptionOps, deleteDesignOptionOps } from "../core";
import { setPhasesOps, setRenovationStylesOps, addDesignOptionSetOps, renameDesignOptionSetOps, addDesignOptionOps, renameDesignOptionOps, setPrimaryOptionOps, acceptDesignOptionOps, deleteDesignOptionOps } from "../core";
type TopBar = ReturnType<typeof useTopBarState>;
type Dialogs = ReturnType<typeof useDialogState>;
@@ -138,13 +138,7 @@ export function useResourceHandlers(opts: {
...modelViewHandlers(applyChange, () => detail),
// [271] Umbau: Etappen und Farben (Ressourcen-Tab „Umbau“).
onSetRenovationPhases: (phases) => applyChange((p) => setPhasesOps(p, phases)),
onSetRenovationStyles: (styles) =>
applyChange((p) => {
const next = { ...(p.renovation ?? {}) };
if (styles) next.styles = styles;
else delete next.styles;
return [setField("renovation", Object.keys(next).length ? next : undefined)];
}),
onSetRenovationStyles: (styles) => applyChange((p) => setRenovationStylesOps(p, styles)),
// [272] Varianten (Ressourcen-Tab „Varianten“): Sätze/Varianten, Hauptvariante, Übernehmen, Löschen (je ein Undo-Schritt).
onAddDesignOptionSet: (name) => applyChange((p) => addDesignOptionSetOps(p, name).ops),
onRenameDesignOptionSet: (setId, name) => applyChange((p) => renameDesignOptionSetOps(p, setId, name), `dopt-set-${setId}`),
+95 -7
View File
@@ -10,6 +10,11 @@
:root {
color-scheme: light;
/* [275] Vorgabe der Umbau-Farben (Kern `renovation::default_style`); Muster mit Projektfarben setzen sie inline. */
--reno-existing: #a6a6a6;
--reno-demolish: #e8c35a;
--reno-new: #c8524a;
--bg: #e0dbd4;
--panel: #e0dbd4;
--panel-2: #d4cfc8;
@@ -1311,13 +1316,13 @@ body {
vertical-align: baseline;
}
.sb-renovation-existing {
background: #a6a6a6;
background: var(--reno-existing);
}
.sb-renovation-demolish {
background: #ffd800;
background: var(--reno-demolish);
}
.sb-renovation-new {
background: #e3001b;
background: var(--reno-new);
}
.sb-toggle.sb-renovation-on {
font-weight: 600;
@@ -9709,7 +9714,7 @@ body {
opacity: 0.6;
}
.reno-swatch.is-mixed {
background: repeating-linear-gradient(45deg, #a6a6a6 0 3px, #ffd800 3px 6px, #e3001b 6px 9px);
background: repeating-linear-gradient(45deg, var(--reno-existing) 0 3px, var(--reno-demolish) 3px 6px, var(--reno-new) 6px 9px);
}
.reno-status-row {
display: flex;
@@ -10363,13 +10368,13 @@ body {
min-width: 0;
}
.reno-fate.is-demolish {
box-shadow: inset 3px 0 0 #ffd800;
box-shadow: inset 3px 0 0 var(--reno-demolish);
}
.reno-fate.is-new {
box-shadow: inset 3px 0 0 #e3001b;
box-shadow: inset 3px 0 0 var(--reno-new);
}
.reno-fate.is-kept {
box-shadow: inset 3px 0 0 #a6a6a6;
box-shadow: inset 3px 0 0 var(--reno-existing);
}
.reno-create {
display: flex;
@@ -10380,3 +10385,86 @@ body {
min-width: 0;
flex: 1 1 auto;
}
/* ── [275] Umbau-Farben bearbeiten (Panel „Umbau“ › Darstellung, Etappen; Ressourcen-Tab „Umbau“) ───────────────── */
.reno-style-grid {
display: flex;
flex-direction: column;
gap: 4px;
}
.reno-style-row {
display: grid;
grid-template-columns: minmax(44px, 1fr) 44px 44px 84px 24px;
align-items: center;
gap: 6px;
}
.reno-style-label {
font-weight: 600;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.reno-style-field {
display: inline-flex;
align-items: center;
gap: 4px;
}
.reno-style-head .reno-style-cap {
justify-self: start;
}
.reno-style-cap {
font-size: 10px;
color: var(--muted);
}
.reno-style-dashed {
display: inline-flex;
align-items: center;
gap: 3px;
font-size: 11px;
color: var(--ink-2);
white-space: nowrap;
}
.reno-style-actions {
display: flex;
justify-content: flex-start;
}
.reno-phase-item {
display: flex;
flex-direction: column;
gap: 4px;
}
.reno-phase-sw {
flex: 0 0 auto;
display: inline-flex;
gap: 2px;
padding: 3px;
background: transparent;
border: 1px solid var(--border);
border-radius: 6px;
cursor: pointer;
}
.reno-phase-sw .reno-swatch {
width: 10px;
height: 14px;
}
.reno-phase-sw.is-own {
border-color: var(--ink-2);
}
.reno-phase-sw.active,
.reno-phase-sw:hover {
border-color: var(--active);
}
.reno-phase-styles {
display: flex;
flex-direction: column;
gap: 4px;
margin: 0 0 4px 22px;
padding: 6px 8px;
background: var(--input);
border: 1px solid var(--border);
border-radius: 8px;
}
.reno-phase-styles .reno-link-btn {
align-self: flex-start;
}
+3 -2
View File
@@ -6,7 +6,7 @@
import { useEffect, useRef, useState } from "react";
import { t } from "../i18n";
import type { TranslationKey } from "../i18n";
import { renovationFilterLabel, useRenovationControls } from "../state/renovationHook";
import { renovationFilterLabel, useRenovationControls, useRenovationSwatches } from "../state/renovationHook";
import { BUILTIN_RENOVATION_FILTERS, RENOVATION_STATUSES } from "../core";
import type { RenovationStatus } from "../model/types";
@@ -14,6 +14,7 @@ export { renovationFilterLabel };
export function RenovationControl() {
const { draw, setDraw, phases, own, filter, filterPhase, levelEditable, setLevel } = useRenovationControls();
const sw = useRenovationSwatches();
const [open, setOpen] = useState(false);
const wrapRef = useRef<HTMLSpanElement | null>(null);
useEffect(() => {
@@ -42,7 +43,7 @@ export function RenovationControl() {
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" />
<span className={`sb-renovation-dot sb-renovation-${draw.status}`} style={{ background: sw[draw.status].fill }} aria-hidden="true" />
{t("renovation.short", { status: statusLabel })}
</button>
{open && (
+1 -1
View File
@@ -33,7 +33,7 @@ export function RenovationStrip({ pair, width = 150 }: { pair: RenovationPair; w
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 demolishFill = pair.result.find((q) => q.kind === "demolish")?.fill ?? pair.oldStrip.find((q) => q.kind === "demolish")?.fill ?? "var(--reno-demolish)";
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>
+101
View File
@@ -0,0 +1,101 @@
// [275] Umbau-Farben bearbeiten: je Status Füllung und Linie als freie Farbe ODER Stift (der gemeinsame `PenColorField`
// der App: Frei/Stift-Umschalter, Stift-Raster des aktiven Stiftsatzes), „gestrichelt“, Zurücksetzen je Status. Eine
// Komponente für das Umbau-Panel (Abschnitt „Darstellung“, Etappen) und den Ressourcen-Tab „Umbau“ — reine Darstellung,
// die Änderung geht als ganzes `RenovationStyles` an `onChange` (der Aufrufer macht daraus Ops).
import { t } from "../i18n";
import type { TranslationKey } from "../i18n";
import type { Project, RenovationStatus, RenovationStyle, RenovationStyles } from "../model/types";
import { activePenSet } from "../model/penSets";
import { patchRenovationStyles, RENOVATION_STATUSES } from "../core";
import type { RenovationStyleSet } from "../core";
import { PenColorField } from "./PenColorField";
export interface RenovationStyleEditorProps {
project: Project;
/** Eigene Angaben (Projekt oder Etappe); `undefined` = keine. */
styles: RenovationStyles | undefined;
/** Aufgelöste Farben, die gerade gelten (Kern), für die Anzeige. */
shown: RenovationStyleSet;
onChange: (next: RenovationStyles | undefined, status: RenovationStatus) => void;
statuses?: readonly RenovationStatus[];
/** „gestrichelt“ für diese Status anbieten (Vorgabe: nur Abbruch). */
dashedFor?: readonly RenovationStatus[];
disabled?: boolean;
/** Präfix der `data-testid` (z. B. `reno-style` → `reno-style-new`). */
testId: string;
onSaveColor?: (paletteId: string, hex: string) => void;
}
export function RenovationStyleEditor({ project, styles, shown, onChange, statuses = RENOVATION_STATUSES, dashedFor = ["demolish"], disabled, testId, onSaveColor }: RenovationStyleEditorProps) {
const pens = project.pens ?? [];
const activeStyles = activePenSet(project)?.pens;
const patch = (s: RenovationStatus, p: Partial<RenovationStyle> | null) => onChange(patchRenovationStyles(styles, s, p), s);
return (
<div className="reno-style-grid">
<div className="reno-style-row reno-style-head" aria-hidden="true">
<span />
<span className="reno-style-cap">{t("renovation.styles.fill")}</span>
<span className="reno-style-cap">{t("renovation.styles.line")}</span>
<span />
<span />
</div>
{statuses.map((s) => {
const own = styles?.[s];
const st = shown[s];
return (
<div className="reno-style-row" key={s} data-testid={`${testId}-${s}`} data-fill={st.fill} data-line={st.line ?? ""} data-dashed={String(st.dashed)}>
<span className="reno-style-label">{t(`renovation.status.${s}` as TranslationKey)}</span>
<span className="reno-style-field" title={t("renovation.styles.fill")} data-testid={`${testId}-${s}-fill`}>
<PenColorField
color={st.fill}
penId={own?.fillPen}
pens={pens}
activeStyles={activeStyles}
customPalettes={project.customPalettes}
builtinBanks={project.builtinPaletteBanks}
onSaveColor={onSaveColor}
disabled={disabled}
onColorChange={(fill) => patch(s, { fill })}
onPenChange={(fillPen) => patch(s, fillPen ? { fillPen } : { fillPen: undefined, fill: st.fill })}
/>
</span>
<span className="reno-style-field" title={t("renovation.styles.line")} data-testid={`${testId}-${s}-line`}>
<PenColorField
color={st.line ?? "#000000"}
penId={own?.linePen}
pens={pens}
activeStyles={activeStyles}
customPalettes={project.customPalettes}
builtinBanks={project.builtinPaletteBanks}
onSaveColor={onSaveColor}
disabled={disabled}
onColorChange={(line) => patch(s, { line })}
onPenChange={(linePen) => patch(s, linePen ? { linePen } : { linePen: undefined, ...(st.line ? { line: st.line } : {}) })}
/>
</span>
{dashedFor.includes(s) ? (
<label className="reno-style-dashed">
<input type="checkbox" checked={st.dashed} disabled={disabled} data-testid={`${testId}-${s}-dashed`} onChange={(e) => patch(s, { dashed: e.target.checked })} />
{t("renovation.styles.dashed")}
</label>
) : (
<span />
)}
<button
type="button"
className="reno-icon-btn"
disabled={disabled || !own}
title={t("renovation.styles.reset")}
aria-label={t("renovation.styles.reset")}
data-testid={`${testId}-${s}-reset`}
onClick={() => patch(s, null)}
>
↺
</button>
</div>
);
})}
</div>
);
}
+15 -36
View File
@@ -1,11 +1,12 @@
// [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).
// Reine Darstellung über Handler (wie die anderen Tabs, auch im macOS-Nebenfenster). [275] Farben als Farbe oder Stift
// über den gemeinsamen Editor (`ui/RenovationStyleEditor.tsx`, wie im Umbau-Panel).
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";
import type { Project, RenovationPhase, RenovationStyles } from "../../model/types";
import { newPhaseId, renovationPhases, resolvedRenovationStyles } from "../../core";
import { RenovationStyleEditor } from "../RenovationStyleEditor";
export interface RenovationHandlers {
/** Etappen-Liste ersetzen (Elemente einer entfernten Etappe verlieren sie). */
@@ -16,7 +17,7 @@ export interface RenovationHandlers {
export function RenovationTab({ project, handlers }: { project: Project; handlers: RenovationHandlers }) {
const phases = renovationPhases(project);
const styles = project.renovation?.styles ?? {};
const styles = project.renovation?.styles;
const setPhases = handlers.onSetRenovationPhases;
const setStyles = handlers.onSetRenovationStyles;
const move = (i: number, d: number) => {
@@ -26,13 +27,6 @@ export function RenovationTab({ project, handlers }: { project: Project; handler
[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>
@@ -70,30 +64,15 @@ export function RenovationTab({ project, handlers }: { project: Project; handler
<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>
);
})}
<RenovationStyleEditor
project={project}
styles={styles}
shown={resolvedRenovationStyles(project).project}
testId="rm-renovation-style"
dashedFor={["existing", "demolish", "new"]}
disabled={!setStyles}
onChange={(next) => setStyles?.(next)}
/>
</div>
);
}