Merge [274] Umbau je Schicht (mit [271]-Rest zusammengeführt)
Konflikte inhaltlich gelöst, beide Funktionsumfänge bleiben: Sanierung je Schicht ([274]) und Ersatzstücke in Schnitt/Ansicht, Projektionslinien in Umbau-Farbe, 2D/Möbel, Bäume = Umbau-Status, Bäume verdeckt ([271]/[149]). - renovation.rs: resolve_filter (mit [272]-Grau) nimmt die sanierten Wände (build_up::look) auf; beide Testmodule (renovation_tests2, renovation_layers_tests); fehlende Felder `ghost` ergänzt (Stand vorher kompilierte nicht). - Schnitt (query.rs) und Ansicht (elevation): gefiltertes Projekt über Resolved::project bzw. without_hidden + swap_build_ups; `orig` (Quelle der Ersatzstücke) = Projekt mit allem, aber mit den gezeigten Aufbauten. - CutRules::with_renovation: Projektionslinien ([271]) plus Farbe je Schicht ([274]); Projektionslinien sanierter Wände in der Farbe der äussersten Schicht (Resolved::faces). - axo/queries: Bearbeitungsvariante ([272]) und Resolved::project ([274]). - Beispiel :umbau vereint Südwand W1 + Schnitt C mit Möbeln, Bäumen und Ansicht West; CSS beide Blöcke. - TODO/ARCHITEKTUR/RELEASE-NOTES: Sätze beider Seiten, veraltete Offen-Punkte von [271] gestrichen, ID-Zähler 274. Bild doc/review-274/06-nach-merge.png.
This commit is contained in:
37 files changed
+2033
-53
No files matched your search
@@ -10,7 +10,7 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `*
|
||||
stehen im Archiv („Bewusst nicht übernommen“).
|
||||
- **Grösse** (eine Person mit Agenten): S ≤ 1 Tag · M ≤ 1 Woche · L ≤ 1 Monat · XL > 1 Monat.
|
||||
Steht keine Grösse im Archiv, ist sie hier geschätzt.
|
||||
- **IDs sind stabil.** Neue ID = nächste freie Zahl nach der höchsten im Archiv und hier (aktuell 273);
|
||||
- **IDs sind stabil.** Neue ID = nächste freie Zahl nach der höchsten im Archiv und hier (aktuell 274);
|
||||
nie eine ID wiederverwenden oder umnummerieren. Präfix-IDs (`[K]`, `[G]`, `[T]`, `[B]`, `[C]`) bleiben.
|
||||
- **Pro Punkt:** was fehlt · wo im Code · Grösse. Höchstens ein bis drei Sätze je Punkt;
|
||||
Messwerte und Befunde gehören in den Commit.
|
||||
@@ -73,7 +73,8 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC.
|
||||
Geprüft und in Ordnung: Anonymität (Plakat-PDF Titel „FALKE 7“, Producer leer, Datum 2000, Schriften eingebettet, `pdftotext` ohne Projekt-/Büronamen; Kennzahlen-PDF nach „anonym“ ebenso; DXF/IFC ohne Projektnamen), Ansichten/Schnitt stimmig zum Grundriss (Fensterlagen nachgemessen), Kennzahlen-Tabelle Plakat = Flächenbilanz, ÜZ 127.71/900, Kosten 2’844 CHF/m² GF plausibel (mit Befund 1), IFC mit Georeferenz LV95 (IfcMapConversion). **Nicht geprüft:** Tauri-App/Mac (Metal, 3D-Bild, Schatten, Rendering), Mausbedienung (alles über Befehlszeile und Test-Naht), Druck des A1-Plakats, DXF/IFC in Fremdsoftware. · M (Reste)
|
||||
|
||||
- ◐ **[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); Ersatzstücke der Öffnungen nur im Grundriss (Schnitt/Ansicht: Öffnung fehlt bzw. ist da, ohne gelbes/rotes Stück); Linien der Projektion im Schnitt und Öffnungen in der Ansicht ohne Umbau-Farbe; Bogenwände ohne Ersatzstück; Blender-Paket ohne Umbau-Farben (nur Ausblenden); 2D-Zeichnungen, Bäume (eigener Status [149]) und Bibliotheksobjekte ohne Status; 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 WunscLine truncated
|
||||
- ◐ **[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
|
||||
- ◐ **[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):**
|
||||
|
||||
@@ -488,6 +488,22 @@ 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.
|
||||
|
||||
**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:
|
||||
`renovation.newTypeId`). `match_layers` ordnet von der Bezugsseite her zu (gleicher Baustoff, Dicke, Lage = Bestand), `pieces` liefert den
|
||||
gezeigten Aufbau (alt, neu oder überlagert in Teilschichten), `look` je Wand und Filter einen `WallLook` (Farbe je Schicht, Ersatztyp,
|
||||
Achsversatz: die Bezugsseite bleibt stehen). **Ein Weg in die Ableitungen:** `Resolved::project`/`swap_build_ups` (Kennzahlen, 3D,
|
||||
Ansicht, Axo, Exporte über `filtered`/`project_for_text`) bzw. `renovation::with_build_ups` (Grundriss: `domains::plan_project`; Schnitt:
|
||||
`section/query.rs`) stellen die Wand auf einen Ersatztyp um (Marke `~renovationOrigin`, damit ein zweites Auflösen dasselbe ergibt);
|
||||
Farben je Schicht im Grundriss über die Schicht-Aktionen (`WallLook::layer_actions`, wie Override-Regeln [33]) und `dash_edges`
|
||||
(Kanten der Abbruch-Schichten gestrichelt, Kontur abgebrochener Schichten unter Neu), im Schnitt über `CutRules::with_renovation`
|
||||
(`layer_style`), in Ansicht/Axo/3D die Farbe der äussersten Schicht (`Resolved::faces`). Oberfläche: Objekt-Info
|
||||
`RenovationField` („Neuer Aufbau (Sanierung)“, Streifen `ui/RenovationStrip.tsx`), Umbau-Panel `panels/RenovationSanierung.tsx`
|
||||
(Typ-Paare, Editor, „Alle Wände vom Typ sanieren“); Kern-Abfragen `renovationPair`, `renovationPairs`. Mit den Ersatzstücken
|
||||
([271]): `orig` in Schnitt und Ansicht ist das Projekt mit allem, aber mit den gezeigten Aufbauten (`apply` ohne Ausgeblendetes);
|
||||
Projektionslinien sanierter Wände in der Farbe der äussersten Schicht (`CutRules::edge` über `Resolved::faces`).
|
||||
|
||||
|
||||
### 3.9 Varianten ([272])
|
||||
|
||||
|
||||
@@ -367,6 +367,21 @@ Fenster zugemauert, neues Fenster in der Westwand, Anbau in der zweiten Etappe).
|
||||
Stand einer Etappe. Der Filter gehört zur Ebene wie die Modelldarstellung; Ausschnitte und Ansichtsvorlagen merken ihn.
|
||||
- **Öffnungen in Bestandswänden:** eine neue Öffnung bricht Mauerwerk ab (im Umbauplan ein gelbes Stück, im Bestand ist die
|
||||
Wand zu), eine Öffnung „Abbruch“ wird zugemauert (rote Ausfachung, im Neubau und Endzustand ist die Wand zu).
|
||||
- **Sanierung je Schicht:** z. B. Aussenwand Beton 20 + Dämmung 10 + Putz → Beton bleibt, neue Dämmung 20 + neuer Putz. In drei
|
||||
Schritten:
|
||||
1. *Sanierungstyp anlegen:* im Panel Umbau, Abschnitt „Sanierung“, den Bestands-Wandtyp wählen und „Sanierungstyp anlegen …“
|
||||
(eine Kopie des Typs). Die Schichten der Kopie in den Ressourcen (Reiter Wandstile) anpassen, etwa die Dämmung auf 20 cm.
|
||||
2. *Zuordnung prüfen:* „Zuordnung bearbeiten“ zeigt Bestandstyp und Sanierungstyp nebeneinander mit dem Streifen Alt/Neu/Ergebnis
|
||||
in den Umbau-Farben. Automatisch gilt: gleicher Baustoff, gleiche Dicke und gleiche Lage von der „Bezugsseite“ her (Vorgabe
|
||||
innen: der Kern bleibt, die Fassade rückt nach aussen; aussen bei Innendämmung) ist Bestand, nur alt ist Abbruch, nur neu ist
|
||||
Neu. Je Schicht lässt sich das von Hand ändern; die Zuordnung gilt für alle Wände dieses Typs.
|
||||
3. *Anwenden:* „Alle Wände vom Typ sanieren“ (ein Undo-Schritt) oder Wände wählen und in der Objekt-Info das Feld
|
||||
„Neuer Aufbau (Sanierung)“ auf den Sanierungstyp bzw. für eine Ausnahme auf einen anderen Wandtyp stellen.
|
||||
|
||||
Die Umbaufilter zeigen dann je Schicht: Bestand und Abbruch den alten Aufbau (Abbruch-Schichten gelb, gestrichelt umrandet),
|
||||
Neubau und Endzustand den neuen (Neubau: neue Schichten rot), der Umbauplan beide — Beton grau, neue Schichten rot und die
|
||||
abgebrochenen als gelbe gestrichelte Kontur darüber. Grundriss, Schnitt, Ansicht, 3D, Öffnungsleibungen und Flächen (GF an der
|
||||
neuen Aussenkante) folgen dem gezeigten Aufbau; ohne Umbaufilter gilt der Bestand.
|
||||
- **Etappen und Farben:** die Etappen im Panel Umbau (oder *Fenster → Ressourcen*, Reiter „Umbau“); dort auch die
|
||||
„Umbau-Farben“ je Status (Füllung, Linie, gestrichelt).
|
||||
- **Flächen:** Panel Flächenbilanz, „Zustand“ Bestand oder Endzustand.
|
||||
|
||||
@@ -180,6 +180,7 @@ und Befunde in `TODO.md` eintragen.
|
||||
| 13.36 | **Blickrichtungen seitenrichtig ([270]):** Musterhaus komplex (Erker im Osten = Plan rechts); 3D-Fenster (Metal) nacheinander Oben, Vorne, Rechts, Isometrie Südost, Südwest, Nordost, Nordwest; dann Ausschnitt „Axonometrie Südost“ auf einem Blatt und `rendering` mit Kamera „Südost“; im 3D Maus nach rechts ziehen (Orbit), rechte Maustaste ziehen (Pan), Begehen mit D, Umschauen; Gelände/Kataster-Kontext (swisstopo) und eine Punktwolke laden; Luftbild drapieren | Oben = Grundriss (Norden oben, Erker rechts, nicht kopfüber); Vorne = Südfassade mit Erker rechts; Rechts = Ostfassade; Isometrie Südost zeigt Süd- und Ostfassade, Erker rechts — gleich wie Axonometrie Südost, Cycles „Südost“ und die Ansicht Süd; Orbit dreht das Modell mit der Maus, Pan folgt der Maus, D läuft nach rechts; Gelände, Baugrube, Verbau, Punktwolke und Luftbild liegen deckungsgleich unter dem Haus (nicht an y = 0 gespiegelt), Strassen/Gebäude des Kontexts seitenrichtig; Schatten fallen auf die richtige Seite (Nachmittag: nach Osten) |
|
||||
| 13.37 | **Umbau ([271]):** *Datei → Neu aus Vorlage: Beispiel Umbau*; Statusleiste „Umbau“ → Umbaufilter nacheinander Bestand, Abbruch, Neubau, Umbauplan, Endzustand (Erdgeschoss, dann Schnitt A); Wand W9 wählen, Objekt-Info „Umbau“ auf Neu, ⌘Z; Zeichen-Status Neu, eine Wand zeichnen; Flächenbilanz „Zustand“ Bestand/Endzustand; PDF und DXF des Umbauplans | Bestand ohne Anbau und neues Fenster (Westwand zu); Abbruch: Zwischenwand gelb gestrichelt, gelbes Stück im neuen Fenster; Neubau: Anbau und neue Tür rot, Nordfenster rot zugemauert; Umbauplan alle drei Farben; Endzustand ohne Farben; Schnitt gleich; neue Wand rot im Umbauplan; ⌘Z nimmt die Status-Änderung in einem Schritt zurück; GF im Endzustand grösser; DXF mit Layern „…_Abbruch“/„…_Neu“; am Bildschirm (Metal) wie im PDF |
|
||||
| 13.38 | **Varianten ([272]):** *Datei → Neu aus Vorlage: Beispiel Varianten*; Knopf „Variante“ in der Statusleiste → Panel „Varianten“; Kombination Fassade B, dann Dachform B (Erdgeschoss, Schnitt A, Ansicht Süd, 3D); Wand W1 wählen, „Zuweisen“ zu Fassade: B, ⌘Z; Satz hinzufügen; „Vergleich öffnen“ und „Vergleich als CSV“; Blatt mit zwei Viewports desselben Ausschnitts, einer mit Dachform B; „Übernehmen“ bei Dachform B, ⌘Z; PDF/DXF/IFC in Kombination B; im IFC-Export-Dialog „Variante: …“ lesen, Häkchen aus und wieder an; Rendering (Cycles) in Studie 2 mit 8 Samples, bei Umbaufilter „Umbauplan“ mit „Umbau-Farben im Bild“ | Fassade B: Bandfenster statt Nordfenster; Dachform B: Satteldach statt Flachdach in Schnitt, Ansicht und 3D; ⌘Z nimmt Zuweisen bzw. Übernehmen in einem Schritt zurück; Vergleich mit 4 Zeilen, GV und Kosten bei Satteldach höher; zweiter Viewport mit Titelzusatz „Dachform B Satteldach“; Exporte zeigen nur die gewählte Variante; Dialoge nennen Umbaufilter und Variante der Ansicht, ohne Häkchen gelten Hauptvarianten und alles; Rendering ohne ausgeblendete Elemente, Umbau-Farben nur mit Häkchen |
|
||||
| 13.39 | **Sanierung je Schicht ([274]):** *Datei → Neu aus Vorlage: Beispiel Umbau*; Panel Umbau → „Sanierung“, „Zuordnung bearbeiten“ beim Typ „Aussenwand Beton 20 + Dämmung 10 (Bestand)“; Umbaufilter Bestand, Abbruch, Neubau, Umbauplan, Endzustand im Erdgeschoss (1:50 und 1:100), Schnitt C (durch die Südwand) und Ansicht Süd; Südwand wählen, Objekt-Info „Neuer Aufbau (Sanierung)“ auf „keiner“, ⌘Z; beim Typ „Aussenwand 34.5 cm“ „Sanierungstyp anlegen …“, Dämmung der Kopie auf 20 cm, „Alle Wände vom Typ sanieren“, ⌘Z; Flächenbilanz Bestand/Endzustand | Streifen Alt/Neu/Ergebnis: Beton grau, Dämmung/Putz alt gelb, neu rot; Bestand: alte Wand ohne Farbe; Abbruch: Putz und Dämmung gelb gestrichelt; Neubau: Wand 10 cm dicker nach aussen, Innenseite bündig, neue Schichten rot; Umbauplan: Beton grau, Neu rot, gelbe gestrichelte Kontur der alten Dämmung darin; Endzustand ohne Farben; Fensterleibung der Südwand folgt dem Aufbau; ⌘Z je ein Schritt; GF im Endzustand grösser; am Bildschirm (Metal) wie im PDF |
|
||||
|
||||
## 14. Datensicherheit auf dem Mac ([116], Audit 14.11.)
|
||||
|
||||
|
||||
@@ -93,6 +93,11 @@ in `doc/KURZANLEITUNG.md`):
|
||||
(grau, gelb gestrichelt, rot bzw. ausgeblendet); Masse und Texte nur mit ausdrücklichem Status. Gilt in Grundriss,
|
||||
Schnitt, Ansicht, Vektor-Axonometrie, Kennzahlen (Bestand/Endzustand) und Exporten (DXF-Layer je Status, IFC `Status` im
|
||||
`Pset_*Common`). Beispiel: *Datei → Neu aus Vorlage: Beispiel Umbau*. Das 3D-Fenster folgt dem Filter der aktiven Ebene (noch ohne Bildprüfung). Exporte (IFC, OBJ, STL, glTF, STEP) und das Rendering (Cycles, Blender-Paket) übernehmen Umbaufilter und Variantenkombination der aktiven Ansicht — die Dialoge zeigen sie und lassen „Hauptvarianten/kein Filter“ wählen; im Rendering mit Cycles färbt „Umbau-Farben im Bild“ (Vorgabe aus) Bestand grau, Abbruch gelb, Neu rot. CLI: `--renovation/--phase` auch für diese Ausgaben. Einschränkungen: das Ersatzstück zeigt sich im Schnitt nur dort, wo die Schnittebene die Öffnung trifft (nicht in der Projektion dahinter); DXF-Layer je Status nur für Wände, Stützen und Öffnungen (nicht für Möbel und Bäume).
|
||||
**Sanierung je Schicht (17.11., [274]):** ein Bestands-Wandtyp bekommt einen Sanierungstyp (Panel Umbau → „Sanierung“: anlegen als
|
||||
Kopie, Zuordnung je Schicht automatisch nach Baustoff, Dicke und Lage von der Bezugsseite oder von Hand, Streifen Alt/Neu/Ergebnis,
|
||||
„Alle Wände vom Typ sanieren“; je Wand „Neuer Aufbau (Sanierung)“ in der Objekt-Info). Die Filter zeigen je Schicht: Abbruch gelb,
|
||||
Neu rot, im Umbauplan die abgebrochenen Schichten als gelbe gestrichelte Kontur über der neuen Füllung; Grundriss, Schnitt, Ansicht,
|
||||
3D, Leibungen und GF folgen dem alten bzw. neuen Aufbau. Beispiel Umbau: Südwand Beton 20 + Dämmung 10 → Dämmung 20.
|
||||
14. **Varianten (17.11., [272]).** Wie Archicads „Design Options“: Variantensätze (z. B. Dachform, Fassade) mit Varianten A, B, …; jedes
|
||||
Element (Bauteile, Öffnungen, Räume, Körper, 2D-Elemente samt Bibliotheksobjekten) gehört zum Hauptmodell oder zu genau einer Variante.
|
||||
Je Ansicht, Ausschnitt, Vorlage und Blatt-Viewport eine Kombination (Vorgabe die Hauptvarianten); Grundriss, Schnitt, Ansicht,
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 186 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 136 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 154 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 83 KiB |
@@ -0,0 +1,78 @@
|
||||
// [274] Sanierung je Schicht: Beispiel Umbau öffnen; Objekt-Info der sanierten Südwand („Neuer Aufbau (Sanierung)“ mit
|
||||
// Streifen Alt/Neu/Ergebnis), auf „keiner“ und Undo; Umbau-Panel „Sanierung“: Typ-Paar mit Zähler, Zuordnung je Schicht
|
||||
// (manuell, Undo), Sanierungstyp anlegen, „Alle Wände vom Typ sanieren“ in einem Undo-Schritt. Geprüft über die UI und
|
||||
// die Test-Naht `renovation`/`planFillColors`. Bilder: `test-results/renovation274-*.png`.
|
||||
import { blurFocus, discardIfAsked, expect, fileMenu, openTab, test } from "./app";
|
||||
|
||||
test.use({ viewport: { width: 1280, height: 800 } });
|
||||
|
||||
const RED = "#e3001b";
|
||||
|
||||
test("Sanierung je Schicht: Feld, Typ-Paar, alle sanieren ([274])", async ({ page }) => {
|
||||
await page.goto("/?dossierTest");
|
||||
await page.getByRole("button", { name: /Neues Projekt/ }).first().click();
|
||||
await expect(page.getByRole("group", { name: "Befehlszeile" })).toBeVisible();
|
||||
await fileMenu(page, /^Neu aus Vorlage: Beispiel Umbau$/);
|
||||
await discardIfAsked(page);
|
||||
await expect(page.locator(".project-name")).toHaveText("Beispiel Umbau");
|
||||
const ren = () => page.evaluate(() => window.__dossierTest!.renovation());
|
||||
const fills = () => page.evaluate(() => window.__dossierTest!.planFillColors());
|
||||
expect((await ren()).buildUp.W1).toBe("type");
|
||||
|
||||
// Objekt-Info: Südwand W1 saniert (wie Typ), Streifen Alt/Neu/Ergebnis.
|
||||
await page.evaluate(() => window.__dossierTest!.select({ walls: ["W1"] }));
|
||||
await openTab(page, "Objekt-Info");
|
||||
const field = page.getByTestId("objinfo-renovation-buildup");
|
||||
await expect(field).toBeVisible();
|
||||
await expect(field).toContainText("wie Typ: Aussenwand Beton 20 + Dämmung 20 (saniert)");
|
||||
const strip = page.getByTestId("objinfo-renovation-strip");
|
||||
await expect(strip).toBeVisible();
|
||||
await expect(strip.getByTestId("reno-strip-result").locator('[data-kind="newOverDemolish"]')).toHaveCount(2);
|
||||
await field.scrollIntoViewIfNeeded();
|
||||
await page.screenshot({ path: "test-results/renovation274-objektinfo.png" });
|
||||
// Auf „keiner“ und zurück (ein Undo-Schritt).
|
||||
await field.getByRole("button", { name: "Neuer Aufbau (Sanierung)" }).click();
|
||||
await page.getByRole("option", { name: "keiner", exact: true }).click();
|
||||
await expect.poll(async () => (await ren()).buildUp.W1).toBe("");
|
||||
await expect(strip).toHaveCount(0);
|
||||
await blurFocus(page);
|
||||
await page.keyboard.press("ControlOrMeta+z");
|
||||
await expect.poll(async () => (await ren()).buildUp.W1).toBe("type");
|
||||
|
||||
// Umbau-Panel, Abschnitt Sanierung: Typ-Paar, Zähler, Editor.
|
||||
await openTab(page, "Umbau");
|
||||
const panel = page.getByTestId("renovation-dock");
|
||||
const san = panel.getByTestId("reno-sanierung");
|
||||
await expect(san.getByTestId("reno-sanierung-count")).toHaveText("Sanierte Bauteile: 1");
|
||||
await expect(san.getByTestId("reno-pair")).toHaveCount(1);
|
||||
await san.getByTestId("reno-pair-edit").click();
|
||||
const ed = san.getByTestId("reno-pair-editor");
|
||||
await expect(ed).toBeVisible();
|
||||
await expect(ed.getByTestId("reno-pair-old-layer")).toHaveCount(3);
|
||||
await expect(ed.getByTestId("reno-pair-old-layer").nth(0)).toHaveAttribute("data-fate", "demolish");
|
||||
await expect(ed.getByTestId("reno-pair-old-layer").nth(2)).toHaveAttribute("data-fate", "kept");
|
||||
await ed.scrollIntoViewIfNeeded();
|
||||
await page.screenshot({ path: "test-results/renovation274-panel.png" });
|
||||
// Manuell: Beton abbrechen ⇒ neuer Beton neu; Undo.
|
||||
await ed.getByTestId("reno-pair-old-fate").nth(2).selectOption("demolish");
|
||||
await expect(ed.getByTestId("reno-pair-new-layer").nth(2)).toHaveAttribute("data-fate", "new");
|
||||
await blurFocus(page);
|
||||
await page.keyboard.press("ControlOrMeta+z");
|
||||
await expect(ed.getByTestId("reno-pair-new-layer").nth(2)).toHaveAttribute("data-fate", "kept");
|
||||
|
||||
// Umbauplan: Rot im Grundriss (neue Schichten der Südwand und Anbau).
|
||||
await panel.getByTestId("reno-filter-umbauplan").click();
|
||||
await expect.poll(async () => Object.keys(await fills())).toContain(RED);
|
||||
|
||||
// Sanierungstyp für „Aussenwand 34.5 cm“ anlegen, alle Wände vom Typ sanieren (ein Undo-Schritt).
|
||||
await san.getByTestId("reno-create-type").selectOption("aw");
|
||||
await san.getByTestId("reno-create").click();
|
||||
await expect(san.getByTestId("reno-pair")).toHaveCount(2);
|
||||
const pair = san.getByTestId("reno-pair").filter({ hasText: "Aussenwand 34.5 cm" });
|
||||
await pair.getByTestId("reno-pair-renovate-all").click();
|
||||
await expect.poll(async () => Object.values((await ren()).buildUp).filter((v) => v === "type").length).toBe(8);
|
||||
await expect(san.getByTestId("reno-sanierung-count")).toHaveText("Sanierte Bauteile: 8");
|
||||
await blurFocus(page);
|
||||
await page.keyboard.press("ControlOrMeta+z");
|
||||
await expect.poll(async () => Object.values((await ren()).buildUp).filter((v) => v === "type").length).toBe(1);
|
||||
});
|
||||
@@ -723,6 +723,23 @@ pub struct WallType {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub layers: Vec<Layer>,
|
||||
/// [274] Sanierungstyp (Wandtyp-Id): neuer Aufbau aller als „saniert“ markierten Wände dieses (Bestands-)Typs.
|
||||
#[serde(rename = "renovationTarget", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub renovation_target: Option<String>,
|
||||
/// [274] Bezugsseite der Sanierung (fehlt ⇒ innen).
|
||||
#[serde(rename = "renovationSide", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub renovation_side: Option<RenovationSide>,
|
||||
/// [274] Manuelle Zuordnung je Schicht dieses Bestandstyps (Bestand/Abbruch, fehlt/„auto“ = automatisch); gilt
|
||||
/// für das Paar mit `renovationTarget`.
|
||||
#[serde(rename = "renovationOld", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub renovation_old: Option<Vec<LayerRenovation>>,
|
||||
/// [274] Manuelle Zuordnung je Schicht des Sanierungstyps (Bestand/Neu, fehlt/„auto“ = automatisch).
|
||||
#[serde(rename = "renovationNew", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub renovation_new: Option<Vec<LayerRenovation>>,
|
||||
#[serde(flatten)]
|
||||
#[ts(skip)]
|
||||
pub extra: Extra,
|
||||
@@ -2977,11 +2994,55 @@ pub struct Renovation {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub phase: Option<String>,
|
||||
/// [274] Saniert: die Wand bekommt den Sanierungstyp ihres Wandtyps (`WallType.renovationTarget`) als neuen
|
||||
/// Aufbau; der bisherige Aufbau ist der Bestand. Wirkt nur beim Status Bestand; Etappe der Sanierung = `phase`.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub renovated: Option<bool>,
|
||||
/// [274] Ausnahme: anderer neuer Aufbau als der Sanierungstyp des Wandtyps (Wandtyp-Id); setzt „saniert“ voraus.
|
||||
#[serde(rename = "newTypeId", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub new_type_id: Option<String>,
|
||||
#[serde(flatten)]
|
||||
#[ts(skip)]
|
||||
pub extra: Extra,
|
||||
}
|
||||
|
||||
/// [274] Bezugsseite einer Sanierung (bleibt stehen, von ihr her werden die Schichten verglichen).
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize, TS)]
|
||||
pub enum RenovationSide {
|
||||
/// Innen (Vorgabe, Aussendämmung): Kern an gleicher Stelle, die Aussenseite verschiebt sich.
|
||||
#[default]
|
||||
#[serde(rename = "inside")]
|
||||
Inside,
|
||||
/// Aussen (Innendämmung): die Fassade bleibt, die Innenseite verschiebt sich.
|
||||
#[serde(rename = "outside")]
|
||||
Outside,
|
||||
#[serde(other)]
|
||||
#[ts(skip)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
/// [274] Zuordnung einer Schicht im Typ-Paar Bestand → Sanierung (manuell statt automatisch).
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize, TS)]
|
||||
pub enum LayerRenovation {
|
||||
/// Automatisch: gleicher Baustoff, gleiche Dicke und gleiche Lage von der Bezugsseite ⇒ Bestand.
|
||||
#[default]
|
||||
#[serde(rename = "auto")]
|
||||
Auto,
|
||||
#[serde(rename = "existing")]
|
||||
Existing,
|
||||
/// Nur im Bestandstyp: die Schicht wird abgebrochen.
|
||||
#[serde(rename = "demolish")]
|
||||
Demolish,
|
||||
/// Nur im Sanierungstyp: die Schicht ist neu.
|
||||
#[serde(rename = "new")]
|
||||
New,
|
||||
#[serde(other)]
|
||||
#[ts(skip)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
/// [271] Eine Bau-Etappe (Reihenfolge = Reihenfolge der Liste).
|
||||
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize, TS)]
|
||||
#[serde(default)]
|
||||
|
||||
@@ -715,13 +715,13 @@ pub fn axo_plan_buf(p: &Project, args: &[f64], text: &str) -> Result<Vec<u8>, St
|
||||
let ren = crate::renovation::View::with(p, v.get("renovation").and_then(|x| x.as_str()), v.get("renovationPhase").and_then(|x| x.as_str()), &[], &opts);
|
||||
// [272] Bearbeitungsvariante der Bildschirm-Ansicht (`designOptionEdit`).
|
||||
let ren = crate::renovation::View::editing(ren, p, crate::design_options::parse_edit(p, v.get("designOptionEdit"))).map(|r| r.resolve(p));
|
||||
let filtered = ren.as_ref().filter(|r| !r.hidden.is_empty()).map(|r| crate::renovation::without_hidden(p, &r.hidden));
|
||||
let filtered = ren.as_ref().and_then(|r| r.project(p));
|
||||
let p = filtered.as_ref().unwrap_or(p);
|
||||
let Some(a) = AxoArgs::parse(p, &v) else { return Ok(w.finish()) };
|
||||
if let Some((mut prims, bounds)) = axo_primitives(p, &a, mono)? {
|
||||
if let Some(r) = ren.as_ref().filter(|r| !r.styled.is_empty()) {
|
||||
if let Some(r) = ren.as_ref().filter(|r| !r.styled.is_empty() || !r.faces.is_empty()) {
|
||||
for q in prims.iter_mut() {
|
||||
let Some(st) = crate::renovation::prim_element(q).and_then(|id| r.styled.get(id)) else { continue };
|
||||
let Some(st) = crate::renovation::prim_element(q).and_then(|id| r.surface(id)) else { continue };
|
||||
if let Primitive::Polygon { fill, stroke, .. } = q {
|
||||
*fill = st.fill.clone();
|
||||
*stroke = st.fill.clone();
|
||||
|
||||
@@ -149,6 +149,14 @@ impl PlanArgs {
|
||||
/// [256] Rand (Papier-mm) um Masszahlen, Texte und Höhenkoten, vor dem die Hilfslinien aussetzen ([`Ctx::cut_at_gaps`]).
|
||||
pub const LINE_GAP_MM: f64 = 0.5;
|
||||
|
||||
/// [274] Projekt einer Plan-Erzeugung: sanierte Wände mit dem Aufbau, den der Umbaufilter zeigt (sonst geliehen).
|
||||
pub fn plan_project<'p>(p: &'p Project, a: &PlanArgs) -> std::borrow::Cow<'p, Project> {
|
||||
if !crate::renovation::build_up::any(p) {
|
||||
return std::borrow::Cow::Borrowed(p);
|
||||
}
|
||||
crate::renovation::with_build_ups(p, crate::renovation::View::for_level(p, &a.floor, a.renovation.as_deref(), a.renovation_phase.as_deref(), &a.design_options))
|
||||
}
|
||||
|
||||
/// Gemeinsamer Zustand einer Plan-Erzeugung.
|
||||
pub struct Ctx<'a> {
|
||||
pub p: &'a Project,
|
||||
@@ -1932,6 +1940,8 @@ fn body_cut_ring(s: &ExtrudedSolid, zb: f64, cut: f64) -> Option<Vec<Vec2>> {
|
||||
|
||||
/// Abfrage `planDomains`: Domänen als Listen (Tests); die 2D-Zeichnungen in `drawings`.
|
||||
pub fn plan_domains(p: &Project, a: &PlanArgs) -> Result<DomainPrims, String> {
|
||||
let pv = plan_project(p, a);
|
||||
let p = pv.as_ref();
|
||||
let c = Ctx::new(p, a);
|
||||
let mut out = DomainPrims::default();
|
||||
let mut bounds = Bounds::new();
|
||||
@@ -2131,6 +2141,8 @@ pub const GROUPS: [&str; 12] = ["under", "ceilings", "roofs", "rooms", "walls",
|
||||
/// Reihenfolge [`GROUPS`], Ausmass im Kopf, Inhalts-Hashes für den GPU-Chunk-Cache. Die
|
||||
/// 2D-Zeichnungen schreiben direkt in den Puffer (keine Primitiv-Liste dazwischen).
|
||||
pub fn plan_domains_buf(p: &Project, a: &PlanArgs) -> Result<Vec<u8>, String> {
|
||||
let pv = plan_project(p, a);
|
||||
let p = pv.as_ref();
|
||||
let c = Ctx::new(p, a);
|
||||
let mut d = DomainPrims::default();
|
||||
let mut bounds = Bounds::new();
|
||||
@@ -2270,6 +2282,8 @@ impl PlanOut {
|
||||
pub fn plan_domains_cached(p: &Project, revs: &crate::document::Revs, cache: &mut super::cache::PlanCache, a: &PlanArgs, have: &HashSet<u64>) -> Result<PlanOut, String> {
|
||||
use super::cache::NOT_FOR_DRAWINGS;
|
||||
use crate::plan::buf::Writer;
|
||||
let pv = plan_project(p, a);
|
||||
let p = pv.as_ref();
|
||||
let c = Ctx::new(p, a);
|
||||
let cc = cache.context(a, revs.epoch());
|
||||
cc.trim();
|
||||
|
||||
@@ -105,12 +105,12 @@ fn surf_ov(p: &Project, v: RuleView, kind: &str, code: &str, name: Option<&str>,
|
||||
/// [271] Umbau-Farben je Ansichtsfläche (Füllung ohne Muster, Kanten in der Linienfarbe, gestrichelt bei Abbruch); gehen
|
||||
/// den Regeln vor.
|
||||
pub(super) fn renovation_faces(faces: &mut [Face], r: &crate::renovation::Resolved) {
|
||||
if r.styled.is_empty() {
|
||||
if r.styled.is_empty() && r.faces.is_empty() {
|
||||
return;
|
||||
}
|
||||
let mut memo: HashMap<String, Rc<SurfOv>> = HashMap::new();
|
||||
for f in faces.iter_mut().filter(|f| !f.id.is_empty()) {
|
||||
let Some(st) = r.styled.get(&f.id) else { continue };
|
||||
let Some(st) = r.surface(&f.id) else { continue };
|
||||
let o = memo.entry(f.id.clone()).or_insert_with(|| {
|
||||
Rc::new(SurfOv { fill: Some(st.fill.clone()), no_pattern: true, hatch: None, outline: None, color: st.line.clone(), lineweight: None, dash: st.dashed.then(|| Some(crate::renovation::DEMOLISH_DASH.to_vec())), hide: false })
|
||||
});
|
||||
|
||||
@@ -1035,8 +1035,10 @@ pub fn elevation_plan_buf(p: &Project, args: &[f64], text: &str) -> Result<Vec<u
|
||||
let on: Option<HashSet<String>> = v.get("rules").and_then(|a| a.as_array()).map(|a| a.iter().filter_map(|s| s.as_str().map(String::from)).collect());
|
||||
// [271] Umbaufilter (angefragt, sonst der der Ebene): Ausgeblendetes fehlt (verdeckt nichts), Farben auf die Flächen.
|
||||
let ren = super::section::query::renovation_view(p, &v, &level).map(|r| r.resolve(p)).filter(|r| !r.is_empty());
|
||||
let filtered = ren.as_ref().filter(|r| !r.hidden.is_empty()).map(|r| crate::renovation::without_hidden(p, &r.hidden));
|
||||
let orig = p;
|
||||
let filtered = ren.as_ref().and_then(|r| r.project(p));
|
||||
// [271] Das Projekt mit allem (Quelle der Ersatzstücke der Öffnungen), [274] sanierte Wände mit dem gezeigten Aufbau.
|
||||
let swapped = ren.as_ref().filter(|r| r.swaps()).and_then(|r| crate::renovation::apply(p, Some(r), &HashSet::new()));
|
||||
let orig = swapped.as_ref().unwrap_or(p);
|
||||
let p = filtered.as_ref().unwrap_or(p);
|
||||
if let Some((mut prims, bounds)) = elevation_primitives_ren(p, &level, shadows, mono, &vis, scale, on.as_ref(), ren.as_ref(), orig)? {
|
||||
super::extras::scale_line_weights(p, scale, &mut prims);
|
||||
|
||||
@@ -314,21 +314,31 @@ impl CutRules {
|
||||
/// [271] Umbau-Farben als Override der Schnittflächen: Füllung der Farbe, ohne Muster, Umriss gestrichelt bei
|
||||
/// Abbruch. Geht den Regeln vor (der Umbaufilter ist die Aussage des Plans).
|
||||
pub fn with_renovation(mut self, out: &Output, r: Option<&crate::renovation::Resolved>) -> CutRules {
|
||||
let Some(r) = r.filter(|r| !r.styled.is_empty()) else { return self };
|
||||
// Projektionslinien: Besitzer mit Umbau-Farbe (nur Linienfarbe und Strichmuster, die Fläche gibt es nicht).
|
||||
let Some(r) = r.filter(|r| !r.styled.is_empty() || !r.walls.is_empty()) else { return self };
|
||||
// Projektionslinien: Besitzer mit Umbau-Farbe (nur Linienfarbe und Strichmuster, die Fläche gibt es nicht);
|
||||
// [274] sanierte Wände in der Farbe ihrer äussersten Schicht.
|
||||
for (k, id) in &out.edge_ids {
|
||||
if let Some(st) = r.styled.get(id) {
|
||||
if let Some(st) = r.styled.get(id).or_else(|| r.faces.get(id)) {
|
||||
if st.line.is_some() || st.dashed {
|
||||
self.edge.insert(*k, st.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
if out.cuts.iter().all(|c| c.source_id.as_ref().is_none_or(|s| !r.styled.contains_key(s))) {
|
||||
// [274] Sanierte Wand: Farbe je Schicht (Schicht-Index im gezeigten Aufbau).
|
||||
let style_of = |c: &Cut| -> Option<crate::renovation::Style> {
|
||||
let s = c.source_id.as_ref()?;
|
||||
if let Some(st) = r.styled.get(s) {
|
||||
return Some(st.clone());
|
||||
}
|
||||
let look = r.walls.get(s).filter(|_| c.kind == Kind::Wall)?;
|
||||
look.layer_style(c.layer_index.or_else(|| c.component_id.as_deref().and_then(|id| look.pieces.iter().position(|q| q.layer.component_id == id)))?)
|
||||
};
|
||||
if out.cuts.iter().all(|c| style_of(c).is_none()) {
|
||||
return self;
|
||||
}
|
||||
self.ov.resize(out.cuts.len(), None);
|
||||
for (i, c) in out.cuts.iter().enumerate() {
|
||||
let Some(st) = c.source_id.as_ref().and_then(|s| r.styled.get(s)) else { continue };
|
||||
let Some(st) = style_of(c) else { continue };
|
||||
let prev = self.ov[i].take();
|
||||
self.ov[i] = Some(CutOv {
|
||||
fill: Some(st.fill.clone()),
|
||||
|
||||
@@ -78,9 +78,15 @@ pub fn section_plan_buf(p: &Project, args: &[f64], text: &str) -> Result<Vec<u8>
|
||||
if let Some(r) = &ren {
|
||||
hidden_ids.extend(r.hidden.iter().cloned());
|
||||
}
|
||||
let filtered = (!hidden_ids.is_empty()).then(|| crate::renovation::without_hidden(p, &hidden_ids));
|
||||
// [271] Das Projekt mit allem (die zugemauerte Öffnung fehlt in `p` unten): Quelle der Ersatzstücke der Öffnungen.
|
||||
let orig = p;
|
||||
let mut filtered = (!hidden_ids.is_empty()).then(|| crate::renovation::without_hidden(p, &hidden_ids));
|
||||
// [274] Sanierte Wände mit dem Aufbau, den der Filter zeigt.
|
||||
if let Some(r) = ren.as_ref().filter(|r| r.swaps()) {
|
||||
r.swap_build_ups(filtered.get_or_insert_with(|| p.clone()));
|
||||
}
|
||||
// [271] Das Projekt mit allem (die zugemauerte Öffnung fehlt in `p` unten): Quelle der Ersatzstücke der Öffnungen;
|
||||
// [274] sanierte Wände auch hier mit dem gezeigten Aufbau.
|
||||
let swapped = ren.as_ref().filter(|r| r.swaps()).and_then(|r| crate::renovation::apply(p, Some(r), &HashSet::new()));
|
||||
let orig = swapped.as_ref().unwrap_or(p);
|
||||
let p = filtered.as_ref().unwrap_or(p);
|
||||
// [184] Öffnungen mit Detailgrad grob (Strich im Schnitt): Wandschnitt an Sturz/Brüstung flach. Das ändert die
|
||||
// Schnittflächen, gehört also in den Schlüssel (unten) und in die Sichtbarkeit.
|
||||
|
||||
@@ -270,7 +270,12 @@ fn wall_poche(c: &Ctx, out: &mut Vec<Primitive>, e: &EffWall, gaps: &[(f64, f64)
|
||||
let layer_mm = LAYER_JOINT_MM * detail.layer_factor();
|
||||
let thick: Vec<f64> = wt.layers.iter().map(|l| l.thickness).collect();
|
||||
// [33] Overrides auf Schichten (Füllung, Schraffur, Umriss); ohne aktive Regel lauter leere Aktionen.
|
||||
let lov = super::overrides::layer_actions(p, c.rule_view(), "wall", &w.category_code, Some(&wt.name), &wt.layers);
|
||||
let mut lov = super::overrides::layer_actions(p, c.rule_view(), "wall", &w.category_code, Some(&wt.name), &wt.layers);
|
||||
// [274] Sanierte Wand: Umbau-Farben je Schicht (Füllung ohne Muster), über den Regeln.
|
||||
let renovated = c.renovation().and_then(|r| r.walls.get(&w.id)).filter(|l| l.type_id == w.wall_type_id && l.pieces.len() == wt.layers.len());
|
||||
if let Some(look) = renovated {
|
||||
look.layer_actions(&mut lov);
|
||||
}
|
||||
let solid = c.solid_cut();
|
||||
// [140] Ab 1:100 (und „grob") schwarze Sammelfläche mit Umriss, ohne Schichten (`style::solid_cut`) —
|
||||
// [33] ausser eine Regel stylt eine Schicht: dann Schichten, die übrigen schwarz ohne Fugen dazwischen.
|
||||
@@ -304,6 +309,10 @@ fn wall_poche(c: &Ctx, out: &mut Vec<Primitive>, e: &EffWall, gaps: &[(f64, f64)
|
||||
};
|
||||
// Fuge zwischen Schicht `a` und `b` weglassen: beide schwarz, gleicher Override ohne Muster, oder Umriss aus.
|
||||
let skip_joint = |a: usize, b: Option<usize>| {
|
||||
// [274] Sanierte Wand: Schichtfugen bleiben (Grenzen zwischen Bestand, Abbruch und Neu, Kontur im Umbauplan).
|
||||
if renovated.is_some() && b.is_some() && !(solid && !layered_solid) {
|
||||
return false;
|
||||
}
|
||||
let (oa, ob) = (ov_of(a), b.and_then(ov_of));
|
||||
let styled = |o: Option<&super::overrides::LayerActions>| o.is_some_and(|o| o.styles());
|
||||
(layered_solid && !styled(oa) && b.is_none_or(|_| !styled(ob)))
|
||||
@@ -1250,6 +1259,10 @@ pub fn plan_walls(c: &Ctx, reference_lines: bool, out: &mut Vec<Primitive>, boun
|
||||
// [271] Umbaufilter: Wand und Öffnungen in ihrer Umbau-Farbe; Ersatzstücke neuer (Abbruch-Stück) bzw.
|
||||
// zugemauerter Öffnungen (Ausfachung) — über der geschlossenen Wand, sonst unter dem Öffnungssymbol.
|
||||
if let Some(r) = c.renovation() {
|
||||
// [274] Sanierte Wand: Kanten der Abbruch-Schichten gestrichelt, Kontur abgebrochener Schichten im Umbauplan.
|
||||
if let Some(look) = r.walls.get(&w.id).filter(|l| l.type_id == w.wall_type_id && arc_wall.is_none()) {
|
||||
crate::renovation::build_up::dash_edges(look, out, out_start, &w.id, w.start, w.end, wr.ref_off);
|
||||
}
|
||||
crate::renovation::restyle_range(r, out, out_start, Some(&w.id));
|
||||
if zone == Zone::Cut && !cut.covered {
|
||||
for pa in r.patches.iter().filter(|pa| pa.wall_id == w.id) {
|
||||
|
||||
@@ -91,6 +91,9 @@ 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)),
|
||||
// [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)),
|
||||
// [209] Kostenschätzung grob; `costDefaults` mit Text „gf“/„gv“ = Beispielwerte der Methode.
|
||||
("costEstimate", _) => json(&crate::kosten::estimate(&renovation_state(p, text))),
|
||||
// [272] Varianten: Sätze mit Varianten und Zahl der Elemente; Vergleich der Kennzahlen/Kosten je Kombination
|
||||
@@ -126,7 +129,10 @@ pub fn run(p: &Project, name: &str, args: &[f64], text: &str) -> Result<String,
|
||||
let o: crate::cycles_scene::CyclesOptions = if text.trim().is_empty() { Default::default() } else { serde_json::from_str(text).map_err(|e| format!("cyclesScene: {e}"))? };
|
||||
// [271] Umbau-Farben nur auf Wunsch (`renovationColors`); Ausgeblendetes (Umbaufilter, Variante) fehlt immer.
|
||||
let styled: std::collections::HashMap<String, String> = if o.renovation_colors {
|
||||
crate::renovation::view_from_text(p, text).map(|v| v.resolve(p).styled.into_iter().map(|(k, s)| (k, s.fill)).collect()).unwrap_or_default()
|
||||
crate::renovation::view_from_text(p, text).map(|v| {
|
||||
let r = v.resolve(p);
|
||||
r.faces.into_iter().chain(r.styled).map(|(k, s)| (k, s.fill)).collect()
|
||||
}).unwrap_or_default()
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
@@ -202,7 +208,7 @@ pub fn run(p: &Project, name: &str, args: &[f64], text: &str) -> Result<String,
|
||||
// [271] Umbaufilter (`text` = `{"renovation": …, "renovationPhase": …}`): Ausgeblendetes fehlt, Farben je Status.
|
||||
// [272] Dazu die Bearbeitungsvariante des 3D-Fensters (`designOptionEdit`, grau ausserhalb).
|
||||
let ren = crate::renovation::screen_view_from_text(p, text).map(|v| v.resolve(p));
|
||||
let filtered = ren.as_ref().filter(|r| !r.hidden.is_empty()).map(|r| crate::renovation::without_hidden(p, &r.hidden));
|
||||
let filtered = ren.as_ref().and_then(|r| r.project(p));
|
||||
let p = filtered.as_ref().unwrap_or(p);
|
||||
let (detail, rails) = model3d_mv(p, text, args[1]);
|
||||
let mut parts = model3d::parts_filtered(p, args[0] != 0.0, detail, args[2] != 0.0, &filter)?;
|
||||
|
||||
@@ -21,6 +21,16 @@
|
||||
//! Vorgabe die Hauptvariante) gehört mit in die [`View`]: Elemente anderer Varianten sind ausgeblendet wie
|
||||
//! Ausgeblendetes des Umbaufilters (auch 2D-Zeichnungen). Darum gibt es eine `View` auch ohne Umbaufilter, sobald
|
||||
//! das Projekt Elemente in Varianten hat.
|
||||
//! - **Sanierung je Schicht** ([274], [`build_up`]): typbasiert. Ein Bestands-Wandtyp trägt seinen Sanierungstyp
|
||||
//! (`WallType.renovationTarget`, dazu Bezugsseite `renovationSide` und die manuelle Zuordnung je Schicht
|
||||
//! `renovationOld`/`renovationNew`); eine Bestandswand mit `renovation.renovated` bekommt ihn als neuen Aufbau
|
||||
//! (Ausnahme je Wand: `renovation.newTypeId`). Zuordnung von der Bezugsseite her (Vorgabe innen: Kern bleibt, die
|
||||
//! Aussenseite verschiebt sich; aussen = Innendämmung): gleicher Baustoff, gleiche Dicke und gleiche Lage ⇒ Bestand,
|
||||
//! nur alt ⇒ Abbruch, nur neu ⇒ Neu; manuell je Schicht überschreibbar (z. B. ersetzter Baustoff gleicher Art).
|
||||
//! Der Filter wählt den gezeigten Aufbau (Abbruch sichtbar, Neu nicht ⇒ alt; Neu sichtbar, Abbruch nicht ⇒ neu;
|
||||
//! beide ⇒ überlagert in Teilschichten, Abbruch als gestrichelte Kontur über der Neu-Füllung). Die Wand-Achse
|
||||
//! bleibt; die Ableitungen sehen eine Ersatzwand mit dem gezeigten Aufbau ([`Resolved::project`],
|
||||
//! [`with_build_ups`]), die Farben gelten je Schicht ([`WallLook`]). Ohne Umbaufilter gilt der Bestandstyp.
|
||||
|
||||
use crate::model::*;
|
||||
use crate::plan::prim::Primitive;
|
||||
@@ -322,6 +332,27 @@ impl View {
|
||||
for w in &p.walls {
|
||||
let s = self.state(w.renovation.as_ref());
|
||||
wall_state.insert(w.id.as_str(), s);
|
||||
// [274] Sanierte Bestandswand: Aufbau und Farben je Schicht statt einer Farbe für die ganze Wand.
|
||||
if s == Some(RenovationStatus::Existing) {
|
||||
if let Some(look) = build_up::look(self, p, w) {
|
||||
if let Some(Treat::Style(st)) = look.treat.first() {
|
||||
out.faces.insert(w.id.clone(), st.clone());
|
||||
}
|
||||
if look.pieces.is_empty() {
|
||||
out.hidden.insert(w.id.clone());
|
||||
}
|
||||
if look.new_type.is_none() && w.extra.0.contains_key(build_up::ORIGIN) {
|
||||
out.restore = true;
|
||||
}
|
||||
if let Some(t) = &look.new_type {
|
||||
if !out.wall_types.iter().any(|x| x.id == t.id) {
|
||||
out.wall_types.push(t.clone());
|
||||
}
|
||||
}
|
||||
out.walls.insert(w.id.clone(), look);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
put(&w.id, self.treat_state(s), out);
|
||||
}
|
||||
for o in p.openings.iter().flatten() {
|
||||
@@ -362,10 +393,10 @@ impl View {
|
||||
}
|
||||
// [271] 2D-Zeichnungen (Möbel, Symbole und Elemente mit ausdrücklichem Status) und Bäume ([149]: Status = Umbau-Status).
|
||||
for x in p.drawings2d.iter().filter(|d| drawing_takes_part(d)) {
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), &mut out);
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), out);
|
||||
}
|
||||
for t in p.trees.iter().flatten() {
|
||||
put(&t.id, self.treat(Some(&tree_renovation(t))), &mut out);
|
||||
put(&t.id, self.treat(Some(&tree_renovation(t))), out);
|
||||
}
|
||||
// Räume: nur sichtbar oder nicht (ein Raum ist kein Bauteil, er bekommt keine Umbau-Farbe).
|
||||
for x in p.rooms.iter().flatten() {
|
||||
@@ -420,11 +451,100 @@ pub struct Resolved {
|
||||
/// Elemente mit Umbau-Farbe (id → Farbe).
|
||||
pub styled: HashMap<String, Style>,
|
||||
pub patches: Vec<Patch>,
|
||||
/// [274] Sanierte Wände (id → gezeigter Aufbau mit Farben je Schicht).
|
||||
pub walls: HashMap<String, WallLook>,
|
||||
/// [274] Wandtypen der gezeigten Aufbauten (neu bzw. überlagert), in [`Self::project`] ergänzt.
|
||||
pub wall_types: Vec<WallType>,
|
||||
/// [274] Ansichtsflächen sanierter Wände (Ansicht, Axo, 3D): Farbe der äussersten Schicht.
|
||||
pub faces: HashMap<String, Style>,
|
||||
/// [274] Eine schon umgestellte Ersatzwand muss auf den Bestand zurück ([`Self::swap_build_ups`]).
|
||||
pub restore: bool,
|
||||
}
|
||||
|
||||
impl Resolved {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.hidden.is_empty() && self.styled.is_empty() && self.patches.is_empty()
|
||||
self.hidden.is_empty() && self.styled.is_empty() && self.patches.is_empty() && self.walls.is_empty()
|
||||
}
|
||||
|
||||
/// Umbau-Farbe einer Ansichtsfläche (Element-Farbe, sonst die der äussersten Schicht einer sanierten Wand).
|
||||
pub fn surface(&self, id: &str) -> Option<&Style> {
|
||||
self.styled.get(id).or_else(|| self.faces.get(id))
|
||||
}
|
||||
|
||||
/// Ersetzt der Filter Aufbauten (Wände mit anderem gezeigtem Aufbau)?
|
||||
pub fn swaps(&self) -> bool {
|
||||
self.restore || self.walls.values().any(|l| l.new_type.is_some())
|
||||
}
|
||||
|
||||
/// Das Projekt dieser Darstellung: ohne Ausgeblendetes, sanierte Wände mit dem gezeigten Aufbau; `None` = unverändert.
|
||||
pub fn project(&self, p: &Project) -> Option<Project> {
|
||||
apply(p, Some(self), &self.hidden)
|
||||
}
|
||||
|
||||
/// Sanierte Wände im Projekt `q` auf den gezeigten Aufbau umstellen (Achse bleibt, Bezugsseite bleibt stehen).
|
||||
pub fn swap_build_ups(&self, q: &mut Project) {
|
||||
if !self.swaps() {
|
||||
return;
|
||||
}
|
||||
for w in q.walls.iter_mut() {
|
||||
let Some(look) = self.walls.get(&w.id) else { continue };
|
||||
if w.wall_type_id == look.type_id {
|
||||
continue;
|
||||
}
|
||||
let Some(t) = &look.new_type else {
|
||||
// Zeigt der Filter den Bestand, aber die Wand ist schon umgestellt: zurück auf den Ursprung.
|
||||
let (ty, off, line) = build_up::origin(w);
|
||||
(w.wall_type_id, w.reference_offset, w.reference_line) = (ty, off, line);
|
||||
w.extra.0.remove(build_up::ORIGIN);
|
||||
continue;
|
||||
};
|
||||
let (ty, off, line) = build_up::origin(w);
|
||||
(w.wall_type_id, w.reference_offset, w.reference_line) = (ty, off, line);
|
||||
// Ursprung merken: ein zweites Auflösen auf dem umgestellten Projekt ergibt dasselbe (`build_up::origin`).
|
||||
let orig = serde_json::json!({"type": w.wall_type_id, "refOffset": w.reference_offset, "refLine": w.reference_line});
|
||||
w.extra.0.insert(build_up::ORIGIN.to_string(), orig);
|
||||
w.wall_type_id = t.id.clone();
|
||||
w.reference_offset = Some(look.ref_offset);
|
||||
}
|
||||
for t in &self.wall_types {
|
||||
if !q.wall_types.iter().any(|x| x.id == t.id) {
|
||||
q.wall_types.push(t.clone());
|
||||
}
|
||||
}
|
||||
for c in self.walls.values().flat_map(|l| l.components.iter()) {
|
||||
if !q.components.iter().any(|x| x.id == c.id) {
|
||||
q.components.push(c.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [274] Projekt ohne `hidden` und mit den gezeigten Aufbauten von `r`; `None` = nichts zu ändern.
|
||||
pub fn apply(p: &Project, r: Option<&Resolved>, hidden: &HashSet<String>) -> Option<Project> {
|
||||
let swaps = r.is_some_and(|r| r.swaps());
|
||||
if hidden.is_empty() && !swaps {
|
||||
return None;
|
||||
}
|
||||
let mut q = if hidden.is_empty() { p.clone() } else { without_hidden(p, hidden) };
|
||||
if let Some(r) = r {
|
||||
r.swap_build_ups(&mut q);
|
||||
}
|
||||
Some(q)
|
||||
}
|
||||
|
||||
/// [274] Projekt einer Plan-Erzeugung mit den gezeigten Aufbauten (Ausgeblendetes bleibt, das blendet der Plan selbst
|
||||
/// aus); ohne sanierte Wände geliehen.
|
||||
pub fn with_build_ups<'a>(p: &'a Project, v: Option<View>) -> std::borrow::Cow<'a, Project> {
|
||||
if !build_up::any(p) {
|
||||
return std::borrow::Cow::Borrowed(p);
|
||||
}
|
||||
match v.map(|v| v.resolve(p)).filter(|r| r.swaps()) {
|
||||
Some(r) => {
|
||||
let mut q = p.clone();
|
||||
r.swap_build_ups(&mut q);
|
||||
std::borrow::Cow::Owned(q)
|
||||
}
|
||||
None => std::borrow::Cow::Borrowed(p),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,14 +577,10 @@ pub fn project_for_text<'a>(p: &'a Project, text: &str) -> std::borrow::Cow<'a,
|
||||
/// Das Projekt ohne das in `v` Ausgeblendete (ohne Wirkung geliehen).
|
||||
pub fn filtered(p: &Project, v: Option<View>) -> std::borrow::Cow<'_, Project> {
|
||||
match v {
|
||||
Some(v) => {
|
||||
let r = v.resolve(p);
|
||||
if r.hidden.is_empty() {
|
||||
std::borrow::Cow::Borrowed(p)
|
||||
} else {
|
||||
std::borrow::Cow::Owned(without_hidden(p, &r.hidden))
|
||||
}
|
||||
}
|
||||
Some(v) => match v.resolve(p).project(p) {
|
||||
Some(q) => std::borrow::Cow::Owned(q),
|
||||
None => std::borrow::Cow::Borrowed(p),
|
||||
},
|
||||
None => std::borrow::Cow::Borrowed(p),
|
||||
}
|
||||
}
|
||||
@@ -472,14 +588,10 @@ pub fn filtered(p: &Project, v: Option<View>) -> std::borrow::Cow<'_, Project> {
|
||||
/// Das Projekt im Zustand eines Filters (`filter`: Id/Name, `phase`: Etappe); ohne gültigen Filter unverändert.
|
||||
pub fn project_in_state<'a>(p: &'a Project, filter: Option<&str>, phase: Option<&str>) -> std::borrow::Cow<'a, Project> {
|
||||
match View::new(p, filter, phase) {
|
||||
Some(v) => {
|
||||
let r = v.resolve(p);
|
||||
if r.hidden.is_empty() {
|
||||
std::borrow::Cow::Borrowed(p)
|
||||
} else {
|
||||
std::borrow::Cow::Owned(without_hidden(p, &r.hidden))
|
||||
}
|
||||
}
|
||||
Some(v) => match v.resolve(p).project(p) {
|
||||
Some(q) => std::borrow::Cow::Owned(q),
|
||||
None => std::borrow::Cow::Borrowed(p),
|
||||
},
|
||||
None => std::borrow::Cow::Borrowed(p),
|
||||
}
|
||||
}
|
||||
@@ -577,7 +689,7 @@ pub fn restyle_linework(prims: &mut Vec<Primitive>, from: usize, st: &Style, fil
|
||||
if from >= prims.len() {
|
||||
return;
|
||||
}
|
||||
let st = Style { fill: st.fill.clone(), line: Some(st.line.clone().unwrap_or_else(|| st.fill.clone())), dashed: st.dashed };
|
||||
let st = Style { fill: st.fill.clone(), line: Some(st.line.clone().unwrap_or_else(|| st.fill.clone())), dashed: st.dashed, ghost: st.ghost };
|
||||
let mut extra = Vec::new();
|
||||
for q in prims[from..].iter_mut() {
|
||||
restyle_with(q, &st, &mut extra, fill);
|
||||
@@ -708,10 +820,10 @@ pub fn screen_view_from_text(p: &Project, text: &str) -> Option<View> {
|
||||
|
||||
/// 3D: Teile in der Umbau-Farbe (Füllfarbe des Status) — Wände, Decken, Dächer, Stützen, Treppen, Körper.
|
||||
pub fn color_parts(p: &Project, parts: &mut crate::model3d::Parts, r: &Resolved) {
|
||||
if r.styled.is_empty() {
|
||||
if r.styled.is_empty() && r.faces.is_empty() {
|
||||
return;
|
||||
}
|
||||
let rgb = |id: &str| r.styled.get(id).map(|s| crate::style::hex_to_rgb(&s.fill, crate::style::WALL_RGB));
|
||||
let rgb = |id: &str| r.surface(id).map(|s| crate::style::hex_to_rgb(&s.fill, crate::style::WALL_RGB));
|
||||
for w in &mut parts.walls {
|
||||
if let Some(c) = rgb(&w.wall_id) {
|
||||
w.color = c;
|
||||
@@ -785,6 +897,510 @@ pub fn renovation_of<'a>(p: &'a Project, id: &str) -> Option<&'a Renovation> {
|
||||
p.drawings2d.iter().find(|d| d.id == id).and_then(|d| d.renovation.as_ref())
|
||||
}
|
||||
|
||||
/// [274] Sanierung je Schicht: Typ-Paar Bestand → Sanierungstyp, Zuordnung der Schichten, gezeigter Aufbau je Filter.
|
||||
pub mod build_up {
|
||||
use super::*;
|
||||
|
||||
/// Toleranz für gleiche Dicke/Lage (m).
|
||||
pub const TOL: f64 = 0.0005;
|
||||
/// Marke an einer umgestellten Ersatzwand: ursprünglicher Typ und Achslage ([`Resolved::swap_build_ups`]).
|
||||
pub const ORIGIN: &str = "~renovationOrigin";
|
||||
|
||||
/// Schicksal einer Schicht im Typ-Paar.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, serde::Serialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum Fate {
|
||||
/// Bleibt (Bestand).
|
||||
Kept,
|
||||
/// Nur im Bestandstyp: wird abgebrochen.
|
||||
Demolish,
|
||||
/// Nur im Sanierungstyp: neu.
|
||||
New,
|
||||
}
|
||||
|
||||
/// Zuordnung je Schicht (Indizes in Typ-Reihenfolge aussen → innen).
|
||||
#[derive(Clone, Debug, PartialEq, serde::Serialize)]
|
||||
pub struct Matched {
|
||||
pub old: Vec<Fate>,
|
||||
pub new: Vec<Fate>,
|
||||
}
|
||||
|
||||
fn thick(l: &Layer) -> f64 {
|
||||
if l.thickness.is_finite() && l.thickness > 0.0 {
|
||||
l.thickness
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
}
|
||||
|
||||
/// Gesamtdicke (unsinnige Dicken zählen 0).
|
||||
pub fn total(layers: &[Layer]) -> f64 {
|
||||
layers.iter().map(thick).sum()
|
||||
}
|
||||
|
||||
/// Lage je Schicht: Abstand der bezugsseitigen und der abgewandten Kante von der Bezugsseite.
|
||||
fn spans(layers: &[Layer], side: RenovationSide) -> Vec<(f64, f64)> {
|
||||
let n = layers.len();
|
||||
let mut out = vec![(0.0, 0.0); n];
|
||||
let mut d = 0.0;
|
||||
let order: Vec<usize> = if side == RenovationSide::Outside { (0..n).collect() } else { (0..n).rev().collect() };
|
||||
for i in order {
|
||||
out[i] = (d, d + thick(&layers[i]));
|
||||
d += thick(&layers[i]);
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Automatische Zuordnung: eine alte Schicht bleibt, wenn der neue Aufbau eine Schicht gleichen Baustoffs mit
|
||||
/// gleicher Lage und Dicke (von der Bezugsseite her) hat; sonst Abbruch. Neue Schichten ohne Gegenstück sind neu.
|
||||
/// Manuelle Zuordnung (`old_ov`/`new_ov`, je Schicht; „auto“ = automatisch) geht vor.
|
||||
pub fn match_layers(old: &[Layer], new: &[Layer], side: RenovationSide, old_ov: &[LayerRenovation], new_ov: &[LayerRenovation]) -> Matched {
|
||||
let (so, sn) = (spans(old, side), spans(new, side));
|
||||
let mut nf = vec![Fate::New; new.len()];
|
||||
let mut of = Vec::with_capacity(old.len());
|
||||
let mut pair_of: Vec<Option<usize>> = Vec::with_capacity(old.len());
|
||||
for (i, l) in old.iter().enumerate() {
|
||||
let hit = (0..new.len()).find(|&j| nf[j] == Fate::New && new[j].component_id == l.component_id && (so[i].0 - sn[j].0).abs() < TOL && (so[i].1 - sn[j].1).abs() < TOL);
|
||||
pair_of.push(hit);
|
||||
of.push(match hit {
|
||||
Some(j) => {
|
||||
nf[j] = Fate::Kept;
|
||||
Fate::Kept
|
||||
}
|
||||
None => Fate::Demolish,
|
||||
});
|
||||
}
|
||||
for (i, f) in of.iter_mut().enumerate() {
|
||||
match old_ov.get(i) {
|
||||
Some(LayerRenovation::Existing) => *f = Fate::Kept,
|
||||
Some(LayerRenovation::Demolish) => {
|
||||
// Das automatisch gepaarte Gegenstück ist dann neu (ausser es ist selbst manuell gesetzt).
|
||||
if let Some(j) = pair_of[i].filter(|&j| matches!(new_ov.get(j), None | Some(LayerRenovation::Auto))) {
|
||||
nf[j] = Fate::New;
|
||||
}
|
||||
*f = Fate::Demolish;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
for (j, f) in nf.iter_mut().enumerate() {
|
||||
match new_ov.get(j) {
|
||||
Some(LayerRenovation::Existing) => *f = Fate::Kept,
|
||||
Some(LayerRenovation::New) => {
|
||||
if let Some(i) = pair_of.iter().position(|x| *x == Some(j)).filter(|&i| matches!(old_ov.get(i), None | Some(LayerRenovation::Auto))) {
|
||||
of[i] = Fate::Demolish;
|
||||
}
|
||||
*f = Fate::New;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
Matched { old: of, new: nf }
|
||||
}
|
||||
|
||||
/// Art eines Teilstücks des gezeigten Aufbaus.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, serde::Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum Kind {
|
||||
Kept,
|
||||
Demolish,
|
||||
New,
|
||||
/// Neue Schicht, wo eine abgebrochene lag (Umbauplan: rot, Abbruch als gestrichelte Kontur darüber).
|
||||
NewOverDemolish,
|
||||
}
|
||||
|
||||
/// Eine Schicht des gezeigten Aufbaus mit Herkunft (Index im Bestands- bzw. Sanierungstyp).
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Piece {
|
||||
pub layer: Layer,
|
||||
pub kind: Kind,
|
||||
pub old: Option<usize>,
|
||||
pub new: Option<usize>,
|
||||
}
|
||||
|
||||
/// Welchen Aufbau eine Darstellung zeigt.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum Shown {
|
||||
/// Bestand samt Abbruch (Bestands-, Abbruchplan).
|
||||
Old,
|
||||
/// Bestand und Neu (Neubauplan, Endzustand).
|
||||
New,
|
||||
/// Beide überlagert (Umbauplan).
|
||||
Both,
|
||||
/// Nur was bleibt (eigener Filter ohne Abbruch und ohne Neu).
|
||||
Kept,
|
||||
}
|
||||
|
||||
/// Schichten des gezeigten Aufbaus in Typ-Reihenfolge (aussen → innen).
|
||||
pub fn pieces(old: &[Layer], new: &[Layer], m: &Matched, side: RenovationSide, shown: Shown) -> Vec<Piece> {
|
||||
let of = |i: usize| m.old.get(i).copied().unwrap_or(Fate::Demolish);
|
||||
let nf = |j: usize| m.new.get(j).copied().unwrap_or(Fate::New);
|
||||
let kind = |f: Fate| match f {
|
||||
Fate::Kept => Kind::Kept,
|
||||
Fate::Demolish => Kind::Demolish,
|
||||
Fate::New => Kind::New,
|
||||
};
|
||||
match shown {
|
||||
Shown::Old => return old.iter().enumerate().map(|(i, l)| Piece { layer: l.clone(), kind: kind(of(i)), old: Some(i), new: None }).collect(),
|
||||
Shown::Kept => return old.iter().enumerate().filter(|(i, _)| of(*i) == Fate::Kept).map(|(i, l)| Piece { layer: l.clone(), kind: Kind::Kept, old: Some(i), new: None }).collect(),
|
||||
Shown::New => return new.iter().enumerate().map(|(j, l)| Piece { layer: l.clone(), kind: kind(nf(j)), old: None, new: Some(j) }).collect(),
|
||||
Shown::Both => {}
|
||||
}
|
||||
// Überlagert: Teilstücke zwischen allen Schichtgrenzen beider Aufbauten, von der Bezugsseite her.
|
||||
let (so, sn) = (spans(old, side), spans(new, side));
|
||||
let mut cuts: Vec<f64> = so.iter().chain(sn.iter()).flat_map(|s| [s.0, s.1]).collect();
|
||||
cuts.sort_by(|a, b| a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Equal));
|
||||
cuts.dedup_by(|a, b| (*a - *b).abs() < TOL);
|
||||
let mut out: Vec<Piece> = Vec::new();
|
||||
for w in cuts.windows(2) {
|
||||
let (d0, d1) = (w[0], w[1]);
|
||||
if d1 - d0 < TOL {
|
||||
continue;
|
||||
}
|
||||
let mid = (d0 + d1) / 2.0;
|
||||
let oi = (0..old.len()).find(|&i| so[i].0 < mid && mid < so[i].1);
|
||||
let nj = (0..new.len()).find(|&j| sn[j].0 < mid && mid < sn[j].1);
|
||||
let (layer, k) = match (oi, nj) {
|
||||
(_, Some(j)) if nf(j) == Fate::Kept => (&new[j], Kind::Kept),
|
||||
(Some(i), Some(j)) => (&new[j], if of(i) == Fate::Demolish { Kind::NewOverDemolish } else { Kind::New }),
|
||||
(None, Some(j)) => (&new[j], Kind::New),
|
||||
(Some(i), None) => (&old[i], kind(of(i))),
|
||||
(None, None) => continue,
|
||||
};
|
||||
let mut layer = layer.clone();
|
||||
layer.thickness = d1 - d0;
|
||||
out.push(Piece { layer, kind: k, old: oi, new: nj });
|
||||
}
|
||||
if side != RenovationSide::Outside {
|
||||
out.reverse();
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Hat das Projekt sanierte Wände?
|
||||
pub fn any(p: &Project) -> bool {
|
||||
p.walls.iter().any(|w| w.renovation.as_ref().is_some_and(marked))
|
||||
}
|
||||
|
||||
/// Ist die Wand als saniert markiert?
|
||||
pub fn marked(r: &Renovation) -> bool {
|
||||
r.renovated == Some(true) || r.new_type_id.as_deref().is_some_and(|s| !s.trim().is_empty())
|
||||
}
|
||||
|
||||
/// Ursprünglicher Typ und Achslage (auch einer schon umgestellten Ersatzwand).
|
||||
pub fn origin(w: &Wall) -> (String, Option<f64>, Option<WallReferenceLine>) {
|
||||
if let Some(o) = w.extra.0.get(ORIGIN) {
|
||||
let t = o.get("type").and_then(|x| x.as_str()).unwrap_or(&w.wall_type_id).to_string();
|
||||
let off = o.get("refOffset").and_then(|x| x.as_f64());
|
||||
let line = o.get("refLine").and_then(|x| serde_json::from_value(x.clone()).ok());
|
||||
return (t, off, line);
|
||||
}
|
||||
(w.wall_type_id.clone(), w.reference_offset, w.reference_line)
|
||||
}
|
||||
|
||||
/// Typ-Paar einer sanierten Wand: Bestandstyp, Sanierungstyp, Bezugsseite, Zuordnung. `None` = nicht saniert, Typ
|
||||
/// fehlt, gleicher Typ oder ein Aufbau ohne Dicke.
|
||||
pub fn pair<'a>(p: &'a Project, w: &Wall) -> Option<(&'a WallType, &'a WallType, RenovationSide, Matched)> {
|
||||
let r = w.renovation.as_ref().filter(|r| marked(r))?;
|
||||
let (old_id, _, _) = origin(w);
|
||||
let old = p.wall_types.iter().find(|t| t.id == old_id)?;
|
||||
let target = r.new_type_id.as_deref().map(str::trim).filter(|s| !s.is_empty()).or(old.renovation_target.as_deref())?;
|
||||
type_pair(p, old, target)
|
||||
}
|
||||
|
||||
/// Typ-Paar Bestandstyp `old` → `target` mit Zuordnung (die manuelle gilt nur für den eingetragenen Sanierungstyp).
|
||||
pub fn type_pair<'a>(p: &'a Project, old: &'a WallType, target: &str) -> Option<(&'a WallType, &'a WallType, RenovationSide, Matched)> {
|
||||
let new = p.wall_types.iter().find(|t| t.id == target)?;
|
||||
if new.id == old.id || total(&old.layers) <= TOL || total(&new.layers) <= TOL {
|
||||
return None;
|
||||
}
|
||||
let side = match old.renovation_side {
|
||||
Some(RenovationSide::Outside) => RenovationSide::Outside,
|
||||
_ => RenovationSide::Inside,
|
||||
};
|
||||
let own = old.renovation_target.as_deref() == Some(target);
|
||||
let (oo, no) = if own { (old.renovation_old.clone().unwrap_or_default(), old.renovation_new.clone().unwrap_or_default()) } else { (Vec::new(), Vec::new()) };
|
||||
let m = match_layers(&old.layers, &new.layers, side, &oo, &no);
|
||||
Some((old, new, side, m))
|
||||
}
|
||||
|
||||
/// Gezeigter Aufbau einer sanierten Wand im Filter.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct WallLook {
|
||||
pub shown: Shown,
|
||||
pub pieces: Vec<Piece>,
|
||||
/// Darstellung je Schicht (gleich lang wie `pieces`).
|
||||
pub treat: Vec<Treat>,
|
||||
/// Wandtyp der Ersatzwand (`None` = der Bestandstyp bleibt).
|
||||
pub new_type: Option<WallType>,
|
||||
/// Typ, den die Wand in der Darstellung trägt.
|
||||
pub type_id: String,
|
||||
/// Achsversatz der Ersatzwand (`Wall.referenceOffset`): die Bezugsseite bleibt stehen.
|
||||
pub ref_offset: f64,
|
||||
/// Umbau-Farbe des Abbruchs, wenn der Filter ihn farbig zeigt (gestrichelte Kanten, Kontur im Umbauplan).
|
||||
pub demolish: Option<Style>,
|
||||
/// Hilfs-Bauteile der Schichten „Neu über Abbruch“ (Kopien des Baustoffs, in [`Resolved::project`] ergänzt).
|
||||
pub components: Vec<Component>,
|
||||
}
|
||||
|
||||
impl WallLook {
|
||||
/// Schicht-Aktionen (Füllung ohne Muster) der farbigen Schichten über `lov` (Index = Schicht des Typs).
|
||||
pub fn layer_actions(&self, lov: &mut Vec<crate::plan::overrides::LayerActions>) {
|
||||
if lov.len() < self.pieces.len() {
|
||||
lov.resize(self.pieces.len(), Default::default());
|
||||
}
|
||||
for (i, t) in self.treat.iter().enumerate() {
|
||||
if let Treat::Style(st) = t {
|
||||
lov[i].fill_color = Some(st.fill.clone());
|
||||
lov[i].hatch = Some("none".into());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Darstellung der Schicht `li` des gezeigten Aufbaus (Schnitt).
|
||||
pub fn layer_style(&self, li: usize) -> Option<Style> {
|
||||
match self.treat.get(li)? {
|
||||
Treat::Style(st) => {
|
||||
let mut st = st.clone();
|
||||
// Neu über Abbruch: die Kontur der abgebrochenen Schicht gestrichelt.
|
||||
if self.pieces[li].kind == Kind::NewOverDemolish && self.demolish.is_some() {
|
||||
st.dashed = true;
|
||||
}
|
||||
Some(st)
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn reference(off: Option<f64>, line: Option<WallReferenceLine>) -> crate::joins::Reference {
|
||||
use crate::joins::Reference;
|
||||
match (off, line) {
|
||||
(Some(v), _) => Reference::Offset(v),
|
||||
(None, Some(WallReferenceLine::Left)) => Reference::Left,
|
||||
(None, Some(WallReferenceLine::Right)) => Reference::Right,
|
||||
_ => Reference::Center,
|
||||
}
|
||||
}
|
||||
|
||||
/// Aufbau der Wand `w` im Filter `v` (`None` = nicht saniert).
|
||||
pub fn look(v: &View, p: &Project, w: &Wall) -> Option<WallLook> {
|
||||
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 tk = v.treat(w.renovation.as_ref());
|
||||
let shown = match (td != Treat::Hide, tn != Treat::Hide) {
|
||||
(true, false) => Shown::Old,
|
||||
(false, true) => Shown::New,
|
||||
(true, true) => Shown::Both,
|
||||
(false, false) => Shown::Kept,
|
||||
};
|
||||
let mut pieces = pieces(&old.layers, &new.layers, &m, side, shown);
|
||||
// Überlagert: neue Schichten über abgebrochenen bekommen ein eigenes (gleich aussehendes) Bauteil, damit
|
||||
// Schnitt und 3D sie nicht mit der übrigen neuen Schicht gleichen Baustoffs zusammenfassen — sonst fehlte dort die
|
||||
// Kontur der abgebrochenen Schicht.
|
||||
let mut components: Vec<Component> = Vec::new();
|
||||
for q in pieces.iter_mut().filter(|q| q.kind == Kind::NewOverDemolish) {
|
||||
let id = format!("{}~abbruch{}", q.layer.component_id, q.old.unwrap_or(0));
|
||||
if !components.iter().any(|c| c.id == id) {
|
||||
components.push(Component { id: id.clone(), ..p.component_or_fallback(&q.layer.component_id).clone() });
|
||||
}
|
||||
q.layer.component_id = id;
|
||||
}
|
||||
let treat = pieces
|
||||
.iter()
|
||||
.map(|q| match q.kind {
|
||||
Kind::Kept => tk.clone(),
|
||||
Kind::Demolish => td.clone(),
|
||||
Kind::New | Kind::NewOverDemolish => tn.clone(),
|
||||
})
|
||||
.collect();
|
||||
let (_, off, line) = origin(w);
|
||||
let t_old = total(&old.layers);
|
||||
let t_eff: f64 = pieces.iter().map(|q| thick(&q.layer)).sum();
|
||||
let r_old = crate::joins::reference_offset(reference(off, line), t_old);
|
||||
let ref_offset = if side == RenovationSide::Outside { r_old - t_old / 2.0 + t_eff / 2.0 } else { r_old + t_old / 2.0 - t_eff / 2.0 };
|
||||
let new_type = (shown != Shown::Old).then(|| {
|
||||
let tag = match shown {
|
||||
Shown::New => "neu",
|
||||
Shown::Both => "umbau",
|
||||
_ => "bleibt",
|
||||
};
|
||||
let name = if shown == Shown::New { new.name.clone() } else { format!("{} → {}", old.name, new.name) };
|
||||
WallType { id: format!("{}~{}~{}", old.id, new.id, tag), name, layers: pieces.iter().map(|q| q.layer.clone()).collect(), ..Default::default() }
|
||||
});
|
||||
let type_id = new_type.as_ref().map_or_else(|| old.id.clone(), |t| t.id.clone());
|
||||
let demolish = match td {
|
||||
Treat::Style(s) => Some(s),
|
||||
_ => None,
|
||||
};
|
||||
Some(WallLook { shown, pieces, treat, new_type, type_id, ref_offset: if ref_offset.is_finite() { ref_offset } else { 0.0 }, demolish, components })
|
||||
}
|
||||
|
||||
/// Grundriss: Kanten der Wand (Umriss, Fugen, Stirnseiten) in `prims[from..]` je Schicht stricheln — Kanten einer
|
||||
/// Abbruch-Schicht gestrichelt, im Umbauplan die Grenzen abgebrochener Schichten innerhalb einer neuen Schicht als
|
||||
/// gestrichelte Kontur in der Abbruch-Farbe. Nur gerade Wände (Frame `start`→`end`, Achsversatz `ref_off`).
|
||||
pub fn dash_edges(look: &WallLook, prims: &mut Vec<Primitive>, from: usize, wall_id: &str, start: Vec2, end: Vec2, ref_off: f64) {
|
||||
let Some(dem) = &look.demolish else { return };
|
||||
let (dx, dy) = (end.x - start.x, end.y - start.y);
|
||||
let len = (dx * dx + dy * dy).sqrt();
|
||||
if !(len > 1e-9) || from >= prims.len() {
|
||||
return;
|
||||
}
|
||||
let m = (-dy / len, dx / len);
|
||||
let n_of = |q: Vec2| (q.x - start.x) * m.0 + (q.y - start.y) * m.1;
|
||||
let t: f64 = look.pieces.iter().map(|q| thick(&q.layer)).sum();
|
||||
let mut bounds = vec![ref_off - t / 2.0];
|
||||
for q in &look.pieces {
|
||||
bounds.push(bounds[bounds.len() - 1] + thick(&q.layer));
|
||||
}
|
||||
let eps = 1e-6;
|
||||
let piece_at = |n: f64| (0..look.pieces.len()).find(|&k| bounds[k] < n && n < bounds[k + 1]);
|
||||
let dem_like = |k: Option<usize>| k.is_none_or(|k| look.pieces[k].kind == Kind::Demolish);
|
||||
let contour = Style { fill: dem.fill.clone(), line: Some(dem.line.clone().unwrap_or_else(|| dem.fill.clone())), dashed: true, ghost: false };
|
||||
// Stil eines Teilstücks (a, b) einer Kante; `None` = unverändert.
|
||||
let style_of = |na: f64, nb: f64| -> Option<&Style> {
|
||||
if (na - nb).abs() < eps {
|
||||
return match bounds.iter().position(|b| (b - na).abs() < eps) {
|
||||
Some(bi) => {
|
||||
let below = bi.checked_sub(1);
|
||||
let above = (bi < look.pieces.len()).then_some(bi);
|
||||
if dem_like(below) && dem_like(above) && (below.is_some() || above.is_some()) {
|
||||
Some(dem)
|
||||
} else {
|
||||
match (below.map(|k| &look.pieces[k]), above.map(|k| &look.pieces[k])) {
|
||||
(Some(a), Some(b)) if a.new.is_some() && a.new == b.new && a.old != b.old && (a.kind == Kind::NewOverDemolish || b.kind == Kind::NewOverDemolish) => Some(&contour),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
None => piece_at(na).filter(|&k| look.pieces[k].kind == Kind::Demolish).map(|_| dem),
|
||||
};
|
||||
}
|
||||
piece_at((na + nb) / 2.0).filter(|&k| look.pieces[k].kind == Kind::Demolish).map(|_| dem)
|
||||
};
|
||||
// Kante in Teilstücke an den Schichtgrenzen zerlegen.
|
||||
let split = |a: Vec2, b: Vec2| -> Vec<(Vec2, Vec2, Option<Style>)> {
|
||||
let (na, nb) = (n_of(a), n_of(b));
|
||||
let mut ts: Vec<f64> = vec![0.0, 1.0];
|
||||
if (na - nb).abs() > eps {
|
||||
for &bn in &bounds {
|
||||
let s = (bn - na) / (nb - na);
|
||||
if s > 1e-9 && s < 1.0 - 1e-9 {
|
||||
ts.push(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
ts.sort_by(|x, y| x.partial_cmp(y).unwrap_or(std::cmp::Ordering::Equal));
|
||||
let at = |s: f64| Vec2 { x: a.x + (b.x - a.x) * s, y: a.y + (b.y - a.y) * s };
|
||||
ts.windows(2).map(|w| (at(w[0]), at(w[1]), style_of(na + (nb - na) * w[0], na + (nb - na) * w[1]).cloned())).collect()
|
||||
};
|
||||
let dash = || Some(Some(DEMOLISH_DASH.to_vec()));
|
||||
let mut extra = Vec::new();
|
||||
for q in prims[from..].iter_mut() {
|
||||
match q {
|
||||
Primitive::Line { a, b, cls, opening_id: None, .. } if matches!(&**cls, "wall-outline" | "layer-joint" | "layer-joint-l") => {
|
||||
let parts = split(*a, *b);
|
||||
if parts.iter().all(|x| x.2.is_none()) {
|
||||
continue;
|
||||
}
|
||||
let template = q.clone();
|
||||
for (k, (pa, pb, st)) in parts.into_iter().enumerate() {
|
||||
let mut l = template.clone();
|
||||
if let Primitive::Line { a, b, dash: d, color, zigzag, motif, .. } = &mut l {
|
||||
*a = pa;
|
||||
*b = pb;
|
||||
if let Some(st) = st {
|
||||
*d = dash();
|
||||
*zigzag = None;
|
||||
*motif = None;
|
||||
if let Some(c) = &st.line {
|
||||
*color = Some(c.clone().into());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Das erste Stück ersetzt die Kante an ihrem Platz (Bereiche dahinter bleiben gültig).
|
||||
if k == 0 {
|
||||
*q = l;
|
||||
} else {
|
||||
extra.push(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
Primitive::Polygon { pts, stroke, stroke_width_mm, wall_id: Some(wid), opening_id: None, no_stroke_edges, greyed, .. } if wid == wall_id && stroke.trim() != "none" && !stroke.is_empty() && *stroke_width_mm > 0.0 && pts.len() >= 2 => {
|
||||
let skip: HashSet<usize> = no_stroke_edges.iter().flatten().filter(|x| x.is_finite() && **x >= 0.0).map(|x| *x as usize).collect();
|
||||
let n = pts.len();
|
||||
let mut lines = Vec::new();
|
||||
let mut any = false;
|
||||
for i in (0..n).filter(|i| !skip.contains(i)) {
|
||||
for (pa, pb, st) in split(pts[i], pts[(i + 1) % n]) {
|
||||
any |= st.is_some();
|
||||
let color = st.as_ref().and_then(|s| s.line.clone()).unwrap_or_else(|| stroke.clone());
|
||||
lines.push(Primitive::Line { a: pa, b: pb, cls: "wall-outline".into(), weight_mm: *stroke_width_mm, dash: if st.is_some() { dash() } else { None }, zigzag: None, motif: None, color: Some(color.into()), drawing_id: None, opening_id: None, stair_id: None, greyed: *greyed, opacity: None });
|
||||
}
|
||||
}
|
||||
if any {
|
||||
*stroke = "none".into();
|
||||
extra.extend(lines);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
prims.extend(extra);
|
||||
}
|
||||
|
||||
/// Abfrage `renovationPair` (Typ-Paar-Editor, Vorschau): Schichten alt/neu mit Zuordnung und Ergebnis-Streifen
|
||||
/// (Umbauplan). `text` = `{"type": Bestandstyp-Id, "target": Sanierungstyp-Id (fehlt = eingetragener)}`; `null` ohne Paar.
|
||||
pub fn pair_json(p: &Project, text: &str) -> serde_json::Value {
|
||||
let v: serde_json::Value = serde_json::from_str(text).unwrap_or_default();
|
||||
let Some(old) = v.get("type").and_then(|x| x.as_str()).and_then(|id| p.wall_types.iter().find(|t| t.id == id)) else { return serde_json::Value::Null };
|
||||
let target = v.get("target").and_then(|x| x.as_str()).filter(|s| !s.is_empty()).or(old.renovation_target.as_deref());
|
||||
let Some((old, new, side, m)) = target.and_then(|t| type_pair(p, old, t)) else { return serde_json::Value::Null };
|
||||
let layer = |l: &Layer, f: Fate| {
|
||||
let c = p.component_or_fallback(&l.component_id);
|
||||
serde_json::json!({"componentId": l.component_id, "name": c.name, "color": c.color, "thickness": thick(l), "fate": f})
|
||||
};
|
||||
let fill = |k: Kind| match k {
|
||||
Kind::Kept => style(p, RenovationStatus::Existing).fill,
|
||||
Kind::Demolish => style(p, RenovationStatus::Demolish).fill,
|
||||
_ => style(p, RenovationStatus::New).fill,
|
||||
};
|
||||
let strip = |shown: Shown| -> Vec<serde_json::Value> { pieces(&old.layers, &new.layers, &m, side, shown).iter().map(|q| serde_json::json!({"thickness": thick(&q.layer), "kind": q.kind, "fill": fill(q.kind)})).collect() };
|
||||
let walls = p.walls.iter().filter(|w| origin(w).0 == old.id).count();
|
||||
let renovated = p.walls.iter().filter(|w| origin(w).0 == old.id && pair(p, w).is_some_and(|x| x.1.id == new.id)).count();
|
||||
serde_json::json!({
|
||||
"type": old.id, "target": new.id, "side": if side == RenovationSide::Outside { "outside" } else { "inside" },
|
||||
"old": old.layers.iter().zip(&m.old).map(|(l, f)| layer(l, *f)).collect::<Vec<_>>(),
|
||||
"new": new.layers.iter().zip(&m.new).map(|(l, f)| layer(l, *f)).collect::<Vec<_>>(),
|
||||
"oldStrip": strip(Shown::Old), "newStrip": strip(Shown::New), "result": strip(Shown::Both),
|
||||
"walls": walls, "renovated": renovated,
|
||||
})
|
||||
}
|
||||
|
||||
/// Abfrage `renovationPairs` (Umbau-Panel): je Bestandstyp mit Sanierungstyp das Ziel und die Anzahl Wände bzw.
|
||||
/// sanierter Wände; dazu die Zahl aller sanierten Wände.
|
||||
pub fn pairs_json(p: &Project) -> serde_json::Value {
|
||||
let pairs: Vec<serde_json::Value> = p
|
||||
.wall_types
|
||||
.iter()
|
||||
.filter_map(|t| {
|
||||
let target = t.renovation_target.as_deref().filter(|s| !s.is_empty())?;
|
||||
let new = p.wall_types.iter().find(|x| x.id == target);
|
||||
let walls = p.walls.iter().filter(|w| origin(w).0 == t.id).count();
|
||||
let renovated = p.walls.iter().filter(|w| origin(w).0 == t.id && w.renovation.as_ref().is_some_and(marked)).count();
|
||||
Some(serde_json::json!({"type": t.id, "name": t.name, "target": target, "targetName": new.map(|n| n.name.clone()), "walls": walls, "renovated": renovated}))
|
||||
})
|
||||
.collect();
|
||||
let total = p.walls.iter().filter(|w| pair(p, w).is_some()).count();
|
||||
serde_json::json!({"pairs": pairs, "renovated": total})
|
||||
}
|
||||
}
|
||||
|
||||
pub use build_up::WallLook;
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "renovation_tests.rs"]
|
||||
pub(crate) mod tests;
|
||||
@@ -792,3 +1408,7 @@ pub(crate) mod tests;
|
||||
#[cfg(test)]
|
||||
#[path = "renovation_tests2.rs"]
|
||||
mod tests2;
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "renovation_layers_tests.rs"]
|
||||
mod layers_tests;
|
||||
@@ -0,0 +1,332 @@
|
||||
//! [274] Tests der Sanierung je Schicht: Zuordnung im Typ-Paar, gezeigter Aufbau je Filter in Grundriss und Schnitt,
|
||||
//! Kennzahlen je Zustand, Öffnung in sanierter Wand, Robustheit.
|
||||
|
||||
use super::build_up::*;
|
||||
use super::tests::{project, umbau_fixture};
|
||||
use super::*;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
fn l(c: &str, t: f64) -> Layer {
|
||||
Layer { component_id: c.into(), thickness: t, ..Default::default() }
|
||||
}
|
||||
|
||||
/// Beispiel Maintainer 17.11.: Aussenwand Bestand = Aussenputz 2 + Dämmung 10 + Beton 20 (aussen → innen); Sanierung:
|
||||
/// Beton bleibt, Dämmung und Putz werden abgebrochen, neue Dämmung 20 + neuer Putz.
|
||||
fn alt() -> Vec<Layer> {
|
||||
vec![l("render-ext", 0.02), l("insulation", 0.10), l("concrete", 0.20)]
|
||||
}
|
||||
fn neu() -> Vec<Layer> {
|
||||
vec![l("render-ext", 0.02), l("insulation", 0.20), l("concrete", 0.20)]
|
||||
}
|
||||
|
||||
use Fate::{Demolish as D, Kept as K, New as N};
|
||||
|
||||
#[test]
|
||||
fn zuordnung_von_der_bezugsseite() {
|
||||
let m = match_layers(&alt(), &neu(), RenovationSide::Inside, &[], &[]);
|
||||
assert_eq!(m.old, vec![D, D, K]);
|
||||
assert_eq!(m.new, vec![N, N, K]);
|
||||
// Gleicher Baustoff, andere Dicke: Abbruch und Neu.
|
||||
let m = match_layers(&[l("a", 0.1), l("b", 0.2)], &[l("a", 0.12), l("b", 0.2)], RenovationSide::Inside, &[], &[]);
|
||||
assert_eq!((m.old.clone(), m.new.clone()), (vec![D, K], vec![N, K]));
|
||||
// Reihenfolge vertauscht: gleiche Dicken, aber andere Lage ⇒ alles neu.
|
||||
let m = match_layers(&[l("a", 0.1), l("b", 0.1)], &[l("b", 0.1), l("a", 0.1)], RenovationSide::Inside, &[], &[]);
|
||||
assert_eq!((m.old.clone(), m.new.clone()), (vec![D, D], vec![N, N]));
|
||||
// Bezugsseite aussen (Innendämmung): der Putz aussen bleibt, innen ändert sich alles.
|
||||
let m = match_layers(&alt(), &neu(), RenovationSide::Outside, &[], &[]);
|
||||
assert_eq!((m.old.clone(), m.new.clone()), (vec![K, D, D], vec![K, N, N]));
|
||||
// Manuelle Zuordnung geht vor; das automatisch gepaarte Gegenstück folgt (Beton abgebrochen ⇒ neuer Beton neu).
|
||||
let m = match_layers(&alt(), &neu(), RenovationSide::Inside, &[LayerRenovation::Auto, LayerRenovation::Auto, LayerRenovation::Demolish], &[LayerRenovation::Auto, LayerRenovation::Existing]);
|
||||
assert_eq!((m.old.clone(), m.new.clone()), (vec![D, D, D], vec![N, K, N]));
|
||||
// Unsinn: NaN/negative Dicken zählen 0, kein Panic.
|
||||
let m = match_layers(&[l("a", f64::NAN), l("b", 0.2)], &[l("b", 0.2), l("c", -1.0)], RenovationSide::Inside, &[], &[]);
|
||||
assert_eq!(m.old.len(), 2);
|
||||
assert_eq!(total(&[l("a", f64::NAN), l("b", f64::INFINITY), l("c", 0.1)]), 0.1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn teilschichten_im_umbauplan() {
|
||||
let m = match_layers(&alt(), &neu(), RenovationSide::Inside, &[], &[]);
|
||||
let q = pieces(&alt(), &neu(), &m, RenovationSide::Inside, Shown::Both);
|
||||
let got: Vec<(Kind, f64)> = q.iter().map(|q| (q.kind, (q.layer.thickness * 1000.0).round() / 1000.0)).collect();
|
||||
// aussen → innen: Putz neu, Dämmung neu (frei), Dämmung neu über altem Putz, über alter Dämmung, Beton bleibt.
|
||||
assert_eq!(got, vec![(Kind::New, 0.02), (Kind::New, 0.08), (Kind::NewOverDemolish, 0.02), (Kind::NewOverDemolish, 0.10), (Kind::Kept, 0.20)]);
|
||||
// Neuer Aufbau dünner als der alte: der Rest des alten bleibt als reiner Abbruch.
|
||||
let m = match_layers(&neu(), &alt(), RenovationSide::Inside, &[], &[]);
|
||||
let q = pieces(&neu(), &alt(), &m, RenovationSide::Inside, Shown::Both);
|
||||
assert_eq!(q.first().map(|q| q.kind), Some(Kind::Demolish));
|
||||
assert!((q.iter().map(|q| q.layer.thickness).sum::<f64>() - 0.42).abs() < 1e-9);
|
||||
// Alt und Neu je für sich.
|
||||
assert_eq!(pieces(&alt(), &neu(), &m_of(), RenovationSide::Inside, Shown::Old).len(), 3);
|
||||
assert_eq!(pieces(&alt(), &neu(), &m_of(), RenovationSide::Inside, Shown::Kept).len(), 1);
|
||||
}
|
||||
|
||||
fn m_of() -> Matched {
|
||||
match_layers(&alt(), &neu(), RenovationSide::Inside, &[], &[])
|
||||
}
|
||||
|
||||
/// Fixture mit Bestandstyp „alt“ (Sanierungstyp „neu“) an W1 und W4, beide saniert.
|
||||
fn saniert_fixture() -> Value {
|
||||
let mut v = umbau_fixture();
|
||||
let lay = |ls: Vec<Layer>| serde_json::to_value(ls).unwrap();
|
||||
v["wallTypes"].as_array_mut().unwrap().push(json!({"id": "alt", "name": "AW Bestand", "layers": lay(alt()), "renovationTarget": "neu"}));
|
||||
v["wallTypes"].as_array_mut().unwrap().push(json!({"id": "neu", "name": "AW saniert", "layers": lay(neu())}));
|
||||
for w in v["walls"].as_array_mut().unwrap() {
|
||||
if w["id"] == "W1" || w["id"] == "W4" {
|
||||
w["wallTypeId"] = json!("alt");
|
||||
w["renovation"] = json!({"status": "existing", "renovated": true});
|
||||
}
|
||||
}
|
||||
v
|
||||
}
|
||||
|
||||
fn plan(p: &Project, filter: &str) -> Vec<Primitive> {
|
||||
let codes: Vec<String> = (0..100).map(|k| format!("{k:02}")).collect();
|
||||
let t = json!({"floor": "eg", "show": codes, "scale": 50, "renovation": filter}).to_string();
|
||||
// Ohne Vereinigung gleicher Bänder verschiedener Wände ([198]): so bleibt jede Fläche bei ihrer Wand.
|
||||
crate::plan::seams::OFF.with(|o| o.set(true));
|
||||
let d = crate::plan::domains::plan_domains(p, &crate::plan::domains::PlanArgs::parse_in(p, 1.0, &t).unwrap()).unwrap();
|
||||
crate::plan::seams::OFF.with(|o| o.set(false));
|
||||
d.walls
|
||||
}
|
||||
|
||||
/// Flächen im Bereich der Wand W1 zwischen den Öffnungen (x 1.7 … 2.9; nach Vereinigung gleicher Bänder [198] auch ohne
|
||||
/// Wand-Id): Füllung und y-Ausdehnung.
|
||||
fn w1_polys(prims: &[Primitive]) -> Vec<(String, f64, f64)> {
|
||||
prims.iter().filter_map(|q| match q {
|
||||
Primitive::Polygon { pts, fill, opening_id: None, .. } if pts.len() >= 3 => {
|
||||
let f = |g: fn(f64, f64) -> f64, k: fn(&Vec2) -> f64, z: f64| pts.iter().map(k).fold(z, g);
|
||||
let (x0, x1, y0, y1) = (f(f64::min, |p| p.x, f64::INFINITY), f(f64::max, |p| p.x, f64::NEG_INFINITY), f(f64::min, |p| p.y, f64::INFINITY), f(f64::max, |p| p.y, f64::NEG_INFINITY));
|
||||
(x0 < 2.3 && x1 > 2.3 && y0 > -0.35 && y1 < 0.25).then(|| (fill.clone(), y0, y1))
|
||||
}
|
||||
_ => None,
|
||||
}).collect()
|
||||
}
|
||||
|
||||
fn wall_fills(prims: &[Primitive], _id: &str) -> Vec<String> {
|
||||
w1_polys(prims).into_iter().map(|x| x.0).filter(|f| f != "none").collect()
|
||||
}
|
||||
|
||||
/// Aussenkante (kleinstes y) bzw. Innenkante (grösstes y) von W1.
|
||||
fn min_y(prims: &[Primitive], _id: &str) -> f64 {
|
||||
w1_polys(prims).iter().map(|x| x.1).fold(f64::INFINITY, f64::min)
|
||||
}
|
||||
fn max_y(prims: &[Primitive], _id: &str) -> f64 {
|
||||
w1_polys(prims).iter().map(|x| x.2).fold(f64::NEG_INFINITY, f64::max)
|
||||
}
|
||||
|
||||
fn dashed_colors(prims: &[Primitive]) -> Vec<String> {
|
||||
prims.iter().filter_map(|q| match q {
|
||||
Primitive::Line { dash: Some(Some(_)), color, cls, opening_id: None, .. } if matches!(&**cls, "wall-outline" | "layer-joint" | "layer-joint-l") => Some(color.as_deref().unwrap_or("").to_string()),
|
||||
_ => None,
|
||||
}).collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grundriss_je_filter_je_schicht() {
|
||||
let p = project(&saniert_fixture());
|
||||
let (grey, yellow, red) = (default_style(RenovationStatus::Existing).fill, default_style(RenovationStatus::Demolish).fill, default_style(RenovationStatus::New).fill);
|
||||
// Bestand: alter Aufbau (32 cm, Mitte auf der Achse), ohne Farbe.
|
||||
let b = plan(&p, "bestand");
|
||||
let f = wall_fills(&b, "W1");
|
||||
assert!(!f.iter().any(|f| *f == yellow || *f == red || *f == grey), "{f:?}");
|
||||
assert!((min_y(&b, "W1") + 0.16).abs() < 1e-6 && (max_y(&b, "W1") - 0.16).abs() < 1e-6, "{} {}", min_y(&b, "W1"), max_y(&b, "W1"));
|
||||
// Abbruch: alter Aufbau, Putz und Dämmung gelb (gestrichelt umrandet), Beton ohne Farbe.
|
||||
let a = plan(&p, "abbruch");
|
||||
let f = wall_fills(&a, "W1");
|
||||
assert_eq!(f.iter().filter(|f| **f == yellow).count(), 2, "{f:?}");
|
||||
assert!(!f.contains(&red));
|
||||
assert!(!dashed_colors(&a).is_empty());
|
||||
assert!((min_y(&a, "W1") + 0.16).abs() < 1e-6);
|
||||
// Neubau: neuer Aufbau (42 cm), innen bündig, Aussenseite 10 cm weiter aussen; neue Schichten rot.
|
||||
let n = plan(&p, "neubau");
|
||||
let f = wall_fills(&n, "W1");
|
||||
assert_eq!(f.iter().filter(|f| **f == red).count(), 2, "{f:?}");
|
||||
assert!(!f.contains(&yellow) && !f.contains(&grey));
|
||||
assert!((max_y(&n, "W1") - 0.16).abs() < 1e-6 && (min_y(&n, "W1") + 0.26).abs() < 1e-6, "{} {}", min_y(&n, "W1"), max_y(&n, "W1"));
|
||||
// Umbauplan: Beton grau, neue Schichten rot (auch über dem Abbruch), Abbruch als gelbe gestrichelte Kontur.
|
||||
let u = plan(&p, "umbauplan");
|
||||
let f = wall_fills(&u, "W1");
|
||||
assert!(f.contains(&grey) && f.iter().filter(|f| **f == red).count() >= 3, "{f:?}");
|
||||
assert!(!f.contains(&yellow), "Abbruch unter Neu nur als Kontur: {f:?}");
|
||||
assert!(dashed_colors(&u).iter().any(|c| *c == yellow), "{:?}", dashed_colors(&u));
|
||||
assert!((min_y(&u, "W1") + 0.26).abs() < 1e-6);
|
||||
// Endzustand: neuer Aufbau ohne Farbe.
|
||||
let e = plan(&p, "endzustand");
|
||||
let f = wall_fills(&e, "W1");
|
||||
assert!(!f.iter().any(|f| *f == yellow || *f == red || *f == grey), "{f:?}");
|
||||
assert!((min_y(&e, "W1") + 0.26).abs() < 1e-6);
|
||||
// Ohne Filter: Bestandstyp, wie heute.
|
||||
let o = plan(&p, "");
|
||||
assert!((min_y(&o, "W1") + 0.16).abs() < 1e-6);
|
||||
}
|
||||
|
||||
fn opening_min_y(prims: &[Primitive], id: &str) -> f64 {
|
||||
prims.iter().filter_map(|q| match q {
|
||||
Primitive::Polygon { pts, opening_id: Some(o), .. } if o == id => Some(pts.iter().map(|p| p.y).fold(f64::INFINITY, f64::min)),
|
||||
Primitive::Line { a, b, opening_id: Some(o), .. } if o == id => Some(a.y.min(b.y)),
|
||||
_ => None,
|
||||
}).fold(f64::INFINITY, f64::min)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn oeffnung_in_sanierter_wand() {
|
||||
let p = project(&saniert_fixture());
|
||||
// O1 (neu) in W1: im Endzustand reicht das Fenster durch den neuen Aufbau (Leibung bis zur neuen Aussenkante).
|
||||
let e = opening_min_y(&plan(&p, "endzustand"), "O1");
|
||||
assert!(e < -0.2, "Öffnung folgt dem neuen Aufbau: {e}");
|
||||
// Abbruchplan: das Abbruch-Stück liegt im alten Aufbau.
|
||||
let a = opening_min_y(&plan(&p, "abbruch"), "O1");
|
||||
assert!(a > -0.17 && a.is_finite(), "{a}");
|
||||
}
|
||||
|
||||
fn section(p: &Project, filter: &str) -> Vec<Primitive> {
|
||||
let level = p.drawing_levels.iter().find(|l| l.id == "schnitt-a").unwrap();
|
||||
let v = json!({"level": level, "scale": 50, "detail": "mittel", "renovation": filter});
|
||||
let buf = crate::queries::run_bin(p, "sectionPlan", &[0.0, 1.0, 0.0], &v.to_string()).unwrap();
|
||||
crate::plan::buf::View::parse(&buf).and_then(|v| v.prims()).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Kleinstes x der Schnittfläche von W4 (Aussenseite bei −x).
|
||||
fn sec_min_x(prims: &[Primitive], id: &str) -> f64 {
|
||||
prims.iter().filter_map(|q| match q {
|
||||
Primitive::Polygon { pts, wall_id: Some(w), .. } if w == id => Some(pts.iter().map(|p| p.x).fold(f64::INFINITY, f64::min)),
|
||||
_ => None,
|
||||
}).fold(f64::INFINITY, f64::min)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn schnitt_je_filter_je_schicht() {
|
||||
let p = project(&saniert_fixture());
|
||||
let (grey, yellow, red) = (default_style(RenovationStatus::Existing).fill, default_style(RenovationStatus::Demolish).fill, default_style(RenovationStatus::New).fill);
|
||||
let fills = |v: &[Primitive]| v.iter().filter_map(|q| match q {
|
||||
Primitive::Polygon { fill, wall_id: Some(w), .. } if w == "W4" => Some(fill.clone()),
|
||||
_ => None,
|
||||
}).collect::<Vec<_>>();
|
||||
let b = section(&p, "bestand");
|
||||
let a = section(&p, "abbruch");
|
||||
let n = section(&p, "neubau");
|
||||
let u = section(&p, "umbauplan");
|
||||
let e = section(&p, "endzustand");
|
||||
assert!(!fills(&b).is_empty() && !fills(&b).iter().any(|f| *f == yellow || *f == red));
|
||||
assert!(fills(&a).contains(&yellow) && !fills(&a).contains(&red), "{:?}", fills(&a));
|
||||
assert!(fills(&n).contains(&red) && !fills(&n).contains(&yellow), "{:?}", fills(&n));
|
||||
assert!(fills(&u).contains(&grey) && fills(&u).contains(&red), "{:?}", fills(&u));
|
||||
assert!(!fills(&e).iter().any(|f| *f == yellow || *f == red || *f == grey));
|
||||
// Umbauplan: die abgebrochenen Schichten unter der neuen Dämmung als gestrichelte Kontur (eigene Schnittflächen).
|
||||
let dashed = |v: &[Primitive]| v.iter().filter(|q| matches!(q, Primitive::Line { dash: Some(Some(_)), cls, .. } if &**cls == "section-joint")).count();
|
||||
assert!(dashed(&u) > dashed(&e), "{} {}", dashed(&u), dashed(&e));
|
||||
// Neuer Aufbau 10 cm dicker nach aussen: die Schnittfläche reicht weiter (Schnitt-Koordinaten: Abstand längs der Linie).
|
||||
let (wb, we) = (sec_min_x(&b, "W4"), sec_min_x(&e, "W4"));
|
||||
assert!(wb.is_finite() && we.is_finite() && (wb - we).abs() > 0.09, "{wb} {we}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn kennzahlen_je_zustand() {
|
||||
let p = project(&saniert_fixture());
|
||||
let mut v = saniert_fixture();
|
||||
for w in v["walls"].as_array_mut().unwrap() {
|
||||
if let Some(r) = w.get_mut("renovation").and_then(|r| r.as_object_mut()) {
|
||||
r.remove("renovated");
|
||||
}
|
||||
}
|
||||
let unsaniert = project(&v);
|
||||
let gf = |p: &Project, f: &str| crate::flaechen::area_table(&project_for_text(p, f)).total.gf;
|
||||
// Bestand: die Sanierung ändert nichts; Endzustand: Aussenkante 10 cm weiter aussen an W1 (5 m) und W4 (4 m).
|
||||
assert!((gf(&p, "bestand") - gf(&unsaniert, "bestand")).abs() < 1e-9);
|
||||
let (a, b) = (gf(&unsaniert, "endzustand"), gf(&p, "endzustand"));
|
||||
assert!(b > a + 0.5, "GF Endzustand unsaniert {a} saniert {b}");
|
||||
// Dicke je Zustand.
|
||||
let th = |f: &str| {
|
||||
let q = project_for_text(&p, f);
|
||||
let w1 = q.walls.iter().find(|w| w.id == "W1").unwrap();
|
||||
q.wall_thickness(w1, 0.0)
|
||||
};
|
||||
assert!((th("endzustand") - 0.42).abs() < 1e-9 && (th("bestand") - 0.32).abs() < 1e-9);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ansicht_und_3d_folgen_dem_aufbau() {
|
||||
let p = project(&saniert_fixture());
|
||||
// 3D (Teile je Schicht): Endzustand mit der Dämmung 20 cm, Bestand mit der alten 10 cm.
|
||||
let parts = |t: &str| -> Value { serde_json::from_str(&crate::queries::run(&p, "model3dParts", &[1.0, 1.0, 0.0], t).unwrap()).unwrap() };
|
||||
let w1 = |v: &Value| v["walls"].as_array().unwrap().iter().filter(|w| w["wallId"] == "W1").cloned().collect::<Vec<_>>();
|
||||
let has = |v: &[Value], t: f64| v.iter().any(|w| (w["thickness"].as_f64().unwrap() - t).abs() < 1e-9);
|
||||
let (e, b) = (w1(&parts(r#"{"renovation":"endzustand"}"#)), w1(&parts(r#"{"renovation":"bestand"}"#)));
|
||||
assert!(has(&b, 0.1) && !has(&e, 0.1), "alte Dämmung nur im Bestand");
|
||||
// Umbauplan: Farbe der äussersten Schicht (neuer Putz = rot).
|
||||
let c = crate::style::hex_to_rgb(&default_style(RenovationStatus::New).fill, [0.0; 3]);
|
||||
assert!(w1(&parts(r#"{"renovation":"umbauplan"}"#)).iter().all(|w| (w["color"][0].as_f64().unwrap() - c[0]).abs() < 1e-9));
|
||||
// Ansicht Süd (Fassade W1) im Umbauplan: rot.
|
||||
let level = p.drawing_levels.iter().find(|l| l.id == "ansicht-sued").unwrap();
|
||||
let buf = crate::queries::run_bin(&p, "elevationPlan", &[0.0, 0.0, 100.0], &json!({"level": level, "renovation": "umbauplan"}).to_string()).unwrap();
|
||||
let prims = crate::plan::buf::View::parse(&buf).and_then(|v| v.prims()).unwrap_or_default();
|
||||
assert!(prims.iter().any(|q| matches!(q, Primitive::Polygon { fill, .. } if *fill == default_style(RenovationStatus::New).fill)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn robust_und_ohne_wirkung_wo_nicht_saniert() {
|
||||
let mut v = saniert_fixture();
|
||||
// Leerer Sanierungstyp, fehlender Typ, NaN-Dicken: wie nicht saniert, kein Panic.
|
||||
v["wallTypes"].as_array_mut().unwrap().push(json!({"id": "leer", "name": "leer", "layers": []}));
|
||||
v["wallTypes"].as_array_mut().unwrap().push(json!({"id": "nan", "name": "nan", "layers": [{"componentId": "x", "thickness": -1.0}]}));
|
||||
let p = project(&v);
|
||||
for t in ["leer", "nan", "gibts-nicht", "alt"] {
|
||||
let mut q = p.clone();
|
||||
for w in q.walls.iter_mut().filter(|w| w.id == "W1") {
|
||||
w.renovation.as_mut().unwrap().new_type_id = Some(t.into());
|
||||
}
|
||||
let w = q.walls.iter().find(|w| w.id == "W1").unwrap();
|
||||
assert!(pair(&q, w).is_none(), "{t}");
|
||||
let _ = plan(&q, "umbauplan");
|
||||
}
|
||||
// Status Abbruch: Sanierung wirkt nicht (die ganze Wand fällt).
|
||||
let mut q = p.clone();
|
||||
for w in q.walls.iter_mut().filter(|w| w.id == "W1") {
|
||||
w.renovation.as_mut().unwrap().status = RenovationStatus::Demolish;
|
||||
}
|
||||
let r = View::new(&q, Some("umbauplan"), None).unwrap().resolve(&q);
|
||||
assert!(!r.walls.contains_key("W1") && r.walls.contains_key("W4"));
|
||||
// Ohne Markierung keine Wirkung.
|
||||
let mut q = p.clone();
|
||||
for w in q.walls.iter_mut() {
|
||||
if let Some(r) = w.renovation.as_mut() {
|
||||
r.renovated = None;
|
||||
}
|
||||
}
|
||||
assert!(!build_up::any(&q));
|
||||
assert!(View::new(&q, Some("umbauplan"), None).unwrap().resolve(&q).walls.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn umgestelltes_projekt_ergibt_dasselbe() {
|
||||
let p = project(&saniert_fixture());
|
||||
let v = View::new(&p, Some("umbauplan"), None).unwrap();
|
||||
let r = v.resolve(&p);
|
||||
let q = r.project(&p).unwrap();
|
||||
let r2 = v.resolve(&q);
|
||||
assert_eq!(r.walls["W1"].type_id, r2.walls["W1"].type_id);
|
||||
assert_eq!(r.walls["W1"].pieces, r2.walls["W1"].pieces);
|
||||
// Bestand nach Umbauplan: zurück auf den Ursprung.
|
||||
let back = View::new(&q, Some("bestand"), None).unwrap().resolve(&q).project(&q).unwrap();
|
||||
let w1 = back.walls.iter().find(|w| w.id == "W1").unwrap();
|
||||
assert_eq!(w1.wall_type_id, "alt");
|
||||
assert_eq!(w1.reference_offset, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn typ_paar_abfragen() {
|
||||
let p = project(&saniert_fixture());
|
||||
let v: Value = serde_json::from_str(&crate::queries::run(&p, "renovationPair", &[], r#"{"type":"alt"}"#).unwrap()).unwrap();
|
||||
assert_eq!(v["target"], "neu");
|
||||
assert_eq!(v["old"].as_array().unwrap().iter().map(|x| x["fate"].as_str().unwrap()).collect::<Vec<_>>(), vec!["demolish", "demolish", "kept"]);
|
||||
assert_eq!(v["result"].as_array().unwrap().len(), 5);
|
||||
assert_eq!((v["walls"].as_u64(), v["renovated"].as_u64()), (Some(2), Some(2)));
|
||||
let all: Value = serde_json::from_str(&crate::queries::run(&p, "renovationPairs", &[], "").unwrap()).unwrap();
|
||||
assert_eq!(all["pairs"][0]["type"], "alt");
|
||||
assert_eq!(all["renovated"], 2);
|
||||
// Unsinn: leer/null.
|
||||
assert_eq!(crate::queries::run(&p, "renovationPair", &[], "kaputt").unwrap(), "null");
|
||||
assert_eq!(crate::queries::run(&p, "renovationPair", &[], r#"{"type":"iw"}"#).unwrap(), "null");
|
||||
}
|
||||
|
||||
@@ -184,6 +184,8 @@ export type QueryName =
|
||||
| "kennzahlen"
|
||||
| "areaTable"
|
||||
| "renovationFilters"
|
||||
| "renovationPair"
|
||||
| "renovationPairs"
|
||||
| "designOptionInfo"
|
||||
| "designOptionCompare"
|
||||
| "costEstimate"
|
||||
|
||||
@@ -130,6 +130,12 @@ export {
|
||||
renovationFilterShows, renovationStyleOf, idsByRenovationStatus, renovationCounts, phaseUsage,
|
||||
} from "../model/renovation";
|
||||
export type { RenovationFilterEntry, RenovationCollection } from "../model/renovation";
|
||||
// [274] Sanierung je Schicht: Typ-Paar Bestand → Sanierungstyp
|
||||
export {
|
||||
wallBuildUp, buildUpKey, parseBuildUpKey, setBuildUpOps, commonBuildUp, renovateAllOfTypeOps, createRenovationTypeOps, setTypePairOps,
|
||||
renovationPair, renovationPairs,
|
||||
} from "../model/renovation";
|
||||
export type { RenovationBuildUp, RenovationPair, RenovationPairLayer, RenovationStripPiece, RenovationPairsInfo } from "../model/renovation";
|
||||
export { buildUmbauSampleProject } from "../model/sampleProjectUmbau";
|
||||
// [272] Varianten: Sätze, Kombinationen, Zuweisen/Kopieren/Übernehmen (Regeln im Kern `design_options.rs`, Sichtbarkeit `renovation.rs`)
|
||||
export {
|
||||
|
||||
@@ -4754,6 +4754,37 @@ 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.buildUp": "Neuer Aufbau (Sanierung)",
|
||||
"renovation.buildUp.none": "keiner",
|
||||
"renovation.buildUp.type": "wie Typ: {name}",
|
||||
"renovation.buildUp.typeMissing": "wie Typ (kein Sanierungstyp)",
|
||||
"renovation.buildUp.other": "Typ {name}",
|
||||
"renovation.buildUp.hint": "Neuer Aufbau nur bei Status Bestand; Abbruch und Neu je Schicht nach dem Typ-Paar.",
|
||||
"renovation.strip.old": "Alt",
|
||||
"renovation.strip.new": "Neu",
|
||||
"renovation.strip.result": "Ergebnis",
|
||||
"renovation.panel.sanierung.title": "Sanierung",
|
||||
"renovation.panel.sanierung.count": "Sanierte Bauteile: {n}",
|
||||
"renovation.panel.sanierung.empty": "Noch kein Sanierungstyp. Wandtyp wählen und „Sanierungstyp anlegen …“.",
|
||||
"renovation.panel.sanierung.walls": "{r} von {n} Wänden saniert",
|
||||
"renovation.panel.sanierung.renovateAll": "Alle Wände vom Typ sanieren",
|
||||
"renovation.panel.sanierung.create": "Sanierungstyp anlegen …",
|
||||
"renovation.panel.sanierung.createFor": "Bestandstyp",
|
||||
"renovation.panel.sanierung.newName": "{name} saniert",
|
||||
"renovation.panel.sanierung.edit": "Zuordnung bearbeiten",
|
||||
"renovation.panel.sanierung.target": "Sanierungstyp",
|
||||
"renovation.panel.sanierung.side": "Bezugsseite",
|
||||
"renovation.panel.sanierung.side.inside": "innen (Aussendämmung)",
|
||||
"renovation.panel.sanierung.side.outside": "aussen (Innendämmung)",
|
||||
"renovation.panel.sanierung.oldLayers": "Bestandstyp (alt)",
|
||||
"renovation.panel.sanierung.newLayers": "Sanierungstyp (neu)",
|
||||
"renovation.panel.sanierung.reset": "Automatisch zuordnen",
|
||||
"renovation.panel.sanierung.remove": "Sanierungstyp entfernen",
|
||||
"renovation.panel.sanierung.editLayers": "Schichten in den Ressourcen …",
|
||||
"renovation.fate.auto": "automatisch",
|
||||
"renovation.fate.kept": "Bestand",
|
||||
"renovation.fate.demolish": "Abbruch",
|
||||
"renovation.fate.new": "Neu",
|
||||
"resources.tab.renovation": "Umbau",
|
||||
"file.newFromUmbauSample": "Neu aus Vorlage: Beispiel Umbau",
|
||||
"menu.native.newFromUmbauSample": "Beispiel Umbau",
|
||||
|
||||
@@ -4740,6 +4740,37 @@ 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.buildUp": "New build-up (refurbishment)",
|
||||
"renovation.buildUp.none": "none",
|
||||
"renovation.buildUp.type": "as type: {name}",
|
||||
"renovation.buildUp.typeMissing": "as type (no refurbishment type)",
|
||||
"renovation.buildUp.other": "Type {name}",
|
||||
"renovation.buildUp.hint": "New build-up only for status existing; demolition and new per layer from the type pair.",
|
||||
"renovation.strip.old": "Old",
|
||||
"renovation.strip.new": "New",
|
||||
"renovation.strip.result": "Result",
|
||||
"renovation.panel.sanierung.title": "Refurbishment",
|
||||
"renovation.panel.sanierung.count": "Refurbished elements: {n}",
|
||||
"renovation.panel.sanierung.empty": "No refurbishment type yet. Pick a wall type and “Create refurbishment type …”.",
|
||||
"renovation.panel.sanierung.walls": "{r} of {n} walls refurbished",
|
||||
"renovation.panel.sanierung.renovateAll": "Refurbish all walls of this type",
|
||||
"renovation.panel.sanierung.create": "Create refurbishment type …",
|
||||
"renovation.panel.sanierung.createFor": "Existing type",
|
||||
"renovation.panel.sanierung.newName": "{name} refurbished",
|
||||
"renovation.panel.sanierung.edit": "Edit layer mapping",
|
||||
"renovation.panel.sanierung.target": "Refurbishment type",
|
||||
"renovation.panel.sanierung.side": "Reference side",
|
||||
"renovation.panel.sanierung.side.inside": "inside (external insulation)",
|
||||
"renovation.panel.sanierung.side.outside": "outside (internal insulation)",
|
||||
"renovation.panel.sanierung.oldLayers": "Existing type (old)",
|
||||
"renovation.panel.sanierung.newLayers": "Refurbishment type (new)",
|
||||
"renovation.panel.sanierung.reset": "Map automatically",
|
||||
"renovation.panel.sanierung.remove": "Remove refurbishment type",
|
||||
"renovation.panel.sanierung.editLayers": "Layers in the resources …",
|
||||
"renovation.fate.auto": "automatic",
|
||||
"renovation.fate.kept": "Existing",
|
||||
"renovation.fate.demolish": "Demolish",
|
||||
"renovation.fate.new": "New",
|
||||
"resources.tab.renovation": "Renovation",
|
||||
"file.newFromUmbauSample": "New From Template: Renovation Example",
|
||||
"menu.native.newFromUmbauSample": "Renovation Example",
|
||||
|
||||
+162
-4
@@ -3,8 +3,8 @@
|
||||
|
||||
import type { CoreOp } from "../core/ops";
|
||||
import { documentFor } from "../core/document";
|
||||
import { patchItems, setField } from "../core/opsBuild";
|
||||
import type { Project, Renovation, RenovationPhase, RenovationShow, RenovationStatus, Tree, TreeStatus } from "./types";
|
||||
import { addItems, patchItem, patchItems, setField } from "../core/opsBuild";
|
||||
import type { LayerRenovation, Project, Renovation, RenovationPhase, RenovationShow, RenovationSide, RenovationStatus, 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;
|
||||
@@ -76,7 +76,7 @@ export function setRenovationOps(project: Project, ids: Iterable<string>, status
|
||||
const old = (e as { renovation?: Renovation }).renovation;
|
||||
const st = status ?? renovationStatus(old);
|
||||
const ph = phase === undefined ? old?.phase : phase ?? undefined;
|
||||
const next = renovationForNew(st, ph);
|
||||
const next = keepRenovated(renovationForNew(st, ph), old);
|
||||
const { renovation: _drop, ...rest } = e as { renovation?: Renovation } & Record<string, unknown>;
|
||||
void _drop;
|
||||
return (next ? { ...rest, renovation: next } : rest) as unknown as typeof e;
|
||||
@@ -88,6 +88,15 @@ export function setRenovationOps(project: Project, ids: Iterable<string>, status
|
||||
return ops;
|
||||
}
|
||||
|
||||
/** [274] Sanierung (`renovated`, `newTypeId`) beim Setzen von Status/Etappe behalten. */
|
||||
function keepRenovated(next: Renovation | undefined, old: Renovation | undefined): Renovation | undefined {
|
||||
if (!old?.renovated && !old?.newTypeId) return next;
|
||||
const r: Renovation = { ...(next ?? { status: "existing" }) };
|
||||
if (old.renovated) r.renovated = true;
|
||||
if (old.newTypeId) r.newTypeId = old.newTypeId;
|
||||
return r;
|
||||
}
|
||||
|
||||
/** Element-Ids der Auswahl, die einen Umbau-Status tragen können. */
|
||||
export function renovatableIds(project: Project, ids: Iterable<string>): string[] {
|
||||
const set = new Set(ids);
|
||||
@@ -141,7 +150,7 @@ export function setPhasesOps(project: Project, phases: readonly RenovationPhase[
|
||||
},
|
||||
(e) => {
|
||||
const r = (e as { renovation?: Renovation }).renovation!;
|
||||
const next = renovationForNew(renovationStatus(r), null);
|
||||
const next = keepRenovated(renovationForNew(renovationStatus(r), null), r);
|
||||
const { renovation: _drop, ...rest } = e as { renovation?: Renovation } & Record<string, unknown>;
|
||||
void _drop;
|
||||
return (next ? { ...rest, renovation: next } : rest) as unknown as typeof e;
|
||||
@@ -250,3 +259,152 @@ export function phaseUsage(project: Project, phaseId: string): number {
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
// ── [274] Sanierung je Schicht: Typ-Paar Bestand → Sanierungstyp (Regeln im Kern `renovation::build_up`) ────────────
|
||||
|
||||
/** Neuer Aufbau einer Wand: keiner, der Sanierungstyp ihres Wandtyps oder ein anderer Wandtyp (Ausnahme). */
|
||||
export type RenovationBuildUp = { kind: "none" } | { kind: "type" } | { kind: "other"; typeId: string };
|
||||
|
||||
/** Neuer Aufbau einer Wand aus ihren Umbau-Angaben. */
|
||||
export function wallBuildUp(r: Renovation | undefined | null): RenovationBuildUp {
|
||||
if (r?.newTypeId) return { kind: "other", typeId: r.newTypeId };
|
||||
return r?.renovated ? { kind: "type" } : { kind: "none" };
|
||||
}
|
||||
|
||||
/** Schlüssel eines Aufbaus für Auswahllisten (`""` keiner, `"type"` wie Typ, sonst die Typ-Id mit Präfix). */
|
||||
export function buildUpKey(b: RenovationBuildUp): string {
|
||||
return b.kind === "none" ? "" : b.kind === "type" ? "type" : `t:${b.typeId}`;
|
||||
}
|
||||
|
||||
/** Gegenstück zu {@link buildUpKey}. */
|
||||
export function parseBuildUpKey(k: string): RenovationBuildUp {
|
||||
if (k === "type") return { kind: "type" };
|
||||
if (k.startsWith("t:") && k.length > 2) return { kind: "other", typeId: k.slice(2) };
|
||||
return { kind: "none" };
|
||||
}
|
||||
|
||||
function withBuildUp(r: Renovation | undefined, b: RenovationBuildUp): Renovation | undefined {
|
||||
const base: Renovation = { ...(r ?? { status: "existing" }) };
|
||||
delete base.renovated;
|
||||
delete base.newTypeId;
|
||||
if (b.kind === "type") base.renovated = true;
|
||||
if (b.kind === "other") {
|
||||
base.renovated = true;
|
||||
base.newTypeId = b.typeId;
|
||||
}
|
||||
const plain = base.status === "existing" && !base.phase && !base.renovated;
|
||||
return plain ? undefined : base;
|
||||
}
|
||||
|
||||
/** Ops: neuer Aufbau für die Wände `ids` (ein Undo-Schritt); Status/Etappe bleiben. */
|
||||
export function setBuildUpOps(project: Project, ids: Iterable<string>, b: RenovationBuildUp): CoreOp[] {
|
||||
const set = new Set(ids);
|
||||
return patchItems(project, "walls", set, (w) => {
|
||||
const next = withBuildUp(w.renovation, b);
|
||||
const { renovation: _drop, ...rest } = w;
|
||||
void _drop;
|
||||
return next ? { ...rest, renovation: next } : rest;
|
||||
});
|
||||
}
|
||||
|
||||
/** Gemeinsamer Aufbau-Schlüssel ({@link buildUpKey}) der Wände `ids`: `"mixed"` bei verschiedenen, `null` ohne Wände. */
|
||||
export function commonBuildUp(project: Project, ids: Iterable<string>): string | null {
|
||||
const set = new Set(ids);
|
||||
let out: string | null = null;
|
||||
for (const w of project.walls) {
|
||||
if (!set.has(w.id)) continue;
|
||||
const k = buildUpKey(wallBuildUp(w.renovation));
|
||||
if (out === null) out = k;
|
||||
else if (out !== k) return "mixed";
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Ops: alle Wände des Bestandstyps `typeId` sanieren (Sanierungstyp des Typs; ein Undo-Schritt). */
|
||||
export function renovateAllOfTypeOps(project: Project, typeId: string): CoreOp[] {
|
||||
const ids = project.walls.filter((w) => w.wallTypeId === typeId && renovationStatus(w.renovation) === "existing").map((w) => w.id);
|
||||
return setBuildUpOps(project, ids, { kind: "type" });
|
||||
}
|
||||
|
||||
/** Nächste freie Wandtyp-Id mit Präfix. */
|
||||
function freeTypeId(project: Project, base: string): string {
|
||||
const used = new Set(project.wallTypes.map((t) => t.id));
|
||||
let i = 1;
|
||||
while (used.has(`${base}-${i}`)) i++;
|
||||
return `${base}-${i}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ops: „Sanierungstyp anlegen …“ — Kopie des Bestandstyps `typeId` als neuer Wandtyp `name` (zum Anpassen der Schichten)
|
||||
* und als Sanierungstyp des Bestandstyps eingetragen. Liefert die Ops und die neue Id.
|
||||
*/
|
||||
export function createRenovationTypeOps(project: Project, typeId: string, name: string): { ops: CoreOp[]; id: string } {
|
||||
const src = project.wallTypes.find((t) => t.id === typeId);
|
||||
if (!src) return { ops: [], id: "" };
|
||||
const id = freeTypeId(project, `${typeId}-saniert`);
|
||||
const copy: WallType = { id, name, layers: src.layers.map((l) => ({ ...l })) };
|
||||
return { ops: [...addItems("wallTypes", [copy]), ...setTypePairOps(project, typeId, { target: id, old: null, new: null })], id };
|
||||
}
|
||||
|
||||
/** Ops: Typ-Paar am Bestandstyp ändern (Sanierungstyp, Bezugsseite, manuelle Zuordnung; `null` entfernt). */
|
||||
export function setTypePairOps(
|
||||
project: Project,
|
||||
typeId: string,
|
||||
patch: { target?: string | null; side?: RenovationSide | null; old?: LayerRenovation[] | null; new?: LayerRenovation[] | null },
|
||||
): CoreOp[] {
|
||||
return patchItem(project, "wallTypes", typeId, (t) => {
|
||||
const next: WallType = { ...t };
|
||||
const put = <K extends keyof WallType>(k: K, v: WallType[K] | null | undefined) => {
|
||||
if (v === undefined) return;
|
||||
if (v === null || (Array.isArray(v) && v.every((x) => x === "auto"))) delete next[k];
|
||||
else next[k] = v;
|
||||
};
|
||||
put("renovationTarget", patch.target);
|
||||
put("renovationSide", patch.side === "inside" ? null : patch.side);
|
||||
put("renovationOld", patch.old);
|
||||
put("renovationNew", patch.new);
|
||||
return next;
|
||||
});
|
||||
}
|
||||
|
||||
/** Schicht eines Typ-Paars (Kern-Abfrage `renovationPair`). */
|
||||
export interface RenovationPairLayer {
|
||||
componentId: string;
|
||||
name: string;
|
||||
color: string;
|
||||
thickness: number;
|
||||
fate: "kept" | "demolish" | "new";
|
||||
}
|
||||
/** Teilstück eines Ergebnis-Streifens. */
|
||||
export interface RenovationStripPiece {
|
||||
thickness: number;
|
||||
kind: "kept" | "demolish" | "new" | "newOverDemolish";
|
||||
fill: string;
|
||||
}
|
||||
export interface RenovationPair {
|
||||
type: string;
|
||||
target: string;
|
||||
side: RenovationSide;
|
||||
old: RenovationPairLayer[];
|
||||
new: RenovationPairLayer[];
|
||||
oldStrip: RenovationStripPiece[];
|
||||
newStrip: RenovationStripPiece[];
|
||||
result: RenovationStripPiece[];
|
||||
walls: number;
|
||||
renovated: number;
|
||||
}
|
||||
|
||||
/** Typ-Paar Bestandstyp → Sanierungstyp (`target` fehlt = eingetragener); `null` ohne gültiges Paar. */
|
||||
export function renovationPair(project: Project, typeId: string, target?: string): RenovationPair | null {
|
||||
return documentFor(project).query<RenovationPair | null>("renovationPair", [], JSON.stringify({ type: typeId, target: target ?? "" }));
|
||||
}
|
||||
|
||||
export interface RenovationPairsInfo {
|
||||
pairs: { type: string; name: string; target: string; targetName: string | null; walls: number; renovated: number }[];
|
||||
renovated: number;
|
||||
}
|
||||
|
||||
/** Alle Typ-Paare mit Zählern (Umbau-Panel „Sanierung“). */
|
||||
export function renovationPairs(project: Project): RenovationPairsInfo {
|
||||
return documentFor(project).query<RenovationPairsInfo>("renovationPairs");
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
// [274] Sanierung je Schicht: Ops (neuer Aufbau je Wand, alle Wände eines Typs, Sanierungstyp anlegen, Typ-Paar),
|
||||
// gemeinsamer Wert bei Mehrfachauswahl, Kern-Abfragen am Umbau-Beispiel (Typ-Paar, Zähler, Grundriss je Filter).
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { applyOps } from "../core/ops";
|
||||
import {
|
||||
buildUpKey,
|
||||
commonBuildUp,
|
||||
createRenovationTypeOps,
|
||||
parseBuildUpKey,
|
||||
renovateAllOfTypeOps,
|
||||
renovationPair,
|
||||
renovationPairs,
|
||||
setBuildUpOps,
|
||||
setPhasesOps,
|
||||
setRenovationOps,
|
||||
setTypePairOps,
|
||||
wallBuildUp,
|
||||
} from "./renovation";
|
||||
import { buildUmbauSampleProject } from "./sampleProjectUmbau";
|
||||
import { generatePlan } from "../plan/generatePlan";
|
||||
import { computeAreaTable } from "../analysis/areaTable";
|
||||
import type { Project } from "./types";
|
||||
|
||||
const ALL = new Set(["20", "21", "30", "31", "40", "60"]);
|
||||
|
||||
function plan(p: Project, filter: string) {
|
||||
const q = { ...p, drawingLevels: p.drawingLevels.map((l) => (l.id === "eg" ? { ...l, renovationFilter: filter } : l)) };
|
||||
return generatePlan(q, "eg", ALL).primitives;
|
||||
}
|
||||
|
||||
describe("[274] Sanierung je Schicht", () => {
|
||||
it("Aufbau-Schlüssel: keiner, wie Typ, anderer Typ", () => {
|
||||
expect(wallBuildUp(undefined)).toEqual({ kind: "none" });
|
||||
expect(wallBuildUp({ status: "existing", renovated: true })).toEqual({ kind: "type" });
|
||||
expect(wallBuildUp({ status: "existing", renovated: true, newTypeId: "x" })).toEqual({ kind: "other", typeId: "x" });
|
||||
for (const k of ["", "type", "t:abc"]) expect(buildUpKey(parseBuildUpKey(k))).toBe(k);
|
||||
expect(parseBuildUpKey("t:")).toEqual({ kind: "none" });
|
||||
});
|
||||
|
||||
it("Neuer Aufbau für mehrere Wände in einem Schritt; Status/Etappe ändern behält die Sanierung", () => {
|
||||
const p = buildUmbauSampleProject();
|
||||
const ops = setBuildUpOps(p, ["W2", "W3"], { kind: "other", typeId: "aw-saniert" });
|
||||
expect(ops).toHaveLength(2);
|
||||
const q = applyOps(p, ops);
|
||||
expect(q.walls.find((w) => w.id === "W2")?.renovation).toEqual({ status: "existing", renovated: true, newTypeId: "aw-saniert" });
|
||||
expect(commonBuildUp(q, ["W2", "W3"])).toBe("t:aw-saniert");
|
||||
expect(commonBuildUp(q, ["W1", "W2"])).toBe("mixed");
|
||||
expect(commonBuildUp(q, ["O1"])).toBeNull();
|
||||
// Status setzen: Sanierung bleibt.
|
||||
const r = applyOps(q, setRenovationOps(q, ["W2"], "existing", "etappe-2"));
|
||||
expect(r.walls.find((w) => w.id === "W2")?.renovation).toEqual({ status: "existing", phase: "etappe-2", renovated: true, newTypeId: "aw-saniert" });
|
||||
// Etappe löschen: Sanierung bleibt.
|
||||
const s = applyOps(p, setPhasesOps(p, [{ id: "etappe-2", name: "Etappe 2" }]));
|
||||
expect(s.walls.find((w) => w.id === "W1")?.renovation).toEqual({ status: "existing", renovated: true });
|
||||
// Keiner: Feld weg (Bestand ohne Etappe).
|
||||
const t = applyOps(q, setBuildUpOps(q, ["W2"], { kind: "none" }));
|
||||
expect(t.walls.find((w) => w.id === "W2")).not.toHaveProperty("renovation");
|
||||
});
|
||||
|
||||
it("Sanierungstyp anlegen, alle Wände vom Typ sanieren, Typ-Paar mit Zuordnung", () => {
|
||||
const p = buildUmbauSampleProject();
|
||||
const { ops, id } = createRenovationTypeOps(p, "aw", "Aussenwand saniert");
|
||||
const q = applyOps(p, ops);
|
||||
expect(q.wallTypes.find((t) => t.id === "aw")?.renovationTarget).toBe(id);
|
||||
expect(q.wallTypes.find((t) => t.id === id)?.layers).toEqual(p.wallTypes.find((t) => t.id === "aw")?.layers);
|
||||
// Alle Bestandswände vom Typ „aw“ (W2, W3, W4 auf EG; W5–W8 auf OG; nicht die neuen W10–W12) in einem Schritt.
|
||||
const r = applyOps(q, renovateAllOfTypeOps(q, "aw"));
|
||||
const renovated = r.walls.filter((w) => w.renovation?.renovated).map((w) => w.id).sort();
|
||||
expect(renovated).toEqual(["W1", "W2", "W3", "W4", "W5", "W6", "W7", "W8"]);
|
||||
// Gleiche Schichten: alles Bestand (nichts abgebrochen, nichts neu).
|
||||
const pr = renovationPair(r, "aw");
|
||||
expect(pr?.old.every((l) => l.fate === "kept")).toBe(true);
|
||||
// Manuelle Zuordnung am Typ-Paar: die Dämmung wird ersetzt.
|
||||
const s = applyOps(r, setTypePairOps(r, "aw", { old: ["auto", "demolish"] }));
|
||||
expect(renovationPair(s, "aw")?.old.map((l) => l.fate)).toEqual(["kept", "demolish", "kept", "kept"]);
|
||||
expect(renovationPair(s, "aw")?.new.map((l) => l.fate)).toEqual(["kept", "new", "kept", "kept"]);
|
||||
// Alles „automatisch“: Feld weg.
|
||||
const u = applyOps(s, setTypePairOps(s, "aw", { old: ["auto", "auto"] }));
|
||||
expect(u.wallTypes.find((t) => t.id === "aw")).not.toHaveProperty("renovationOld");
|
||||
expect(renovationPairs(u).pairs.map((x) => x.type).sort()).toEqual(["aw", "aw-bestand"]);
|
||||
});
|
||||
|
||||
it("Beispiel Umbau: Typ-Paar der Südwand, Zähler, Grundriss und GF je Filter", () => {
|
||||
const p = buildUmbauSampleProject();
|
||||
const pr = renovationPair(p, "aw-bestand");
|
||||
expect(pr?.old.map((l) => l.fate)).toEqual(["demolish", "demolish", "kept"]);
|
||||
expect(pr?.new.map((l) => l.fate)).toEqual(["new", "new", "kept"]);
|
||||
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");
|
||||
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).
|
||||
const unsaniert = applyOps(p, setBuildUpOps(p, ["W1"], { kind: "none" }));
|
||||
const gf = (q: Project) => computeAreaTable(q, JSON.stringify({ renovation: "endzustand", renovationPhase: "etappe-1" })).total.gf;
|
||||
expect(gf(p) - gf(unsaniert)).toBeGreaterThan(0.25);
|
||||
const gfB = (q: Project) => computeAreaTable(q, "bestand").total.gf;
|
||||
expect(gfB(p)).toBeCloseTo(gfB(unsaniert), 9);
|
||||
});
|
||||
});
|
||||
@@ -8,9 +8,12 @@
|
||||
// Möbel (Objekte der Bibliothek) und Bäume tragen den Umbau-Status ebenfalls: ein Sofa bleibt (Bestand), ein Tisch wird
|
||||
// entfernt (Abbruch, Etappe 1), ein neues Sofa kommt in den Anbau (Etappe 2); ein Baum wird gefällt (Bäume: `status` = Umbau-Status),
|
||||
// ein neuer wird gepflanzt.
|
||||
// [274] Sanierung je Schicht: die Südwand W1 ist eine Aussenwand „Beton 20 + Dämmung 10 + Aussenputz“ (Bestandstyp
|
||||
// „aw-bestand“) mit dem Sanierungstyp „aw-saniert“ (Beton bleibt, Dämmung und Putz werden abgebrochen, neue Dämmung 20 +
|
||||
// neuer Putz), saniert in Etappe 1: Kern bleibt an seiner Stelle, die Fassade rückt 10 cm nach aussen.
|
||||
// Nur Modellfelder, keine Kern-Befehle: das Modul ist ohne geladenen Kern auswertbar.
|
||||
|
||||
import type { Ceiling, Drawing2D, DrawingLevel, Opening, Project, Renovation, Room, Tree, Wall } from "./types";
|
||||
import type { Ceiling, Drawing2D, DrawingLevel, Opening, Project, Renovation, Room, Tree, Wall, WallType } from "./types";
|
||||
import { sampleProject } from "./sampleProject";
|
||||
|
||||
const E1: Renovation = { status: "new", phase: "etappe-1" };
|
||||
@@ -46,8 +49,35 @@ export function buildUmbauSampleProject(): Project {
|
||||
{ id: "schnitt-b", name: "Schnitt B", kind: "section", visible: true, locked: false, linePoints: [{ x: 1.4, y: -1 }, { x: 1.4, y: 8 }], directionSign: -1 },
|
||||
// Ansicht West (Blick nach Osten): das neue Fenster O3 in der Bestandswand W4 mit seinem Abbruch-Stück, der Anbau dahinter.
|
||||
{ id: "ansicht-west", name: "Ansicht West", kind: "elevation", visible: true, locked: false, linePoints: [{ x: -2, y: 8 }, { x: -2, y: -1 }], directionSign: 1 },
|
||||
// [274] Schnitt durch die sanierte Südwand W1 (zwischen Tür und Fenster) und den Anbau.
|
||||
{ id: "schnitt-c", name: "Schnitt C", kind: "section", visible: true, locked: false, linePoints: [{ x: 2, y: -1 }, { x: 2, y: 8 }], directionSign: -1 },
|
||||
];
|
||||
const walls: Wall[] = base.walls.map((w) =>
|
||||
w.id === "W9" ? { ...w, renovation: D1 } : w.id === "W1" ? { ...w, wallTypeId: "aw-bestand", renovation: { status: "existing", phase: "etappe-1", renovated: true } } : w,
|
||||
);
|
||||
// [274] Typ-Paar Bestand → Sanierung (aussen → innen).
|
||||
const wallTypes: WallType[] = [
|
||||
...base.wallTypes,
|
||||
{
|
||||
id: "aw-bestand",
|
||||
name: "Aussenwand Beton 20 + Dämmung 10 (Bestand)",
|
||||
layers: [
|
||||
{ componentId: "render-ext", thickness: 0.02 },
|
||||
{ componentId: "insulation", thickness: 0.1 },
|
||||
{ componentId: "concrete", thickness: 0.2 },
|
||||
],
|
||||
renovationTarget: "aw-saniert",
|
||||
},
|
||||
{
|
||||
id: "aw-saniert",
|
||||
name: "Aussenwand Beton 20 + Dämmung 20 (saniert)",
|
||||
layers: [
|
||||
{ componentId: "render-ext", thickness: 0.02 },
|
||||
{ componentId: "insulation", thickness: 0.2 },
|
||||
{ componentId: "concrete", thickness: 0.2 },
|
||||
],
|
||||
},
|
||||
];
|
||||
const walls: Wall[] = base.walls.map((w) => (w.id === "W9" ? { ...w, renovation: D1 } : w));
|
||||
walls.push(wall("W10", 0, 4, 0, 7), wall("W11", 0, 7, 3, 7), wall("W12", 3, 7, 3, 4));
|
||||
const openings: Opening[] = (base.openings ?? []).map((o) => (o.id === "O2" ? { ...o, renovation: D1 } : o));
|
||||
openings.push(
|
||||
@@ -86,6 +116,7 @@ export function buildUmbauSampleProject(): Project {
|
||||
id: "beispiel-umbau",
|
||||
name: "Beispiel Umbau",
|
||||
drawingLevels: levels,
|
||||
wallTypes,
|
||||
walls,
|
||||
openings,
|
||||
ceilings,
|
||||
|
||||
@@ -1981,6 +1981,9 @@ export type LayerFunction =
|
||||
| "cladding"
|
||||
| "air";
|
||||
|
||||
/** [274] Zuordnung einer Schicht im Typ-Paar Bestand → Sanierung (manuell statt automatisch). */
|
||||
export type LayerRenovation = "auto" | "existing" | "demolish" | "new";
|
||||
|
||||
/**
|
||||
* Schichteinzug einer Wandschicht an der Öffnung ([106]): Regel für alle Seiten, je Seite
|
||||
* übersteuerbar. `layer` zählt ab aussen (0 = äusserste Schicht); negativ ab innen (−1 = innerste),
|
||||
@@ -3415,6 +3418,15 @@ export type Renovation = {
|
||||
* Fehlt ⇒ erste Etappe.
|
||||
*/
|
||||
phase?: string;
|
||||
/**
|
||||
* [274] Saniert: die Wand bekommt den Sanierungstyp ihres Wandtyps (`WallType.renovationTarget`) als neuen
|
||||
* Aufbau; der bisherige Aufbau ist der Bestand. Wirkt nur beim Status Bestand; Etappe der Sanierung = `phase`.
|
||||
*/
|
||||
renovated?: boolean;
|
||||
/**
|
||||
* [274] Ausnahme: anderer neuer Aufbau als der Sanierungstyp des Wandtyps (Wandtyp-Id); setzt „saniert“ voraus.
|
||||
*/
|
||||
newTypeId?: string;
|
||||
};
|
||||
|
||||
/** [271] Ein Umbaufilter (wie Archicads „Renovation Filter“): Darstellung je Status. */
|
||||
@@ -3441,6 +3453,11 @@ export type RenovationSettings = {
|
||||
/** [271] Darstellung eines Status im Umbaufilter. */
|
||||
export type RenovationShow = "show" | "hide" | "override";
|
||||
|
||||
/**
|
||||
* [274] Bezugsseite einer Sanierung (bleibt stehen, von ihr her werden die Schichten verglichen).
|
||||
*/
|
||||
export type RenovationSide = "inside" | "outside";
|
||||
|
||||
/**
|
||||
* [271] Umbau-Status eines Bauteils (Archicad „Renovation Status“; SIA 400: Bestand schwarz/grau, Abbruch gelb,
|
||||
* Neu rot).
|
||||
@@ -4751,7 +4768,26 @@ export type Wall = {
|
||||
export type WallReferenceLine = "left" | "center" | "right";
|
||||
|
||||
/** Ein Wandtyp = geordneter Schichtaufbau (außen → innen). */
|
||||
export type WallType = { id: string; name: string; layers: Array<Layer> };
|
||||
export type WallType = {
|
||||
id: string;
|
||||
name: string;
|
||||
layers: Array<Layer>;
|
||||
/**
|
||||
* [274] Sanierungstyp (Wandtyp-Id): neuer Aufbau aller als „saniert“ markierten Wände dieses (Bestands-)Typs.
|
||||
*/
|
||||
renovationTarget?: string;
|
||||
/** [274] Bezugsseite der Sanierung (fehlt ⇒ innen). */
|
||||
renovationSide?: RenovationSide;
|
||||
/**
|
||||
* [274] Manuelle Zuordnung je Schicht dieses Bestandstyps (Bestand/Abbruch, fehlt/„auto“ = automatisch); gilt
|
||||
* für das Paar mit `renovationTarget`.
|
||||
*/
|
||||
renovationOld?: Array<LayerRenovation>;
|
||||
/**
|
||||
* [274] Manuelle Zuordnung je Schicht des Sanierungstyps (Bestand/Neu, fehlt/„auto“ = automatisch).
|
||||
*/
|
||||
renovationNew?: Array<LayerRenovation>;
|
||||
};
|
||||
|
||||
/** Rollladen-/Sonnenschutzkasten über der Öffnung (P0-Minimalfassung). */
|
||||
export type WindowShading = {
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
import type { Project, RenovationShow, RenovationStatus } from "../model/types";
|
||||
import { ConfirmDialog } from "../ui/ConfirmDialog";
|
||||
import { usePanelHostAction } from "./host";
|
||||
import { RenovationSanierung } from "./RenovationSanierung";
|
||||
|
||||
const MIXED = "__mixed";
|
||||
|
||||
@@ -238,6 +239,9 @@ export function RenovationPanel() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* [274] Sanierung je Schicht: Typ-Paare Bestand → Sanierungstyp */}
|
||||
<RenovationSanierung project={project} />
|
||||
|
||||
{/* Etappen */}
|
||||
<div className="reno-block">
|
||||
<div className="reno-head">{t("renovation.phases.title")}</div>
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
// [274] Umbau-Panel, Abschnitt „Sanierung“: Typ-Paare Bestandstyp → Sanierungstyp mit Zählern, „Alle Wände vom Typ
|
||||
// sanieren“ (ein Undo-Schritt), „Sanierungstyp anlegen …“ (Kopie des Bestandstyps) und der Typ-Paar-Editor: Alt und Neu
|
||||
// nebeneinander, Zuordnung je Schicht (automatisch oder manuell), Bezugsseite, Ergebnis-Streifen mit SIA-Farben.
|
||||
// Die Regeln (Zuordnung, Teilstücke) rechnet der Kern (`renovation::build_up`); gespeichert wird am Bestandstyp.
|
||||
|
||||
import { useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import type { TranslationKey } from "../i18n";
|
||||
import { useStore } from "../state/appStore";
|
||||
import {
|
||||
createRenovationTypeOps,
|
||||
renovateAllOfTypeOps,
|
||||
renovationPair,
|
||||
renovationPairs,
|
||||
setTypePairOps,
|
||||
} from "../core";
|
||||
import type { LayerRenovation, Project, RenovationSide } from "../model/types";
|
||||
import { RenovationStrip } from "../ui/RenovationStrip";
|
||||
import { usePanelHostAction } from "./host";
|
||||
|
||||
function PairEditor({ project, typeId }: { project: Project; typeId: string }) {
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const openResources = usePanelHostAction("onOpenResources");
|
||||
const wt = project.wallTypes.find((x) => x.id === typeId);
|
||||
const pair = renovationPair(project, typeId);
|
||||
if (!wt || !pair) return null;
|
||||
const oldOv = wt.renovationOld ?? [];
|
||||
const newOv = wt.renovationNew ?? [];
|
||||
const setOv = (which: "old" | "new", i: number, v: LayerRenovation) => {
|
||||
const n = which === "old" ? wt.layers.length : (project.wallTypes.find((x) => x.id === pair.target)?.layers.length ?? 0);
|
||||
const cur = [...(which === "old" ? oldOv : newOv)];
|
||||
while (cur.length < n) cur.push("auto");
|
||||
cur[i] = v;
|
||||
applyChange((p) => setTypePairOps(p, typeId, which === "old" ? { old: cur } : { new: cur }));
|
||||
};
|
||||
const layerRow = (which: "old" | "new", l: (typeof pair.old)[number], i: number) => {
|
||||
const ov = (which === "old" ? oldOv : newOv)[i] ?? "auto";
|
||||
const choices: LayerRenovation[] = which === "old" ? ["auto", "existing", "demolish"] : ["auto", "existing", "new"];
|
||||
return (
|
||||
<div className="reno-pair-layer" key={i} data-testid={`reno-pair-${which}-layer`} data-fate={l.fate}>
|
||||
<span className="reno-swatch" style={{ background: l.color }} aria-hidden="true" />
|
||||
<span className="reno-pair-name" title={l.name}>
|
||||
{l.name}
|
||||
</span>
|
||||
<span className="reno-pair-cm">{(l.thickness * 100).toFixed(1)}</span>
|
||||
<select
|
||||
value={ov}
|
||||
data-testid={`reno-pair-${which}-fate`}
|
||||
aria-label={l.name}
|
||||
className={`reno-fate is-${l.fate}`}
|
||||
onChange={(e) => setOv(which, i, e.target.value as LayerRenovation)}
|
||||
>
|
||||
{choices.map((c) => (
|
||||
<option key={c} value={c}>
|
||||
{c === "auto" ? `${t("renovation.fate.auto")} (${t(`renovation.fate.${l.fate}` as TranslationKey)})` : t(`renovation.fate.${c === "existing" ? "kept" : c}` as TranslationKey)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
return (
|
||||
<div className="reno-pair-editor" data-testid="reno-pair-editor">
|
||||
<label className="reno-field">
|
||||
<span>{t("renovation.panel.sanierung.target")}</span>
|
||||
<select value={pair.target} data-testid="reno-pair-target" onChange={(e) => applyChange((p) => setTypePairOps(p, typeId, { target: e.target.value, old: null, new: null }))}>
|
||||
{project.wallTypes
|
||||
.filter((x) => x.id !== typeId)
|
||||
.map((x) => (
|
||||
<option key={x.id} value={x.id}>
|
||||
{x.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="reno-field">
|
||||
<span>{t("renovation.panel.sanierung.side")}</span>
|
||||
<select value={pair.side} data-testid="reno-pair-side" onChange={(e) => applyChange((p) => setTypePairOps(p, typeId, { side: e.target.value as RenovationSide }))}>
|
||||
<option value="inside">{t("renovation.panel.sanierung.side.inside")}</option>
|
||||
<option value="outside">{t("renovation.panel.sanierung.side.outside")}</option>
|
||||
</select>
|
||||
</label>
|
||||
<div className="reno-pair-cols">
|
||||
<div className="reno-pair-col">
|
||||
<div className="reno-head sub">{t("renovation.panel.sanierung.oldLayers")}</div>
|
||||
{pair.old.map((l, i) => layerRow("old", l, i))}
|
||||
</div>
|
||||
<div className="reno-pair-col">
|
||||
<div className="reno-head sub">{t("renovation.panel.sanierung.newLayers")}</div>
|
||||
{pair.new.map((l, i) => layerRow("new", l, i))}
|
||||
</div>
|
||||
</div>
|
||||
<RenovationStrip pair={pair} width={170} />
|
||||
<div className="reno-select-by">
|
||||
<button type="button" className="reno-link-btn" data-testid="reno-pair-reset" onClick={() => applyChange((p) => setTypePairOps(p, typeId, { old: null, new: null }))}>
|
||||
{t("renovation.panel.sanierung.reset")}
|
||||
</button>
|
||||
<button type="button" className="reno-link-btn" onClick={() => openResources("wallStyles")}>
|
||||
{t("renovation.panel.sanierung.editLayers")}
|
||||
</button>
|
||||
<button type="button" className="reno-link-btn" data-testid="reno-pair-remove" onClick={() => applyChange((p) => setTypePairOps(p, typeId, { target: null, old: null, new: null, side: null }))}>
|
||||
{t("renovation.panel.sanierung.remove")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function RenovationSanierung({ project }: { project: Project }) {
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const info = renovationPairs(project);
|
||||
const [open, setOpen] = useState<string | null>(null);
|
||||
const targets = new Set(info.pairs.map((x) => x.target));
|
||||
const candidates = project.wallTypes.filter((x) => !x.renovationTarget && !targets.has(x.id));
|
||||
const [pick, setPick] = useState("");
|
||||
const pickId = candidates.some((x) => x.id === pick) ? pick : (candidates[0]?.id ?? "");
|
||||
return (
|
||||
<div className="reno-block" data-testid="reno-sanierung">
|
||||
<div className="reno-head">{t("renovation.panel.sanierung.title")}</div>
|
||||
<div className="reno-hint" data-testid="reno-sanierung-count">
|
||||
{t("renovation.panel.sanierung.count", { n: String(info.renovated) })}
|
||||
</div>
|
||||
{info.pairs.length === 0 && <div className="reno-hint">{t("renovation.panel.sanierung.empty")}</div>}
|
||||
{info.pairs.map((pr) => (
|
||||
<div className="reno-pair" key={pr.type} data-testid="reno-pair">
|
||||
<div className="reno-pair-title">
|
||||
<span>{pr.name}</span>
|
||||
<span aria-hidden="true">→</span>
|
||||
<span>{pr.targetName ?? pr.target}</span>
|
||||
</div>
|
||||
<div className="reno-hint">{t("renovation.panel.sanierung.walls", { r: String(pr.renovated), n: String(pr.walls) })}</div>
|
||||
<div className="reno-select-by">
|
||||
<button
|
||||
type="button"
|
||||
className="reno-link-btn"
|
||||
data-testid="reno-pair-renovate-all"
|
||||
disabled={pr.walls === 0 || pr.renovated === pr.walls}
|
||||
onClick={() => applyChange((p) => renovateAllOfTypeOps(p, pr.type))}
|
||||
>
|
||||
{t("renovation.panel.sanierung.renovateAll")}
|
||||
</button>
|
||||
<button type="button" className="reno-link-btn" data-testid="reno-pair-edit" aria-expanded={open === pr.type} onClick={() => setOpen(open === pr.type ? null : pr.type)}>
|
||||
{t("renovation.panel.sanierung.edit")}
|
||||
</button>
|
||||
</div>
|
||||
{open === pr.type && <PairEditor project={project} typeId={pr.type} />}
|
||||
</div>
|
||||
))}
|
||||
{candidates.length > 0 && (
|
||||
<div className="reno-field reno-create">
|
||||
<select value={pickId} aria-label={t("renovation.panel.sanierung.createFor")} data-testid="reno-create-type" onChange={(e) => setPick(e.target.value)}>
|
||||
{candidates.map((x) => (
|
||||
<option key={x.id} value={x.id}>
|
||||
{x.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<button
|
||||
type="button"
|
||||
className="reno-add-btn"
|
||||
data-testid="reno-create"
|
||||
onClick={() => {
|
||||
const src = project.wallTypes.find((x) => x.id === pickId);
|
||||
if (!src) return;
|
||||
applyChange((p) => createRenovationTypeOps(p, pickId, t("renovation.panel.sanierung.newName", { name: src.name })).ops);
|
||||
setOpen(pickId);
|
||||
}}
|
||||
>
|
||||
{t("renovation.panel.sanierung.create")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -4,8 +4,9 @@
|
||||
import { memo } from "react";
|
||||
import { t } from "../../i18n";
|
||||
import type { RenovationStatus } from "../../model/types";
|
||||
import { RENOVATION_STATUSES } from "../../core";
|
||||
import { useStore } from "../../state/appStore";
|
||||
import { RENOVATION_STATUSES, commonBuildUp, parseBuildUpKey, renovationPair, setBuildUpOps } from "../../core";
|
||||
import { getState, useStore } from "../../state/appStore";
|
||||
import { RenovationStrip } from "../../ui/RenovationStrip";
|
||||
import { useRenovationSelection } from "../../state/renovationHook";
|
||||
import { Dropdown } from "../../ui/Dropdown";
|
||||
|
||||
@@ -44,6 +45,7 @@ export const RenovationField = memo(function RenovationField() {
|
||||
width={150}
|
||||
/>
|
||||
</div>
|
||||
<BuildUpField />
|
||||
{phases.length > 0 && (
|
||||
<div className="objinfo-field" data-testid="objinfo-renovation-phase">
|
||||
<span className="objinfo-flabel">{t("renovation.phase")}</span>
|
||||
@@ -62,3 +64,59 @@ export const RenovationField = memo(function RenovationField() {
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
const NO_TYPES: readonly { id: string; name: string; renovationTarget?: string }[] = [];
|
||||
|
||||
/**
|
||||
* [274] „Neuer Aufbau (Sanierung)“ der gewählten Wände: keiner, wie Typ (Sanierungstyp des Wandtyps) oder ein anderer
|
||||
* Wandtyp (Ausnahme). Mehrfachauswahl in einem Undo-Schritt; bei gemeinsamem Wandtyp der Streifen Alt/Neu/Ergebnis.
|
||||
*/
|
||||
const BuildUpField = memo(function BuildUpField() {
|
||||
const types = useStore((s) => s.project.wallTypes) ?? NO_TYPES;
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const wallIds = useStore((s) => s.selection.walls);
|
||||
// Gemeinsamer Aufbau und gemeinsamer Wandtyp als Text: rendert nur bei echter Änderung neu.
|
||||
const key = useStore((s) => {
|
||||
const set = new Set(s.selection.walls);
|
||||
const ts = new Set(s.project.walls.filter((w) => set.has(w.id)).map((w) => w.wallTypeId));
|
||||
return JSON.stringify([commonBuildUp(s.project, s.selection.walls), ts.size === 1 ? [...ts][0] : null]);
|
||||
});
|
||||
const [common, typeId] = JSON.parse(key) as [string | null, string | null];
|
||||
if (common === null || wallIds.length === 0) return null;
|
||||
const own = typeId ? types.find((x) => x.id === typeId) : undefined;
|
||||
const ownTarget = own?.renovationTarget ? types.find((x) => x.id === own.renovationTarget) : undefined;
|
||||
const options = [
|
||||
...(common === "mixed" ? [{ value: MIXED, label: t("renovation.mixed") }] : []),
|
||||
{ value: "", label: t("renovation.buildUp.none") },
|
||||
{ value: "type", label: ownTarget ? t("renovation.buildUp.type", { name: ownTarget.name }) : t("renovation.buildUp.typeMissing") },
|
||||
...types.filter((x) => x.id !== typeId).map((x) => ({ value: `t:${x.id}`, label: t("renovation.buildUp.other", { name: x.name }) })),
|
||||
];
|
||||
const value = common === "mixed" ? MIXED : common;
|
||||
const b = parseBuildUpKey(value === MIXED ? "" : value);
|
||||
const target = b.kind === "other" ? b.typeId : b.kind === "type" ? ownTarget?.id : undefined;
|
||||
const pair = typeId && target ? renovationPair(getState().project, typeId, target) : null;
|
||||
return (
|
||||
<>
|
||||
<div className="objinfo-field" data-testid="objinfo-renovation-buildup">
|
||||
<span className="objinfo-flabel" title={t("renovation.buildUp.hint")}>
|
||||
{t("renovation.buildUp")}
|
||||
</span>
|
||||
<Dropdown
|
||||
value={value}
|
||||
onChange={(v) => {
|
||||
if (v === MIXED) return;
|
||||
applyChange((p) => setBuildUpOps(p, wallIds, parseBuildUpKey(v)));
|
||||
}}
|
||||
options={options}
|
||||
title={t("renovation.buildUp")}
|
||||
width={150}
|
||||
/>
|
||||
</div>
|
||||
{pair && (
|
||||
<div className="objinfo-field reno-strip-field" data-testid="objinfo-renovation-strip">
|
||||
<RenovationStrip pair={pair} width={140} />
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
});
|
||||
@@ -65,8 +65,8 @@ declare global {
|
||||
planFillColors: () => Record<string, number>;
|
||||
/** [272] Öffnungs-Ids im Grundriss der aktiven Ebene (alle Klassen, 1:100). */
|
||||
planOpeningIds: () => string[];
|
||||
/** [271] Umbau: Filter und Etappe der aktiven Ebene, Zeichen-Status, Status je Wand. */
|
||||
renovation: () => { filter: string | null; phase: string | null; draw: string; walls: Record<string, string> };
|
||||
/** [271] Umbau: Filter und Etappe der aktiven Ebene, Zeichen-Status, Status je Wand; [274] neuer Aufbau je Wand („type“ = Sanierungstyp, sonst Typ-Id, leer = keiner). */
|
||||
renovation: () => { filter: string | null; phase: string | null; draw: string; walls: Record<string, string>; buildUp: Record<string, string> };
|
||||
/** [272] Varianten: Kombination der aktiven Ebene, Zeichen-Variante, Variante je Element (`set/option`, leer = Hauptmodell), Sätze. */
|
||||
designOptions: () => { level: Record<string, string>; combination: string | null; combinations: string[]; draw: string | null; elements: Record<string, string>; sets: string[] };
|
||||
/** [272] Grundriss der aktiven Ebene wie auf dem Bildschirm (mit Bearbeitungsvariante): Wände und grau gezeichnete Wände (ids); dazu derselbe Grundriss für den Druck. */
|
||||
@@ -230,6 +230,7 @@ export function installTestHooks(): void {
|
||||
phase: l?.renovationPhase ?? null,
|
||||
draw: s.drawRenovation.status,
|
||||
walls: Object.fromEntries(s.project.walls.map((w) => [w.id, w.renovation?.status ?? "existing"])),
|
||||
buildUp: Object.fromEntries(s.project.walls.map((w) => [w.id, w.renovation?.newTypeId ?? (w.renovation?.renovated ? "type" : "")])),
|
||||
};
|
||||
},
|
||||
context: () =>
|
||||
|
||||
+114
@@ -10266,3 +10266,117 @@ body {
|
||||
.sb-toggle.sb-design-editing .material-symbols-outlined {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* [274] Sanierung je Schicht: Streifen Alt/Neu/Ergebnis, Typ-Paare und Typ-Paar-Editor im Umbau-Panel. */
|
||||
.reno-strip {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
font-size: 10px;
|
||||
color: var(--ink-2);
|
||||
}
|
||||
.reno-strip-row {
|
||||
display: grid;
|
||||
grid-template-columns: 48px auto 1fr;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.reno-strip-label {
|
||||
font-size: 10px;
|
||||
}
|
||||
.reno-strip-bar {
|
||||
display: inline-flex;
|
||||
height: 10px;
|
||||
}
|
||||
.reno-strip-piece {
|
||||
display: inline-block;
|
||||
height: 10px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid rgba(0, 0, 0, 0.5);
|
||||
border-right-width: 0;
|
||||
}
|
||||
.reno-strip-piece:last-child {
|
||||
border-right-width: 1px;
|
||||
}
|
||||
.reno-strip-cm {
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: var(--muted);
|
||||
}
|
||||
.reno-strip-field {
|
||||
display: block;
|
||||
}
|
||||
.reno-pair {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
padding: 4px 0;
|
||||
border-top: 1px solid var(--line, rgba(0, 0, 0, 0.08));
|
||||
}
|
||||
.reno-pair-title {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.reno-pair-editor {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding: 6px;
|
||||
border-radius: 4px;
|
||||
background: var(--panel-2, rgba(0, 0, 0, 0.03));
|
||||
}
|
||||
.reno-pair-cols {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 6px;
|
||||
}
|
||||
.reno-pair-col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
}
|
||||
.reno-pair-layer {
|
||||
display: grid;
|
||||
grid-template-columns: 12px minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
column-gap: 4px;
|
||||
font-size: 11px;
|
||||
}
|
||||
.reno-pair-layer .reno-swatch {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
.reno-pair-name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.reno-pair-cm {
|
||||
color: var(--muted);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.reno-pair-layer select {
|
||||
grid-column: 2 / 4;
|
||||
font-size: 11px;
|
||||
min-width: 0;
|
||||
}
|
||||
.reno-fate.is-demolish {
|
||||
box-shadow: inset 3px 0 0 #ffd800;
|
||||
}
|
||||
.reno-fate.is-new {
|
||||
box-shadow: inset 3px 0 0 #e3001b;
|
||||
}
|
||||
.reno-fate.is-kept {
|
||||
box-shadow: inset 3px 0 0 #a6a6a6;
|
||||
}
|
||||
.reno-create {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
}
|
||||
.reno-create select {
|
||||
min-width: 0;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// [274] Vorschau-Streifen einer Sanierung: Alt, Neu und Ergebnis (Umbauplan) mit SIA-Farben, aussen links → innen rechts,
|
||||
// massstäblich zueinander (gleiche Meter je Pixel). Die Teilstücke rechnet der Kern (`renovationPair`).
|
||||
|
||||
import { t } from "../i18n";
|
||||
import type { TranslationKey } from "../i18n";
|
||||
import type { RenovationPair, RenovationStripPiece } from "../core";
|
||||
|
||||
function Bar({ pieces, scale, demolishFill }: { pieces: RenovationStripPiece[]; scale: number; demolishFill: string }) {
|
||||
return (
|
||||
<span className="reno-strip-bar">
|
||||
{pieces.map((q, i) => (
|
||||
<span
|
||||
key={i}
|
||||
className={`reno-strip-piece is-${q.kind}`}
|
||||
data-kind={q.kind}
|
||||
style={{
|
||||
width: `${Math.max(1, q.thickness * scale)}px`,
|
||||
background: q.fill,
|
||||
// Neu über Abbruch: Abbruch als gestrichelte Kontur über der Neu-Füllung.
|
||||
outline: q.kind === "newOverDemolish" ? `1px dashed ${demolishFill}` : undefined,
|
||||
outlineOffset: q.kind === "newOverDemolish" ? "-2px" : undefined,
|
||||
borderStyle: q.kind === "demolish" ? "dashed" : "solid",
|
||||
}}
|
||||
title={`${t(`renovation.fate.${q.kind === "newOverDemolish" ? "new" : q.kind}` as TranslationKey)} ${(q.thickness * 100).toFixed(1)} cm`}
|
||||
/>
|
||||
))}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** Streifen Alt/Neu/Ergebnis eines Typ-Paars; `width` = Pixel für den dicksten Aufbau. */
|
||||
export function RenovationStrip({ pair, width = 150 }: { pair: RenovationPair; width?: number }) {
|
||||
const sum = (v: RenovationStripPiece[]) => v.reduce((a, q) => a + q.thickness, 0);
|
||||
const max = Math.max(sum(pair.oldStrip), sum(pair.newStrip), sum(pair.result), 1e-6);
|
||||
const scale = width / max;
|
||||
const demolishFill = pair.result.find((q) => q.kind === "demolish")?.fill ?? pair.oldStrip.find((q) => q.kind === "demolish")?.fill ?? "#ffd800";
|
||||
const row = (label: string, pieces: RenovationStripPiece[], id: string) => (
|
||||
<div className="reno-strip-row" data-testid={`reno-strip-${id}`}>
|
||||
<span className="reno-strip-label">{label}</span>
|
||||
<Bar pieces={pieces} scale={scale} demolishFill={demolishFill} />
|
||||
<span className="reno-strip-cm">{(sum(pieces) * 100).toFixed(1)} cm</span>
|
||||
</div>
|
||||
);
|
||||
return (
|
||||
<div className="reno-strip" data-testid="reno-strip">
|
||||
{row(t("renovation.strip.old"), pair.oldStrip, "old")}
|
||||
{row(t("renovation.strip.new"), pair.newStrip, "new")}
|
||||
{row(t("renovation.strip.result"), pair.result, "result")}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user