diff --git a/TODO.md b/TODO.md index 59b8b7f0..9abbe647 100644 --- a/TODO.md +++ b/TODO.md @@ -2696,6 +2696,29 @@ Format · [90] Versionsvergleich · [91] Assistent · [92] Speckle. - ✅ **[139] Kleine Fehler aus der Doku.** (5.11.) Beim Schreiben der Doku gefunden: (1) Befehl `wand` startete den Zauberstab statt der Wand; der Zauberstab heisst jetzt `zauberstab` (Kürzel `zs`), `wand` = Wand, Kern-Befehl `wand` unverändert. (2) Cmd/Strg+S war doppelt belegt: jetzt Speichern (bekannter Pfad ohne Dialog, sonst Dialog), Cmd/Strg+Shift+S = Speichern unter, Teilen auf Cmd/Strg+Shift+J. (3) `schedule --openings --format svg`: Zellen werden in der Blattaufteilung (`area_report.rs`, gilt auch für PDF) auf Spaltenbreite umbrochen statt zu überlappen, Spaltenbreiten der Liste angepasst. Offen: Speichern/Speichern unter nur per vitest geprüft, nicht in der Tauri-App. +- ◐ **[140] Plandarstellung überarbeitet.** (5.11., Wunsch Maintainer: „Plandarstellung schöner, Strichstärken + richtig") Befund am Musterhaus komplex (CLI-SVG in Papiergrösse, 1:50/100/200/500, Schnitt, Ansicht, Deckenspiegel): + Tür-/Fenstersymbole und Schichtfugen als Haarlinie 0.02 (im Druck fast weg), Wand-Schnittkante 0.35 = so stark wie + Zähl-Höhenlinien (0.25) und Schnitt-Schichten (jede Schicht 0.35 umrandet), Detail „fein" machte die Schnittkante + dünner (×0.6), Massstab-Faktor (100/n)^0.25 zu flach (1:50 nur ×1.19) und für alle Stärken gleich, Masszahlen 4 mm + (grösser als Raumstempel), Höhenlinien quer durch die Räume, Ansicht ohne Silhouette (alles 0.13), Override + „Brandschutztüren rot" färbte im Beispiel alle Türen. Geändert: [32] Faktor (100/n)^0.5 (0.4–2), wirkt nur über dem + Sockel 0.09 (`extras::scale_weight`: w' = 0.09 + (w − 0.09)·f) → Schnittkante 0.5 → 0.67 (1:50) / 0.38 (1:200), + Schraffur/Bemassung bleiben ≈ 0.1–0.15, Rangfolge in jedem Massstab erhalten; Symbole Türen/Fenster 0.13 + (`SYMBOL_LINE_MM`), Schichtfugen 0.09 (`LAYER_JOINT_MM`), Detail fein ×1.0 / grob ×1.2; Schnitt: Schichten fein + (0.13), Umriss der vereinigten Schnittflächen 0.5 (`section-cut-outline`); Ansicht: Silhouette (Aussenrand aller + Bauteilflächen) 0.35, Details 0.13, Grundlinie 0.5; Höhenlinien enden an der Gebäudegrundfläche + (`site_rules::building_footprint`), Zähllinie 0.18 statt 0.25; Bemassung 2.5 mm Text / 2 mm Strich (Kern, DXF, + Griffe, `DIM_DEFAULTS_MM`); Raumstempel ab 1:200 7 pt statt 10 pt, Standardstempel ohne SIA-Zeile. Standard-Ebenen (neue Projekte): Wände 0.5 statt 0.35, Treppen 0.25 statt 0.35, + `scaleLineWeights` an. Bestehende Projekte behalten ihre Ebenen-/Element-Stärken; neu wirken nur Ableitung, Faktor + und Fallbacks (ohne eigene Werte). Tests: `strichstaerken_rangfolge_je_massstab`, `schnittkante_schwer_fugen_fein`, + `silhouette_mittel_details_fein`, `hoehenlinien_enden_am_gebaeude`, `raumstempel_je_massstab`. Goldens neu (Strichstärken, Masszahlgrösse, + Höhenlinien). Offen: dünne Schichten (Putz, Parkett) laufen in 1:100 zu einem Balken zusammen (Detailgrad sollte + sie zusammenfassen); Achsen laufen in Ansicht/Grundriss durch das Gebäude; Raumstempel farbig statt schwarz im + Druck ohne Schwarz-Weiss; Schatten im EG-Grundriss überdeckt Bemassung; eigene Stempel (`Room.stamp`) behalten in + 1:200 alle Zeilen; ein Geschoss in 1:500 braucht Detail „grob" (sonst Stempel/Masse übereinander — die CLI rechnet + immer „mittel"); gestapelte Höhenlinien an Stützmauer/Baugrube wirken als brauner Balken. Nur Linux/CLI-SVG + Chromium geprüft, + nicht in der Tauri-App (Bildschirm-Modus nicht angesehen). · M - ◐ **[68] Baugrube / Geländebearbeitung.** (30.10.) Kontext-Objekt `excavation` (Rust-Modell, `ContextObject`): Sohle (`outline`, `bottom` m ±0.00), Böschung `slope` (Standard 45°, je Kante `edgeSlopes`), Schüttung `fillSlope` (33.7°), Bermen `bermWidth`/`bermHeight`. Neues Gelände = clamp(t, b − d·tan β, b + H(d)) mit d = Abstand zum diff --git a/src-tauri/core/src/grips.rs b/src-tauri/core/src/grips.rs index 4beda84a..99db0a21 100644 --- a/src-tauri/core/src/grips.rs +++ b/src-tauri/core/src/grips.rs @@ -419,7 +419,7 @@ fn model_to_mm(m: f64, scale: f64) -> f64 { } /// Standard-Schrifthöhe der Masszahl (Papier-mm, `DIM_DEFAULTS_MM.textHeight`). -const DIM_TEXT_HEIGHT_MM: f64 = 4.0; +const DIM_TEXT_HEIGHT_MM: f64 = 2.5; /// `dimTextFrame` der TS-Fassade: bei nicht endlichen Eingaben alles NaN. fn dim_frame(a: (f64, f64), b: (f64, f64), offset: f64, h: f64) -> ((f64, f64), (f64, f64), (f64, f64)) { diff --git a/src-tauri/core/src/plan/context.rs b/src-tauri/core/src/plan/context.rs index a81318ac..0464696b 100644 --- a/src-tauri/core/src/plan/context.rs +++ b/src-tauri/core/src/plan/context.rs @@ -62,6 +62,9 @@ pub fn plan_context(c: &Ctx, out: &mut Vec) { // [137] Pick-Flächen der Baugruben zuletzt (zuoberst): sie liegen im Rahmen des Geländes, das sonst // jeden Klick in der Grube fängt. let mut late: Vec = Vec::new(); + // [140] Höhenlinien enden an der Gebäudegrundfläche (statt quer durch die Räume zu laufen). + let mut house_cache: Option>> = None; + let mut house = || -> Vec> { house_cache.get_or_insert_with(|| building_rings(c.p)).clone() }; for obj in c.p.context.as_deref().unwrap_or(&[]) { let code = match obj { ContextObject::ImportedMesh(m) => m.category_code.as_deref(), @@ -90,8 +93,11 @@ pub fn plan_context(c: &Ctx, out: &mut Vec) { continue; } let seg_end = if k.closed { pts.len() } else { pts.len() - 1 }; + let rings = house(); for i in 0..seg_end { - out.push(context_line(pts[i], pts[(i + 1) % pts.len()])); + for (a, b) in outside(pts[i], pts[(i + 1) % pts.len()], &rings) { + out.push(context_line(a, b)); + } } } } @@ -112,7 +118,7 @@ pub fn plan_context(c: &Ctx, out: &mut Vec) { } out.push(pick_band(q, Some(&t.id), None)); } - terrain_contours(c, t, out); + terrain_contours(c, t, out, &house()); } ContextObject::Excavation(e) => excavation_lines(c, e, out, &mut late), ContextObject::Image(_) => {} @@ -122,6 +128,58 @@ pub fn plan_context(c: &Ctx, out: &mut Vec) { } const TERRAIN_INK: &str = "#7a5b3a"; + +/// [140] Aussenringe der Gebäudegrundfläche (Wände und Körper aller Geschosse vereinigt, ohne Innenhöfe/Räume). +fn building_rings(p: &Project) -> Vec> { + crate::site_rules::building_footprint(p).into_iter().filter_map(|poly| poly.into_iter().next()).filter(|r| r.len() >= 3).collect() +} + +fn inside(q: Vec2, ring: &[Vec2]) -> bool { + let mut c = false; + let n = ring.len(); + for i in 0..n { + let (a, b) = (ring[i], ring[(i + n - 1) % n]); + if (a.y > q.y) != (b.y > q.y) && q.x < (b.x - a.x) * (q.y - a.y) / (b.y - a.y) + a.x { + c = !c; + } + } + c +} + +/// Teile der Strecke a–b ausserhalb aller `rings`. +fn outside(a: Vec2, b: Vec2, rings: &[Vec]) -> Vec<(Vec2, Vec2)> { + let (dx, dy) = (b.x - a.x, b.y - a.y); + let (lo_x, hi_x, lo_y, hi_y) = (a.x.min(b.x), a.x.max(b.x), a.y.min(b.y), a.y.max(b.y)); + let mut ts = vec![0.0, 1.0]; + let mut near = false; + for r in rings { + let n = r.len(); + for i in 0..n { + let (p, q) = (r[i], r[(i + 1) % n]); + if p.x.max(q.x) < lo_x || p.x.min(q.x) > hi_x || p.y.max(q.y) < lo_y || p.y.min(q.y) > hi_y { + continue; + } + near = true; + let (ex, ey) = (q.x - p.x, q.y - p.y); + let den = dx * ey - dy * ex; + if den.abs() < 1e-15 { + continue; + } + let t = ((p.x - a.x) * ey - (p.y - a.y) * ex) / den; + let u = ((p.x - a.x) * dy - (p.y - a.y) * dx) / den; + if t > 0.0 && t < 1.0 && (0.0..=1.0).contains(&u) { + ts.push(t); + } + } + } + let at = |t: f64| v2(a.x + dx * t, a.y + dy * t); + if !near { + // Ganz innerhalb (ohne Kantenberührung) oder ganz ausserhalb. + return if rings.iter().any(|r| inside(a, r)) { vec![] } else { vec![(a, b)] }; + } + ts.sort_by(|x, y| x.total_cmp(y)); + ts.windows(2).filter(|w| w[1] - w[0] > 1e-9 && !rings.iter().any(|r| inside(at((w[0] + w[1]) / 2.0), r))).map(|w| (at(w[0]), at(w[1]))).collect() +} const EXCAVATION_INK: &str = "#1f242c"; fn ink_line(a: Vec2, b: Vec2, w: f64, color: &str, dash: Option>) -> Primitive { @@ -130,7 +188,7 @@ fn ink_line(a: Vec2, b: Vec2, w: f64, color: &str, dash: Option>) -> Pr /// [T6] Höhenlinien aus dem Gelände-Netz (samt Baugruben) in der Äquidistanz `contourInterval`; jede /// `contourIndexEvery`-te ist Zähllinie (dicker, mit Höhenangabe, lesbar gedreht). -fn terrain_contours(c: &Ctx, t: &TerrainMesh, out: &mut Vec) { +fn terrain_contours(c: &Ctx, t: &TerrainMesh, out: &mut Vec, house: &[Vec]) { let Some(iv) = t.contour_interval.filter(|v| v.is_finite() && *v > 0.0) else { return }; let every = t.contour_index_every.filter(|v| v.is_finite() && *v >= 1.0).map_or(5, |v| v.round() as i64); let st = crate::excavation::site_terrain(c.p, t); @@ -138,7 +196,8 @@ fn terrain_contours(c: &Ctx, t: &TerrainMesh, out: &mut Vec) { for l in crate::terrain::isolines(st.current(), iv, 0.0) { let k = (l.level / iv).round() as i64; let index = k.rem_euclid(every) == 0; - let w = if index { 0.25 } else { 0.1 }; + // [140] Zähllinie mittel (0.18), Höhenlinie fein (0.1): Gelände bleibt unter dem Gebäude zurück. + let w = if index { 0.18 } else { 0.1 }; let n = l.pts.len(); let segs = if l.closed { n } else { n - 1 }; let seg_len = |i: usize| (l.pts[(i + 1) % n][0] - l.pts[i][0]).hypot(l.pts[(i + 1) % n][1] - l.pts[i][1]); @@ -159,7 +218,9 @@ fn terrain_contours(c: &Ctx, t: &TerrainMesh, out: &mut Vec) { } for (f0, f1) in spans { let pt = |f: f64| v2(a[0] + (b[0] - a[0]) * f, a[1] + (b[1] - a[1]) * f); - out.push(ink_line(pt(f0), pt(f1), w, TERRAIN_INK, None)); + for (p0, p1) in outside(pt(f0), pt(f1), house) { + out.push(ink_line(p0, p1, w, TERRAIN_INK, None)); + } } acc += d; } @@ -354,6 +415,35 @@ mod tests { assert_eq!(top_context(&out, -30.0, 0.0), None); } + /// [140] Höhenlinien enden an der Gebäudegrundfläche (Wände vereinigt, ganzer Aussenring). + #[test] + fn hoehenlinien_enden_am_gebaeude() { + let ring = [v2(0.0, 0.0), v2(10.0, 0.0), v2(10.0, 8.0), v2(0.0, 8.0)]; + let rings = vec![ring.to_vec()]; + // Quer durch: nur die beiden Stücke ausserhalb bleiben. + let parts = outside(v2(-5.0, 4.0), v2(15.0, 4.0), &rings); + assert_eq!(parts.len(), 2); + assert!((parts[0].1.x - 0.0).abs() < 1e-9 && (parts[1].0.x - 10.0).abs() < 1e-9); + // Ganz innen (im Raum, keine Kante in der Nähe): weg; ganz aussen: bleibt. + assert!(outside(v2(4.0, 4.0), v2(5.0, 4.0), &rings).is_empty()); + assert_eq!(outside(v2(20.0, 4.0), v2(25.0, 4.0), &rings).len(), 1); + // Im Plan: Gelände z = x/10, Haus aus vier Wänden 12..18 × 0..10 → keine Höhenlinie bei x = 15 im Haus. + let t = TerrainMesh { id: "t".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 mut v: serde_json::Value = serde_json::from_str(include_str!("../../tests/fixtures/sample_project.json")).unwrap(); + let wall = |id: &str, a: [f64; 2], b: [f64; 2]| serde_json::json!({"id": id, "type": "wall", "floorId": v["drawingLevels"][0]["id"], "categoryCode": "20", "wallTypeId": v["walls"][0]["wallTypeId"], "start": {"x": a[0], "y": a[1]}, "end": {"x": b[0], "y": b[1]}, "height": 3}); + let walls = serde_json::json!([wall("a", [12.0, -2.0], [18.0, -2.0]), wall("b", [18.0, -2.0], [18.0, 12.0]), wall("c", [18.0, 12.0], [12.0, 12.0]), wall("d", [12.0, 12.0], [12.0, -2.0])]); + v["walls"] = walls; + v["openings"] = serde_json::json!([]); + let mut p: Project = serde_json::from_value(v).unwrap(); + p.context = Some(vec![ContextObject::TerrainMesh(t)]); + let a = super::super::domains::PlanArgs::parse(1.0, r#"{"scale": 100}"#).unwrap(); + let mut out = Vec::new(); + plan_context(&Ctx::new(&p, &a), &mut out); + let lines: Vec<(Vec2, Vec2)> = out.iter().filter_map(|q| match q { Primitive::Line { a, b, color: Some(c), .. } if c == TERRAIN_INK => Some((*a, *b)), _ => None }).collect(); + assert!(lines.iter().any(|(a, _)| (a.x - 5.0).abs() < 1e-6), "Höhenlinie ausserhalb fehlt"); + assert!(lines.iter().all(|(a, b)| !((a.x - 15.0).abs() < 1e-6 && (a.y + b.y) / 2.0 > 0.0 && (a.y + b.y) / 2.0 < 10.0)), "Höhenlinie im Haus"); + } + /// [T6]/[68] Höhenlinien (Zähllinien dicker + beschriftet) und Baugrube (Sohle, Oberkante, Schraffur). #[test] fn hoehenlinien_und_baugrube() { @@ -377,7 +467,7 @@ mod tests { let mut out = Vec::new(); plan_context(&Ctx::new(&p, &a), &mut out); let w = |m: f64| out.iter().filter(|q| matches!(q, Primitive::Line { weight_mm, color: Some(c), .. } if *weight_mm == m && c == TERRAIN_INK)).count(); - assert!(w(0.1) > 4 && w(0.25) > 0, "{} {}", w(0.1), w(0.25)); + assert!(w(0.1) > 4 && w(0.18) > 0, "{} {}", w(0.1), w(0.18)); let labels: Vec<&str> = out.iter().filter_map(|q| if let Primitive::DrawingText { text, .. } = q { Some(text.as_str()) } else { None }).collect(); assert!(labels.contains(&"5"), "{labels:?}"); let ex = out.iter().filter(|q| matches!(q, Primitive::Line { color: Some(c), .. } if c == EXCAVATION_INK)).count(); @@ -385,7 +475,7 @@ mod tests { // Die Zähllinie ist unter ihrer Beschriftung unterbrochen: keine Linie läuft durch den Textmittelpunkt. let at = out.iter().find_map(|q| if let Primitive::DrawingText { text, at, .. } = q { (text == "5").then_some(*at) } else { None }).unwrap(); let near = out.iter().filter(|q| matches!(q, Primitive::Line { a, b, weight_mm, color: Some(c), .. } - if *weight_mm == 0.25 && c == TERRAIN_INK && (a.x.min(b.x) - 0.01..=a.x.max(b.x) + 0.01).contains(&at.x) && (a.y.min(b.y) - 0.01..=a.y.max(b.y) + 0.01).contains(&at.y))).count(); + if *weight_mm == 0.18 && c == TERRAIN_INK && (a.x.min(b.x) - 0.01..=a.x.max(b.x) + 0.01).contains(&at.x) && (a.y.min(b.y) - 0.01..=a.y.max(b.y) + 0.01).contains(&at.y))).count(); assert_eq!(near, 0, "Linie läuft durch das Etikett bei {at:?}"); } diff --git a/src-tauri/core/src/plan/domains.rs b/src-tauri/core/src/plan/domains.rs index e7882691..a17e2355 100644 --- a/src-tauri/core/src/plan/domains.rs +++ b/src-tauri/core/src/plan/domains.rs @@ -23,6 +23,9 @@ const COLUMN_FALLBACK_FILL: &str = "#3a3f47"; const ROOM_FILL_ALPHA: &str = "00"; /// Basis-Schriftgrösse des Raumstempels (pt). const ROOM_STAMP_PT: f64 = 10.0; +/// [140] Raumstempel ab 1:200 (2.5 mm statt 3.5 mm, ohne SIA-Zeile): kleine Räume überlappen sonst. +const ROOM_STAMP_SMALL_PT: f64 = 7.0; +const ROOM_STAMP_SMALL_FROM: f64 = 200.0; const NAME_PT: f64 = 12.0; const NUMBER_PT: f64 = 9.0; const LINE2_PT: f64 = 9.0; @@ -605,17 +608,18 @@ fn rooms(c: &Ctx, out: &mut Vec, bounds: &mut Bounds) { continue; } let at = room.stamp_anchor.unwrap_or(pv(res.centroid)); + let small = c.a.scale >= ROOM_STAMP_SMALL_FROM; let (doc, extra_lines) = match &room.stamp { Some(s) => (room_stamp_to_doc(s), room_stamp_extra_lines(s, res.net, room.sia_category)), - None => ( - room.stamp_doc.clone().unwrap_or_else(|| doc_from_text(&room.name)), - vec![ - StampLine { text: format!("{} m²", to_fixed(res.net, 2)), align: Align::Center }, - StampLine { text: format!("{} · {}", sia_key(room.sia_category), sia_label(room.sia_category)), align: Align::Center }, - ], - ), + None => { + let mut lines = vec![StampLine { text: format!("{} m²", to_fixed(res.net, 2)), align: Align::Center }]; + if !small { + lines.push(StampLine { text: format!("{} · {}", sia_key(room.sia_category), sia_label(room.sia_category)), align: Align::Center }); + } + (room.stamp_doc.clone().unwrap_or_else(|| doc_from_text(&room.name)), lines) + } }; - out.push(Primitive::Text { at, doc, extra_lines, base_pt: ROOM_STAMP_PT, color: color.into(), room_id: Some(room.id.clone()), greyed, opacity: None }); + out.push(Primitive::Text { at, doc, extra_lines, base_pt: if small { ROOM_STAMP_SMALL_PT } else { ROOM_STAMP_PT }, color: color.into(), room_id: Some(room.id.clone()), greyed, opacity: None }); } } @@ -985,6 +989,19 @@ mod tests { PlanArgs::parse(detail, &t).unwrap() } + /// [140] Raumstempel ab 1:200 kleiner (7 pt) und ohne SIA-Zeile; bis 1:100 10 pt mit zwei Zusatzzeilen. + #[test] + fn raumstempel_je_massstab() { + let p = sample(); + let stamp = |scale: f64| { + let t = serde_json::json!({ "floor": "eg", "show": ["20", "60"], "grey": [], "scale": scale }).to_string(); + let r = plan_domains(&p, &PlanArgs::parse(1.0, &t).unwrap()).unwrap(); + r.rooms.iter().find_map(|q| match q { Primitive::Text { base_pt, extra_lines, .. } => Some((*base_pt, extra_lines.len())), _ => None }).unwrap() + }; + assert_eq!(stamp(100.0), (ROOM_STAMP_PT, 2)); + assert_eq!(stamp(200.0), (ROOM_STAMP_SMALL_PT, 1)); + } + #[test] fn beispiel_eg_decke_raum() { let p = sample(); diff --git a/src-tauri/core/src/plan/drawings.rs b/src-tauri/core/src/plan/drawings.rs index a0221ad3..b092588e 100644 --- a/src-tauri/core/src/plan/drawings.rs +++ b/src-tauri/core/src/plan/drawings.rs @@ -26,8 +26,9 @@ pub const DEFAULT_SCALE_DENOMINATOR: f64 = 100.0; // Bemassung (SIA 400 B.5.3): Defaults in Papier-mm (`model/dimension.ts`). const DIM_GAP_MM: f64 = 1.0; const DIM_OVERSHOOT_MM: f64 = 1.0; -const DIM_TICK_LEN_MM: f64 = 3.0; -const DIM_TEXT_HEIGHT_MM: f64 = 4.0; +// [140] Masszahl 2.5 mm, Schrägstrich 2 mm (vorher 4 / 3 — grösser als Raumstempel). +const DIM_TICK_LEN_MM: f64 = 2.0; +const DIM_TEXT_HEIGHT_MM: f64 = 2.5; // Höhenkote (SIA 400 B.5.4), fixe Modell-Meter. const KOTE_TRI_SIZE_M: f64 = 0.15; @@ -1858,7 +1859,7 @@ mod tests { match &out[5] { Primitive::DrawingText { text, height_m, .. } => { assert_eq!(text, "3.25"); - assert!((height_m - 0.2).abs() < 1e-12); + assert!((height_m - 0.125).abs() < 1e-12); } o => panic!("{o:?}"), } diff --git a/src-tauri/core/src/plan/dxf.rs b/src-tauri/core/src/plan/dxf.rs index 0887a886..4216fd92 100644 --- a/src-tauri/core/src/plan/dxf.rs +++ b/src-tauri/core/src/plan/dxf.rs @@ -69,8 +69,8 @@ const K_INSERT: usize = 7; /// Bemassungs-Standards in Papier-mm (`DIM_DEFAULTS_MM`). const DIM_GAP: f64 = 1.0; const DIM_OVERSHOOT: f64 = 1.0; -const DIM_TICK: f64 = 3.0; -const DIM_TEXT: f64 = 4.0; +const DIM_TICK: f64 = 2.0; +const DIM_TEXT: f64 = 2.5; /// Optionen des Exports. pub struct DxfOptions { diff --git a/src-tauri/core/src/plan/elevation.rs b/src-tauri/core/src/plan/elevation.rs index 715b09af..a39e597b 100644 --- a/src-tauri/core/src/plan/elevation.rs +++ b/src-tauri/core/src/plan/elevation.rs @@ -15,6 +15,10 @@ use std::collections::HashMap; const EDGE_INK: &str = "#2b3039"; const EDGE_MM: f64 = 0.13; +/// [140] Silhouette (Umriss aller Bauteile zusammen) mittelstark: hebt den Baukörper von Details ab. +const SILHOUETTE_MM: f64 = 0.35; +/// [140] Abstand (m), bis zu dem eine Kante als Teil der Silhouette gilt. +const SILHOUETTE_TOL: f64 = 2e-3; const FRAME_MM: f64 = 0.18; const GLASS_FILL_MONO: &str = "#c4c8cd"; const GLASS_FILL_COLOR: &str = "#9fc2d9"; @@ -1096,6 +1100,27 @@ fn outline_line(a: Pt, b: Pt) -> Primitive { line(v2(a[0], a[1]), v2(b[0], b[1]), "elevation-outline", EDGE_MM, EDGE_INK) } +/// [140] Aussenränder der vereinigten Bauteilflächen (Silhouette des Baukörpers in der Ansicht). +fn silhouette_rings(faces: &[Face]) -> Vec> { + let polys: Vec = faces.iter().filter(|f| f.pts.len() >= 3).map(|f| vec![f.pts.clone()]).collect(); + // Nur Aussenringe: Löcher der Vereinigung (Gauben-Ausschnitte, Fugen zwischen Dachflächen) sind keine Silhouette. + crate::polygon_bool::union(&polys).into_iter().filter_map(|poly| poly.into_iter().next()).collect() +} + +/// Liegt `q` (bis [`SILHOUETTE_TOL`]) auf einem der Ringe? +fn on_rings(rings: &[Vec], q: Pt) -> bool { + rings.iter().any(|r| { + (0..r.len()).any(|i| { + let (a, b) = (r[i], r[(i + 1) % r.len()]); + let (dx, dy) = (b[0] - a[0], b[1] - a[1]); + let l2 = dx * dx + dy * dy; + let t = if l2 > 0.0 { (((q[0] - a[0]) * dx + (q[1] - a[1]) * dy) / l2).clamp(0.0, 1.0) } else { 0.0 }; + let (ex, ey) = (a[0] + t * dx - q[0], a[1] + t * dy - q[1]); + ex * ex + ey * ey <= SILHOUETTE_TOL * SILHOUETTE_TOL + }) + }) +} + fn poly_prim(pts: Vec, fill: &str, stroke: &str, w: f64, opening: Option<&str>) -> Primitive { let mut pr = polygon(pts, fill, stroke, w, no_hatch()); if let (Primitive::Polygon { opening_id, .. }, Some(id)) = (&mut pr, opening) { @@ -1500,6 +1525,7 @@ pub fn elevation_primitives(p: &Project, level: &LevelSpec, shadows: bool, mono: }); let mut prims: Vec = items.into_iter().map(|it| it.prim).collect(); // Exakt sichtbare Kanten liegen über allen Füllungen (die Füllungen bleiben Maler-Ordnung). + let silhouette = silhouette_rings(&faces); for e in &edges { acc.add(e.a[0], e.a[1]); acc.add(e.b[0], e.b[1]); @@ -1509,6 +1535,8 @@ pub fn elevation_primitives(p: &Project, level: &LevelSpec, shadows: bool, mono: *dash = Some(Some(HIDDEN_DASH.to_vec())); } prims.push(l); + } else if on_rings(&silhouette, [(e.a[0] + e.b[0]) / 2.0, (e.a[1] + e.b[1]) / 2.0]) { + prims.push(line(v2(e.a[0], e.a[1]), v2(e.b[0], e.b[1]), "elevation-outline", SILHOUETTE_MM, EDGE_INK)); } else { prims.push(outline_line(e.a, e.b)); } @@ -2133,6 +2161,25 @@ mod tests { } /// [132] Stützen erscheinen in der Ansicht (Fläche mit Pick-Id, Umriss); runde ohne Facettenfugen. + /// [140] Ansicht: Silhouette des Baukörpers mittel (0.35), innere Kanten fein (0.13), Grundlinie schwer. + #[test] + fn silhouette_mittel_details_fein() { + let p = proj132( + serde_json::json!([]), + serde_json::json!([ + {"id": "C1", "type": "column", "floorId": "F", "categoryCode": "25", "position": {"x": 2, "y": 2}, "profile": {"kind": "rect", "width": 0.2, "depth": 0.2}, "rotation": 0, "height": 2.5}, + {"id": "C2", "type": "column", "floorId": "F", "categoryCode": "25", "position": {"x": 2, "y": 4}, "profile": {"kind": "rect", "width": 0.6, "depth": 0.2}, "rotation": 0, "height": 1.5} + ]), + ); + let prims = view132(&p, "s"); + let ws: Vec = prims.iter().filter_map(|q| match q { Primitive::Line { cls, weight_mm, .. } if cls == "elevation-outline" => Some(*weight_mm), _ => None }).collect(); + assert!(ws.contains(&SILHOUETTE_MM), "Silhouette fehlt: {ws:?}"); + // C1 (schmal, vorne) steht vor C2 (breiter, niedriger): die Oberkante von C2 ist Silhouette, die + // Kanten von C1 innerhalb von C2 sind fein. + assert!(ws.contains(&EDGE_MM), "innere Kanten fehlen: {ws:?}"); + assert!(GROUND_MM > SILHOUETTE_MM && SILHOUETTE_MM > EDGE_MM); + } + #[test] fn stuetzen_in_der_ansicht() { let p = proj132( diff --git a/src-tauri/core/src/plan/extras.rs b/src-tauri/core/src/plan/extras.rs index e4f2b62c..558d4fb3 100644 --- a/src-tauri/core/src/plan/extras.rs +++ b/src-tauri/core/src/plan/extras.rs @@ -366,19 +366,34 @@ pub fn cut_z(p: &Project, floor: &str) -> f64 { // ── Schwarz-Weiss und Strichstärken ───────────────────────────────────────────────────────────── const REFERENCE_SCALE: f64 = 100.0; -const MIN_FACTOR: f64 = 0.5; -const MAX_FACTOR: f64 = 1.6; +const MIN_FACTOR: f64 = 0.4; +const MAX_FACTOR: f64 = 2.0; +/// [140] Sockel (Papier-mm), der nicht mit dem Massstab wächst/schrumpft: feine Linien (Schraffur, +/// Bemassung) ändern sich kaum, Haarlinien darunter gar nicht. +const FINE_MM: f64 = 0.09; -/// Strichstärken-Faktor für 1:`scale` ([32], nur mit `Project.scaleLineWeights`): (100/n)^0.25, -/// begrenzt auf 0,5–1,6; sonst 1. +/// Strichstärken-Faktor für 1:`scale` ([32], nur mit `Project.scaleLineWeights`): (100/n)^0.5 (1:50 ≈ 1.41, +/// 1:200 ≈ 0.71, 1:500 ≈ 0.45), begrenzt auf 0,4–2; sonst 1. Wirkt über [`scale_weight`] je nach Stärke. pub fn line_weight_factor(p: &Project, scale: f64) -> f64 { if p.scale_line_weights != Some(true) || !(scale > 0.0) || !scale.is_finite() { return 1.0; } - let f = jsnum::pow(REFERENCE_SCALE / scale, 0.25); + let f = jsnum::pow(REFERENCE_SCALE / scale, 0.5); jsnum::min(MAX_FACTOR, jsnum::max(MIN_FACTOR, f)) } +/// [140] Stärke `w` (Papier-mm, bezogen auf 1:100) beim Massstabsfaktor `f`: nur der Anteil über dem +/// Sockel [`FINE_MM`] skaliert (w' = 0.09 + (w − 0.09)·f). Schwere Linien folgen dem Massstab fast ganz +/// (Schnittkante 0.5 → 0.67 bei 1:50, → 0.38 bei 1:200), feine kaum (0.13 → 0.15 / 0.12) — die Rangfolge +/// bleibt in jedem Massstab erhalten (linear, steigend), und Schraffuren fallen in 1:200/1:500 nicht unter +/// die Druckgrenze. Linien bis 0.09 (Haarlinien) bleiben unverändert. +pub fn scale_weight(w: f64, f: f64) -> f64 { + if f == 1.0 || !(w > FINE_MM) || !f.is_finite() { + return w; + } + FINE_MM + (w - FINE_MM) * f +} + /// Nachbearbeitung beim Schreiben (`plan::buf::Writer::post`): Schwarz-Weiss (alle Farben auf Tinte /// bzw. Papier; eine Vollpoché bleibt schwarz) und Strichstärken-Faktor — in dieser Reihenfolge wie /// früher `toMono` und `scalePrimitiveWeights`. @@ -401,7 +416,7 @@ impl Post { h.color = (if h.pattern == HatchPattern::Solid { HATCH_INK } else { MONO_INK }).into(); } if self.lw != 1.0 { - h.line_weight *= self.lw; + h.line_weight = scale_weight(h.line_weight, self.lw); } } @@ -418,7 +433,7 @@ impl Post { } self.hatch(hatch); if self.lw != 1.0 { - *stroke_width_mm *= self.lw; + *stroke_width_mm = scale_weight(*stroke_width_mm, self.lw); } } Primitive::Text { color, .. } => { @@ -431,12 +446,12 @@ impl Post { *color = Some(MONO_INK.into()); } if self.lw != 1.0 { - *weight_mm *= self.lw; + *weight_mm = scale_weight(*weight_mm, self.lw); } } Primitive::Arc { weight_mm, .. } | Primitive::DrawingCircle { weight_mm, .. } | Primitive::DrawingArc { weight_mm, .. } => { if self.lw != 1.0 { - *weight_mm *= self.lw; + *weight_mm = scale_weight(*weight_mm, self.lw); } } Primitive::DrawingText { .. } | Primitive::DrawingTextPath { .. } | Primitive::DrawingImage { .. } => {} @@ -445,7 +460,7 @@ impl Post { /// Farbe und Stärke einer Linie. pub fn line<'a>(&self, color: Option<&'a str>, w: f64) -> (Option<&'a str>, f64) { - (if self.mono { Some(MONO_INK) } else { color }, if self.lw != 1.0 { w * self.lw } else { w }) + (if self.mono { Some(MONO_INK) } else { color }, scale_weight(w, self.lw)) } } @@ -459,7 +474,7 @@ pub fn scale_line_weights(p: &Project, scale: f64, prims: &mut [Primitive]) { let post = Post { mono: false, lw, sketch: 0.0 }; for q in prims.iter_mut() { match q { - Primitive::Line { weight_mm, .. } => *weight_mm *= lw, + Primitive::Line { weight_mm, .. } => *weight_mm = scale_weight(*weight_mm, lw), _ => post.apply(q), } } @@ -660,9 +675,10 @@ mod tests { let mut on = sample(); on.scale_line_weights = Some(true); assert_eq!(line_weight_factor(&on, 100.0), 1.0); - assert!((line_weight_factor(&on, 200.0) - 0.5f64.powf(0.25)).abs() < 1e-12); - assert!((line_weight_factor(&on, 50.0) - 2f64.powf(0.25)).abs() < 1e-12); - assert_eq!(line_weight_factor(&on, 100000.0), 0.5); + assert!((line_weight_factor(&on, 200.0) - 0.5f64.sqrt()).abs() < 1e-12); + assert!((line_weight_factor(&on, 50.0) - 2f64.sqrt()).abs() < 1e-12); + assert_eq!(line_weight_factor(&on, 100000.0), 0.4); + assert_eq!(line_weight_factor(&on, 1.0), 2.0); assert_eq!(line_weight_factor(&sample(), 200.0), 1.0); assert_eq!(line_weight_factor(&on, f64::NAN), 1.0); } @@ -676,13 +692,34 @@ mod tests { let mut a = lines(); scale_line_weights(&on, 200.0, &mut a); let Primitive::Line { weight_mm, .. } = &a[0] else { unreachable!() }; - assert!((weight_mm - 0.5 * 0.5f64.powf(0.25)).abs() < 1e-12); + assert!((weight_mm - (0.09 + 0.41 * 0.5f64.sqrt())).abs() < 1e-12); let mut b = lines(); scale_line_weights(&sample(), 200.0, &mut b); let Primitive::Line { weight_mm, .. } = &b[0] else { unreachable!() }; assert_eq!(*weight_mm, 0.5); } + /// [140] Rangfolge der Strichstärken je Massstab: Schnittkante 0.5 (1:100) → ≈ 0.67 (1:50) / ≈ 0.38 + /// (1:200); feine Linien (Schraffur 0.1, Bemassung 0.13) ändern sich kaum, nie unter 0.09; die + /// Reihenfolge schwer > mittel > fein > Schraffur bleibt in jedem Massstab. + #[test] + fn strichstaerken_rangfolge_je_massstab() { + let mut on = sample(); + on.scale_line_weights = Some(true); + let at = |w: f64, s: f64| scale_weight(w, line_weight_factor(&on, s)); + assert!((at(0.5, 50.0) - 0.67).abs() < 0.01); + assert!((at(0.5, 200.0) - 0.38).abs() < 0.01); + assert_eq!(at(0.5, 100.0), 0.5); + assert!((at(0.13, 50.0) - 0.13).abs() < 0.02 && (at(0.13, 200.0) - 0.13).abs() < 0.02); + for s in [20.0, 50.0, 100.0, 200.0, 500.0, 1000.0] { + let class = [0.7, 0.5, 0.35, 0.25, 0.18, 0.13, 0.1].map(|w| at(w, s)); + assert!(class.windows(2).all(|p| p[0] > p[1]), "1:{s}: {class:?}"); + assert!(at(0.1, s) >= 0.09 && at(0.13, s) >= 0.09, "1:{s}: feine Linien druckbar"); + } + assert_eq!(scale_weight(0.02, 0.5), 0.02, "Haarlinien bleiben"); + assert_eq!(scale_weight(f64::NAN, 2.0).is_nan(), true); + } + #[test] fn blatt_ebene_ohne_strichstaerken_faktor() { let mut p = sample(); diff --git a/src-tauri/core/src/plan/section.rs b/src-tauri/core/src/plan/section.rs index a463bf51..f060bb1b 100644 --- a/src-tauri/core/src/plan/section.rs +++ b/src-tauri/core/src/plan/section.rs @@ -20,7 +20,10 @@ use std::collections::{HashMap, HashSet}; const SECTION_INK: &str = "#1f242c"; const SECTION_VISIBLE_INK: &str = "#2b3039"; const SECTION_HIDDEN_INK: &str = "#8a929c"; -const SECTION_CUT_OUTLINE_MM: f64 = 0.35; +/// [140] Umriss der geschnittenen Masse (Vereinigung aller Schnittflächen): schwer wie die Wand im Grundriss. +const SECTION_CUT_OUTLINE_MM: f64 = 0.5; +/// [140] Fugen zwischen Schichten/Bauteilen innerhalb der geschnittenen Masse: fein. +const SECTION_JOINT_MM: f64 = 0.13; const SECTION_VISIBLE_MM: f64 = 0.18; const SECTION_GROUND_MM: f64 = 0.5; const SECTION_HIDDEN_MM: f64 = 0.13; @@ -2266,6 +2269,7 @@ pub fn section_primitives(out: &Output, mono: bool, hidden_lines: bool, vis: &Vi let mut prims = Vec::new(); let mut acc = Acc::new(); let shown = |code: &str| vis.visible(code) && vis.render(code); + let mut cut_rings: Vec = Vec::new(); // [T6] Erdreich zuerst (unter allem), ohne Umriss; Kategorie wie das Gelände. let terrain_shown = out.profiles.iter().all(|pr| pr.category.as_deref().is_none_or(shown)); if terrain_shown { @@ -2306,7 +2310,7 @@ pub fn section_primitives(out: &Output, mono: bool, hidden_lines: bool, vis: &Vi (fill.to_string(), hatch) }; let src = cp.source_id.clone(); - let mut pr = polygon(pts, &fill, SECTION_INK, SECTION_CUT_OUTLINE_MM, hatch); + let mut pr = polygon(pts, &fill, SECTION_INK, SECTION_JOINT_MM, hatch); if let Primitive::Polygon { wall_id, ceiling_id, roof_id, stair_id, extruded_solid_id, no_stroke_edges, greyed, .. } = &mut pr { *wall_id = if cp.kind == Kind::Wall { src.clone() } else { None }; *ceiling_id = if cp.kind == Kind::Slab && cp.stair_id.is_none() { src.clone() } else { None }; @@ -2316,8 +2320,18 @@ pub fn section_primitives(out: &Output, mono: bool, hidden_lines: bool, vis: &Vi *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()]); prims.push(pr); } + // [140] Schnittkante: Umriss der vereinigten Schnittflächen schwer, Fugen dazwischen bleiben fein. + for poly in crate::polygon_bool::union(&cut_rings) { + for ring in &poly { + for i in 0..ring.len() { + let (a, b) = (ring[i], ring[(i + 1) % ring.len()]); + prims.push(line(v2(a[0], a[1]), v2(b[0], b[1]), "section-cut-outline", SECTION_CUT_OUTLINE_MM, SECTION_INK)); + } + } + } for pr in &out.profiles { if let Some(code) = pr.category.as_deref() { if !shown(code) { @@ -3631,6 +3645,22 @@ mod ts_faelle { assert_eq!(zero.visible.len(), all.visible.len()); } + /// [140] Rangfolge im Schnitt: Umriss der geschnittenen Masse schwer (0.5), Fuge zwischen zwei + /// aneinanderstossenden Bauteilen fein (0.13), Ansichtskanten dazwischen (0.18). + #[test] + fn schnittkante_schwer_fugen_fein() { + let out = Output { cuts: vec![band(0.0, 1.0, 0.0, 1.0, None, "#fff"), band(1.0, 2.0, 0.0, 1.0, None, "#fff")], ..Default::default() }; + let (prims, _) = section_primitives(&out, false, false, &Visibility::default()); + let joints: Vec = prims.iter().filter_map(|q| match q { Primitive::Polygon { stroke_width_mm, .. } => Some(*stroke_width_mm), _ => None }).collect(); + assert_eq!(joints, [SECTION_JOINT_MM, SECTION_JOINT_MM]); + let outline: Vec<(Vec2, Vec2)> = prims.iter().filter_map(|q| match q { Primitive::Line { a, b, cls, weight_mm, .. } if cls == "section-cut-outline" => { assert_eq!(*weight_mm, SECTION_CUT_OUTLINE_MM); Some((*a, *b)) } _ => None }).collect(); + // Umriss = Rechteck 2 × 1 (die Fuge bei x = 1 gehört nicht dazu). + let len: f64 = outline.iter().map(|(a, b)| (b.x - a.x).hypot(b.y - a.y)).sum(); + assert!((len - 6.0).abs() < 1e-6, "{len}"); + assert!(outline.iter().all(|(a, b)| !((a.x - 1.0).abs() < 1e-6 && (b.x - 1.0).abs() < 1e-6))); + assert!(SECTION_CUT_OUTLINE_MM > SECTION_VISIBLE_MM && SECTION_VISIBLE_MM > SECTION_JOINT_MM); + } + #[test] fn primitive_pick_ids_und_kategorien() { let mut w = band(0.0, 1.0, 0.0, 1.0, None, "#fff"); diff --git a/src-tauri/core/src/plan/style.rs b/src-tauri/core/src/plan/style.rs index 5f391553..26193f00 100644 --- a/src-tauri/core/src/plan/style.rs +++ b/src-tauri/core/src/plan/style.rs @@ -8,6 +8,12 @@ pub const POCHE_STROKE: &str = "#1a1a1a"; pub const MONO_INK: &str = "#111111"; pub const LAYER_LINE_MM: f64 = 0.02; pub const SYMBOL_HAIRLINE_MM: f64 = 0.02; +/// [140] Feine Symbol-Linien der Türen/Fenster im Grundriss (Blatt, Aufschlag, Glas, Bank), solange der Typ +/// keine eigene Stärke trägt — vorher Haarlinie 0.02 (im Druck kaum sichtbar). +pub const SYMBOL_LINE_MM: f64 = 0.13; +/// [140] Schichtfugen im Wandschnitt ohne eigene Fugenstärke (`Layer.jointWeightMm`): fein, aber druckbar +/// (vorher 0.02); bewusst unter der Schraffur-Stärke, damit dünne Schichten in 1:100 nicht zulaufen. +pub const LAYER_JOINT_MM: f64 = 0.09; /// Kanten über der Schnittebene (Decken-/Dachränder, Bauteile „über Schnitt"): Strichpunktlinie nach /// SIA 400 B.3.3 (Strich, Lücke, Punkt, Lücke; Punkt = Länge 0 mit runder Kappe). pub const OVERHEAD_DASH: [f64; 4] = [0.4, 0.12, 0.0, 0.12]; @@ -40,9 +46,11 @@ impl Detail { /// Stärke der Wand-Umrisslinie als Faktor auf die Ebenen-lw. pub fn outline_factor(self) -> f64 { match self { - Detail::Grob => 1.6, + // [140] Fein (1:50/1:20) behält die volle Schnittkante (vorher 0.6 — dünner als die + // Fugen-Rangfolge verlangt); Grob (1:200/1:500, Vollpoché) etwas kräftiger. + Detail::Grob => 1.2, Detail::Mittel => 1.0, - Detail::Fein => 0.6, + Detail::Fein => 1.0, } } diff --git a/src-tauri/core/src/plan/walls.rs b/src-tauri/core/src/plan/walls.rs index 62d48857..10cf4016 100644 --- a/src-tauri/core/src/plan/walls.rs +++ b/src-tauri/core/src/plan/walls.rs @@ -176,7 +176,7 @@ fn wall_poche(c: &Ctx, out: &mut Vec, e: &EffWall, gaps: &[(f64, f64) let angle = atan2(w.end.y - w.start.y, w.end.x - w.start.x) * 180.0 / std::f64::consts::PI; let stroke = e.color.as_deref().unwrap_or(POCHE_STROKE); let outline_mm = wall_lw * detail.outline_factor(); - let layer_mm = LAYER_LINE_MM * detail.layer_factor(); + let layer_mm = LAYER_JOINT_MM * detail.layer_factor(); let thick: Vec = wt.layers.iter().map(|l| l.thickness).collect(); let f = crate::plan::wall_poche::wall_poche(&encode_wall_poche(w, &thick, total, ref_off, gaps, cuts, detail == Detail::Grob, view_only, reveals)); if f.is_empty() { @@ -420,11 +420,11 @@ fn opening_symbol(c: &Ctx, out: &mut Vec, w: &Wall, o: &Opening, colo b.push(shading.map_or(0.0, |s| s.r#box.width)); b.push(shading.map_or(0.0, |s| s.r#box.height)); // Strichstärken - b.push(SYMBOL_HAIRLINE_MM); - b.push(o.frame_line.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_HAIRLINE_MM)); + b.push(SYMBOL_LINE_MM); + b.push(o.frame_line.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_LINE_MM)); b.push(frame_view_weight); - b.push(o.sash_line.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_HAIRLINE_MM)); - b.push(o.sill_line_style.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_HAIRLINE_MM)); + b.push(o.sash_line.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_LINE_MM)); + b.push(o.sill_line_style.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_LINE_MM)); // Details ([94]): Anschlag, Fensterbank, Storenkasten. // Anschlag: je Seite verschieden ⇒ zeichnet `opening_detail_plan`. let rebate_sides = det.as_ref().map(|f| f.rebate).filter(|r| (r.left - r.right).abs() > 1e-9 || dframe.is_some()); diff --git a/src/cli/__golden__/ansicht.svg b/src/cli/__golden__/ansicht.svg index 8cd8fab4..771238ba 100644 --- a/src/cli/__golden__/ansicht.svg +++ b/src/cli/__golden__/ansicht.svg @@ -47,31 +47,31 @@ - + - + - + - + - - + + - - + + - - - - + + + + - + diff --git a/src/cli/__golden__/grundriss-eg.svg b/src/cli/__golden__/grundriss-eg.svg index 07d944c0..b5048233 100644 --- a/src/cli/__golden__/grundriss-eg.svg +++ b/src/cli/__golden__/grundriss-eg.svg @@ -7,119 +7,119 @@ 17.01 m² HNF · Hauptnutzfläche - + - + - + - + - - + + - - - + + + - + - + - + - + - + - + - + - + - + - + - - + + - - - + + + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cli/__golden__/schnitt.svg b/src/cli/__golden__/schnitt.svg index 4f981372..ab89457b 100644 --- a/src/cli/__golden__/schnitt.svg +++ b/src/cli/__golden__/schnitt.svg @@ -1,37 +1,61 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/export/exportDxf.cad.test.ts b/src/export/exportDxf.cad.test.ts index 26b3a2d6..a336c7ed 100644 --- a/src/export/exportDxf.cad.test.ts +++ b/src/export/exportDxf.cad.test.ts @@ -124,8 +124,8 @@ describe.skipIf(!hasEzdxf)("Fachplaner-Export gegen ezdxf", { timeout: 60_000 }, } const st = r.dimstyles["DOSSIER_1-100"]; expect(st).toMatchObject({ dimscale: 100, dimtad: 1, dimdec: 2, dimlfac: 1, dimtxsty: "DOSSIER" }); - expect(st.dimtxt as number).toBeCloseTo(0.004, 9); // 4 mm Papier - expect(st.dimtsz as number).toBeCloseTo(0.0015, 9); // Architekturstrich 3 mm + expect(st.dimtxt as number).toBeCloseTo(0.0025, 9); // 2.5 mm Papier ([140]) + expect(st.dimtsz as number).toBeCloseTo(0.001, 9); // Architekturstrich 2 mm ([140]) }); it("Bemassungsstil im Massstab 1:50 und in cm", () => { diff --git a/src/export/planToPrintSvg.text.test.ts b/src/export/planToPrintSvg.text.test.ts index 7ed6350d..780172bb 100644 --- a/src/export/planToPrintSvg.text.test.ts +++ b/src/export/planToPrintSvg.text.test.ts @@ -131,10 +131,10 @@ describe("Druck-SVG: Textgrössen in Papier-mm", () => { expect(t.xs[0] - t.xs[1]).toBeCloseTo((4 * K) / 2, 3); }); - it("Masszahl in der Papier-Schrifthöhe (4 mm), Höhenkote lesbar gross", () => { + it("Masszahl in der Papier-Schrifthöhe (2.5 mm, [140]), Höhenkote lesbar gross", () => { const all = print(); const dim = all.find((x) => x.text === "5.00")!; - expect(dim.sizes[0]).toBeCloseTo(4, 3); + expect(dim.sizes[0]).toBeCloseTo(2.5, 3); const kote = all.find((x) => /0[.,]00/.test(x.text) && x !== dim); expect(kote).toBeDefined(); expect(kote!.sizes[0]).toBeGreaterThan(1); diff --git a/src/model/dimension.ts b/src/model/dimension.ts index bba723b0..c8d1ebc9 100644 --- a/src/model/dimension.ts +++ b/src/model/dimension.ts @@ -8,14 +8,14 @@ // Erzeugungszeit also bekannt und eindeutig. /** - * Defaults in PAPIER-MILLIMETERN (übliche Zeichnungswerte; entsprechen bei - * 1:50 genau den früheren festen Modellwerten 0.05/0.05/0.15/0.2 m). + * Defaults in PAPIER-MILLIMETERN (übliche Zeichnungswerte; [140]: Masszahl 2.5 mm, + * Schrägstrich 2 mm — eine Stufe unter dem Raumstempel). */ export const DIM_DEFAULTS_MM = { gap: 1, overshoot: 1, - tickLen: 3, - textHeight: 4, + tickLen: 2, + textHeight: 2.5, } as const; /** Default-Grösse der Linienenden (Pfeil, Punkt, …) in Papier-Millimetern (wie im Kern). */ diff --git a/src/model/sampleProject.ts b/src/model/sampleProject.ts index a7de1904..0ad06739 100644 --- a/src/model/sampleProject.ts +++ b/src/model/sampleProject.ts @@ -389,7 +389,8 @@ export const sampleProject: Project = { code: "20", name: "Wände", color: "#0a0a0a", - lw: 0.35, + // [140] Schnittkante 0.5 bei 1:100 (mit `scaleLineWeights` ≈ 0.7 bei 1:50, ≈ 0.35 bei 1:200). + lw: 0.5, visible: true, locked: false, children: [ @@ -400,13 +401,15 @@ export const sampleProject: Project = { }, { code: "30", name: "Decken", color: "#605850", lw: 0.35, visible: true, locked: false }, { code: "31", name: "Dächer", color: "#7a4a3a", lw: 0.35, visible: true, locked: false }, - { code: "40", name: "Treppen", color: "#4a6a58", lw: 0.35, visible: true, locked: false }, + { code: "40", name: "Treppen", color: "#4a6a58", lw: 0.25, visible: true, locked: false }, { code: "35", name: "Träger", color: "#a87858", lw: 0.5, visible: true, locked: false }, { code: "50", name: "Text", color: "#d0d0d0", lw: 0.13, visible: true, locked: false }, { code: "60", name: "Räume", color: "#5a7a9a", lw: 0.13, visible: true, locked: false }, { code: "90", name: "Referenzen", color: "#585860", lw: 0.13, visible: true, locked: false }, { code: "99", name: "Konstruktion", color: "#404048", lw: 0.13, visible: true, locked: false }, ], + // [140] Strichstärken folgen dem Massstab (neue Projekte; bestehende behalten ihre Einstellung). + scaleLineWeights: true, walls: [ // ── EG: 5 × 4 m Raum (CCW) ── // Süd (unten) diff --git a/src/model/sampleProjectComplex.ts b/src/model/sampleProjectComplex.ts index 697d93ed..4b4a468c 100644 --- a/src/model/sampleProjectComplex.ts +++ b/src/model/sampleProjectComplex.ts @@ -688,7 +688,7 @@ const snap = (id: string, name: string, level: string, scale: number, center: Ve function views(): Pick { return { overrideRules: [ - { id: "or-brand", name: "Brandschutztüren rot", enabled: true, condition: { type: "layer_name", operator: "contains", value: "Türen" }, actions: { color: "#c0392b", lineweight: 0.35 } }, + { id: "or-brand", name: "Brandschutztüren rot", enabled: false, condition: { type: "layer_name", operator: "contains", value: "Türen" }, actions: { color: "#c0392b", lineweight: 0.35 } }, ], viewTemplates: [ { id: "vt-gr100", name: "Grundriss 1:100", detail: "mittel", scaleDenominator: 100, scaleLineWeights: true, cutHeight: 1.0 }, diff --git a/src/plan/__golden__/komplex-ansicht-ansicht-sued.txt b/src/plan/__golden__/komplex-ansicht-ansicht-sued.txt index c4ad6a42..ffe3301c 100644 --- a/src/plan/__golden__/komplex-ansicht-ansicht-sued.txt +++ b/src/plan/__golden__/komplex-ansicht-ansicht-sued.txt @@ -6,4 +6,4 @@ polygon 1541 rect 1 svg 1 text 4 -hash 99e90b8d7e720074 +hash 13c462eddf903040 diff --git a/src/plan/__golden__/komplex-grundriss-dg-100.txt b/src/plan/__golden__/komplex-grundriss-dg-100.txt index 6a5209c4..f5e06c55 100644 --- a/src/plan/__golden__/komplex-grundriss-dg-100.txt +++ b/src/plan/__golden__/komplex-grundriss-dg-100.txt @@ -1,5 +1,5 @@ viewBox -4 0 23 18 -bytes 335733 +bytes 335698 circle 14 line 3490 path 7 @@ -7,4 +7,4 @@ polygon 84 rect 1 svg 1 text 36 -hash ee49c09d752ec831 +hash b88ec245a30ce2f3 diff --git a/src/plan/__golden__/komplex-grundriss-dg-50.txt b/src/plan/__golden__/komplex-grundriss-dg-50.txt index ddc1e75b..0cf96f05 100644 --- a/src/plan/__golden__/komplex-grundriss-dg-50.txt +++ b/src/plan/__golden__/komplex-grundriss-dg-50.txt @@ -1,5 +1,5 @@ viewBox -4 0 23 18 -bytes 339126 +bytes 339174 circle 14 line 3490 path 7 @@ -7,4 +7,4 @@ polygon 84 rect 1 svg 1 text 36 -hash 6d7a49d4aa11cf99 +hash 24505c31de657c2a diff --git a/src/plan/__golden__/komplex-grundriss-eg-100.txt b/src/plan/__golden__/komplex-grundriss-eg-100.txt index b2f36a5f..2cbc5bea 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 147364 +bytes 147365 circle 16 line 832 path 68 @@ -7,4 +7,4 @@ polygon 257 rect 1 svg 1 text 121 -hash 45e68ce965a49c5d +hash 6adf8da2a695b17a diff --git a/src/plan/__golden__/komplex-grundriss-eg-50.txt b/src/plan/__golden__/komplex-grundriss-eg-50.txt index d8369cef..8bf4f61f 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 147796 +bytes 147696 circle 16 line 832 path 68 @@ -7,4 +7,4 @@ polygon 257 rect 1 svg 1 text 121 -hash dea353f151ea1cc1 +hash c61e13454d30ac4f diff --git a/src/plan/__golden__/komplex-grundriss-og-100.txt b/src/plan/__golden__/komplex-grundriss-og-100.txt index ebdcbd09..96cefbe9 100644 --- a/src/plan/__golden__/komplex-grundriss-og-100.txt +++ b/src/plan/__golden__/komplex-grundriss-og-100.txt @@ -1,5 +1,5 @@ viewBox -4.055 0 25.109 23.11 -bytes 413037 +bytes 412951 circle 14 line 4009 path 40 @@ -7,4 +7,4 @@ polygon 226 rect 1 svg 1 text 91 -hash 7d43d37dc2df5f36 +hash 95b660dfdb89c295 diff --git a/src/plan/__golden__/komplex-grundriss-og-50.txt b/src/plan/__golden__/komplex-grundriss-og-50.txt index cb2abbfc..21d709bf 100644 --- a/src/plan/__golden__/komplex-grundriss-og-50.txt +++ b/src/plan/__golden__/komplex-grundriss-og-50.txt @@ -1,5 +1,5 @@ viewBox -4.055 0 25.109 23.11 -bytes 416536 +bytes 416599 circle 14 line 4009 path 40 @@ -7,4 +7,4 @@ polygon 226 rect 1 svg 1 text 91 -hash 63761ac76b26d6f6 +hash 5a80b44538371ebc diff --git a/src/plan/__golden__/komplex-grundriss-ug-100.txt b/src/plan/__golden__/komplex-grundriss-ug-100.txt index 15f7c3da..575e1865 100644 --- a/src/plan/__golden__/komplex-grundriss-ug-100.txt +++ b/src/plan/__golden__/komplex-grundriss-ug-100.txt @@ -1,5 +1,5 @@ viewBox -10.004 0 31.058 26.958 -bytes 83162 +bytes 83175 circle 14 line 481 path 30 @@ -7,4 +7,4 @@ polygon 107 rect 1 svg 1 text 75 -hash 53f7fc8b03f80857 +hash 04995fa4a25c1dce diff --git a/src/plan/__golden__/komplex-grundriss-ug-50.txt b/src/plan/__golden__/komplex-grundriss-ug-50.txt index 97968ee7..e39d8041 100644 --- a/src/plan/__golden__/komplex-grundriss-ug-50.txt +++ b/src/plan/__golden__/komplex-grundriss-ug-50.txt @@ -1,5 +1,5 @@ viewBox -10.004 0 31.058 26.958 -bytes 83325 +bytes 83420 circle 14 line 481 path 30 @@ -7,4 +7,4 @@ polygon 107 rect 1 svg 1 text 75 -hash 46946bd19183e627 +hash 8debbdbb59223894 diff --git a/src/plan/__golden__/komplex-schnitt-schnitt-a.txt b/src/plan/__golden__/komplex-schnitt-schnitt-a.txt index c2c8b599..cfeb7577 100644 --- a/src/plan/__golden__/komplex-schnitt-schnitt-a.txt +++ b/src/plan/__golden__/komplex-schnitt-schnitt-a.txt @@ -1,9 +1,9 @@ viewBox 4.457 0 21.343 17.778 -bytes 45659 +bytes 65056 circle 3 -line 161 +line 376 polygon 168 rect 1 svg 1 text 3 -hash 4c4a94713688309d +hash 85215eea3c7d1169 diff --git a/src/plan/__golden__/muster-ansicht-ansicht-sued.txt b/src/plan/__golden__/muster-ansicht-ansicht-sued.txt index 78e8913b..f6f4cf9b 100644 --- a/src/plan/__golden__/muster-ansicht-ansicht-sued.txt +++ b/src/plan/__golden__/muster-ansicht-ansicht-sued.txt @@ -4,4 +4,4 @@ line 31 polygon 42 rect 1 svg 1 -hash c9caba6eee20fbd9 +hash 4b1f6e5269c6c321 diff --git a/src/plan/__golden__/muster-grundriss-eg-100.txt b/src/plan/__golden__/muster-grundriss-eg-100.txt index c334f7c9..0464f085 100644 --- a/src/plan/__golden__/muster-grundriss-eg-100.txt +++ b/src/plan/__golden__/muster-grundriss-eg-100.txt @@ -1,9 +1,9 @@ viewBox -0.672 0 6.345 5.345 -bytes 15919 +bytes 15907 line 67 path 8 polygon 61 rect 1 svg 1 text 7 -hash 97bd11bea3bf9d08 +hash ad8766ed45e2dec9 diff --git a/src/plan/__golden__/muster-grundriss-eg-50.txt b/src/plan/__golden__/muster-grundriss-eg-50.txt index decb859d..15097414 100644 --- a/src/plan/__golden__/muster-grundriss-eg-50.txt +++ b/src/plan/__golden__/muster-grundriss-eg-50.txt @@ -6,4 +6,4 @@ polygon 61 rect 1 svg 1 text 7 -hash 7dfca568eb0b0d41 +hash 10fc1ef5859d46d9 diff --git a/src/plan/__golden__/muster-grundriss-og-100.txt b/src/plan/__golden__/muster-grundriss-og-100.txt index b5c47642..ae980bed 100644 --- a/src/plan/__golden__/muster-grundriss-og-100.txt +++ b/src/plan/__golden__/muster-grundriss-og-100.txt @@ -1,9 +1,9 @@ viewBox -0.9 0 6.8 5.8 -bytes 7485 +bytes 7481 line 35 path 4 polygon 23 rect 1 svg 1 text 4 -hash b27877c94cb8dbfb +hash 0b855c965139033b diff --git a/src/plan/__golden__/muster-grundriss-og-50.txt b/src/plan/__golden__/muster-grundriss-og-50.txt index 193bc518..dc305f31 100644 --- a/src/plan/__golden__/muster-grundriss-og-50.txt +++ b/src/plan/__golden__/muster-grundriss-og-50.txt @@ -6,4 +6,4 @@ polygon 23 rect 1 svg 1 text 4 -hash d614790cd50f9817 +hash 631f36b943fff8e6 diff --git a/src/plan/__golden__/muster-schnitt-schnitt-a.txt b/src/plan/__golden__/muster-schnitt-schnitt-a.txt index e1b4ac19..68f34a09 100644 --- a/src/plan/__golden__/muster-schnitt-schnitt-a.txt +++ b/src/plan/__golden__/muster-schnitt-schnitt-a.txt @@ -1,7 +1,7 @@ viewBox 0.1 0 6.8 7.586 -bytes 7590 -line 35 +bytes 9686 +line 59 polygon 31 rect 1 svg 1 -hash 58399ffc23652b9f +hash 1626fed816bbf55f diff --git a/src/plan/drawings.test.ts b/src/plan/drawings.test.ts index bb145e47..d410111f 100644 --- a/src/plan/drawings.test.ts +++ b/src/plan/drawings.test.ts @@ -633,8 +633,8 @@ describe("2D-Zeichnung — Bemassung: Papier-mm statt Modellmass", () => { const lens = out .filter((p) => p.kind === "line") .map((p) => (p.kind === "line" ? Math.hypot(p.b.x - p.a.x, p.b.y - p.a.y) : 0)); - // Default 3 mm bei 1:50 = 0.15 m (der frühere feste Modellwert). - expect(Math.min(...lens)).toBeCloseTo(0.15, 9); + // Default 2 mm bei 1:50 = 0.1 m ([140], vorher 3 mm). + expect(Math.min(...lens)).toBeCloseTo(0.1, 9); }); }); diff --git a/src/plan/generatePlan.corner.test.ts b/src/plan/generatePlan.corner.test.ts index 421a844d..35e0246f 100644 --- a/src/plan/generatePlan.corner.test.ts +++ b/src/plan/generatePlan.corner.test.ts @@ -134,11 +134,11 @@ describe("generatePlan — Schichtfugen als stilisierbare Linien", () => { expect(joints[0].dash ?? null).toBeNull(); }); - it("fällt ohne Zuweisung auf die Haarlinie (0.02 mm) in Wandfarbe zurück", () => { + it("fällt ohne Zuweisung auf die feine Fuge (0.09 mm, [140]) in Wandfarbe zurück", () => { const proj = cornerProject(); proj.walls = [proj.walls[0]]; const joints = jointLines(proj); expect(joints.length).toBe(1); - expect(joints[0].weightMm).toBeCloseTo(0.02, 6); + expect(joints[0].weightMm).toBeCloseTo(0.09, 6); }); }); diff --git a/src/plan/generatePlan.lineWeights.test.ts b/src/plan/generatePlan.lineWeights.test.ts index b105f51b..5f4e4644 100644 --- a/src/plan/generatePlan.lineWeights.test.ts +++ b/src/plan/generatePlan.lineWeights.test.ts @@ -12,6 +12,9 @@ import type { Primitive } from "./generatePlan/shared"; const ALL = new Set(flattenCategories(sampleProject.layers).map((c) => c.code)); const on: Project = { ...sampleProject, scaleLineWeights: true }; +const off: Project = { ...sampleProject, scaleLineWeights: false }; +// [140] Kern `scale_weight`: nur der Anteil über 0.09 mm skaliert (1:200: Faktor √½). +const scaledWeight = (w: number, f: number) => (w > 0.09 ? 0.09 + (w - 0.09) * f : w); const weights = (ps: Primitive[]) => ps.flatMap((p) => (p.kind === "polygon" ? [p.strokeWidthMm] : "weightMm" in p && typeof p.weightMm === "number" ? [p.weightMm] : [])); const plan = (p: Project, n: number, compact = false) => @@ -19,18 +22,18 @@ const plan = (p: Project, n: number, compact = false) => describe("Strichstärken nach Massstab", () => { // Der Faktor selbst (Grenzen, ungültiger Massstab) ist im Kern geprüft (`plan/extras.rs`). - it("Grundriss 1:200: jede Stärke × Faktor, aus → unverändert", () => { - const base = weights(plan(sampleProject, 200).primitives); + it("Grundriss 1:200: jede Stärke über dem Sockel × Faktor, aus → unverändert", () => { + const base = weights(plan(off, 200).primitives); const scaled = weights(plan(on, 200).primitives); expect(scaled.length).toBe(base.length); - const f = 0.5 ** 0.25; - scaled.forEach((w, i) => expect(w).toBeCloseTo(base[i] * f, 9)); + expect(scaled).not.toEqual(base); + scaled.forEach((w, i) => expect(w).toBeCloseTo(scaledWeight(base[i], Math.SQRT1_2), 9)); }); it("auch die kompakte Linien-Unterlage (GPU-Ansicht) wird skaliert", () => { - const base = weights(plan(sampleProject, 200, true).primitives); + const base = weights(plan(off, 200, true).primitives); const scaled = weights(plan(on, 200, true).primitives); expect(scaled.length).toBe(base.length); - scaled.forEach((w, i) => expect(w).toBeCloseTo(base[i] * 0.5 ** 0.25, 9)); + scaled.forEach((w, i) => expect(w).toBeCloseTo(scaledWeight(base[i], Math.SQRT1_2), 9)); }); it("gleiche Eingabe → gleiche Inhalts-Hashes der Kern-Abschnitte (GPU-Cache), auch mit Massstab", () => { const line = { @@ -41,7 +44,7 @@ describe("Strichstärken nach Massstab", () => { const pl = generatePlan(p, "eg", ALL, undefined, "mittel", false, false, true, 200); return (pl.bufRuns ?? []).flatMap((r) => Array.from(r.buf.hashes!.subarray(r.from, r.to))); }; - const base = { ...sampleProject, drawings2d: [...sampleProject.drawings2d, line] }; + const base = { ...off, drawings2d: [...sampleProject.drawings2d, line] }; const a = hashes(base); expect(a.length).toBeGreaterThan(0); expect(hashes(base)).toEqual(a); diff --git a/src/plan/generatePlan.windowFields.test.ts b/src/plan/generatePlan.windowFields.test.ts index 0a804a0a..ae945b6e 100644 --- a/src/plan/generatePlan.windowFields.test.ts +++ b/src/plan/generatePlan.windowFields.test.ts @@ -340,11 +340,11 @@ describe("generatePlan — Linien-Übersteuerung je Kategorie (Opening.frameLine sillLine: { faces: "aussen", view: "auf" }, }; - it("ohne Übersteuerung: Stulp-/Sash-/Sims-Linien nutzen den Default (Opening.color bzw. Haarlinie)", () => { + it("ohne Übersteuerung: Stulp-/Sash-/Sims-Linien nutzen den Default (Opening.color bzw. feine Linie 0.13, [140])", () => { const p = project({ ...baseWindow, typeId: "wt1" }, [twoSashType]); const stulp = linesOfClass(p, "window-stulp", "mittel"); expect(stulp.length).toBeGreaterThan(0); - for (const l of stulp) expect(l.kind === "line" && l.weightMm).toBeCloseTo(0.02, 6); + for (const l of stulp) expect(l.kind === "line" && l.weightMm).toBeCloseTo(0.13, 6); }); it("frameLine übersteuert Farbe+Stärke der Laibungs-Blöcke (window-stulp, einflügliges Fenster ohne Flügelstoss)", () => {