diff --git a/TODO.md b/TODO.md index ae942e3a..3d0b3e52 100644 --- a/TODO.md +++ b/TODO.md @@ -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 292); +- **IDs sind stabil.** Neue ID = nächste freie Zahl nach der höchsten im Archiv und hier (aktuell 293); 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. @@ -66,7 +66,8 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC. - ◐ **[291]** Geländer: Aufbau je Feld und gebunden an Treppe/Deckenkante (19.11., nach 1.0, Leitbild Archicad; Linux/Chromium, nicht auf dem Mac geprüft). Modell (Rust, `gen:types`): `posts`/`postSpacing`/`postSize` (Pfosten an Ecken und Enden, Felder je Strecke gleich lang), `handrailProfile` (rechteckig/rund als Achteck-Stufen), `handrailHeight`, `midRails`, `fields` (Füllung je Feld: Stäbe/Glas/Brüstung/Lochblech), Bindung `stairId`+`stairSide` bzw. `ceilingId`+`edgeIndex`/`edgeCount`/`edgeInset`. Auflösung im Kern (`railing::path`): Treppe = Handlauf-Achse der Wange (`stair_rail`), Fuss lotrecht unter dem Handlauf (Höhe über der Stufenkante), Teile auf Teilstrecken geschert (`Piece.slope` = `RSlab.slope`); Deckenkante = Kantenzug nach innen versetzt, Fuss auf Decken-OK; ändert sich Treppe/Decke, folgt die Achse. Gebundene Treppenseite: eigener Treppen-Handlauf entfällt (`railing::stair_code` in Plan, 3D, IFC), sonst wie bisher. Grundriss an der Schnitthöhe geteilt (darüber Strich-Punkt), Schnitt/Ansicht/3D/3D-Dokument/Schatten/IFC aus denselben Prismen (IfcRailing ein Körper, Pset `Dossier_Railing.Axis` = aufgelöste Achse), Objekt-Info (Pfosten, Profil, Handlaufhöhe, Zwischenholme, Füllung je Feld, Bindung, „Lösen“), gebundene Geländer ohne Griffe. Befehl `gelaender` Option „an Treppe/Kante“ (ein Klick, Kern sucht nächste Wange/Kante ≤ 0.75 m). Bestehende Geländer unverändert (Goldens gleich). Tests: `railing_bound_tests.rs` (Pfosten, Ecken, Felder, Treppe/Decke ändern, Treppen-Handlauf, Befehl, Grundriss, Rundreise), `railingGrips.test.ts`, e2e `railing291.spec.ts`; Prüfbild Axo + Ansicht (Treppe mit Stabgeländer, Balkon Glas mit Pfosten) angesehen, nicht eingecheckt. Offen: Füllung je Feld in der Objekt-Info nur über Feld-Nr. (keine Auswahl im Plan); runder Handlauf nur angenähert; Treppen-Wendel ohne Pfosten-Feinheiten (Pfosten ab 10° Knick); IFC ein Körper (Pfosten nicht als Teile); gebundene Geländer bewegen sich nicht mit „Verschieben“ (folgen dem Träger); Mac/Tauri nicht geprüft. · M - ◐ **[278]** Nutzungseinheiten und Wohnungsspiegel (17.11.; Lücke 6; nicht auf dem Mac geprüft): `unit_schedule.rs`, Panel Flächenbilanz „Nutzungseinheiten“, CLI `--wohnungsspiegel` umgesetzt. Offen: Einheiten im Grundriss als farbige Fläche/Stempel auf eigener Klasse ([180]; `Unit.color` ist da); Summen je Typ/Geschoss nicht als eigene Blatt-Tabelle; Mindestfläche Zimmer und NWF nach kantonaler Definition fehlen; Einheit nicht in IFC/DXF; Spiegel im schmalen Dock als Karten. · M - ◐ **[281]** Geneigte Decken und Rampen (18.11.; Lücke 8; nicht auf dem Mac geprüft): `Ceiling.slope`, Befehl `rampe`, Schnitt/Ansicht/3D/IFC (`IfcRamp`) umgesetzt. Offen: Wandschichten werden von geneigten Decken nicht eingeschnitten (Wandoberkante: [292]); STEP-Export schreibt die Platte waagrecht (truck kennt `slope` nicht); Sonne: geneigte Decke wirft Hüllprisma-Schatten, empfängt keinen; Rampenlauf ohne Material-/Typzuordnung im IFC; Rampen-Umriss unter Schnittebene gestrichelt. Gefällelinie 18.11. mit zwei Griffen (Anfang/Ende, Kern-Op `ceilingSlopeGrip`, Gefälle in % bleibt, ein Undo-Schritt je Zug; e2e `ramp281.spec.ts`; nicht in der Tauri-App geprüft). · M -- ◐ **[292]** Wand „OK bis Decke“ (19.11.; nach 1.0; Rest von [281]): `Wall.ceilingAttach` (Rust-Modell + `types.generated.ts`; fehlt = aus). Die Wand endet an der Unterkante der Decken ihres Geschosses — waagrecht auf Decken-UK, bei geneigter Decke mit schräger Oberkante (`ceiling_undersides` in `model3d/walls.rs` baut Unterkanten-Facetten samt Aussparungen, `wall_bands.rs` nutzt dieselbe Facetten-Logik wie „Wand an Dach“ [G2]: je Punkt gilt die tiefste Decken-UK bzw. die niedrigere von Dach und Decke, Stücke über der UK entfallen, im Deckenloch und ausserhalb der Decke bleibt die Krone, ohne Decke die Geschosshöhe; Platte bis Aussenkante der tragenden Schicht [178]). Wirkt über `emit_walls` auf 3D, Schnitt, Ansicht und IFC (Bänder, Mengen). UI: Objekt-Info Wand „Oberkante: Geschosshöhe / Bis Decke“, Befehl `wand` Option „OK bis Decke“ (Taste D/C, Vorgabe aus — keine eindeutige Regel für Innenwände). Rust-Tests `wand_ok_bis_decke_*` (waagrecht, Rückfall, geneigt, Deckenloch). Offen: Wand-Quelle `top` „an Dach“ und „frei“ bleiben die bisherigen Felder (`top`/`roofAttach`), keine gemeinsame Auswahl; Plan-Ansichtshöhe skalarer Werte (z. B. Kennzahl Wandhöhe) nutzt weiter die Krone; nicht in der Tauri-App geprüft. · S +- ◐ **[292]** Wand „OK bis Decke“ (19.11.; nach 1.0; Rest von [281]): `Wall.ceilingAttach` (Rust-Modell + `types.generated.ts`; fehlt = aus). Die Wand endet an der Unterkante der Decken ihres Geschosses — waagrecht auf Decken-UK, bei geneigter Decke mit schräger Oberkante (`ceiling_undersides` in `model3d/walls.rs` baut Unterkanten-Facetten samt Aussparungen, `wall_bands.rs` nutzt dieselbe Facetten-Logik wie „Wand an Dach“ [G2]: je Punkt gilt die tiefste Decken-UK bzw. die niedrigere von Dach und Decke, Stücke über der UK entfallen, im Deckenloch und ausserhalb der Decke bleibt die Krone, ohne Decke die Geschosshöhe; Platte bis Aussenkante der tragenden Schicht [178]). Wirkt über `emit_walls` auf 3D, Schnitt, Ansicht und IFC (Bänder, Mengen). UI: Objekt-Info Wand „Oberkante: Geschosshöhe / Bis Decke“, Befehl `wand` Option „OK bis Decke“ (Taste D/C, Vorgabe aus — keine eindeutige Regel für Innenwände). Rust-Tests `wand_ok_bis_decke_*` (waagrecht, Rückfall, geneigt, Deckenloch). Offen: Auswahl jetzt gemeinsam, s. [293]; Plan-Ansichtshöhe skalarer Werte (z. B. Kennzahl Wandhöhe) nutzt weiter die Krone; nicht in der Tauri-App geprüft. · S +- ◐ **[293]** Wand-Oberkante als EINE Auswahl (19.11.; nach 1.0; Rest von [292]): `src/model/wallTop.ts` (vitest) bildet `roofAttach` + `ceilingAttach` auf „Geschosshöhe / Frei (Höhe)“ (Dächer schneiden automatisch), „Bis Decke“ (Dach schneidet nicht), „Bis Dach“, „Bis Decke/Dach (tiefere)“ ab — der Kern rechnet beide Felder schon zusammen (je Punkt die tiefere Kante), also kein Modell-Umbau/Enum. Objekt-Info Wand: ein Dropdown „Oberkante“ (`onSetWallTopMode`, beide Felder in einer Op = ein Undo-Schritt), Befehl `wand` Option „Oberkante“ (Taste D/T, reihum; Kern `cmd_create.rs` setzt `roofAttach`/`ceilingAttach`, Rust-Test `wand_oberkante_aus_anfrage`). Der Zustand „Dach schneidet nicht, keine Decke“ (`roofAttach` false) zeigt sich als „Geschosshöhe“ (Wählen setzt zurück auf automatisch). Offen: skalare Wandhöhe (`u_value.rs` Fläche, `export_schedule.rs` Wandliste) nutzt weiter `Wall.height` — Mittelwert aus der tatsächlichen Oberkante (Fläche/Länge) nicht umgesetzt (kein einzelner Kern-Helfer für die Wandfläche je Wand, Bänder je Schicht); Höhe frei vs. Geschosshöhe bleibt über die Höhenfelder darunter; nicht in der Tauri-App geprüft. · S - ◐ **[280]** Träger/Unterzug als eigenes Bauteil (17.11.; Lücke 9; nicht auf dem Mac geprüft): `Project.beams`, Befehl `traeger`, IFC `IfcBeam`, Griffe umgesetzt (`Beam::as_column`, läuft durch Stützen-Code). Offen: `Group` ohne `beamIds` (Träger laufen über `columnIds`; Transformation bewegt nur EIN gewähltes Element des Kanals, in betretener Gruppe gezeichneter Träger wird nicht Mitglied, ungeprüft); keine Stütze-Träger-Verschneidung/Anschlussdetails; Profile nur als Text (kein Katalog, keine Gewichte); nur rechteckig und waagrecht; Deckenspiegel mit Unterzügen fehlt; Fassadenträger über mehrere Geschosse nur via `topOffset`; IFC-Import liest `IfcBeam` weiter als Körper ([B4]/[B5]); Attribute-Panel (Strich, Schraffur, Poché) für Träger nicht verdrahtet. · M - ◐ **[276]** Schnitt-/Ansichtslinie im Plan einstellbar wie Archicad (17.11.): `lineMode`, Linientyp, Stift, Marker je Linie, Vorgabe in der Modelldarstellung (`plan/misc.rs`, `plan/context.rs`, `SectionLookFields.tsx`). Offen: nicht auf dem Mac geprüft; Linientyp/Stift in der Modelldarstellung wählbar machen; Marke „Kreis mit Pfeil“ für Ansichten; Marken-Versatz unabhängig von der Linie. · S - ◐ **[284]** Review der Stränge seit `9f32c71f` ([271]–[283], [B5], [256], [266]) auf echte Fehler vor der Beta (18.11.). Behoben: Träger fehlten im Varianten-Filter (`design_options.rs`) und in `without_elements` (Umbau/Variante in 3D, Schnitt, Kennzahlen, IFC); Gefällelinie der geneigten Decke wanderte beim Verschieben/Drehen/Kopieren und beim Projekt-Verschieben nicht mit; Export „nur Auswahl“ nahm alle Geländer/Bäume mit; Zeichnen in betretener Gruppe nahm Träger/Geländer/Bäume nicht auf; Fang-Cache ohne `beams`; Cmd+A ohne Geländer; Geschoss löschen liess Dächer, Stützen, Träger, Geländer verwaist; Robustheits-Test für die neuen Bauteile mit Randwerten (kein Panic gefunden). Danach (18.11.): Geschoss löschen nimmt auch 2D-Elemente, Körper, Bäume und Kameras des Geschosses mit (`projectSlice.ts::deleteLevel`, vitest); Geländer in Darstellungs-Regeln (`overrides.rs`, Bauteilart „railing“), „Klasse der Auswahl“ (`layers.rs`) und Mass-Assoziation (`dim_assoc.rs`: Ecken/Kanten der Achse); Robustheits-Fixture `wettbewerb.json` neu aus `dossier-cli :wettbewerb migrate` (mit Geländern, Rampe, Einheiten). Die übrigen Fixtures enthalten diese Bauteile in ihren Beispielprojekten nicht. Erledigt, keine Offenpunkte mehr. Nicht in der Tauri-App geprüft; TS-Seite nur vitest/tsc (WASM nicht neu gebaut). diff --git a/doc/review-293/oberkante.png b/doc/review-293/oberkante.png new file mode 100644 index 00000000..0d7db5e0 Binary files /dev/null and b/doc/review-293/oberkante.png differ diff --git a/e2e/wallTop293.spec.ts b/e2e/wallTop293.spec.ts new file mode 100644 index 00000000..bf23c151 --- /dev/null +++ b/e2e/wallTop293.spec.ts @@ -0,0 +1,37 @@ +// [293] Wand-Oberkante als EINE Auswahl (Objekt-Info): beide Felder in einer Op, ein Undo-Schritt. +// Prüfbild: doc/review-293/oberkante.png (Objekt-Info der Wand mit Auswahl „Oberkante“). +import { blurFocus, discardIfAsked, expect, fileMenu, test } from "./app"; + +test("Wand: Oberkante Auswahl setzt roofAttach/ceilingAttach zusammen, Undo in einem Schritt ([293])", 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: Wettbewerb$/); + await discardIfAsked(page); + await expect(page.locator(".project-name")).toContainText("Wettbewerb"); + const wallId = await page.evaluate(() => window.__dossierTest!.walls()[0].id); + const tops = () => page.evaluate((id) => window.__dossierTest!.wallTops()[id], wallId); + await page.evaluate((id) => window.__dossierTest!.select({ walls: [id] }), wallId); + const field = page.locator(".objinfo-field").filter({ hasText: "Oberkante" }).first(); + await expect(field).toBeVisible(); + const pick = async (name: string) => { + await field.getByRole("button").first().click(); + await page.getByRole("option", { name, exact: true }).click(); + }; + expect(await tops()).toBeUndefined(); + await pick("Bis Decke/Dach (tiefere)"); + await expect.poll(tops).toEqual({ roofAttach: undefined, ceilingAttach: true }); + await pick("Bis Decke"); + await expect.poll(tops).toEqual({ roofAttach: false, ceilingAttach: true }); + await pick("Bis Dach"); + await expect.poll(tops).toEqual({ roofAttach: true, ceilingAttach: undefined }); + // Ein Undo-Schritt macht die letzte Auswahl rückgängig (beide Felder zusammen). + await blurFocus(page); + await page.keyboard.press("ControlOrMeta+z"); + await expect.poll(tops).toEqual({ roofAttach: false, ceilingAttach: true }); + await page.setViewportSize({ width: 1700, height: 900 }); + await page.waitForTimeout(800); + const box = (await field.boundingBox())!; + const x = Math.max(0, box.x - 40); + await page.screenshot({ path: "doc/review-293/oberkante.png", clip: { x, y: Math.max(0, box.y - 240), width: 420, height: 460 } }); +}); diff --git a/src-tauri/core/src/cmd_create.rs b/src-tauri/core/src/cmd_create.rs index 33dd059b..0a4fb909 100644 --- a/src-tauri/core/src/cmd_create.rs +++ b/src-tauri/core/src/cmd_create.rs @@ -406,10 +406,13 @@ fn wall_ops(root: &Map, p: &Project, v: &Value, ctx: &Ctx, ids: & if let Some(e) = external { f.push(("isExternal", Value::Bool(e))); } - // [292] OK bis Decke (Option des Befehls, Vorgabe aus). + // [292]/[293] Oberkante (Option des Befehls, Vorgabe Geschosshöhe): `ceilingAttach`, `roofAttach` nur wenn gesetzt. if matches!(v.get("ceilingAttach"), Some(Value::Bool(true))) { f.push(("ceilingAttach", Value::Bool(true))); } + if let Some(Value::Bool(r)) = v.get("roofAttach") { + f.push(("roofAttach", Value::Bool(*r))); + } walls.push(obj(f)); } if walls.is_empty() { @@ -1651,6 +1654,27 @@ mod tests { assert!(wall("WT1", json!({"external": null}))["isExternal"] == true); } + /// [293] Oberkante der neuen Wand: `ceilingAttach`/`roofAttach` der Anfrage kommen ins Element, fehlend bleibt fehlend. + #[test] + fn wand_oberkante_aus_anfrage() { + let r = root(json!({"wallTypes": [{"id": "WT1", "name": "W", "layers": [{"componentId": "c", "thickness": 0.3}]}]})); + let wall = |extra: Value| { + let mut q = json!({"cmd": "wall", "pts": [[0, 0], [4, 0]], "thick": null}); + q.as_object_mut().unwrap().extend(extra.as_object().unwrap().clone()); + let mut q = req(q); + q["ctx"]["wallType"] = json!("WT1"); + let o = ops(&r, &crate::model::lenient::typed_for_test(&r), &q).unwrap(); + items(&o, 0)[0].clone() + }; + let w = wall(json!({})); + assert!(w.get("ceilingAttach").is_none() && w.get("roofAttach").is_none()); + let w = wall(json!({"ceilingAttach": true, "roofAttach": false})); + assert_eq!((w["ceilingAttach"].clone(), w["roofAttach"].clone()), (json!(true), json!(false))); + let w = wall(json!({"roofAttach": true})); + assert!(w.get("ceilingAttach").is_none()); + assert_eq!(w["roofAttach"], true); + } + /// [285] Decke mit Lage: `top` = Oberkante in m über dem Boden des Geschosses (0 = Bodenplatte unter dem Geschoss); /// ohne Angabe bleibt die Oberkante am Geschoss. #[test] diff --git a/src/commands/cmds/wall.ts b/src/commands/cmds/wall.ts index 58224b7d..74594ef3 100644 --- a/src/commands/cmds/wall.ts +++ b/src/commands/cmds/wall.ts @@ -33,6 +33,7 @@ import type { } from "../types"; import { createMutation, createPreview, xy } from "../createCore"; import { t } from "../../i18n"; +import { wallTopNext, wallTopPatch, type WallTopMode } from "../../model/wallTop"; const EPS = 1e-6; const DEG = Math.PI / 180; @@ -81,10 +82,10 @@ interface ArcMode { typeName: string | null; /** [285] Aussenbauteil (IFC `IsExternal`): „auto“ = nach dem Wandtyp („Aussenwand“ ⇒ aussen), „yes“/„no“ ausdrücklich. */ ext: "auto" | "yes" | "no"; - /** [292] OK bis Decke: neue Wände enden an der Unterkante der Decke ihres Geschosses (Vorgabe aus). */ - ceil: boolean; + /** [292]/[293] Oberkante neuer Wände (Geschosshöhe, bis Decke, bis Dach, tiefere von beiden; Vorgabe Geschosshöhe). */ + top: WallTopMode; } -const NO_MODE: ArcMode = { arc: false, tangent: false, typeId: null, typeName: null, ext: "auto", ceil: false }; +const NO_MODE: ArcMode = { arc: false, tangent: false, typeId: null, typeName: null, ext: "auto", top: "storey" }; const EXT_NEXT = { auto: "yes", yes: "no", no: "auto" } as const; /** Kontext mit dem gewählten Wandtyp des Befehls (Option „Wandtyp“); ein inzwischen gelöschter Typ fällt auf den aktiven zurück. */ @@ -120,7 +121,7 @@ const arcOption = (on: boolean): CmdOption => ({ id: "arc", labelKey: "cmd.polyl const tangentOption = (on: boolean): CmdOption => ({ id: "tangent", labelKey: "cmd.polyline.tangentOpt", value: on ? "on" : "off" }); const typeOption = (s: ArcMode): CmdOption => ({ id: "wtype", labelKey: "cmd.wall.typeOpt", value: s.typeName ?? t("cmd.wall.typeActive"), key: "W" }); const extOption = (s: ArcMode): CmdOption => ({ id: "ext", labelKey: "cmd.wall.extOpt", value: t(`cmd.wall.ext.${s.ext}`), key: t("cmd.wall.extKey") }); -const ceilOption = (s: ArcMode): CmdOption => ({ id: "ceil", labelKey: "cmd.wall.ceilOpt", value: t(s.ceil ? "cmd.wall.ext.yes" : "cmd.wall.ext.no"), key: t("cmd.wall.ceilKey") }); +const topOption = (s: ArcMode): CmdOption => ({ id: "top", labelKey: "cmd.wall.topOpt", value: t(`objinfo.wall.topMode.${s.top}`), key: t("cmd.wall.topKey") }); /** * Bänder der schon gesetzten Segmente: sie ändern sich je Mausschritt nicht und werden nur neu gerechnet, @@ -170,13 +171,13 @@ function wallDraft( * Commit: je Achssegment eine Wand des aktiven Typs (Höhe aus dem Geschoss); eine gelockte Dicke * (einschichtig) wählt/erzeugt den passenden Wandtyp — beides im Kern (`cmd_create.rs`). */ -const appendWalls = (pts: Vec2[], ctx: CommandContext, thick: number | null, segs: Seg[] = [], ext: ArcMode["ext"] = "auto", ceil = false) => { +const appendWalls = (pts: Vec2[], ctx: CommandContext, thick: number | null, segs: Seg[] = [], ext: ArcMode["ext"] = "auto", top: WallTopMode = "storey") => { const external = ext === "auto" ? null : ext === "yes"; return createMutation( ctx, segs.some((g) => g !== 0) - ? { cmd: "wall", pts: pts.map(xy), thick, segs, external, ceilingAttach: ceil } - : { cmd: "wall", pts: pts.map(xy), thick, external, ceilingAttach: ceil }, + ? { cmd: "wall", pts: pts.map(xy), thick, segs, external, ...wallTopPatch(top) } + : { cmd: "wall", pts: pts.map(xy), thick, external, ...wallTopPatch(top) }, ); }; @@ -189,7 +190,7 @@ const idle = ( { draft: null, done: true }, ]; -const modeOf = (s: ArcMode): ArcMode => ({ arc: s.arc, tangent: s.tangent, typeId: s.typeId, typeName: s.typeName, ext: s.ext, ceil: s.ceil }); +const modeOf = (s: ArcMode): ArcMode => ({ arc: s.arc, tangent: s.tangent, typeId: s.typeId, typeName: s.typeName, ext: s.ext, top: s.top }); const draftOf = (ctx: CommandContext, s: WallDrawing): ToolDraft => wallDraft(ctx, s.points, s.cursor, s.thickOverride, s); export const wallCommand: Command = { @@ -205,7 +206,7 @@ export const wallCommand: Command = { accepts: () => ["point", "number", "option"], options: (s) => { const ps = s as WallCmdState; - const arc = [arcOption(!!ps.arc), ...(ps.arc ? [tangentOption(!!ps.tangent)] : []), typeOption(ps), extOption(ps), ceilOption(ps)]; + const arc = [arcOption(!!ps.arc), ...(ps.arc ? [tangentOption(!!ps.tangent)] : []), typeOption(ps), extOption(ps), topOption(ps)]; return ps.phase === "next" ? [...arc, UNDO] : arc; }, init: (): WallIdle => ({ phase: "start", lastPoint: null, thickOverride: null, single: false, ...NO_MODE }), @@ -215,10 +216,10 @@ export const wallCommand: Command = { const to = s.thickOverride; // [285] Wandtyp wählen (reihum durch die Typen des Projekts) bzw. Aussenbauteil umschalten. - if (input.kind === "option" && (input.id === "wtype" || input.id === "ext" || input.id === "ceil")) { + if (input.kind === "option" && (input.id === "wtype" || input.id === "ext" || input.id === "top")) { let flip: Partial; if (input.id === "ext") flip = { ext: EXT_NEXT[s.ext] }; - else if (input.id === "ceil") flip = { ceil: !s.ceil }; + else if (input.id === "top") flip = { top: wallTopNext(s.top) }; else { const list = ctx0.project.wallTypes; if (list.length === 0) return [s, { draft: null }]; @@ -301,7 +302,7 @@ export const wallCommand: Command = { if (s.points.length >= 3 && segLen(s.points[0], pt) < EPS) { return [ { phase: "start", lastPoint: null, thickOverride: to, single, ...modeOf(s) } as WallIdle, - { draft: null, done: true, commit: appendWalls([...s.points, s.points[0]], ctx, to, [...s.segs, seg], s.ext, s.ceil) }, + { draft: null, done: true, commit: appendWalls([...s.points, s.points[0]], ctx, to, [...s.segs, seg], s.ext, s.top) }, ]; } const ns: WallDrawing = { @@ -334,7 +335,7 @@ export const wallCommand: Command = { const to = s.thickOverride; return [ { phase: "start", lastPoint: null, thickOverride: to, single: s.single, ...modeOf(s) } as WallIdle, - { draft: null, done: true, commit: appendWalls(pts, ctx, to, s.segs, s.ext, s.ceil) }, + { draft: null, done: true, commit: appendWalls(pts, ctx, to, s.segs, s.ext, s.top) }, ]; } return idle(s.thickOverride, s.single, modeOf(s)); diff --git a/src/commands/cmds/wallType.test.ts b/src/commands/cmds/wallType.test.ts index e3fd3671..1f9f42db 100644 --- a/src/commands/cmds/wallType.test.ts +++ b/src/commands/cmds/wallType.test.ts @@ -79,4 +79,16 @@ describe("wallCommand Wandtyp und Aussenbauteil [285]", () => { const o = wallCommand.options(s).find((x) => x.id === "wtype"); expect(o?.value).toBe("Innenwand 12"); }); + + it("Option Oberkante [293]: reihum Geschosshöhe, Decke, Dach, tiefere von beiden", () => { + const w0 = draw([]); + expect(w0.ceilingAttach).toBeUndefined(); + expect(w0.roofAttach).toBeUndefined(); + const w1 = draw(["top"]); + expect([w1.ceilingAttach, w1.roofAttach]).toEqual([true, false]); + const w2 = draw(["top", "top"]); + expect([w2.ceilingAttach, w2.roofAttach]).toEqual([undefined, true]); + const w3 = draw(["top", "top", "top"]); + expect([w3.ceilingAttach, w3.roofAttach]).toEqual([true, undefined]); + }); }); diff --git a/src/i18n/de.ts b/src/i18n/de.ts index 3bea63f1..a7bf9a82 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -647,20 +647,17 @@ export const de = { "objinfo.wall.refLine.right": "Innen (rechts)", "objinfo.wall.refLine.joint": "Fuge", "objinfo.wall.sliceTermination": "An Decke enden", - "objinfo.wall.roofAttach": "An Dach anschliessen", "objinfo.isExternal": "Aussenbauteil", "objinfo.loadBearing": "Tragend", - "objinfo.wall.roofAttach.auto": "Automatisch", - "objinfo.wall.roofAttach.on": "Ja, bis unters Dach", - "objinfo.wall.roofAttach.off": "Nein", - "objinfo.wall.ceilingAttach": "Oberkante", - "objinfo.wall.ceilingAttach.off": "Geschosshöhe", - "objinfo.wall.ceilingAttach.on": "Bis Decke", - "objinfo.wall.ceilingAttach.tip": "Geschosshöhe: Die Wand endet an ihrer Oberkante (Geschoss bzw. frei gesetzt). Bis Decke: Sie endet an der Unterkante der Decke ihres Geschosses, auch bei geneigter Decke; im Deckenloch bleibt die Krone.", - "objinfo.wall.roofAttach.tip": "Automatisch: Die Wand endet je Schicht an der Dach-Unterkante, wo ihre Krone darüber liegt. Ja: zusätzlich bis unter das Dach verlängert. Nein: Dächer schneiden die Wand nicht.", "objinfo.wall.sliceTermination.both": "Aus", "objinfo.wall.sliceTermination.below": "Unten", "objinfo.wall.sliceTermination.above": "Oben", + "objinfo.wall.topMode": "Oberkante", + "objinfo.wall.topMode.storey": "Geschosshöhe / Frei (Höhe)", + "objinfo.wall.topMode.ceiling": "Bis Decke", + "objinfo.wall.topMode.roof": "Bis Dach", + "objinfo.wall.topMode.lower": "Bis Decke/Dach (tiefere)", + "objinfo.wall.topMode.tip": "Geschosshöhe / Frei: Die Wand endet an ihrer Oberkante (Geschoss bzw. frei gesetzt, Höhe unten); Dächer schneiden sie automatisch. Bis Decke: Unterkante der Decke ihres Geschosses, auch geneigt; Dächer schneiden nicht. Bis Dach: bis unter das Dach verlängert. Bis Decke/Dach: je Punkt die tiefere der beiden Kanten.", "objinfo.wall.buildup": "Aufbau", "objinfo.wall.single": "Solid", "objinfo.wall.multi": "Mehrschichtig", @@ -2080,8 +2077,8 @@ export const de = { "cmd.wall.typeActive": "aktiv", "cmd.wall.extOpt": "Aussenbauteil", "cmd.wall.extKey": "A", - "cmd.wall.ceilOpt": "OK bis Decke", - "cmd.wall.ceilKey": "D", + "cmd.wall.topOpt": "Oberkante", + "cmd.wall.topKey": "D", "cmd.wall.ext.auto": "nach Typ", "cmd.wall.ext.yes": "ja", "cmd.wall.ext.no": "nein", diff --git a/src/i18n/en.ts b/src/i18n/en.ts index f2b3bda9..d78c2f24 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -645,20 +645,17 @@ export const en: Record = { "objinfo.wall.refLine.right": "Interior (right)", "objinfo.wall.refLine.joint": "Joint", "objinfo.wall.sliceTermination": "End at ceiling", - "objinfo.wall.roofAttach": "Attach to roof", "objinfo.isExternal": "External", "objinfo.loadBearing": "Load-bearing", - "objinfo.wall.roofAttach.auto": "Automatic", - "objinfo.wall.roofAttach.on": "Yes, up to the roof", - "objinfo.wall.roofAttach.off": "No", - "objinfo.wall.ceilingAttach": "Top", - "objinfo.wall.ceilingAttach.off": "Storey height", - "objinfo.wall.ceilingAttach.on": "Up to ceiling", - "objinfo.wall.ceilingAttach.tip": "Storey height: the wall ends at its top (storey or freely set). Up to ceiling: it ends at the underside of its storey's ceiling, also for a sloped ceiling; the crown stays in a ceiling opening.", - "objinfo.wall.roofAttach.tip": "Automatic: each wall layer ends at the roof underside where its top lies above it. Yes: also extended up to the roof. No: roofs do not cut the wall.", "objinfo.wall.sliceTermination.both": "Off", "objinfo.wall.sliceTermination.below": "Below", "objinfo.wall.sliceTermination.above": "Above", + "objinfo.wall.topMode": "Top", + "objinfo.wall.topMode.storey": "Storey height / free (height)", + "objinfo.wall.topMode.ceiling": "Up to ceiling", + "objinfo.wall.topMode.roof": "Up to roof", + "objinfo.wall.topMode.lower": "Ceiling/roof (lower one)", + "objinfo.wall.topMode.tip": "Storey height / free: the wall ends at its top (storey or freely set, height below); roofs cut it automatically. Up to ceiling: underside of its storey's ceiling, also sloped; roofs do not cut. Up to roof: extended up to the roof. Ceiling/roof: the lower of both edges at each point.", "objinfo.wall.buildup": "Build-up", "objinfo.wall.single": "Solid", "objinfo.wall.multi": "Multi layer", @@ -2069,8 +2066,8 @@ export const en: Record = { "cmd.wall.typeActive": "active", "cmd.wall.extOpt": "External", "cmd.wall.extKey": "E", - "cmd.wall.ceilOpt": "Top to ceiling", - "cmd.wall.ceilKey": "C", + "cmd.wall.topOpt": "Top", + "cmd.wall.topKey": "T", "cmd.wall.ext.auto": "by type", "cmd.wall.ext.yes": "yes", "cmd.wall.ext.no": "no", diff --git a/src/model/wallTop.test.ts b/src/model/wallTop.test.ts new file mode 100644 index 00000000..621dae44 --- /dev/null +++ b/src/model/wallTop.test.ts @@ -0,0 +1,24 @@ +import { describe, expect, it } from "vitest"; +import { WALL_TOP_MODES, wallTopFromFields, wallTopPatch, wallTopNext } from "./wallTop"; + +describe("Wand-Oberkante [293]", () => { + it("Felder und Auswahl sind umkehrbar", () => { + for (const m of WALL_TOP_MODES) { + const p = wallTopPatch(m); + expect(wallTopFromFields(p.roofAttach, p.ceilingAttach)).toBe(m); + } + }); + it("Standard (nichts gesetzt) = Geschosshöhe", () => { + expect(wallTopFromFields(undefined, undefined)).toBe("storey"); + expect(wallTopPatch("storey")).toEqual({ roofAttach: undefined, ceilingAttach: undefined }); + }); + it("Decke allein schaltet das Dach ab, tiefere lässt es automatisch", () => { + expect(wallTopPatch("ceiling")).toEqual({ roofAttach: false, ceilingAttach: true }); + expect(wallTopPatch("lower")).toEqual({ roofAttach: undefined, ceilingAttach: true }); + expect(wallTopPatch("roof")).toEqual({ roofAttach: true, ceilingAttach: undefined }); + }); + it("reihum", () => { + expect(wallTopNext("storey")).toBe("ceiling"); + expect(wallTopNext("lower")).toBe("storey"); + }); +}); diff --git a/src/model/wallTop.ts b/src/model/wallTop.ts new file mode 100644 index 00000000..70f24a5f --- /dev/null +++ b/src/model/wallTop.ts @@ -0,0 +1,32 @@ +/** + * [293] Wand-Oberkante als EINE Auswahl über die Felder `Wall.roofAttach` ([G2]) und `Wall.ceilingAttach` ([292]). + * Die Höhe selbst (`height`/`top`) bleibt getrennt (Geschosshöhe bzw. frei, s. Objekt-Info „Höhe“). + * storey — Geschosshöhe/frei: Dächer schneiden automatisch, keine Decke + * roof — bis unters Dach verlängert + * ceiling — bis Unterkante der Decke, Dächer schneiden nicht + * lower — Decke und Dach, je Punkt die tiefere Kante (so rechnet `wall_bands.rs` bei beiden Feldern) + */ +export type WallTopMode = "storey" | "ceiling" | "roof" | "lower"; +export const WALL_TOP_MODES: readonly WallTopMode[] = ["storey", "ceiling", "roof", "lower"]; + +export interface WallTopFields { + roofAttach: boolean | undefined; + ceilingAttach: boolean | undefined; +} + +export function wallTopFromFields(roofAttach: boolean | undefined, ceilingAttach: boolean | undefined): WallTopMode { + if (ceilingAttach) return roofAttach === false ? "ceiling" : "lower"; + return roofAttach === true ? "roof" : "storey"; +} + +/** Felder für eine Auswahl; `undefined` entfernt das Feld (Vorgabe). */ +export function wallTopPatch(mode: WallTopMode): WallTopFields { + switch (mode) { + case "storey": return { roofAttach: undefined, ceilingAttach: undefined }; + case "roof": return { roofAttach: true, ceilingAttach: undefined }; + case "ceiling": return { roofAttach: false, ceilingAttach: true }; + case "lower": return { roofAttach: undefined, ceilingAttach: true }; + } +} + +export const wallTopNext = (m: WallTopMode): WallTopMode => WALL_TOP_MODES[(WALL_TOP_MODES.indexOf(m) + 1) % WALL_TOP_MODES.length]; diff --git a/src/panels/host.ts b/src/panels/host.ts index 45afda9a..1c05621e 100644 --- a/src/panels/host.ts +++ b/src/panels/host.ts @@ -46,6 +46,7 @@ import type { TerrainOptions } from "../model/terrain"; import type { TextStylePreset } from "../text/richText"; import type { ScheduleKind } from "../export/exportSchedule"; import type { DetailLevel } from "../model/viewTypes"; +import type { WallTopMode } from "../model/wallTop"; import type { TabId as ResourceTabId } from "../ui/ResourceManager"; // ── Darstellungsmodus-Steuerung je Dock-Inhalt ──────────────────────────── @@ -421,8 +422,8 @@ export interface PanelHostValue { */ onSetWallSliceTermination: (termination: SliceTermination) => void; /** An Dach anschliessen ([G2]): "auto" = Default (Wand endet an der Dach-Unterkante). */ - onSetWallRoofAttach: (attach: "auto" | "on" | "off") => void; - onSetWallCeilingAttach: (attach: boolean) => void; + /** [293] Oberkante der Wand: setzt `roofAttach` und `ceilingAttach` zusammen (ein Undo-Schritt). */ + onSetWallTopMode: (mode: WallTopMode) => void; /** Aussenbauteil/tragend der gewählten Wand bzw. Decke ([97]/[98]); `false` = Feld weg. */ onSetBuildingFlags: (flags: { isExternal?: boolean; loadBearing?: boolean }) => void; /** [178] Deckenrand der gewählten Decke: `true` = bis an den Umriss, `false` = Auflager bis Kern (Standard). */ diff --git a/src/panels/objectInfo/WallSection.tsx b/src/panels/objectInfo/WallSection.tsx index ba9ddb02..67b66f93 100644 --- a/src/panels/objectInfo/WallSection.tsx +++ b/src/panels/objectInfo/WallSection.tsx @@ -8,6 +8,7 @@ import { usePanelHost } from "../host"; import { t } from "../../i18n"; import { Dropdown } from "../../ui/Dropdown"; import type { WallReferenceLine, SliceTermination } from "../../model/types"; +import { wallTopFromFields, type WallTopMode } from "../../model/wallTop"; import { UValueRow } from "../UValueRow"; import { formatM } from "../../model/types"; import { BuildingFlags, DimensionField, MixedMark, VerticalAnchorRow } from "./fields"; @@ -99,34 +100,20 @@ export function WallSection({ /> - {/* An Dach anschliessen ([G2]): automatisch endet die Wand an der Dach-Unterkante, "Ja" - verlängert sie bis unter das Dach, "Nein" lässt die Dächer die Wand nicht schneiden. */} + {/* Oberkante ([293], [G2], [292]): EINE Auswahl über roofAttach + ceilingAttach (eine Op). */}
- {t("objinfo.wall.roofAttach")} + {t("objinfo.wall.topMode")} host.onSetWallRoofAttach(v as "auto" | "on" | "off")} + value={wallTopFromFields(wall.roofAttach === "auto" ? undefined : wall.roofAttach === "on", wall.ceilingAttach)} + onChange={(v) => host.onSetWallTopMode(v as WallTopMode)} options={[ - { value: "auto", label: t("objinfo.wall.roofAttach.auto") }, - { value: "on", label: t("objinfo.wall.roofAttach.on") }, - { value: "off", label: t("objinfo.wall.roofAttach.off") }, + { value: "storey", label: t("objinfo.wall.topMode.storey") }, + { value: "ceiling", label: t("objinfo.wall.topMode.ceiling") }, + { value: "roof", label: t("objinfo.wall.topMode.roof") }, + { value: "lower", label: t("objinfo.wall.topMode.lower") }, ]} - title={t("objinfo.wall.roofAttach.tip")} - width={120} - /> -
- {/* OK bis Decke ([292]): Oberkante an der Unterkante der Decke des Geschosses, auch geneigt. */} -
- {t("objinfo.wall.ceilingAttach")} - host.onSetWallCeilingAttach(v === "on")} - options={[ - { value: "off", label: t("objinfo.wall.ceilingAttach.off") }, - { value: "on", label: t("objinfo.wall.ceilingAttach.on") }, - ]} - title={t("objinfo.wall.ceilingAttach.tip")} - width={120} + title={t("objinfo.wall.topMode.tip")} + width={150} />
diff --git a/src/state/panelHost/elementAttributesHost.ts b/src/state/panelHost/elementAttributesHost.ts index 69153eac..f199dd34 100644 --- a/src/state/panelHost/elementAttributesHost.ts +++ b/src/state/panelHost/elementAttributesHost.ts @@ -6,6 +6,7 @@ import { patchItems, removeRoofHole, setRoofEdge } from "../../core"; import type { EntityOf } from "../../core"; import { getState } from "../appStore"; +import { wallTopPatch } from "../../model/wallTop"; import type { FlatHostOpts, HostPart } from "./types"; /** Auswahl-Arten mit Mehrfach-Setzen (Schlüssel in `Selection`). */ @@ -88,13 +89,9 @@ export function buildElementAttributesHost(c: FlatHostOpts) { // "both" ist der Default ⇒ als undefined speichern (Alt-Projekt-Parität). patchAll("walls", selection.id, { sliceTermination: termination === "both" ? undefined : termination }); }, - onSetWallRoofAttach: (attach) => { - if (selection?.kind === "wall") - // "auto" ist der Default ⇒ als undefined speichern. - patchAll("walls", selection.id, { roofAttach: attach === "auto" ? undefined : attach === "on" }); - }, - onSetWallCeilingAttach: (attach) => { - if (selection?.kind === "wall") patchAll("walls", selection.id, { ceilingAttach: attach ? true : undefined }); + onSetWallTopMode: (mode) => { + // [293] roofAttach + ceilingAttach in EINER Op (undefined = Vorgabe). + if (selection?.kind === "wall") patchAll("walls", selection.id, { ...wallTopPatch(mode) }); }, onSetBuildingFlags: (flags) => { const patch: { isExternal?: boolean; loadBearing?: boolean } = {}; diff --git a/src/state/testHooks.ts b/src/state/testHooks.ts index cd9e0e76..c6bc6aae 100644 --- a/src/state/testHooks.ts +++ b/src/state/testHooks.ts @@ -91,6 +91,8 @@ declare global { layerView: () => { wallId: string; visible: string[]; prims: number; wallPrims: number }; /** [195] Strichstärke-Override der Wände (id → mm), nur gesetzte. */ wallWeights: () => Record; + /** [293] Oberkante der Wände: `roofAttach`/`ceilingAttach`, nur Wände mit gesetztem Feld. */ + wallTops: () => Record; /** [190] Auswahl-Aktion wie das native Menü (Bearbeiten > Verbinden usw.), ohne Tastendruck: `runSelectionAction`. */ selectionAction: (id: SelectionActionId) => void; /** [190] Wände (id, Start, Ende) des Projekts. */ @@ -151,6 +153,7 @@ export function installTestHooks(): void { excavations: (p.context ?? []).flatMap((c) => (c.type === "excavation" ? [{ id: c.id, bottom: c.bottom }] : [])), }; }, + wallTops: () => Object.fromEntries(getState().project.walls.flatMap((w) => (w.roofAttach === undefined && w.ceilingAttach === undefined ? [] : [[w.id, { roofAttach: w.roofAttach, ceilingAttach: w.ceilingAttach }]]))), wallWeights: () => Object.fromEntries(getState().project.walls.flatMap((w) => (w.strokeWeight === undefined ? [] : [[w.id, w.strokeWeight]]))), selectionAction: (id) => runSelectionAction(id), walls: () => getState().project.walls.map((w) => ({ id: w.id, start: { ...w.start }, end: { ...w.end } })),