From 48ce1d5ce6e6e7abfcff358c41ddae1857304e87 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 11:09:39 +0000 Subject: [PATCH] =?UTF-8?q?[332]=20H=C3=B6henlinie:=20gezeichnete=20Linien?= =?UTF-8?q?=20mit=20getippter=20H=C3=B6he=20zu=20Gel=C3=A4nde-H=C3=B6henli?= =?UTF-8?q?nien=20(Befehl=20hl,=20Knopf=20im=20Panel=20Gel=C3=A4nde)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODO.md | 3 +- e2e/contourLine332.spec.ts | 71 +++++++++ src-tauri/core/src/cmd_create.rs | 5 + src-tauri/core/src/contour_draw.rs | 207 ++++++++++++++++++++++++++ src-tauri/core/src/lib.rs | 1 + src/commands/cmds/contourLine.test.ts | 104 +++++++++++++ src/commands/cmds/contourLine.ts | 122 +++++++++++++++ src/commands/registry.ts | 5 + src/i18n/de.ts | 7 + src/i18n/en.ts | 7 + src/panels/SitePanel.tsx | 3 + src/panels/host.ts | 2 + src/state/panelHost/siteHost.ts | 1 + 13 files changed, 537 insertions(+), 1 deletion(-) create mode 100644 e2e/contourLine332.spec.ts create mode 100644 src-tauri/core/src/contour_draw.rs create mode 100644 src/commands/cmds/contourLine.test.ts create mode 100644 src/commands/cmds/contourLine.ts diff --git a/TODO.md b/TODO.md index cd6cae0b..32237f5e 100644 --- a/TODO.md +++ b/TODO.md @@ -11,7 +11,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 331); +- **IDs sind stabil.** Neue ID = nächste freie Zahl nach der höchsten im Archiv und hier (aktuell 332); 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. @@ -60,6 +60,7 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC. - ◐ **[308]** 3D-Dokument: Gelände als Modellsockel (20.11., Bild `doc/review-308/axo.png`; `plan/axo_terrain.rs`). Zuschnitt auf Parzelle (`siteRules.parcel`, Bounding-Box ∪ Gebäude) + 2 m, ohne Parzelle Gebäude + 5 m; an allen Randkanten senkrechte Seitenflächen bis tiefster Geländepunkt (inkl. Baugrube) − 1 m, dunkler getönt, senkrechte Kanten nur an Ecken. Bildgrösse folgt Haus + Sockel. Option `terrainClip` (`parcel` Vorgabe | `building` | `none` = wie bisher ohne Sockel), CLI `--terrain-clip`. Offen: Rechteck-Hülle und Keller siehe [309]; keine UI-Einstellung für `terrainClip` (nur Doc3d-Extra/CLI); Mac/Tauri nicht geprüft. · S - ◐ **[309]** 3D-Dokument: Sockelrand gerade, Zuschnitt auf Parzellenumriss, Keller (20.11., Bild `doc/review-309/axo.png`; `plan/axo_terrain.rs`). Zuschnittfläche = Parzellenumriss + 2 m (Gehrung über `kernel2d`, Ecken ≤ 4·d, Selbstschnitte per Vereinigung geheilt, konkave Parzellen) ∪ Gebäude + 2 m, ohne Parzelle Gebäude + 5 m; Dreiecke werden an die Fläche geschnitten (i_overlay), Randkanten nur auf der Zuschnittkante und echtem Netzrand. Deckt das Netz die Fläche nicht oder ist es zu dicht, Raster über der Fläche mit am Netzrand ergänztem (konstant fortgesetztem) Gelände statt gezacktem Rand. Sockel-Unterkante ≤ tiefstes Bauteil − 0.5 m (zusätzlich zu tiefster Geländepunkt − 1 m). Offen: ergänztes Gelände ausserhalb des Netzes ist eine Annahme (nächste Höhe), im Bild nicht gekennzeichnet; keine UI-Einstellung für `terrainClip`; Mac/Tauri nicht geprüft (Haarlinien auf den Sockelseiten: [310]). · S - ◐ **[319]** Ansichtsschatten ([316]) schneller (20.11.; `plan/elevation/sun.rs`): Werfer-Stücke vorab aufs Hüllrechteck des Empfängers beschnitten, Stücke neben einem konvexen Empfänger (Dachdreieck) entfallen, ganz deckendes Stück allein, EIN Boolean je Empfänger (Vereinigung + Schnitt in einem). Nicht an schrägen Kanten beschneiden: fast gleiche Kanten bringen i_overlay auf Sekunden. Musterhaus komplex, alle 4 Ansichten nativ: Schatten 863 → 109 ms, Wettbewerb 46 → 14 ms; Abweichung zur alten Rechnung ≤ 3e-7 m² (`bench319`, ignored), Golden komplex Süd +3 Polygone (Rundungssplitter). e2e Präsentationsblatt 1.7 min / Pick 1.5 min (Grenze 2 min). Offen: Mac nicht geprüft (Ansicht Ost Komplex → [320]). · S +- ◐ **[332]** Eigenes Gelände aus gezeichneten Höhenlinien (25.11., Wunsch Maintainer): Befehl „Höhenlinie“ (`hl`, Knopf „Höhenlinien zeichnen“ im Panel Gelände) — Linie, Polylinie (mit Bögen), Spline, Bezier, Bogen, Kreis, Ellipse oder Rechteck anklicken, Höhe tippen (Enter: letzte Höhe + Äquidistanz; vorgewählte Linie: Zahl sofort tippen); die Linie wird Höhenlinie im ersten Höhenlinien-Satz (sonst neuer Satz, Klasse 14), danach „Gelände erzeugen“. Kern `contour_draw.rs`, Befehl `commands/cmds/contourLine.ts`, e2e `contourLine332.spec.ts`. Offen: einzelne Höhenpunkte (Koten) als Stützpunkte; mehrere vorgewählte Linien auf einmal mit Äquidistanz; nicht auf dem Mac. · S - ◐ **[331]** Schraffuren Erdreich und Kies (25.11., Vorlage Maintainer): Erdreich als SIA-Flechtmuster (quadratische Felder 0.25 m, je vier Striche, von Feld zu Feld um 90° gewechselt, 45° gedreht; `hatchgen/src/hatch.rs` `earth_runs`), Kies als Kiesel (Ellipsen verschiedener Grösse/Drehung, dazwischen Punkte; `gravel_runs`). Im Schnitt über 1:50 papierkonstant vergrössert (sonst bei 1:100 zu dicht, `plan/section/primitives.rs`). Geprüft: Schnitt A 1:50/1:100 (CLI `--hatch`, Linux). Offen: gestalterische Varianten (ausfransender Unterrand des Erdbands), nicht auf dem Mac. · S - ◐ **[330]** SIA-400-Prüfung der Darstellung (24.11., Musterhaus komplex: EG 1:100/1:50, Schnitt A-A, Ansicht Süd, Bilder nur lokal). In Ordnung: Wände 1:100 schwarz, 1:50 nach Baustoff schraffiert; Türen mit Flügel und Viertelkreis, Schiebetüren mit Pfeil; Fenster mit Glas-/Leibungslinien; Treppe mit Bruchlinie, über der Schnittebene gestrichelt; Schnitt mit Höhenkoten (fertig, ▽), Erdreich, Achsen; Ansicht mit Strichstärken-Hierarchie Gelände 0.5 / Umriss 0.25 / Kanten 0.13 / Feines 0.09 mm, Flügelsymbole gestrichelt, Materialfuge, Schatten 45°. Geändert: Lauflinie mit Antrittspunkt als Vorgabe (SIA 400 / DIN 1356: Punkt am Antritt, Pfeil am Austritt; vorher aus, `plan/model_view.rs`); Goldens nachgeführt. Hinweis: der CLI-Plan zeigt alle Klassen (Kamera-Blickkegel quer durch den Plan) — die Vorlage „Grundriss 1:100“ blendet sie aus. Offen: Dämmung im 1:100 nicht vom Mauerwerk abgesetzt (alles schwarz; Bürowahl), Rohbau-/Fertigkoten nicht unterschieden; Grundriss 1:200 (UG, 25.11.) in Ordnung: Wände schwarz, Rundstütze, Türen/Fenster, Wendeltreppe lesbar; Erker-Sehnen über den Fenstern gewollt ([216]). Das automatische Radiusmass am Erker steht mittig über der Wendeltreppe (Zahl am Griff verschiebbar; „bündig am Bogen“ versucht und verworfen, weil es bis zur Aussenkante misst und die Zahl dann auf der Wand liegt). Blatt 501 „Detail und Situation“ (25.11.): Situation nach SIA 400 in Ordnung (Neubau schwarz, Bestand grau, Höhenlinien, Nordpfeil, Massstabsbalken); das Detail fehlte auf dem Blatt (die Nachbarhäuser, Klasse 12, waren im Detail-Ausschnitt sichtbar, der Viewport rechnete mit ihnen und das Detail fiel aus dem Rahmen) → Klasse 12 im Ausschnitt aus, Beschriftungen näher ans Bauteil, Viewport 265 mm hoch (Beispielprojekt). Plankopf mit mehreren Massstäben zeigt jetzt alle („1:10 / 1:500“, Kern `layout_model.rs`). Blätter 101–103 (25.11.): 101 zeigte den Sonnenschatten trotz Vorlage „Grundriss 1:100“ (Klassen-Schalter der verknüpften Vorlage fehlten im Ausschnitt; Test), Nachbarhäuser im Grundriss, Titel links ausserhalb, Zahlen des Massstabsbalkens abgeschnitten (Kern: Ausmass des Balkens ohne Zahlen, `acc_bounds`) → behoben; Ansichtslinien West/Ost näher ans Haus (−11/22 m). Run-Schriftgrösse `sizePt` in Plantexten jetzt überall Papier-pt (Entscheid Maintainer 25.11.: 14 pt sind gedruckt 14 pt; vorher rechneten Druck/PDF `print_svg.rs` und SVG-Planansicht in Modell-pt, render2d und DXF schon in Papier-pt). Offen: Blatt 401 (Listen) nicht geprüft; nicht auf dem Mac. · M - ◐ **[329]** Bedienung Zeichnungsfenster (24.11., Rest aus [287]): Werkzeug-Tooltips mit Tastenkürzel („Wand (W)“, `state/keyboardShortcuts.ts` `toolShortcutLabel`, (12)); Mehrfachauswahl in der Objekt-Info: Kopf „3 Elemente gewählt: 2 Wände, 1 Tür/Fenster“, die Klasse im Kopf gilt für alle gewählten in einem Undo-Schritt (vorher nur das erste; `state/selectionCategory.ts`, (6)); Ausschnitt nach IFC-Bauteil-Import auf alles ([328]). Einstellung „Griffe beim Loslassen übernehmen“ (Allgemein → Arbeitsbereich, Vorgabe aus; Wunsch Maintainer 24.11. „als Option“): an = gezogener Punkt-/Kanten-Griff gilt beim Loslassen (Archicad/Vectorworks), Klick ohne Ziehen bleibt bewaffnet für getippte Werte (`state/gripPrefs.ts`, `planView/usePlanPickCycle.ts` `endDrag`, e2e `gripRelease329.spec.ts`); nur im Grundriss/Schnitt, das 3D-Fenster nicht. Reiter „+“ öffnet eine Auswahl (Geschoss → neuer Grundriss-Reiter, Schnitt/Ansicht/3D, „Kopie dieses Reiters“; vorher immer eine Kopie, `DrawingTabs.tsx`, e2e `tabAdd329.spec.ts`, (8)); Lineale ohne nachlaufende Nullen und Einheit („10“, „2.5“ statt „10.000m“, `tools/displayUnits.ts`); Statusleiste „Klasse 20 Wände“ statt „Ebene“ (Objekt-Info nennt es Klasse). Offen aus [287]: (7) Anfangsansicht/zwei Massstabszahlen, (10) Einfügen ohne Vorschau, (11) Prompts; Felder ausser Klasse/Farbe/Strich zeigen bei Mehrfachauswahl das erste Element. · M diff --git a/e2e/contourLine332.spec.ts b/e2e/contourLine332.spec.ts new file mode 100644 index 00000000..007a628a --- /dev/null +++ b/e2e/contourLine332.spec.ts @@ -0,0 +1,71 @@ +// [332] Eigenes Gelände aus gezeichneten Höhenlinien (Wunsch Maintainer 25.11.): Splines zeichnen, im Panel „Gelände" +// „Höhenlinien zeichnen", Linien anklicken und ihre Höhe tippen (die dritte per Enter mit dem Vorschlag), dann +// „Gelände erzeugen". Eigener Port: E2E_PORT=5193 npx playwright test e2e/contourLine332.spec.ts +import type { Page } from "@playwright/test"; +import { blurFocus, commandInput, expect, openTab, startNewProject, test, typeCommand } from "./app"; +import type {} from "../src/state/testHooks"; + +test.use({ viewport: { width: 1600, height: 1000 } }); + +async function clickModel(page: Page, x: number, y: number): Promise { + const p = await page.locator("svg.plan-svg").first().evaluate( + (el, [x, y]) => { + const [vx, vy, vw, vh] = el.getAttribute("viewBox")!.split(/\s+/).map(Number); + const ox = Number(el.getAttribute("data-origin-x") ?? 0); + const oy = Number(el.getAttribute("data-origin-y") ?? 0); + const r = el.getBoundingClientRect(); + const s = Math.min(r.width / vw, r.height / vh); + return { x: r.left + (r.width - vw * s) / 2 + (x * 90 - ox - vx) * s, y: r.top + (r.height - vh * s) / 2 + (-y * 90 - oy - vy) * s }; + }, + [x, y], + ); + await page.mouse.click(p.x, p.y); +} + +const prompt = (page: Page) => page.locator(".cmdline-prompt"); +const contours = (page: Page) => + page.evaluate(() => window.__dossierTest!.context().filter((c) => c.type === "contourSet").length); + +test("Höhenlinien zeichnen: Splines anklicken, Höhe tippen, Gelände erzeugen", async ({ page }) => { + test.setTimeout(120_000); + await startNewProject(page, "?dossierTest"); + // Drei Splines (Hang nach Süden), abseits des neuen Projekts (Schnittlinien beim Ursprung). + for (const y of [0, 6, 12]) { + await commandInput(page).focus(); + await typeCommand(page, "sp"); + for (const p of [`30,${y}`, `40,${y + 1}`, `50,${y}`]) await typeCommand(page, p); + await commandInput(page).press("Enter"); + await expect(prompt(page)).toHaveText("Befehl:"); + } + await blurFocus(page); + await page.locator('[title="Auf Plan einpassen"]').first().click(); + await page.waitForTimeout(600); + + await openTab(page, "Gelände"); + await page.getByRole("button", { name: "Höhenlinien zeichnen" }).click(); + await expect(prompt(page)).toHaveText("Linie für die Höhenlinie wählen (Enter: fertig):"); + await clickModel(page, 40, 1); + await expect(prompt(page)).toHaveText(/^Höhe/); + await commandInput(page).focus(); + await typeCommand(page, "500"); + await expect(prompt(page)).toHaveText(/^Linie für die Höhenlinie/); + await expect.poll(() => contours(page)).toBe(1); + await clickModel(page, 40, 7); + await commandInput(page).focus(); + await typeCommand(page, "501"); + await clickModel(page, 40, 13); + await expect(prompt(page)).toHaveText(/^Höhe/); + // Enter: Vorschlag 502 (letzte Höhe + Äquidistanz); nochmals Enter: fertig. + await commandInput(page).press("Enter"); + await expect(prompt(page)).toHaveText(/^Linie für die Höhenlinie/); + await commandInput(page).press("Enter"); + await expect(prompt(page)).toHaveText("Befehl:"); + await expect(page.locator(".toast-message").filter({ hasText: "Höhenlinien übernommen" })).toBeVisible(); + + // Gelände erzeugen (Panel) → Geländenetz in der Kontext-Schicht. + await page.getByRole("button", { name: "Gelände erzeugen" }).click(); + await expect + .poll(() => page.evaluate(() => window.__dossierTest!.context().map((c) => c.type))) + .toEqual(expect.arrayContaining(["contourSet", "terrainMesh"])); + await page.screenshot({ path: "test-results/contourLine332.png" }); +}); diff --git a/src-tauri/core/src/cmd_create.rs b/src-tauri/core/src/cmd_create.rs index 3504bbc0..9496da81 100644 --- a/src-tauri/core/src/cmd_create.rs +++ b/src-tauri/core/src/cmd_create.rs @@ -1335,6 +1335,8 @@ pub fn ops(root: &Map, p: &Project, v: &Value) -> Option> "railing" => railing_ops(p, v, &ctx, ids), "circlesToTrees" => circles_to_trees_ops(root, p, v, &ctx, ids), "extrude" => extrude_ops(root, v, &ctx, ids), + // [332] Gezeichnete Linie → Gelände-Höhenlinie. + "contourLine" => crate::contour_draw::ops(root, p, v, &ctx, ids), // [222] Volumenstudie → Bauteile. "solidToParts" => crate::cmd_massing::ops(root, p, v, &ctx, ids), _ => return crate::cmd_draw::ops(root, p, v, &ctx, ids).or_else(|| crate::cmd_solid::ops(root, p, v, &ctx, ids)), @@ -1471,6 +1473,9 @@ pub fn query(root: &Map, p: &Project, v: &Value) -> Option crate::cmd_massing::check(p, v), "pickProfile" => json!({ "hit": pick_profile(root, level, at).map_or(Value::Null, profile_json) }), "profile" => json!({ "hit": find(root, "drawings2d", s_of(v, "id")).map_or(Value::Null, profile_json) }), + // [332] Linie für eine Höhenlinie: angeklickt bzw. vorgewählt. + "pickContourLine" => json!({ "hit": crate::contour_draw::pick(p, level, at).map_or(Value::Null, crate::contour_draw::hit_json) }), + "contourLine" => json!({ "hit": p.drawings2d.iter().find(|d| d.id == s_of(v, "id")).map_or(Value::Null, crate::contour_draw::hit_json) }), _ => return crate::cmd_draw::query(root, p, v).or_else(|| crate::cmd_solid::query(root, p, v)).map(Ok), })) } diff --git a/src-tauri/core/src/contour_draw.rs b/src-tauri/core/src/contour_draw.rs new file mode 100644 index 00000000..d469a622 --- /dev/null +++ b/src-tauri/core/src/contour_draw.rs @@ -0,0 +1,207 @@ +//! [332] Eigene Höhenlinien zeichnen: eine 2D-Linie (Linie, Polylinie samt Bögen, Spline, Bezier, Bogen, Kreis, +//! Ellipse, Rechteck) wird mit einer getippten Höhe zur Gelände-Höhenlinie. Sie kommt in den ersten Höhenlinien-Satz +//! der Kontext-Schicht (den liest „Gelände erzeugen“, `cmd_solid::terrain_ops`), sonst in einen neuen Satz der Klasse +//! „14 Höhenlinien“; die Quell-Zeichnung verschwindet. Ein Undo-Schritt je Linie. + +use serde_json::{Map, Value}; + +use crate::cmd_create::{category_or, find, obj, point_segment_distance, polyline_edges, pvs, remove_op, s, s_of, opt_n, Ctx}; +use crate::cmd_transform::IdGen; +use crate::json_util::js_num; +use crate::model::{Drawing2D, Drawing2DGeom, Project, SplineMode, Vec2}; +use crate::ops::Op; + +/// Fangabstand beim Anklicken einer Linie (Modell-m), wie beim Extrudieren. +const HIT_TOL: f64 = 0.25; +/// Klasse „Höhenlinien“ (wie der Höhenlinien-Import). +const CONTOUR_CATEGORY: &str = "14"; + +fn pts_of(f: &[f64]) -> Vec { + f.chunks_exact(2).map(|c| Vec2 { x: c[0], y: c[1] }).collect() +} + +fn flat(p: &[Vec2]) -> Vec { + p.iter().flat_map(|q| [q.x, q.y]).collect() +} + +/// Linienzug einer Zeichnung (Punkte, geschlossen?) — `None` für Texte, Masse, Schraffuren u. ä. oder Unsinn. +pub fn line_of(g: &Drawing2DGeom) -> Option<(Vec, bool)> { + let (pts, closed) = match g { + Drawing2DGeom::Line { a, b } => (vec![*a, *b], false), + Drawing2DGeom::Polyline { pts, closed, bulge, .. } => { + let real = bulge.as_ref().is_some_and(|b| b.iter().any(|x| x.abs() > 1e-9)); + let q = if real { pts_of(&crate::bulge::polyline_points(&flat(pts), bulge.as_deref().unwrap_or(&[]), *closed)) } else { pts.clone() }; + (q, *closed && pts.len() > 2) + } + Drawing2DGeom::Spline { pts, closed, mode } => { + let closed = *closed && pts.len() > 2; + let q = if pts.len() < 3 { + pts.clone() + } else if *mode == Some(SplineMode::Control) { + pts_of(&crate::curves::uniform_bspline(&flat(pts), closed, 16.0)) + } else { + pts_of(&crate::curves::catmull_rom(&flat(pts), closed, 16.0)) + }; + (q, closed) + } + Drawing2DGeom::Bezier { pts } => (if pts.len() < 4 { pts.clone() } else { pts_of(&crate::curves::bezier_chain(&flat(pts), 24.0)) }, false), + Drawing2DGeom::Arc { center, r, a0, a1 } => (crate::plan::text_curve::arc_points(*center, *r, *a0, *a1), false), + Drawing2DGeom::Circle { center, r } => (crate::cmd_create::circle_pts((center.x, center.y), *r, 48).into_iter().map(|(x, y)| Vec2 { x, y }).collect(), true), + Drawing2DGeom::Ellipse { center, rx, ry, rotation } => (pts_of(&crate::curves::ellipse(center.x, center.y, *rx, *ry, *rotation, 48.0)), true), + Drawing2DGeom::Rect { min, max } => (vec![*min, Vec2 { x: max.x, y: min.y }, *max, Vec2 { x: min.x, y: max.y }], true), + _ => return None, + }; + // Doppelte Folgepunkte weg (Tessellierung, Schlusspunkt = Anfang bei geschlossenen). + let mut q: Vec = Vec::with_capacity(pts.len()); + for p in pts { + if !(p.x.is_finite() && p.y.is_finite()) { + return None; + } + if q.last().is_none_or(|l: &Vec2| (l.x - p.x).abs() > 1e-9 || (l.y - p.y).abs() > 1e-9) { + q.push(p); + } + } + if closed && q.len() > 1 && (q[0].x - q[q.len() - 1].x).abs() < 1e-9 && (q[0].y - q[q.len() - 1].y).abs() < 1e-9 { + q.pop(); + } + (q.len() >= if closed { 3 } else { 2 }).then_some((q, closed)) +} + +/// Nächste Linie der Ebene am Punkt (Kantenabstand < [`HIT_TOL`]). +pub fn pick<'a>(p: &'a Project, level: &str, at: (f64, f64)) -> Option<&'a Drawing2D> { + let mut best = None; + let mut best_d = HIT_TOL; + for d in p.drawings2d.iter().filter(|d| d.level_id == level) { + let Some((pts, closed)) = line_of(&d.geom) else { continue }; + let v: Vec<(f64, f64)> = pts.iter().map(|q| (q.x, q.y)).collect(); + for (a, b) in polyline_edges(&v, closed) { + let dd = point_segment_distance(at, a, b); + if dd < best_d { + best_d = dd; + best = Some(d); + } + } + } + best +} + +/// Treffer als JSON für die Hülle (Hervorhebung): `{ id, pts, closed }`. +pub fn hit_json(d: &Drawing2D) -> Value { + match line_of(&d.geom) { + Some((pts, closed)) => obj(vec![("id", s(&d.id)), ("pts", pvs(&pts.iter().map(|q| (q.x, q.y)).collect::>())), ("closed", Value::Bool(closed))]), + None => Value::Null, + } +} + +/// Ops: Quelle `source` (Zeichnung) mit Höhe `z` zur Höhenlinie; ohne gültige Linie/Höhe nichts. +pub fn ops(root: &Map, p: &Project, v: &Value, ctx: &Ctx, ids: &mut IdGen) -> Vec { + let src = s_of(v, "source"); + // Höhe Pflicht (fehlt/ungültig: nichts — `n_of` machte daraus 0). + let z = opt_n(v, "z").unwrap_or(f64::NAN); + let Some(d) = p.drawings2d.iter().find(|d| d.id == src) else { return Vec::new() }; + let Some((pts, closed)) = line_of(&d.geom).filter(|_| z.is_finite()) else { return Vec::new() }; + if find(root, "drawings2d", src).is_none() { + return Vec::new(); + } + let contour = obj(vec![("z", js_num(z)), ("pts", pvs(&pts.iter().map(|q| (q.x, q.y)).collect::>())), ("closed", Value::Bool(closed))]); + let context = root.get("context").and_then(Value::as_array).map(Vec::as_slice).unwrap_or(&[]); + let set = context.iter().find(|o| o.get("type").and_then(Value::as_str) == Some("contourSet")); + let mut out = match set { + Some(set) => { + let mut e = set.clone(); + if let Some(list) = e.get_mut("contours").and_then(Value::as_array_mut) { + list.push(contour); + } else if let Some(m) = e.as_object_mut() { + m.insert("contours".into(), Value::Array(vec![contour])); + } + vec![Op::Replace { collection: "context".into(), entity: e }] + } + None => vec![Op::Add { + collection: "context".into(), + items: vec![obj(vec![ + ("id", s(&ids.next("contours"))), + ("type", s("contourSet")), + ("name", s("Höhenlinien (gezeichnet)")), + ("categoryCode", category_or(p, CONTOUR_CATEGORY, ctx)), + ("source", s("Gezeichnet")), + ("contours", Value::Array(vec![contour])), + ])], + at: None, + }], + }; + out.extend(remove_op(root, "drawings2d", &[src])); + out +} + +#[cfg(test)] +mod tests { + use super::*; + use serde_json::json; + + fn project(drawings: Value, context: Value) -> (Map, Project) { + let v = json!({ + "name": "T", "walls": [], "openings": [], "rooms": [], + "drawingLevels": [{"id": "eg", "name": "EG", "kind": "floor", "visible": true, "locked": false}], + "layers": [{"code": "14", "name": "Höhenlinien", "color": "#888888", "lw": 0.1, "visible": true, "locked": false}], + "drawings2d": drawings, "context": context, + }); + let p: Project = serde_json::from_value(v.clone()).unwrap(); + (v.as_object().unwrap().clone(), p) + } + + fn run(root: &Map, p: &Project, v: Value) -> Vec { + let ctx = crate::cmd_create::ctx_of(&v); + let mut ids = IdGen::new("t"); + ops(root, p, &v, &ctx, &mut ids) + } + + #[test] + fn linienarten_als_linienzug() { + let l = |g: Value| line_of(&serde_json::from_value::(g).unwrap()); + assert_eq!(l(json!({"shape": "line", "a": {"x": 0, "y": 0}, "b": {"x": 3, "y": 0}})).map(|(p, c)| (p.len(), c)), Some((2, false))); + assert_eq!(l(json!({"shape": "rect", "min": {"x": 0, "y": 0}, "max": {"x": 3, "y": 2}})).map(|(p, c)| (p.len(), c)), Some((4, true))); + let (c, closed) = l(json!({"shape": "circle", "center": {"x": 1, "y": 1}, "r": 2})).unwrap(); + assert!(closed && c.len() == 48 && c.iter().all(|q| ((q.x - 1.0).hypot(q.y - 1.0) - 2.0).abs() < 1e-9)); + // Spline durch die Punkte: dichter als die Eingabe, Anfang und Ende bleiben. + let (sp, closed) = l(json!({"shape": "spline", "pts": [{"x": 0, "y": 0}, {"x": 5, "y": 2}, {"x": 10, "y": 0}], "closed": false})).unwrap(); + assert!(!closed && sp.len() > 10 && sp[0].x == 0.0 && (sp[sp.len() - 1].x - 10.0).abs() < 1e-9); + // Polylinie mit Bogen: tesselliert. + let (pb, _) = l(json!({"shape": "polyline", "pts": [{"x": 0, "y": 0}, {"x": 4, "y": 0}], "closed": false, "bulge": [1.0, 0.0]})).unwrap(); + assert!(pb.len() > 2); + // Text, entartet: nichts. + assert!(l(json!({"shape": "text", "at": {"x": 0, "y": 0}, "text": "x", "height": 0.25, "angle": 0})).is_none()); + assert!(l(json!({"shape": "line", "a": {"x": 1, "y": 1}, "b": {"x": 1, "y": 1}})).is_none()); + } + + #[test] + fn linie_wird_hoehenlinie_im_neuen_satz() { + let (root, p) = project(json!([{"id": "d1", "type": "drawing2d", "levelId": "eg", "categoryCode": "00", "geom": {"shape": "polyline", "pts": [{"x": 0, "y": 0}, {"x": 10, "y": 1}, {"x": 20, "y": 0}], "closed": false}}]), json!([])); + let ops = run(&root, &p, json!({"cmd": "contourLine", "source": "d1", "z": 451.5, "level": "eg"})); + let j: Vec = ops.iter().map(|o| o.to_json()).collect(); + assert_eq!(j.len(), 2, "{j:?}"); + let set = &j[0]["items"][0]; + assert_eq!((set["type"].as_str(), set["categoryCode"].as_str()), (Some("contourSet"), Some("14"))); + assert_eq!(set["contours"][0]["z"].as_f64(), Some(451.5)); + assert_eq!(set["contours"][0]["pts"].as_array().map(Vec::len), Some(3)); + assert_eq!(j[1]["kind"].as_str(), Some("remove")); + // Ohne Höhe oder unbekannte Quelle: nichts. + assert!(run(&root, &p, json!({"cmd": "contourLine", "source": "d1", "z": null})).is_empty()); + assert!(run(&root, &p, json!({"cmd": "contourLine", "source": "x", "z": 1})).is_empty()); + } + + #[test] + fn haengt_an_den_ersten_vorhandenen_satz() { + let (root, p) = project( + json!([{"id": "d1", "type": "drawing2d", "levelId": "eg", "categoryCode": "00", "geom": {"shape": "line", "a": {"x": 0, "y": 5}, "b": {"x": 20, "y": 5}}}]), + json!([{"id": "hl", "type": "contourSet", "name": "Import", "categoryCode": "14", "contours": [{"z": 450, "pts": [{"x": 0, "y": 0}, {"x": 20, "y": 0}], "closed": false}]}]), + ); + let j: Vec = run(&root, &p, json!({"cmd": "contourLine", "source": "d1", "z": 451})).iter().map(|o| o.to_json()).collect(); + assert_eq!(j[0]["kind"].as_str(), Some("replace")); + assert_eq!(j[0]["entity"]["id"].as_str(), Some("hl")); + assert_eq!(j[0]["entity"]["contours"].as_array().map(Vec::len), Some(2)); + // Angeklickt: nächste Linie der Ebene. + assert_eq!(pick(&p, "eg", (10.0, 5.1)).map(|d| d.id.as_str()), Some("d1")); + assert!(pick(&p, "eg", (10.0, 6.0)).is_none()); + assert!(pick(&p, "og", (10.0, 5.0)).is_none()); + } +} diff --git a/src-tauri/core/src/lib.rs b/src-tauri/core/src/lib.rs index 26ae1b67..a2f4f530 100644 --- a/src-tauri/core/src/lib.rs +++ b/src-tauri/core/src/lib.rs @@ -129,6 +129,7 @@ pub mod cmd_transform; pub mod cmd_edit; pub mod cmd_create; pub mod cmd_massing; +pub mod contour_draw; pub mod cmd_draw; #[cfg(test)] mod cmd_autodim_tests; diff --git a/src/commands/cmds/contourLine.test.ts b/src/commands/cmds/contourLine.test.ts new file mode 100644 index 00000000..4dd19fa3 --- /dev/null +++ b/src/commands/cmds/contourLine.test.ts @@ -0,0 +1,104 @@ +/** + * [332] `contourLineCommand` — gezeichnete Linie anklicken + Höhe tippen → Gelände-Höhenlinie; der Befehl wartet auf die + * nächste Linie und schlägt letzte Höhe + Äquidistanz vor; aus den Höhenlinien entsteht mit „Gelände" ein Netz. + */ + +import { beforeEach, describe, expect, it } from "vitest"; +import { contourLineCommand, resetContourLineDefaults, suggestedZ } from "./contourLine"; +import { terrainCommand } from "./terrain"; +import type { CommandContext, CommandState, Project } from "../types"; + +const line = (id: string, y: number, x0 = 0, x1 = 20) => ({ + id, + type: "drawing2d" as const, + levelId: "eg", + categoryCode: "20", + geom: { shape: "spline" as const, pts: [{ x: x0, y }, { x: (x0 + x1) / 2, y: y + 0.5 }, { x: x1, y }], closed: false }, +}); + +function project(): Project { + return { + id: "t", + name: "T", + lineStyles: [], + hatches: [], + components: [], + wallTypes: [], + drawingLevels: [{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false, floorHeight: 2.6, cutHeight: 1.0, baseElevation: 0 }], + layers: [ + { code: "14", name: "Höhenlinien", color: "#888888", lw: 0.1, visible: true, locked: false }, + { code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }, + ], + walls: [], + openings: [], + ceilings: [], + stairs: [], + rooms: [], + drawings2d: [line("a", 0), line("b", 5), line("c", 10)], + context: [], + } as Project; +} + +const ctxOf = (p: Project, drawingIds: string[] = []): CommandContext => ({ + project: p, + level: p.drawingLevels[0], + defaultCategoryCode: "20", + activeLineStyleId: "solid", + activeWallTypeId: "aw", + lastPoint: null, + selection: { wallIds: [], drawingId: drawingIds[0] ?? null, drawingIds }, +}); + +const contours = (p: Project) => (p.context ?? []).flatMap((o) => (o.type === "contourSet" ? o.contours : [])); + +describe("contourLineCommand", () => { + beforeEach(() => resetContourLineDefaults()); + + it("Linie anklicken, Höhe tippen → Höhenlinie; nächste Linie mit Vorschlag (Enter); dann Gelände", () => { + let p = project(); + const cmd = contourLineCommand; + let s: CommandState = cmd.init(); + // Daneben geklickt: Hinweis, kein Wechsel. + let [ns, r] = cmd.onInput(s, { kind: "point", point: { x: 10, y: 2.5 } }, ctxOf(p)); + expect(ns.phase).toBe("pick"); + expect(r.notice?.key).toBe("cmd.contourLine.noLine"); + // Erste Linie (y = 0) mit 450. + [s] = cmd.onInput(s, { kind: "point", point: { x: 0.05, y: 0 } }, ctxOf(p)); + expect(s.phase).toBe("height"); + [s, r] = cmd.onInput(s, { kind: "number", value: 450 }, ctxOf(p)); + p = r.commit!(p); + expect(s.phase).toBe("pick"); + expect(contours(p).map((c) => c.z)).toEqual([450]); + expect(p.drawings2d.map((d) => d.id)).toEqual(["b", "c"]); + // Zweite mit 451 → Äquidistanz 1; dritte per Enter: Vorschlag 452. + [s] = cmd.onInput(s, { kind: "point", point: { x: 0.05, y: 5 } }, ctxOf(p)); + [s, r] = cmd.onInput(s, { kind: "number", value: 451 }, ctxOf(p)); + p = r.commit!(p); + expect(suggestedZ(p)).toBe(452); + [s] = cmd.onInput(s, { kind: "point", point: { x: 0.05, y: 10 } }, ctxOf(p)); + [s, r] = cmd.onConfirm(s, ctxOf(p)); + p = r.commit!(p); + expect(contours(p).map((c) => c.z)).toEqual([450, 451, 452]); + expect(p.drawings2d).toEqual([]); + // Ein Satz der Klasse „14". + const sets = (p.context ?? []).filter((o) => o.type === "contourSet"); + expect(sets.map((o) => o.categoryCode)).toEqual(["14"]); + // Enter beim Wählen: fertig, mit Hinweis. + [, r] = cmd.onConfirm(s, ctxOf(p)); + expect(r.done).toBe(true); + expect(r.notice?.key).toBe("cmd.contourLine.done"); + // Gelände aus den gezeichneten Höhenlinien. + const t = terrainCommand.autoRun!(ctxOf(p)); + const withTerrain = t.commit!(p); + const mesh = (withTerrain.context ?? []).find((o) => o.type === "terrainMesh"); + expect(mesh && mesh.type === "terrainMesh" ? mesh.indices.length : 0).toBeGreaterThan(0); + }); + + it("vorgewählte Linie: getippte Zahl ist gleich ihre Höhe", () => { + const p = project(); + const [, r] = contourLineCommand.onInput(contourLineCommand.init(), { kind: "number", value: 3.5 }, ctxOf(p, ["b"])); + const next = r.commit!(p); + expect(contours(next).map((c) => c.z)).toEqual([3.5]); + expect(next.drawings2d.map((d) => d.id)).toEqual(["a", "c"]); + }); +}); diff --git a/src/commands/cmds/contourLine.ts b/src/commands/cmds/contourLine.ts new file mode 100644 index 00000000..b63ce2a8 --- /dev/null +++ b/src/commands/cmds/contourLine.ts @@ -0,0 +1,122 @@ +// [332] Höhenlinie — eigene Gelände-Höhenlinien aus gezeichneten Linien (Linie, Polylinie, Spline, Bogen, Kreis, +// Ellipse, Rechteck). Ablauf wie beim Extrudieren: +// 1) Linie anklicken (oder eine vorgewählte nehmen), +// 2) „Höhe:" → Zahl tippen, Enter übernimmt den Vorschlag (letzte Höhe + Äquidistanz). +// Die Linie wird zur Höhenlinie (Kern `contour_draw.rs`, ein Undo-Schritt je Linie) und der Befehl wartet auf die +// nächste Linie; Enter/Esc beim Wählen beendet ihn. Daraus erzeugt „Gelände“ das Geländemodell. + +import type { Command, CommandContext, CommandResult, CommandState, Project, Vec2 } from "../types"; +import { createMutation, createQuery, xy } from "../createCore"; + +/** Getroffene Linie (Kern): Id, Linienzug, geschlossen? */ +export interface LineHit { + id: string; + pts: Vec2[]; + closed: boolean; +} + +/** Zuletzt getippte Höhe und Äquidistanz (Abstand der letzten beiden Höhen) über Aufrufe hinweg. */ +let lastZ: number | null = null; +let step = 1; + +/** Nur für Tests: Vorschlag zurücksetzen. */ +export function resetContourLineDefaults(): void { + lastZ = null; + step = 1; +} + +const query = (project: Project, req: { q: string } & Record): LineHit | null => + createQuery<{ hit: LineHit | null }>(project, req).hit ?? null; + +/** Höchste vorhandene Höhenlinie (alle Sätze der Kontext-Schicht), sonst null. */ +function topContour(project: Project): number | null { + let top: number | null = null; + for (const o of project.context ?? []) { + if (o.type !== "contourSet") continue; + for (const c of o.contours) if (Number.isFinite(c.z) && (top === null || c.z > top)) top = c.z; + } + return top; +} + +/** Vorschlag für die nächste Höhe: letzte + Äquidistanz, sonst über der höchsten vorhandenen, sonst 0. */ +export function suggestedZ(project: Project): number { + if (lastZ !== null) return lastZ + step; + const top = topContour(project); + return top === null ? 0 : top + step; +} + +interface ClPick extends CommandState { + phase: "pick"; +} +interface ClHeight extends CommandState { + phase: "height"; + hit: LineHit; +} +type ClState = ClPick | ClHeight; + +const PICK: ClPick = { phase: "pick", lastPoint: null }; + +/** Genau eine vorgewählte Linie (sonst null). */ +function preselected(ctx: CommandContext): LineHit | null { + const ids = ctx.selection.drawingIds ?? (ctx.selection.drawingId ? [ctx.selection.drawingId] : []); + if (ids.length !== 1 || ctx.selection.wallIds.length > 0) return null; + return query(ctx.project, { q: "contourLine", id: ids[0] }); +} + +const draftOf = (hit: LineHit, at: Vec2 | null, project: Project): CommandResult => ({ + draft: { + preview: [{ kind: "poly", pts: hit.pts, closed: hit.closed }], + vertices: [], + ...(at ? { hud: { at, text: `${suggestedZ(project).toFixed(2)} m` } } : {}), + }, +}); + +/** Höhe übernehmen: Höhenlinie anlegen, Vorschlag nachführen, nächste Linie wählen. */ +function commit(hit: LineHit, z: number, ctx: CommandContext): [CommandState, CommandResult] { + if (lastZ !== null && Math.abs(z - lastZ) > 1e-9) step = z - lastZ; + lastZ = z; + return [{ ...PICK }, { draft: null, commit: createMutation(ctx, { cmd: "contourLine", source: hit.id, z }) }]; +} + +export const contourLineCommand: Command = { + name: "contourline", + labelKey: "cmd.contourLine.label", + prompt: (s) => ((s as ClState).phase === "height" ? "cmd.contourLine.height" : "cmd.contourLine.pick"), + // Auch beim Wählen eine Zahl: mit vorgewählter Linie gilt sie sofort als deren Höhe. + accepts: () => ["point", "number"], + options: () => [], + floorOnly: true, + + init: (): ClState => ({ ...PICK }), + + onInput: (state, input, ctx): [CommandState, CommandResult] => { + const s = state as ClState; + if (s.phase === "pick") { + // Vorgewählte Linie: getippte Zahl ist gleich ihre Höhe (wie beim Extrudieren). + if (input.kind === "number" && Number.isFinite(input.value)) { + const pre = preselected(ctx); + return pre ? commit(pre, input.value, ctx) : [s, { draft: null }]; + } + if (input.kind !== "point") return [s, { draft: null }]; + const hit = query(ctx.project, { q: "pickContourLine", level: ctx.level.id, pt: xy(input.point) }); + if (!hit) return [s, { draft: null, notice: { key: "cmd.contourLine.noLine", kind: "warning" } }]; + return [{ phase: "height", hit, lastPoint: null } as ClHeight, draftOf(hit, input.point, ctx.project)]; + } + if (input.kind === "number" && Number.isFinite(input.value)) return commit(s.hit, input.value, ctx); + return [s, { draft: null }]; + }, + + onMove: (state, point, _snap, ctx): [CommandState, CommandResult] => { + const s = state as ClState; + if (s.phase === "height") return [s, draftOf(s.hit, point, ctx.project)]; + return [s, { draft: null }]; + }, + + // Enter/Rechtsklick: beim Höhen-Schritt den Vorschlag übernehmen; beim Wählen beenden. + onConfirm: (state, ctx): [CommandState, CommandResult] => { + const s = state as ClState; + if (s.phase === "height") return commit(s.hit, suggestedZ(ctx.project), ctx); + return [{ ...PICK }, { draft: null, done: true, notice: { key: "cmd.contourLine.done", kind: "info" } }]; + }, + onCancel: (): [CommandState, CommandResult] => [{ ...PICK }, { draft: null, done: true }], +}; diff --git a/src/commands/registry.ts b/src/commands/registry.ts index a8dc66af..ca30fe43 100644 --- a/src/commands/registry.ts +++ b/src/commands/registry.ts @@ -62,6 +62,7 @@ import { copyCommand } from "./cmds/copy"; import { arrayCommand } from "./cmds/array"; import { offsetCommand } from "./cmds/offset"; import { extrudeCommand } from "./cmds/extrude"; +import { contourLineCommand } from "./cmds/contourLine"; import { revolveCommand } from "./cmds/revolve"; import { loftCommand } from "./cmds/loft"; import { trimCommand } from "./cmds/trim"; @@ -155,6 +156,7 @@ export const COMMANDS: Record = { array: arrayCommand, offset: offsetCommand, extrude: extrudeCommand, + contourline: contourLineCommand, revolve: revolveCommand, loft: loftCommand, trim: trimCommand, @@ -344,6 +346,9 @@ export const ALIASES: Record = { parallel: "multiline", imp: "import", ter: "terrain", + hl: "contourline", + hoehenlinie: "contourline", + höhenlinie: "contourline", baugrube: "excavation", aushub: "excavation", netzzuschnitt: "meshcrop", diff --git a/src/i18n/de.ts b/src/i18n/de.ts index fcea9f11..d954bf2e 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -2708,6 +2708,11 @@ export const de = { "cmd.extrude.pick": "Geschlossenes Profil wählen:", "cmd.extrude.height": "Höhe:", "cmd.extrude.taper": "Verjüngung (0–1, 1=Spitze):", + "cmd.contourLine.label": "Höhenlinie", + "cmd.contourLine.pick": "Linie für die Höhenlinie wählen (Enter: fertig):", + "cmd.contourLine.height": "Höhe (m ü. M. bzw. Projekthöhe, Enter: Vorschlag):", + "cmd.contourLine.noLine": "Hier liegt keine Linie (Linie, Polylinie, Spline, Bogen, Kreis, Ellipse oder Rechteck anklicken)", + "cmd.contourLine.done": "Höhenlinien übernommen — „Gelände“ erzeugt daraus das Geländemodell", // Trim (Quick-Trim): auf den wegzuschneidenden Abschnitt klicken; wiederholend. "cmd.trim.label": "Stutzen", "cmd.trim.pick": "Abschnitt zum Wegschneiden anklicken (Esc beendet):", @@ -2851,6 +2856,8 @@ export const de = { "site.smooth.hint": "Höhenlinien als Bruchkanten, flache Dreiecke behoben, Fläche ohne Überschwingen geglättet", "site.excavation.draw": "Baugrube zeichnen", "site.excavation.hint": "Umriss der Sohle zeichnen; Böschungen schneiden das Gelände", + "site.contourLine.draw": "Höhenlinien zeichnen", + "site.contourLine.hint": "Gezeichnete Linien (Linie, Polylinie, Spline, Kreis …) anklicken und ihre Höhe tippen; danach „Gelände erzeugen“", "site.contourInterval": "Äquidistanz", "site.contourIndexEvery": "Zähllinie jede", "site.smoothShading": "Glatt schattieren", diff --git a/src/i18n/en.ts b/src/i18n/en.ts index ee844882..091430d4 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -2696,6 +2696,11 @@ export const en: Record = { "cmd.extrude.pick": "Select closed profile:", "cmd.extrude.height": "Height:", "cmd.extrude.taper": "Taper (0–1, 1=point):", + "cmd.contourLine.label": "Contour line", + "cmd.contourLine.pick": "Select line for the contour (Enter: done):", + "cmd.contourLine.height": "Elevation (m a.s.l. or project height, Enter: suggestion):", + "cmd.contourLine.noLine": "No line here (click a line, polyline, spline, arc, circle, ellipse or rectangle)", + "cmd.contourLine.done": "Contours added — “Terrain” builds the terrain model from them", // Trim (quick-trim): click the part to cut away; repeats until Esc. "cmd.trim.label": "Trim", "cmd.trim.pick": "Click the part to trim away (Esc to finish):", @@ -2839,6 +2844,8 @@ export const en: Record = { "site.smooth.hint": "Contours as breaklines, flat triangles fixed, surface smoothed without overshoot", "site.excavation.draw": "Draw excavation", "site.excavation.hint": "Draw the outline of the pit bottom; slopes cut the terrain", + "site.contourLine.draw": "Draw contours", + "site.contourLine.hint": "Click drawn lines (line, polyline, spline, circle …) and type their elevation; then “Generate terrain”", "site.contourInterval": "Interval", "site.contourIndexEvery": "Index contour every", "site.smoothShading": "Smooth shading", diff --git a/src/panels/SitePanel.tsx b/src/panels/SitePanel.tsx index 08d40cdd..75b41e48 100644 --- a/src/panels/SitePanel.tsx +++ b/src/panels/SitePanel.tsx @@ -82,6 +82,9 @@ export function SitePanel() { > {t("site.setGeoref")} + {ctxImportOpen && ( diff --git a/src/panels/host.ts b/src/panels/host.ts index 1c05621e..f041f2ed 100644 --- a/src/panels/host.ts +++ b/src/panels/host.ts @@ -638,6 +638,8 @@ export interface PanelHostValue { onPatchContextObject: (id: string, patch: Record, coalesceKey?: string) => void; /** [68] Startet den Befehl „Baugrube" (Umriss zeichnen). */ onStartExcavation: () => void; + /** [332] Startet den Befehl „Höhenlinie" (gezeichnete Linien mit Höhe zu Gelände-Höhenlinien). */ + onStartContourLine: () => void; /** * Setzt/ersetzt den Georeferenzierungs-Bezug (`Project.geoAnchor`) — welcher * Modell-Punkt welcher realen LV95-Koordinate entspricht. `undefined` löscht diff --git a/src/state/panelHost/siteHost.ts b/src/state/panelHost/siteHost.ts index bc7be120..94f5d0c0 100644 --- a/src/state/panelHost/siteHost.ts +++ b/src/state/panelHost/siteHost.ts @@ -19,6 +19,7 @@ export function buildSiteHost(c: FlatHostOpts) { onGenerateTerrain: generateTerrain, onPatchContextObject: patchContextObject, onStartExcavation: () => onRunCommand("excavation"), + onStartContourLine: () => onRunCommand("contourline"), onSetGeoAnchor: (anchor) => { applyChange((p) => setFieldIfChanged(p, "geoAnchor", anchor)); },