From a5881311fee960870df39b4a852ad06fb291d81b Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Nov 2026 05:14:33 +0000 Subject: [PATCH] =?UTF-8?q?[256]=20Plan-Review=20Runde=204=20(Fortsetzung)?= =?UTF-8?q?:=20Nachbargeb=C3=A4ude=20hellgrau=20=C3=BCber=20den=20Klassen-?= =?UTF-8?q?Stil=20und=20nur=20=C3=BCber=20dem=20Gel=C3=A4nde,=20Treppen-Br?= =?UTF-8?q?uchlinie=20in=20Papiergr=C3=B6sse,=20Abgabe-Vorlagen=20ohne=20K?= =?UTF-8?q?ameras/Schatten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Modell: LayerCategory.fill (Vorgabe-Füllung der Klasse); „12 Gebäude" hellgrau (Kern-Tabelle, TS, Beispiele). - Grundriss/Schnitt: geschnittene Netze auf einer Klasse mit Füllung hellgrau mit Umriss in Klassenfarbe statt schwarz, Füllungs-Regel geht vor; Situation/Schwarzplan unverändert. Höhenlinien enden an gefüllten Nachbarn. - Schnitt: Netze auf Umgebungsklassen enden am Geländeende (kein schwebender Nachbar). - Treppe: Zickzack der Bruchlinie 2 × 1.5 mm Papier (vorher fest ≤ 6 cm, bei 1:100 wie eine Trittkante). - Standard-Vorlagen: Kameras (92) in Abgabe-Vorlagen aus, Sonnenschatten (08) nur in der Präsentation; Beispiel komplex analog; Geländekote und Revisionstext im Beispiel nicht mehr auf den Massketten. - Goldens nachgeführt (Nachbar-Stil, Bruchlinie, Situation ohne Kamera). --- TODO.md | 22 +++++++- src-tauri/core/src/import_context.rs | 37 +++++++++----- src-tauri/core/src/model/generated.rs | 6 +++ src-tauri/core/src/plan/context.rs | 40 +++++++++++++++ src-tauri/core/src/plan/mesh_plan.rs | 31 +++++++++-- src-tauri/core/src/plan/section/mesh_tests.rs | 28 ++++++++++ src-tauri/core/src/plan/section/meshes.rs | 51 +++++++++++++++++++ src-tauri/core/src/plan/section/mod.rs | 7 ++- src-tauri/core/src/plan/section/primitives.rs | 19 +++++-- src-tauri/core/src/plan/stair_symbol.rs | 26 ++++++++-- src-tauri/core/src/plan/stairs.rs | 2 +- src-tauri/core/src/plan/style.rs | 9 ++++ src-tauri/core/src/standards.rs | 25 ++++++--- src/cli/__golden__/grundriss-eg.svg | 2 +- src/model/contextCategories.test.ts | 2 +- src/model/contextCategories.ts | 4 +- src/model/sampleProject.ts | 2 +- src/model/sampleProjectComplex.test.ts | 15 ++++++ src/model/sampleProjectComplex.ts | 17 ++++--- src/model/sampleProjectWettbewerb.ts | 2 +- src/model/types.generated.ts | 6 +++ .../__golden__/komplex-grundriss-eg-100.txt | 4 +- .../__golden__/komplex-grundriss-eg-50.txt | 4 +- .../__golden__/komplex-grundriss-og-100.txt | 2 +- .../__golden__/komplex-grundriss-og-50.txt | 2 +- .../__golden__/komplex-grundriss-ug-100.txt | 2 +- .../__golden__/komplex-grundriss-ug-50.txt | 4 +- .../__golden__/komplex-schwarzplan-500.txt | 13 +++-- src/plan/__golden__/komplex-situation-500.txt | 13 +++-- .../__golden__/muster-grundriss-eg-100.txt | 4 +- .../__golden__/muster-grundriss-eg-50.txt | 4 +- 31 files changed, 333 insertions(+), 72 deletions(-) diff --git a/TODO.md b/TODO.md index 2d8c470d..5eed198a 100644 --- a/TODO.md +++ b/TODO.md @@ -278,7 +278,27 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC. (grau/Umriss?); Sonnenschatten im 1:100-Grundriss (Wettbewerb, komplex); DG-Fenster über der Schnitthöhe bemasst, aber nicht gezeigt (gestrichelt?); Stempel „Schlafen" DG auf 80 %; Treppe im Grundriss ohne Schnitt-Bruchlinie über die Laufbreite; Höhenlinien-Koten/Revisionstext auf Masszahlen (komplex EG Süd); Kotenwerte doppelt gerechnet in TS und Kern (`levelMarkers.ts` ↔ `level_marker_bounds`, Doppelspur seit [199]). Nicht in der - Tauri-App/auf dem Mac angesehen. · M + Tauri-App/auf dem Mac angesehen. + **14.11. (Fortsetzung):** (a) Nachbargebäude über den Klassen-Stil: neues Modellfeld `LayerCategory.fill` (Vorgabe-Füllung der Klasse), + „12 Gebäude" hellgrau `#d9d9d9` (Kern-Tabelle `import_context`, TS `contextCategories.ts`, Beispiele); geschnittene Netze auf einer Klasse mit + Füllung im Grundriss (`mesh_plan`) und Schnitt (`CutRules::class`) hellgrau mit Umriss in Klassenfarbe/-stärke statt schwarz, ohne schwere + Schnittkante; eine Füllungs-Regel ([33]) geht vor; Situation/Schwarzplan unverändert. Höhenlinien enden an gefüllten Nachbarn + (`filled_context_rings`). Im Schnitt enden Netze auf Umgebungsklassen am Geländeende (`clip_context_meshes_to_terrain`; komplex: der + schwebende Nachbar entfällt). Tests `nachbargebaeude_im_grundriss_nach_klassenstil`, `nachbargebaeude_hellgrau_und_nur_ueber_dem_gelaende`, + `hoehenlinien_enden_am_gefuellten_nachbarn`. (b) Treppen-Bruchlinie war da, aber ihr Zickzack (fest ≤ 6 cm) las sich bei 1:100 als + weitere Trittkante: jetzt in Papiergrösse (2 × 1.5 mm, `RunOpts::break_mm`, Test `bruchlinie_zickzack_in_papiergroesse`). (c) Geländekote und + Revisionstext im Beispiel komplex lagen von Hand auf den (später erzeugten) Auto-Massketten — unter die Ketten verschoben (vitest + `sampleProjectComplex.test.ts`); Höhenlinien-Beschriftungen wichen den Massen schon aus. Von Hand gesetzte Texte verschiebt der Kern + bewusst nicht. (d) Standard-Vorlagen: Kameras (92) aus in Präsentation, Eingabe, Ausführung, Situation, Schwarzplan; Sonnenschatten (08) aus + in Eingabe/Ausführung, an in der Präsentation (Test `abgabe_vorlagen_ohne_kameras_schatten_nur_praesentation`); komplex: „Grundriss 1:100/1:50" + und „Brandschutzplan" ohne 08/92, der Arbeitsplan ohne Vorlage zeigt beides. Goldens (komplex Grundrisse, Situation, Schwarzplan, muster + EG, CLI-Grundriss) nachgeführt. Geprüft nur Linux/CLI-SVG in Chromium. **Offen:** DG-Fenster über der Schnitthöhe — sie werden + „über Schnitt" strichpunktiert gezeichnet, aber in der schwarzen 1:100-Wand unsichtbar (DG Rundfenster 1.8 m; EG Bad 1.1 m, Rundfenster 1.2 m + liegen ebenfalls über 1.0 m): nicht zu bemassen hätte auch diese Bad-Fenster aus den EG/OG-Ketten genommen — Entscheid nötig (hell auf + schwarz zeichnen oder Schnitthöhe/Bemassung); Wettbewerb: Geschosse ohne Vorlage, Schatten kommt vom eingeschalteten Sonnenstand + (`sunStudy.show`), unverändert; Wettbewerb-Schnitt ohne Gelände: Nachbar bleibt (hellgrau) weit neben dem Haus; `levelMarkers.ts`-Doppelspur + (braucht eine Kern-Abfrage mit Plan-Puffer als Eingabe); Stempel „Schlafen" DG 80 %; Klassen-Füllung im Klassen-Dialog noch nicht + editierbar. · M - Fachplaner-Austausch: DXF/DWG je Geschoss/Schnitt/Ansicht ([200]), IFC mit Räumen/Psets ([201]); Rundreise in Archicad/Revit einmal real prüfen ([C9]). - Baurecht-Hülle/Ausnützung (AZ/ÜZ) gegen Modell als Nachweis-Tabelle. diff --git a/src-tauri/core/src/import_context.rs b/src-tauri/core/src/import_context.rs index 8fa0bc8d..66c9f1d4 100644 --- a/src-tauri/core/src/import_context.rs +++ b/src-tauri/core/src/import_context.rs @@ -22,27 +22,32 @@ struct Def { name: &'static str, color: &'static str, lw: f64, + /// [256] Vorgabe-Füllung der Klasse (`LayerCategory.fill`). + fill: Option<&'static str>, } +/// [256] Nachbargebäude im Grundriss/Schnitt hellgrau mit grauem Umriss (Schweizer Praxis; schwarz nur im Schwarzplan). +pub const BUILDING_FILL: &str = "#d9d9d9"; + /// [140] Kontext in Grautönen (Tusche-Standard), Farbe nur, wo der Nutzer sie setzt. /// „05 Kontext" — Elternkategorie der Kontext-Kategorien. -const CONTEXT_PARENT: Def = Def { code: "05", name: "Kontext", color: "#707078", lw: 0.13 }; +const CONTEXT_PARENT: Def = Def { code: "05", name: "Kontext", color: "#707078", lw: 0.13, fill: None }; /// „31 Dächer" bleibt oberste Ebene. -const IMPORTED_ROOF: Def = Def { code: "31", name: "Dächer", color: "#4a4a4a", lw: 0.18 }; +const IMPORTED_ROOF: Def = Def { code: "31", name: "Dächer", color: "#4a4a4a", lw: 0.18, fill: None }; /// Kinder von „05 Kontext", in dieser Reihenfolge (`NESTED_CONTEXT_CATEGORIES`). const NESTED: [Def; 11] = [ - Def { code: "02", name: "Gelände", color: "#808080", lw: 0.13 }, - Def { code: "03", name: "Luftbild", color: "#707078", lw: 0.13 }, - Def { code: "10", name: "Situation", color: "#909090", lw: 0.18 }, - Def { code: "12", name: "Gebäude", color: "#888888", lw: 0.25 }, - Def { code: "11", name: "Strasse", color: "#808080", lw: 0.18 }, - Def { code: "04", name: "Wald", color: "#909090", lw: 0.13 }, - Def { code: "15", name: "Parkplätze", color: "#a0a0a0", lw: 0.13 }, - Def { code: "16", name: "Bahn", color: "#606060", lw: 0.18 }, - Def { code: "17", name: "Gewässer", color: "#909090", lw: 0.13 }, - Def { code: "18", name: "Grünflächen", color: "#a0a0a0", lw: 0.13 }, + Def { code: "02", name: "Gelände", color: "#808080", lw: 0.13, fill: None }, + Def { code: "03", name: "Luftbild", color: "#707078", lw: 0.13, fill: None }, + Def { code: "10", name: "Situation", color: "#909090", lw: 0.18, fill: None }, + Def { code: "12", name: "Gebäude", color: "#888888", lw: 0.25, fill: Some(BUILDING_FILL) }, + Def { code: "11", name: "Strasse", color: "#808080", lw: 0.18, fill: None }, + Def { code: "04", name: "Wald", color: "#909090", lw: 0.13, fill: None }, + Def { code: "15", name: "Parkplätze", color: "#a0a0a0", lw: 0.13, fill: None }, + Def { code: "16", name: "Bahn", color: "#606060", lw: 0.18, fill: None }, + Def { code: "17", name: "Gewässer", color: "#909090", lw: 0.13, fill: None }, + Def { code: "18", name: "Grünflächen", color: "#a0a0a0", lw: 0.13, fill: None }, // [143] Baugruben eigene Kategorie: Grundrisse blenden „02 Gelände" oft aus, die Baugrube soll bleiben. - Def { code: "07", name: "Baugrube", color: "#4a4a4a", lw: 0.18 }, + Def { code: "07", name: "Baugrube", color: "#4a4a4a", lw: 0.18, fill: None }, ]; /// [256] Ist `code` eine Umgebungsklasse („05 Kontext" und ihre Kinder: Gelände, Situation, Gebäude, Strasse …)? @@ -52,7 +57,11 @@ pub fn is_context_class(code: &str) -> bool { } fn category(d: &Def) -> Value { - json!({"code": d.code, "name": d.name, "color": d.color, "lw": d.lw, "visible": true, "locked": false}) + let mut v = json!({"code": d.code, "name": d.name, "color": d.color, "lw": d.lw, "visible": true, "locked": false}); + if let Some(f) = d.fill { + v["fill"] = json!(f); + } + v } /// [207] Bekannte Layer-Namen amtlicher Kataster-/Vermessungs-DXF auf die Kontext-Klassen: Gebäude → „12", Strassen diff --git a/src-tauri/core/src/model/generated.rs b/src-tauri/core/src/model/generated.rs index 627a6559..91415515 100644 --- a/src-tauri/core/src/model/generated.rs +++ b/src-tauri/core/src/model/generated.rs @@ -2793,6 +2793,12 @@ pub struct LayerCategory { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub hatch: Option, + /// [256] Füllfarbe der Klasse (hex) für geschnittene Netzkörper ohne eigene Regel (Grundriss und Schnitt), + /// mit Umriss in Klassenfarbe und -stärke — z. B. Nachbargebäude „12 Gebäude" hellgrau statt schwarz. + /// Fehlt sie, gilt die Körper-Konvention (ab 1:100 schwarz). Situation/Schwarzplan färben selbst ([207]). + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub fill: Option, /// Unterkategorien (Baum). #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] diff --git a/src-tauri/core/src/plan/context.rs b/src-tauri/core/src/plan/context.rs index f87dbe5d..a6dfe9a8 100644 --- a/src-tauri/core/src/plan/context.rs +++ b/src-tauri/core/src/plan/context.rs @@ -83,6 +83,8 @@ pub fn plan_context_with(c: &Ctx, out: &mut Vec, drawing_obstacles: & if let Some(s) = &sit { h.extend(super::situation::own_rings(c.p)); h.extend(super::situation::context_rings(c, s)); + } else { + h.extend(filled_context_rings(c)); } h }) @@ -179,6 +181,24 @@ pub fn plan_context_with(c: &Ctx, out: &mut Vec, drawing_obstacles: & out.append(&mut late); } +/// [256] Grundflächen der sichtbaren Netze auf Klassen mit Füllung (Nachbargebäude hellgrau, `style::class_cut_style`): +/// die Höhenlinien enden an ihnen wie am eigenen Haus, statt über die graue Fläche zu laufen. +fn filled_context_rings(c: &Ctx) -> Vec> { + let mut out = Vec::new(); + for o in c.p.context.as_deref().unwrap_or(&[]) { + let ContextObject::ImportedMesh(m) = o else { continue }; + if !c.shown(&m.category_code) || super::style::class_cut_style(c.p, &m.category_code).is_none() { + continue; + } + for poly in super::situation::mesh_polygons(&m.positions, &m.indices) { + if let Some(r) = poly.first().filter(|r| r.len() >= 3) { + out.push(r.iter().map(|q| v2(q[0], q[1])).collect()); + } + } + } + out +} + /// [157] Sohle und Böschungsoberkante der Baugruben, die dieser Grundriss zeigt (Gelände sichtbar, Kategorie /// der Baugrube gezeigt), als Strecken — Hindernisse der Aussenbemassung und der Schnittmarken-Beschriftung. pub(super) fn excavation_segments(c: &Ctx) -> Vec<([f64; 2], [f64; 2])> { @@ -1441,6 +1461,26 @@ mod tests { assert!(out.is_empty(), "Gelände samt Höhenlinien und Pick-Fläche ausgeblendet"); } + /// [256] Nachbargebäude auf einer Klasse mit Füllung (hellgrau): die Höhenlinien enden an ihnen; ohne Füllung + /// (Umriss) laufen sie weiter. + #[test] + fn hoehenlinien_enden_am_gefuellten_nachbarn() { + let t = TerrainMesh { id: "t".into(), category_code: "02".into(), positions: vec![0.0, 0.0, 0.0, 30.0, 0.0, 3.0, 30.0, 10.0, 3.0, 0.0, 10.0, 0.0], indices: vec![0.0, 1.0, 2.0, 0.0, 2.0, 3.0], contour_interval: Some(0.5), ..Default::default() }; + let (positions, indices) = crate::mesh_view::tests::cube(12.0, 18.0, -2.0, 12.0, 0.0, 6.0); + let nb = ContextObject::ImportedMesh(ImportedMesh { id: "n".into(), category_code: "12".into(), positions, indices, ..Default::default() }); + let mut p = Project { context: Some(vec![ContextObject::TerrainMesh(t), nb]), ..Default::default() }; + p.layers = vec![LayerCategory { code: "12".into(), name: "Gebäude".into(), color: "#888888".into(), lw: 0.25, visible: true, fill: Some("#d9d9d9".into()), ..Default::default() }]; + let a = super::super::domains::PlanArgs::parse(1.0, r#"{"show": ["02", "12"], "scale": 100}"#).unwrap(); + let inside = |p: &Project| { + let mut out = Vec::new(); + plan_context(&Ctx::new(p, &a), &mut out); + out.iter().any(|q| matches!(q, Primitive::Line { a, b, color: Some(c), .. } if c == TERRAIN_INK && (a.x - 15.0).abs() < 1e-6 && (a.y + b.y) / 2.0 > 0.0 && (a.y + b.y) / 2.0 < 10.0)) + }; + assert!(!inside(&p), "Höhenlinie im gefüllten Nachbarn"); + p.layers[0].fill = None; + assert!(inside(&p), "ohne Füllung läuft sie durch"); + } + /// [140] Steile Stellen (Stützmauer, Böschung): Höhenlinien enger als 0.6 mm auf dem Papier werden /// ausgedünnt (jede zweite, sonst nur Zähllinien); im flachen Teil bleiben alle. #[test] diff --git a/src-tauri/core/src/plan/mesh_plan.rs b/src-tauri/core/src/plan/mesh_plan.rs index df183423..3007a85a 100644 --- a/src-tauri/core/src/plan/mesh_plan.rs +++ b/src-tauri/core/src/plan/mesh_plan.rs @@ -346,11 +346,15 @@ fn draw_items(c: &Ctx, range: &ViewRange, items: &[Item], out: &mut Vec (f.clone(), h.clone()), - None => (ov.and_then(|o| o.fill.clone()).unwrap_or_else(|| solid_fill.clone()), ov.and_then(|o| o.hatch.clone()).map_or_else(|| solid_hatch.clone(), |h| h.unwrap_or_else(no_hatch))), + // [256] Ohne Bauteil und ohne Füllungs-Regel: Vorgabe-Stil der Klasse (Nachbargebäude hellgrau, grauer Umriss). + let class = comp.is_none().then(|| class_cut_style(c.p, &m.mesh.category_code)).flatten().filter(|_| ov.is_none_or(|o| o.fill.is_none())); + let (fill, hatch) = match (&comp, &class) { + (Some((f, h)), _) => (f.clone(), h.clone()), + (None, Some((f, _, _))) => (f.clone(), ov.and_then(|o| o.hatch.clone()).flatten().unwrap_or_else(no_hatch)), + (None, None) => (ov.and_then(|o| o.fill.clone()).unwrap_or_else(|| solid_fill.clone()), ov.and_then(|o| o.hatch.clone()).map_or_else(|| solid_hatch.clone(), |h| h.unwrap_or_else(no_hatch))), }; - let mut q = super::section::polygon(pts.iter().map(|q| Vec2 { x: q[0], y: q[1] }).collect(), &fill, POCHE_STROKE, WALL_FALLBACK_MM, hatch); + let (stroke, stroke_mm) = class.as_ref().map_or((POCHE_STROKE, WALL_FALLBACK_MM), |(_, k, w)| (k.as_str(), *w)); + let mut q = super::section::polygon(pts.iter().map(|q| Vec2 { x: q[0], y: q[1] }).collect(), &fill, stroke, stroke_mm, hatch); if let Primitive::Polygon { context_object_id, extruded_solid_id, no_stroke_edges, greyed: g, .. } = &mut q { match it.solid { Some(s) => *extruded_solid_id = Some(s.id.clone()), @@ -452,6 +456,25 @@ mod tests { }).sum() } + /// [256] Nachbargebäude auf einer Klasse mit Füllung („12 Gebäude"): im Grundriss hellgrau mit Umriss in Klassenfarbe + /// und -stärke statt schwarz; eine Füllungs-Regel ([33]) geht vor. + #[test] + fn nachbargebaeude_im_grundriss_nach_klassenstil() { + let m = ContextObject::ImportedMesh(ImportedMesh { id: "n".into(), name: "Nachbar".into(), category_code: "12".into(), positions: cube(0.0, 8.0, 0.0, 6.0, 0.0, 7.0).0, indices: cube(0.0, 8.0, 0.0, 6.0, 0.0, 7.0).1, ..Default::default() }); + let mut p = project(vec![m]); + p.layers = vec![LayerCategory { code: "12".into(), name: "Gebäude".into(), color: "#888888".into(), lw: 0.25, visible: true, fill: Some("#d9d9d9".into()), ..Default::default() }]; + let a = PlanArgs::parse(1.0, &serde_json::json!({"floor": "eg", "show": ["12"], "global": true, "scale": 100.0}).to_string()).unwrap(); + let draw = |p: &Project| { + let c = Ctx::new(p, &a); + let mut out = Vec::new(); + plan_meshes(&c, &mut out); + out.into_iter().find_map(|q| match q { Primitive::Polygon { fill, stroke, stroke_width_mm, context_object_id: Some(i), .. } if i == "n" && fill != "none" => Some((fill, stroke, stroke_width_mm)), _ => None }).unwrap() + }; + assert_eq!(draw(&p), ("#d9d9d9".to_string(), "#888888".to_string(), 0.25)); + p.layers[0].fill = None; + assert_eq!(draw(&p).0, HATCH_INK, "ohne Klassen-Füllung schwarz"); + } + #[test] fn stuetze_geschnitten_mit_poche() { let p = project(vec![mesh("s", cube(0.0, 0.3, 0.0, 0.4, 0.0, 2.7))]); diff --git a/src-tauri/core/src/plan/section/mesh_tests.rs b/src-tauri/core/src/plan/section/mesh_tests.rs index 8cc2ec8d..22eafbb1 100644 --- a/src-tauri/core/src/plan/section/mesh_tests.rs +++ b/src-tauri/core/src/plan/section/mesh_tests.rs @@ -192,3 +192,31 @@ fn geschlossenes_gelaende_als_gelaendelinie() { assert_eq!(mesh_cuts(&o).len(), 1); assert!(o.profiles.is_empty()); } + +/// [256] Nachbargebäude (Netz auf „12 Gebäude", Klasse mit Füllung): im Schnitt hellgrau mit Umriss in Klassenfarbe +/// statt schwarz, nicht in der schweren Schnittkante; ohne Füllung der Klasse wie bisher schwarz. Über das Geländeende +/// hinaus nichts (Gelände u 1 … 12): der Nachbar rechts davon entfällt, einer über dem Rand wird beschnitten. +#[test] +fn nachbargebaeude_hellgrau_und_nur_ueber_dem_gelaende() { + let (positions, indices) = cube(-4.0, 7.0, -3.0, 3.0, -1.0, 0.0); + let terrain = ContextObject::TerrainMesh(TerrainMesh { id: "g".into(), name: "Site".into(), category_code: "02".into(), positions, indices, ..Default::default() }); + let nb = |id: &str, x0: f64, x1: f64| ContextObject::ImportedMesh(ImportedMesh { id: id.into(), name: id.into(), category_code: "12".into(), positions: cube(x0, x1, -1.0, 2.0, 0.0, 6.0).0, indices: cube(x0, x1, -1.0, 2.0, 0.0, 6.0).1, ..Default::default() }); + let mut p = with(vec![terrain, nb("innen", 0.0, 2.0), nb("rand", 6.0, 9.0), nb("weg", 10.0, 12.0)]); + p.layers = vec![LayerCategory { code: "12".into(), name: "Gebäude".into(), color: "#888888".into(), lw: 0.25, visible: true, fill: Some("#d9d9d9".into()), ..Default::default() }]; + let o = compute_section(&p, &lv(false), &[]).unwrap().unwrap(); + let ids = |o: &Output| mesh_cuts(o).iter().filter_map(|c| c.source_id.clone()).collect::>(); + assert_eq!(ids(&o), ["innen", "rand"], "rechts vom Gelände kein Schnitt"); + let rand = mesh_cuts(&o).into_iter().find(|c| c.source_id.as_deref() == Some("rand")).unwrap(); + assert!((bbox(&rand.pts)[1] - 12.0).abs() < 1e-9, "endet am Geländeende u = 12: {:?}", rand.pts); + assert!(o.visible.iter().chain(&o.hidden).all(|e| e.kind != Kind::Mesh || (e.a[0] <= 12.0 + 1e-9 && e.b[0] <= 12.0 + 1e-9)), "Kanten enden am Gelände"); + let rules = CutRules::of(&p, &o, RuleView::at(100.0, None)); + let (prims, _) = section_primitives_at(&o, true, false, &Visibility::default(), 100.0, Detail::Mittel, false, &rules); + let poly = |id: &str| prims.iter().find_map(|q| match q { Primitive::Polygon { fill, stroke, stroke_width_mm, context_object_id: Some(i), .. } if i == id => Some((fill.clone(), stroke.clone(), *stroke_width_mm)), _ => None }).unwrap(); + assert_eq!(poly("innen"), ("#d9d9d9".to_string(), "#888888".to_string(), 0.25)); + assert!(!prims.iter().any(|q| matches!(q, Primitive::Line { cls, a, .. } if cls == "section-cut-outline" && a.x > 4.9 && a.x < 7.1)), "keine schwere Schnittkante um den Nachbarn"); + // Klasse ohne Füllung: schwarz wie freie Körper. + p.layers[0].fill = None; + let rules = CutRules::of(&p, &o, RuleView::at(100.0, None)); + let (prims, _) = section_primitives_at(&o, true, false, &Visibility::default(), 100.0, Detail::Mittel, false, &rules); + assert!(prims.iter().any(|q| matches!(q, Primitive::Polygon { fill, context_object_id: Some(i), .. } if i == "innen" && fill == HATCH_INK))); +} diff --git a/src-tauri/core/src/plan/section/meshes.rs b/src-tauri/core/src/plan/section/meshes.rs index bdbefd81..0ef49daf 100644 --- a/src-tauri/core/src/plan/section/meshes.rs +++ b/src-tauri/core/src/plan/section/meshes.rs @@ -126,6 +126,57 @@ pub(super) fn append_mesh_sections(cuts: &mut Vec, lines: &mut Vec<(usize, } } +/// [256] Netze auf Umgebungsklassen (Nachbargebäude) nur, wo Gelände ist: Schnittflächen, offene Züge und Kanten +/// enden am Geländeende (u-Bereich der Geländelinie), sonst schweben sie neben dem Gelände. Ohne Geländelinie unverändert. +pub(super) fn clip_context_meshes_to_terrain(out: &mut Output) { + let (lo, hi) = out.profiles.iter().flat_map(|p| p.pts.iter()).fold((f64::INFINITY, f64::NEG_INFINITY), |(lo, hi), q| (lo.min(q[0]), hi.max(q[0]))); + if !(lo.is_finite() && hi.is_finite() && hi > lo) { + return; + } + let ctx: Vec = out.meshes.iter().map(|m| m.category.as_deref().is_some_and(crate::import_context::is_context_class)).collect(); + if !ctx.iter().any(|&c| c) { + return; + } + let is_ctx = |k: Kind, i: usize| k == Kind::Mesh && ctx.get(i).copied().unwrap_or(false); + out.cuts = std::mem::take(&mut out.cuts) + .into_iter() + .filter_map(|mut c| { + if !is_ctx(c.kind, c.index) { + return Some(c); + } + let (pts, nse) = unfold::clip_poly_u(&c.pts, c.nse.as_deref(), lo, hi)?; + (pts.len() >= 3).then(|| { + c.pts = pts; + c.nse = nse; + c + }) + }) + .collect(); + out.mesh_lines = std::mem::take(&mut out.mesh_lines) + .into_iter() + .flat_map(|(k, pts)| if ctx.get(k).copied().unwrap_or(false) { clip_line_to_u(&pts, lo, hi) } else { vec![pts] }.into_iter().map(move |p| (k, p))) + .collect(); + let clip_edges = |v: Vec| -> Vec { + v.into_iter() + .filter_map(|mut e| { + if !is_ctx(e.kind, e.index) { + return Some(e); + } + let (a, b) = if e.a[0] <= e.b[0] { (e.a, e.b) } else { (e.b, e.a) }; + if b[0] < lo || a[0] > hi { + return None; + } + let at = |x: f64| if (b[0] - a[0]).abs() < 1e-12 { a } else { [x, a[1] + (b[1] - a[1]) * (x - a[0]) / (b[0] - a[0])] }; + e.a = if a[0] < lo { at(lo) } else { a }; + e.b = if b[0] > hi { at(hi) } else { b }; + Some(e) + }) + .collect() + }; + out.visible = clip_edges(std::mem::take(&mut out.visible)); + out.hidden = clip_edges(std::mem::take(&mut out.hidden)); +} + /// [152] Oberkante eines Rings (u rechts, Höhe oben): Kanten, über denen aussen liegt — gegen den Uhrzeigersinn die /// nach links laufenden —, zu Zügen verkettet (von links nach rechts). fn upper_edge(ring: &[[f64; 2]]) -> Vec> { diff --git a/src-tauri/core/src/plan/section/mod.rs b/src-tauri/core/src/plan/section/mod.rs index 34c72921..15856063 100644 --- a/src-tauri/core/src/plan/section/mod.rs +++ b/src-tauri/core/src/plan/section/mod.rs @@ -290,6 +290,9 @@ pub struct CutRules { pub terrain_hatch: Option, /// [152] Linien-Aktionen (Farbe, Stärke, Linienstil) je importiertem Netz (`Output::meshes`-Index). pub mesh: HashMap, + /// [256] Vorgabe-Stil der Klasse je importiertem Netz (`Output::meshes`-Index): Füllung, Umrissfarbe, -stärke + /// (`style::class_cut_style`, z. B. Nachbargebäude hellgrau statt schwarz). + pub class: HashMap, } impl CutRules { @@ -313,7 +316,8 @@ impl CutRules { } mesh = rules.into_iter().enumerate().filter_map(|(i, r)| r.filter(|r| r.0.any()).map(|r| (i, MeshLineStyle { color: r.0.color.clone(), weight: r.0.lineweight.filter(|w| w.is_finite() && *w >= 0.0), dash: super::overrides::linetype_dash(p, r.0.linetype_id.as_deref()) }))).collect(); } - CutRules { loose: loose_fill_components(p), ov, terrain, terrain_dash, terrain_hatch, mesh } + let class = out.meshes.iter().enumerate().filter_map(|(i, m)| m.category.as_deref().and_then(|k| super::style::class_cut_style(p, k)).map(|s| (i, s))).collect(); + CutRules { loose: loose_fill_components(p), ov, terrain, terrain_dash, terrain_hatch, mesh, class } } } @@ -649,6 +653,7 @@ pub(super) fn compute_plane(p: &Project, level: &LevelSpec, bodies: &[BodyMesh], let meshes = meshes.iter().map(|m| MeshMeta { id: m.mesh.id.clone(), name: m.mesh.name.clone(), category: Some(m.mesh.category_code.clone()) }).collect(); let mut out = Output { cuts, visible, hidden, profiles: Vec::new(), earth: Vec::new(), shoring: Vec::new(), terrain_id: None, meshes, mesh_lines, edge_cats }; append_terrain_profiles(&mut out, p, base, u); + clip_context_meshes_to_terrain(&mut out); if let Some(s) = strip { unfold::clip_output(&mut out, s); } diff --git a/src-tauri/core/src/plan/section/primitives.rs b/src-tauri/core/src/plan/section/primitives.rs index 57272d28..3675ca54 100644 --- a/src-tauri/core/src/plan/section/primitives.rs +++ b/src-tauri/core/src/plan/section/primitives.rs @@ -502,8 +502,12 @@ pub fn section_primitives_mv(out: &Output, mono: bool, hidden_lines: bool, vis: Some(_) => false, None => black && !loose_cut(cp, loose), }; - let black = base_black && !ov.is_some_and(|o| o.styles()); - let (mut fill, mut hatch) = if black { + // [256] Netz auf einer Klasse mit Füllung (Nachbargebäude): Klassen-Stil statt schwarz, eine Füllungs-Regel geht vor. + let class = (cp.kind == Kind::Mesh).then(|| rules.class.get(&cp.index)).flatten().filter(|_| ov.is_none_or(|o| o.fill.is_none())); + let black = base_black && !ov.is_some_and(|o| o.styles()) && class.is_none(); + let (mut fill, mut hatch) = if let Some((f, _, _)) = class { + (f.clone(), no_hatch()) + } else if black { (HATCH_INK.to_string(), no_hatch()) } else if cf == Some(CutFill::Empty) { (HATCH_PAPER.to_string(), no_hatch()) @@ -543,7 +547,11 @@ pub fn section_primitives_mv(out: &Output, mono: bool, hidden_lines: bool, vis: late_joints.push(l); } } - let mut pr = if stroked && dash.is_none() { polygon(pts, &fill, SECTION_INK, SECTION_JOINT_MM, hatch) } else { polygon(pts, &fill, "none", 0.0, hatch) }; + let mut pr = match class { + Some((_, k, w)) if stroked && dash.is_none() => polygon(pts, &fill, k, *w, hatch), + _ if stroked && dash.is_none() => polygon(pts, &fill, SECTION_INK, SECTION_JOINT_MM, hatch), + _ => polygon(pts, &fill, "none", 0.0, hatch), + }; if let Primitive::Polygon { wall_id, ceiling_id, roof_id, stair_id, extruded_solid_id, no_stroke_edges, greyed, context_object_id, .. } = &mut pr { // [152] Importiertes Netz: Pick über die Kontext-Id. *context_object_id = if cp.kind == Kind::Mesh { src.clone() } else { None }; @@ -555,7 +563,10 @@ pub fn section_primitives_mv(out: &Output, mono: bool, hidden_lines: bool, vis: *no_stroke_edges = cp.nse.clone(); *greyed = Some(cp.category.as_deref().is_some_and(|c| vis.greyed(c))); } - cut_rings.push(vec![cp.pts.clone()]); + // [256] Klassen-Stil: eigener Umriss, nicht in der schweren Schnittkante des Gebäudes. + if class.is_none() { + cut_rings.push(vec![cp.pts.clone()]); + } prims.push(pr); } prims.append(&mut late_joints); diff --git a/src-tauri/core/src/plan/stair_symbol.rs b/src-tauri/core/src/plan/stair_symbol.rs index cab0fa51..7c29ef3d 100644 --- a/src-tauri/core/src/plan/stair_symbol.rs +++ b/src-tauri/core/src/plan/stair_symbol.rs @@ -337,6 +337,9 @@ pub struct RunOpts { pub rail_half: f64, /// [G1] Untersicht: ohne Bruchlinie, alles über der Schnitthöhe gestrichelt (Schnitthöhe unter dem Treppenfuss). pub no_break: bool, + /// [256] Meter je Papier-mm (Massstab/1000) für das Zickzack der Bruchlinie (2 mm breit, 1.5 mm hoch); 0 = feste + /// Modellgrösse (≤ 8 × 6 cm), bei 1:100 kaum sichtbar. + pub break_mm: f64, } /// [173] Schnittparameter des Strahls `a + t·d` mit der Geraden durch `c`–`e` (`None` = parallel). @@ -527,8 +530,11 @@ pub fn plan_stair_run(params: &[f64], total_rise: f64, cut_rise: f64, lw_mm: f64 if w > 1e-6 { let c = mul(d, 1.0 / w); let m = mid(b.a, b.b); - let z = 0.08_f64.min(w * 0.15); - let h = 0.06_f64.min(b.depth * 0.8); + let (z, h) = if run.break_mm > 0.0 && run.break_mm.is_finite() { + ((2.0 * run.break_mm).min(w * 0.25), (1.5 * run.break_mm).min(b.depth * 1.6)) + } else { + (0.08_f64.min(w * 0.15), 0.06_f64.min(b.depth * 0.8)) + }; let pts = [b.a, sub(m, mul(c, z)), add(sub(m, mul(c, z / 3.0)), mul(b.up, h)), sub(add(m, mul(c, z / 3.0)), mul(b.up, h)), add(m, mul(c, z)), b.b]; for k in 0..pts.len() - 1 { o.line(CLS_BREAK, pts[k], pts[k + 1], w_outline, false); @@ -816,6 +822,20 @@ mod tests { assert!(all.iter().all(|l| !l.1) && all.iter().all(|l| l.0 != CLS_BREAK)); } + /// [256] Zickzack der Bruchlinie in Papiergrösse (`RunOpts::break_mm`): bei 1:100 gut 1 mm hoch, sonst liest sich die + /// Bruchlinie quer über den Lauf wie eine weitere Trittkante; ohne Massstab wie bisher (≤ 6 cm). + #[test] + fn bruchlinie_zickzack_in_papiergroesse() { + let x_break = 5.5 * 3.0 / 16.0; + let height = |run: &RunOpts| { + let b = plan_stair_run(&straight(), 2.8, 1.0, 0.25, false, 0.0, 3, false, &[], run); + lines_w(&b).into_iter().filter(|l| l.0 == CLS_BREAK).flat_map(|l| [l.2[0], l.3[0]]).map(|x| (x - x_break).abs()).fold(0.0, f64::max) + }; + assert!(height(&RunOpts::default()) <= 0.06 + 1e-9); + let h = height(&RunOpts { break_mm: 0.1, ..Default::default() }); + assert!(h >= 0.1 - 1e-9, "1:100: Zickzack {h} m"); + } + /// [155] Podest über der Schnitthöhe als erstes Element: Bruchlinie auf dem Podest, Lauf 1 ganz ausgezogen. #[test] fn bruch_auf_dem_podest() { @@ -988,7 +1008,7 @@ mod tests { assert!(l(&g.run_line) >= l(&raw.run_line) - 1e-9, "{name}: nicht kürzer als vorher"); assert!(len(sub(g.arrow.head.1, g.run_line[n - 1])) < 1e-9, "{name}: Pfeil am Ende"); let mut h = stair_geometry(&sp, 2.8); - run_line_to_edges(&mut h, spiral, &RunOpts { start: 0.1, end: 0.2, start_mark: None, rail_half: 0.0, no_break: false }); + run_line_to_edges(&mut h, spiral, &RunOpts { start: 0.1, end: 0.2, start_mark: None, rail_half: 0.0, no_break: false, break_mm: 0.0 }); assert!((l(&g.run_line) - l(&h.run_line) - 0.3).abs() < 1e-6, "{name}: Versatz 0.1 + 0.2"); assert!(len(sub(h.arrow.head.1, h.run_line[h.run_line.len() - 1])) < 1e-9); } diff --git a/src-tauri/core/src/plan/stairs.rs b/src-tauri/core/src/plan/stairs.rs index 08da653d..f1af9ad7 100644 --- a/src-tauri/core/src/plan/stairs.rs +++ b/src-tauri/core/src/plan/stairs.rs @@ -255,7 +255,7 @@ fn step_numbers(out: &mut Vec, geo: &kernel2d::StairGeometry, cut_hei /// (Halbmesser 0.75 mm Papier, nur mit Lauflinie). fn run_opts(o: &super::model_view::StairOpts, scale: f64, s: &Stair) -> crate::plan::stair_symbol::RunOpts { let m = |mm: f64| if scale.is_finite() && scale > 0.0 { mm * scale / 1000.0 } else { 0.0 }; - crate::plan::stair_symbol::RunOpts { start: m(o.run_start_mm), end: m(o.run_end_mm), start_mark: (o.start_mark && o.walk_line).then(|| m(0.75)).filter(|r| *r > 0.0), rail_half: rail_half(s), no_break: false } + crate::plan::stair_symbol::RunOpts { start: m(o.run_start_mm), end: m(o.run_end_mm), start_mark: (o.start_mark && o.walk_line).then(|| m(0.75)).filter(|r| *r > 0.0), rail_half: rail_half(s), no_break: false, break_mm: m(1.0) } } /// [T3] Halbe Handlaufbreite der Treppe (Meter). diff --git a/src-tauri/core/src/plan/style.rs b/src-tauri/core/src/plan/style.rs index 99430887..e6e21d38 100644 --- a/src-tauri/core/src/plan/style.rs +++ b/src-tauri/core/src/plan/style.rs @@ -92,6 +92,15 @@ pub fn solid_cut(detail: Detail, scale: f64, cut_hatch: bool) -> bool { detail == Detail::Grob || (!cut_hatch && detail != Detail::Fein && scale.is_finite() && scale >= SOLID_CUT_FROM) } +/// [256] Vorgabe-Stil der Klasse `code` für geschnittene Netzkörper: (Füllung, Umrissfarbe, Umrissstärke mm), wenn +/// die Klasse eine Füllung trägt (`LayerCategory.fill`, z. B. „12 Gebäude" hellgrau). Regeln ([33]) gehen vor. +pub fn class_cut_style(p: &Project, code: &str) -> Option<(String, String, f64)> { + let k = p.layer_category(code)?; + let fill = k.fill.as_deref().map(str::trim).filter(|f| !f.is_empty())?; + let lw = if k.lw.is_finite() && k.lw >= 0.0 { k.lw } else { 0.13 }; + Some((fill.to_string(), k.color.clone(), lw)) +} + /// [140] Ist eine Schicht der Dicke `thickness_m` (Meter) bei 1:`scale` auf dem Papier dünn /// (unter [`THIN_LAYER_PAPER_MM`])? Nur zusammen mit [`simplify_thin_layers`] verwenden. pub fn is_thin_layer(thickness_m: f64, scale: f64) -> bool { diff --git a/src-tauri/core/src/standards.rs b/src-tauri/core/src/standards.rs index 00b47bc5..ddb88fb5 100644 --- a/src-tauri/core/src/standards.rs +++ b/src-tauri/core/src/standards.rs @@ -271,16 +271,16 @@ pub fn roof_types() -> Vec { /// Alle Standard-Ressourcen je Projekt-Liste, in Abhängigkeitsreihenfolge. /// [66] Ansichtsvorlagen für Pläne „mit einem Klick" (an Geschoss/Schnitt/Ansicht binden oder anwenden): /// Präsentation (Tusche wie alle Pläne [140], Farbe über `mono: false` wählbar; Schatten, ohne Referenz- und -/// Konstruktionslinien), Eingabe 1:100 und Ausführung 1:50 +/// Konstruktionslinien und Kameras), Eingabe 1:100 und Ausführung 1:50 (ohne Sonnenschatten und Kameras, [256]) /// (schwarz-weiss nach SIA 400). pub fn view_templates() -> Vec { vec![ json!({"id": "std-vt-praesentation", "name": "Präsentation", "detail": "mittel", "mono": true, "shadows": true, "hiddenLines": false, - "layerVisibility": {"90": false, "91": false, "99": false}}), + "layerVisibility": {"90": false, "91": false, "92": false, "99": false}}), json!({"id": "std-vt-eingabe-100", "name": "Eingabeplan 1:100", "detail": "mittel", "scaleDenominator": 100, "mono": true, "shadows": false, - "layerVisibility": {"99": false}}), + "layerVisibility": {"08": false, "92": false, "99": false}}), json!({"id": "std-vt-ausfuehrung-50", "name": "Ausführungsplan 1:50", "detail": "fein", "scaleDenominator": 50, "mono": true, "shadows": false, - "scaleLineWeights": true, "layerVisibility": {"99": false}}), + "scaleLineWeights": true, "layerVisibility": {"08": false, "92": false, "99": false}}), // [207] Situationsplan 1:500 für Wettbewerbe: eigenes Gebäude schwarz, Kontext grau (bzw. alles schwarz im Schwarzplan); // ohne Raster, Bauteil-Zeichnungen, Text, Bemassung, Koten und Referenzen. Parzelle, Strassen, Höhenlinien und Bäume bleiben. json!({"id": "std-vt-situation-wbw", "name": "Situation WBW 1:500", "detail": "grob", "scaleDenominator": 500, "mono": true, "shadows": false, @@ -291,8 +291,8 @@ pub fn view_templates() -> Vec { } /// [207] Klassen, die der Situationsplan ausblendet: Raster, Wände (samt Türen/Fenster, Möbel, Stützen), Decken, Dächer, -/// Träger, Treppen, Baugrube, Text, Räume, Bemassung, Auto-Bemassung, Höhenkoten, Details, Referenzen, Schnittmarken, Konstruktion. -const SITUATION_HIDDEN: [&str; 18] = ["00", "07", "20", "21", "22", "25", "30", "35", "40", "50", "60", "80", "81", "82", "85", "90", "91", "99"]; +/// Träger, Treppen, Baugrube, Text, Räume, Bemassung, Auto-Bemassung, Höhenkoten, Details, Referenzen, Schnittmarken, Kameras ([256]), Konstruktion. +const SITUATION_HIDDEN: [&str; 19] = ["00", "07", "20", "21", "22", "25", "30", "35", "40", "50", "60", "80", "81", "82", "85", "90", "91", "92", "99"]; /// [173] Stufen der Modelldarstellung als Vorlagen (≙ Archicad „Modelldarstellung"): Wettbewerb 1:200 (Wände als /// Fläche, Räume mit Name und Fläche ohne Nummer, nur das Gesamtmass, ohne Koten), Baueingabe 1:100 (SIA-Kategorie, @@ -811,6 +811,19 @@ mod tests { use super::*; use crate::model::Project; + /// [256] Abgabe-Vorlagen ohne Kamera-Sichtkegel (Klasse 92); Sonnenschatten (Klasse 08) nur in der Präsentation — + /// Eingabe- und Ausführungsplan blenden ihn aus, Situation/Schwarzplan zeichnen ohnehin keinen. + #[test] + fn abgabe_vorlagen_ohne_kameras_schatten_nur_praesentation() { + let vt = view_templates(); + let hidden = |id: &str, code: &str| vt.iter().find(|t| t["id"] == id).unwrap()["layerVisibility"][code] == json!(false); + for id in ["std-vt-praesentation", "std-vt-eingabe-100", "std-vt-ausfuehrung-50", "std-vt-situation-wbw", "std-vt-schwarzplan"] { + assert!(hidden(id, CAMERA_CATEGORY), "{id}: Kameras aus"); + } + assert!(!hidden("std-vt-praesentation", SHADOW_CATEGORY), "Präsentation mit Schatten"); + assert!(hidden("std-vt-eingabe-100", SHADOW_CATEGORY) && hidden("std-vt-ausfuehrung-50", SHADOW_CATEGORY)); + } + fn empty_root() -> Map { json!({"id": "p", "name": "P", "lineStyles": [], "hatches": [], "components": [], "wallTypes": [], "drawingLevels": [], "walls": [], "openings": []}) diff --git a/src/cli/__golden__/grundriss-eg.svg b/src/cli/__golden__/grundriss-eg.svg index d4c2854c..ca33f242 100644 --- a/src/cli/__golden__/grundriss-eg.svg +++ b/src/cli/__golden__/grundriss-eg.svg @@ -32,7 +32,7 @@ - + diff --git a/src/model/contextCategories.test.ts b/src/model/contextCategories.test.ts index 608f7b1c..441f0205 100644 --- a/src/model/contextCategories.test.ts +++ b/src/model/contextCategories.test.ts @@ -111,7 +111,7 @@ describe("ensureContextCategories", () => { it("Tabelle im Kern = Definitionen hier (alle Codes)", () => { const nested = [TERRAIN_CATEGORY, IMAGE_CATEGORY, GENERIC_IMPORT_CATEGORY, ...Object.values(GEO_CATEGORY_DEFS)]; - const cat = (c: { code: string; name: string; color: string; lw: number }) => ({ code: c.code, name: c.name, color: c.color, lw: c.lw, visible: true, locked: false }); + const cat = (c: { code: string; name: string; color: string; lw: number; fill?: string }) => ({ code: c.code, name: c.name, color: c.color, lw: c.lw, visible: true, locked: false, ...(c.fill ? { fill: c.fill } : {}) }); const out = ensureContextCategories([], [...nested.map((c) => c.code), IMPORTED_ROOF_CATEGORY.code]); expect(out).toEqual([{ ...cat(CONTEXT_PARENT_CATEGORY), children: nested.map(cat) }, cat(IMPORTED_ROOF_CATEGORY)]); }); diff --git a/src/model/contextCategories.ts b/src/model/contextCategories.ts index e3d2f4e7..fd0d455b 100644 --- a/src/model/contextCategories.ts +++ b/src/model/contextCategories.ts @@ -32,6 +32,8 @@ export interface ContextCategoryDef { name: string; color: string; lw: number; + /** [256] Vorgabe-Füllung der Klasse (geschnittene Netze, z. B. Nachbargebäude hellgrau). */ + fill?: string; } /** @@ -105,7 +107,7 @@ export const IMPORTED_ROOF_CATEGORY: ContextCategoryDef = { * als auch die echten swissBUILDINGS3D-Meshes ab (`building`). */ export const GEO_CATEGORY_DEFS: Record = { - building: { code: "12", name: "Gebäude", color: "#888888", lw: 0.25 }, + building: { code: "12", name: "Gebäude", color: "#888888", lw: 0.25, fill: "#d9d9d9" }, road: { code: "11", name: "Strasse", color: "#808080", lw: 0.18 }, forest: { code: "04", name: "Wald", color: "#909090", lw: 0.13 }, parking: { code: "15", name: "Parkplätze", color: "#a0a0a0", lw: 0.13 }, diff --git a/src/model/sampleProject.ts b/src/model/sampleProject.ts index 1a6d92b0..a1ec0dcc 100644 --- a/src/model/sampleProject.ts +++ b/src/model/sampleProject.ts @@ -386,7 +386,7 @@ export const sampleProject: Project = { children: [ { code: "10", name: "Situation", color: "#909090", lw: 0.18, visible: true, locked: false }, { code: "11", name: "Strasse", color: "#808080", lw: 0.18, visible: true, locked: false }, - { code: "12", name: "Gebäude", color: "#888888", lw: 0.18, visible: true, locked: false }, + { code: "12", name: "Gebäude", color: "#888888", lw: 0.18, fill: "#d9d9d9", visible: true, locked: false }, { code: "13", name: "Bäume", color: "#808080", lw: 0.13, visible: true, locked: false }, { code: "14", name: "Höhenlinien", color: "#808080", lw: 0.18, visible: true, locked: false }, ], diff --git a/src/model/sampleProjectComplex.test.ts b/src/model/sampleProjectComplex.test.ts index d91bada3..cc6fca91 100644 --- a/src/model/sampleProjectComplex.test.ts +++ b/src/model/sampleProjectComplex.test.ts @@ -74,6 +74,21 @@ describe("Musterhaus komplex", () => { } }); + it("[256] EG 1:100: Geländekote und Revisionstext stehen nicht auf Masszahlen", () => { + const plan = generatePlan(p, "eg", codes, undefined, "mittel", false, false, true, 100); + const texts = plan.primitives.flatMap((q) => (q.kind === "drawingText" ? [q] : [])); + // Grosszügige Box (Anker unbekannt: links, Mitte oder rechts) um den Text. + const box = (t: (typeof texts)[number]) => { + const w = 0.6 * t.heightM * t.text.length; + return [t.at.x - w, t.at.y - t.heightM, t.at.x + w, t.at.y + t.heightM]; + }; + const hit = (a: number[], b: number[]) => a[0] < b[2] && b[0] < a[2] && a[1] < b[3] && b[1] < a[3]; + const dims = texts.filter((t) => /^\d+\.\d\d$/.test(t.text)).map(box); + const labels = texts.filter((t) => t.text.includes("Pfosten-Riegel") || /^[-+]\d+\.\d\d$/.test(t.text)); + expect(labels.length).toBeGreaterThanOrEqual(2); + for (const t of labels) expect(dims.some((d) => hit(box(t), d)), t.text).toBe(false); + }); + it("Schnitte und Ansichten rechnen", async () => { for (const l of p.drawingLevels.filter((x) => x.kind === "section")) { const o = await computeSection(p, l); diff --git a/src/model/sampleProjectComplex.ts b/src/model/sampleProjectComplex.ts index 1954c69a..23902b04 100644 --- a/src/model/sampleProjectComplex.ts +++ b/src/model/sampleProjectComplex.ts @@ -609,7 +609,8 @@ function annotations(): Drawing2D[] { // Höhenkoten (absolut, wie die Koten in Schnitt/Ansicht). add("kote-eg", "eg", "80", { shape: "kote", at: P(3, 2.5), value: Z.eg, kind: "okFertig", rotation: 0 }); - add("kote-eg-terrain", "eg", "80", { shape: "kote", at: P(8.5, -3), value: r3(terrainZ(8.5, -1)), kind: "okFertig", rotation: 0 }); + // [256] Geländekote unter den Massketten und Achsblasen (vorher auf der Gesamtmasszahl „17.39“). + add("kote-eg-terrain", "eg", "80", { shape: "kote", at: P(12.5, -5.6), value: r3(terrainZ(12.5, -5.6)), kind: "okFertig", rotation: 0 }); add("kote-ug", "ug", "80", { shape: "kote", at: P(3, 2.5), value: Z.ug, kind: "okFertig", rotation: 0 }); add("kote-og", "og", "80", { shape: "kote", at: P(3, 2.5), value: Z.og, kind: "okFertig", rotation: 0 }); add("kote-dg", "dg", "80", { shape: "kote", at: P(3, 3.5), value: Z.dg, kind: "okFertig", rotation: 0 }); @@ -629,7 +630,8 @@ function annotations(): Drawing2D[] { // Revisionswolke (Bögen nach aussen: negativer Bulge bei Gegenuhrzeigersinn). const cloud = [...arcPts(P(12.6, 0), 1.9, -Math.PI, Math.PI, 18).slice(0, 18)].map((q) => P(q.x, r3(q.y * 0.6))); add("revision-a", "eg", "90", { shape: "polyline", closed: true, pts: cloud, bulge: cloud.map(() => -0.45) }, { color: "#c0392b", weightMm: 0.35 }); - add("revision-a-text", "eg", "90", { shape: "text", at: P(14.6, -1.4), text: "△A Pfosten-Riegel statt Fenstertür", height: 0.22, angle: 0 }, { color: "#c0392b" }); + // [256] Revisionstext neben dem Hinweis unter den Massketten (vorher auf den Masszahlen der zweiten Kette). + add("revision-a-text", "eg", "90", { shape: "text", at: P(11.5, -4.5), text: "△A Pfosten-Riegel statt Fenstertür", height: 0.22, angle: 0 }, { color: "#c0392b" }); // [157] Nordpfeil am Ostrand der Parzelle zwischen den Bäumen (vorher auf „Kat.-Nr. 2417“ und der Ansichtslinie Ost). add("nordpfeil", "eg", "50", { shape: "block", blockDefId: "blk-nord", at: P(26.8, 2.5), rotation: 0, scale: 1.2 }); @@ -722,12 +724,14 @@ const NO_NEIGHBOURS = vis(["12"]); /** [207] Klassen, die ein Kataster-Import anlegt (Gewässer „17"): im Ausschnitt eingeblendet, auch wenn es sie im Beispiel noch nicht gibt (fehlender Code = aus). */ const KATASTER_VISIBLE: Record = { "17": true }; /** [207] Klassen, die die Ansichtsvorlage „Situation WBW" ausblendet (`standards.rs::SITUATION_HIDDEN`; Test `sampleProjectComplex.situation.test.ts`). */ -const SITUATION_HIDDEN = ["00", "07", "20", "21", "22", "25", "30", "35", "40", "50", "60", "80", "81", "82", "85", "90", "91", "99"]; +const SITUATION_HIDDEN = ["00", "07", "20", "21", "22", "25", "30", "35", "40", "50", "60", "80", "81", "82", "85", "90", "91", "92", "99"]; const LEVEL_VIS: Record = Object.fromEntries(LEVELS.map((l) => [l.id, true])); /** Grundrisse auf Blättern: ohne Kataster, Strasse, Höhenlinien und Gelände. */ const PLAN_VIS = vis(["01", "02", "10", "11", "13", "14"]); /** Kontext (Gelände, Baugrube, Höhenlinien, Kataster, Raster) aus — für das Detail. */ const HIDE_SITE = vis(["00", "01", "02", "07", "10", "11", "13", "14"]); +/** [256] Vorlagen der Arbeits-/Abgabepläne: Sonnenschatten (08) und Kameras (92) aus. */ +const NO_SUN_CAMERA: Record = { "08": false, "92": false }; /** Bildschirm-px je Meter, bei denen die Ansicht genau im Papier-Massstab 1:`scale` steht (96 dpi, wie `geometry.ts::dpi`). */ const pxPerMeterAt = (scale: number) => Math.round((96 / 25.4) * 1000 / scale * 100) / 100; const snap = (id: string, name: string, level: string, scale: number, center: Vec2, extra: Partial[number]> = {}) => ({ @@ -741,13 +745,14 @@ function views(): Pick ls.flatMap((l) => [l.code, ...codesOf(l.children ?? [])]); const visHidden = (hidden: string[]): Record => Object.fromEntries(codesOf(sampleProject.layers).map((c) => [c, !hidden.includes(c)])); /** Klassen, die die Situation ausblendet (wie `standards.rs::SITUATION_HIDDEN`). */ -const SITUATION_HIDDEN = ["00", "07", "20", "21", "22", "25", "30", "35", "40", "50", "60", "80", "81", "82", "85", "90", "91", "99"]; +const SITUATION_HIDDEN = ["00", "07", "20", "21", "22", "25", "30", "35", "40", "50", "60", "80", "81", "82", "85", "90", "91", "92", "99"]; const LEVEL_VIS: Record = Object.fromEntries(LEVELS.map((l) => [l.id, true])); const pxPerMeterAt = (scale: number) => Math.round(((96 / 25.4) * 1000) / scale * 100) / 100; diff --git a/src/model/types.generated.ts b/src/model/types.generated.ts index 6240a45d..91d753c9 100644 --- a/src/model/types.generated.ts +++ b/src/model/types.generated.ts @@ -1814,6 +1814,12 @@ export type LayerCategory = { locked: boolean; /** Optionale Standard-Schraffur der Kategorie. */ hatch?: string; + /** + * [256] Füllfarbe der Klasse (hex) für geschnittene Netzkörper ohne eigene Regel (Grundriss und Schnitt), + * mit Umriss in Klassenfarbe und -stärke — z. B. Nachbargebäude „12 Gebäude" hellgrau statt schwarz. + * Fehlt sie, gilt die Körper-Konvention (ab 1:100 schwarz). Situation/Schwarzplan färben selbst ([207]). + */ + fill?: string; /** Unterkategorien (Baum). */ children?: Array; }; diff --git a/src/plan/__golden__/komplex-grundriss-eg-100.txt b/src/plan/__golden__/komplex-grundriss-eg-100.txt index 3c06ecd8..26e79ab9 100644 --- a/src/plan/__golden__/komplex-grundriss-eg-100.txt +++ b/src/plan/__golden__/komplex-grundriss-eg-100.txt @@ -1,5 +1,5 @@ viewBox -41.5 0 95 63.6 -bytes 68381 +bytes 68384 circle 16 g 1 line 141 @@ -10,4 +10,4 @@ rect 1 svg 1 text 116 tspan 25 -hash 680e9c7d98703234 +hash 73ca22505d4b088b diff --git a/src/plan/__golden__/komplex-grundriss-eg-50.txt b/src/plan/__golden__/komplex-grundriss-eg-50.txt index d1d0d354..7ac5757e 100644 --- a/src/plan/__golden__/komplex-grundriss-eg-50.txt +++ b/src/plan/__golden__/komplex-grundriss-eg-50.txt @@ -1,5 +1,5 @@ viewBox -41.5 0 95 63.6 -bytes 110542 +bytes 110549 circle 16 g 1 line 365 @@ -10,4 +10,4 @@ rect 1 svg 1 text 116 tspan 25 -hash 7648bcf107ccdde3 +hash 757bff4a0a52194b diff --git a/src/plan/__golden__/komplex-grundriss-og-100.txt b/src/plan/__golden__/komplex-grundriss-og-100.txt index 90a6ba78..3c92762f 100644 --- a/src/plan/__golden__/komplex-grundriss-og-100.txt +++ b/src/plan/__golden__/komplex-grundriss-og-100.txt @@ -10,4 +10,4 @@ rect 1 svg 1 text 87 tspan 19 -hash 627997a99a81b806 +hash c7704fd40741d5cc diff --git a/src/plan/__golden__/komplex-grundriss-og-50.txt b/src/plan/__golden__/komplex-grundriss-og-50.txt index 5546cbb5..de63e88f 100644 --- a/src/plan/__golden__/komplex-grundriss-og-50.txt +++ b/src/plan/__golden__/komplex-grundriss-og-50.txt @@ -10,4 +10,4 @@ rect 1 svg 1 text 86 tspan 18 -hash a90f35ea4563ac99 +hash 7003cc6954740f63 diff --git a/src/plan/__golden__/komplex-grundriss-ug-100.txt b/src/plan/__golden__/komplex-grundriss-ug-100.txt index 03548f7b..73e9a5dd 100644 --- a/src/plan/__golden__/komplex-grundriss-ug-100.txt +++ b/src/plan/__golden__/komplex-grundriss-ug-100.txt @@ -10,4 +10,4 @@ rect 1 svg 1 text 71 tspan 15 -hash f4ea57ac9b383644 +hash 140af5eec3465b69 diff --git a/src/plan/__golden__/komplex-grundriss-ug-50.txt b/src/plan/__golden__/komplex-grundriss-ug-50.txt index 46950cd1..ea9d522d 100644 --- a/src/plan/__golden__/komplex-grundriss-ug-50.txt +++ b/src/plan/__golden__/komplex-grundriss-ug-50.txt @@ -1,5 +1,5 @@ viewBox -13.693 0 38.527 33.406 -bytes 48749 +bytes 48751 circle 16 g 1 line 94 @@ -10,4 +10,4 @@ rect 1 svg 1 text 71 tspan 15 -hash 77b2b13a58b74fb9 +hash 4aa844c87458df0d diff --git a/src/plan/__golden__/komplex-schwarzplan-500.txt b/src/plan/__golden__/komplex-schwarzplan-500.txt index 7161154e..2d609235 100644 --- a/src/plan/__golden__/komplex-schwarzplan-500.txt +++ b/src/plan/__golden__/komplex-schwarzplan-500.txt @@ -1,12 +1,11 @@ viewBox -41.5 0 95 63.6 -bytes 5218 +bytes 3579 g 1 -line 7 +line 3 path 1 -polygon 18 -polyline 3 +polygon 10 +polyline 2 rect 1 svg 1 -text 9 -tspan 1 -hash 3d1684b3659e8901 +text 8 +hash c546873f54a3e7ff diff --git a/src/plan/__golden__/komplex-situation-500.txt b/src/plan/__golden__/komplex-situation-500.txt index 7161154e..2d609235 100644 --- a/src/plan/__golden__/komplex-situation-500.txt +++ b/src/plan/__golden__/komplex-situation-500.txt @@ -1,12 +1,11 @@ viewBox -41.5 0 95 63.6 -bytes 5218 +bytes 3579 g 1 -line 7 +line 3 path 1 -polygon 18 -polyline 3 +polygon 10 +polyline 2 rect 1 svg 1 -text 9 -tspan 1 -hash 3d1684b3659e8901 +text 8 +hash c546873f54a3e7ff diff --git a/src/plan/__golden__/muster-grundriss-eg-100.txt b/src/plan/__golden__/muster-grundriss-eg-100.txt index 858803dd..797fd8a5 100644 --- a/src/plan/__golden__/muster-grundriss-eg-100.txt +++ b/src/plan/__golden__/muster-grundriss-eg-100.txt @@ -1,5 +1,5 @@ viewBox -1.621 0 8.242 7.535 -bytes 5719 +bytes 5717 g 1 line 17 polygon 19 @@ -8,4 +8,4 @@ rect 1 svg 1 text 5 tspan 2 -hash 5c5454d2e7f9a18c +hash a49bed6c6d82f6b1 diff --git a/src/plan/__golden__/muster-grundriss-eg-50.txt b/src/plan/__golden__/muster-grundriss-eg-50.txt index 40057f23..d7eda1ca 100644 --- a/src/plan/__golden__/muster-grundriss-eg-50.txt +++ b/src/plan/__golden__/muster-grundriss-eg-50.txt @@ -1,5 +1,5 @@ viewBox -1.56 0 8.121 7.354 -bytes 9304 +bytes 9302 g 1 line 18 polygon 49 @@ -8,4 +8,4 @@ rect 1 svg 1 text 5 tspan 2 -hash 545b18572ba9c27a +hash 571259b69c30c68a