From cee7cbe0f97a7838e288a5d4e86ce9983e7ae3ac Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Nov 2026 08:48:16 +0000 Subject: [PATCH] =?UTF-8?q?[140]=20Tusche=20als=20Standard:=20Schwarz-Weis?= =?UTF-8?q?s=20beh=C3=A4lt=20Graut=C3=B6ne,=20Schraffur,=20Schatten=20und?= =?UTF-8?q?=20Luftbilder;=20Ansicht=20ohne=20Materialfarben;=20grob:=20T?= =?UTF-8?q?=C3=BCren=20mit=20Bogen,=20Fenster=20zwei=20Striche?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/core/src/plan/elevation.rs | 50 +++++++++++++++++-- src-tauri/core/src/plan/extras.rs | 73 ++++++++++++++++++++++++++-- src-tauri/core/src/plan/openings.rs | 53 +++++++++++++++----- src-tauri/core/src/plan/svg.rs | 13 ++--- src-tauri/core/src/plan/walls.rs | 2 + src-tauri/core/src/queries.rs | 8 +-- src/cli/main.ts | 18 ++++--- src/plan/generatePlan.ts | 17 ++++--- src/state/viewSlice.ts | 6 +-- 9 files changed, 192 insertions(+), 48 deletions(-) diff --git a/src-tauri/core/src/plan/elevation.rs b/src-tauri/core/src/plan/elevation.rs index ff2137be..e520cb9d 100644 --- a/src-tauri/core/src/plan/elevation.rs +++ b/src-tauri/core/src/plan/elevation.rs @@ -21,7 +21,10 @@ const SILHOUETTE_MM: f64 = 0.18; /// [140] Abstand (m), bis zu dem eine Kante als Teil der Silhouette gilt. const SILHOUETTE_TOL: f64 = 2e-3; const FRAME_MM: f64 = 0.13; -const GLASS_FILL_MONO: &str = "#c4c8cd"; +/// [140] Tusche (Schwarz-Weiss, Standard): Glas hellgrau, Schatten neutral grau und hell. +const GLASS_FILL_MONO: &str = "#dcdcdc"; +const SHADOW_FILL_MONO: &str = "#c4c4c4"; +const OPENING_SHADOW_FILL_MONO: &str = "#d2d2d2"; /// [140] Glas hellgrau statt blau (Farbe nur, wo der Nutzer sie setzt). const GLASS_FILL_COLOR: &str = "#d3d8dd"; const SHADOW_FILL: &str = "#8f959e"; @@ -1433,7 +1436,7 @@ pub fn elevation_primitives(p: &Project, level: &LevelSpec, shadows: bool, mono: }) .collect(); i += 2 * count; - let mut prim = polygon(pts, SHADOW_FILL, "none", 0.0, no_hatch()); + let mut prim = polygon(pts, if mono { SHADOW_FILL_MONO } else { SHADOW_FILL }, "none", 0.0, no_hatch()); // [137] Klick auf den Schlagschatten wählt die Schatten-Einstellung der Ansicht (keine Element-Id). if let Primitive::Polygon { context_object_id, .. } = &mut prim { *context_object_id = Some(crate::plan::extras::SITE_PICK_VIEW_SHADOWS.into()); @@ -1497,7 +1500,7 @@ pub fn elevation_primitives(p: &Project, level: &LevelSpec, shadows: bool, mono: let f_v = min(0.3, 0.08 / max(h_v, 1e-6)); for (fa0, fa1, fz0, fz1) in [(0.0, 1.0, 1.0 - f_v, 1.0), (0.0, f_u, 0.0, 1.0 - f_v)] { let r = [quad_at(fa0, fz0), quad_at(fa1, fz0), quad_at(fa1, fz1), quad_at(fa0, fz1)]; - push(polygon(to_vec(&r), OPENING_SHADOW_FILL, "none", 0.0, no_hatch())); + push(polygon(to_vec(&r), if mono { OPENING_SHADOW_FILL_MONO } else { OPENING_SHADOW_FILL }, "none", 0.0, no_hatch())); } } for (a, b) in &op.divisions { @@ -1623,6 +1626,8 @@ fn pattern_style(sp: &SurfacePattern, comp: &Component) -> (f64, String) { } const PATTERN_INK: &str = "#3a3f47"; +/// [140] Ansichtsschraffur in Tusche: feines Grau (Materialstruktur tritt hinter die Kanten zurück). +const MONO_PATTERN_INK: &str = "#8c8c8c"; /// Linie der Ansichtsschraffur: Endpunkte, Verdeckungstiefe, Maler-Tiefe, Stil-Index. type PatternLine = (Pt, Pt, f64, f64, usize); @@ -1740,7 +1745,7 @@ fn surface_patterns(p: &Project, faces: &mut [Face], frame: &[f64; 9], scale: f6 } if mono { for s in &mut styles { - s.1 = PATTERN_INK.into(); + s.1 = MONO_PATTERN_INK.into(); } } (lines, styles) @@ -1975,6 +1980,43 @@ mod tests { assert_eq!(render(&p, 2000.0).matches("elevation-surface-pattern").count(), 0, "grob: weggelassen"); } + /// [140] Tusche-Ansicht (Schwarz-Weiss, Standard): keine Materialfarben, Flächen weiss, Glas hellgrau, + /// Schatten und Ansichtsschraffur in neutralem Grau (Schatten bleiben). + #[test] + fn tusche_ansicht_ohne_materialfarben() { + let mut p = sample(); + let outer = p.wall_types.iter().find(|t| t.id == "aw").unwrap().layers[0].component_id.clone(); + let c = p.components.iter_mut().find(|c| c.id == outer).unwrap(); + c.elevation_color = Some("#c0603a".into()); + c.surface_pattern = Some(SurfacePattern { kind: SurfacePatternKind::Lines, spacing: 0.1, color: Some("#a0522d".into()), ..Default::default() }); + let l = p.drawing_levels.iter().find(|l| l.id == "ansicht-sued").unwrap(); + let level = LevelSpec::from_json(&serde_json::to_value(l).unwrap()); + let (prims, _) = elevation_primitives(&p, &level, true, true, &Visibility::default(), 50.0).unwrap().unwrap(); + let neutral = |c: &str| c == "none" || crate::plan::extras::is_neutral(c); + let mut shadow = false; + let mut pattern = false; + for q in &prims { + match q { + Primitive::Polygon { fill, stroke, context_object_id, .. } => { + assert!(neutral(fill) && neutral(stroke), "bunt: {fill} {stroke}"); + shadow |= context_object_id.as_deref() == Some(crate::plan::extras::SITE_PICK_VIEW_SHADOWS); + } + Primitive::Line { cls, color, .. } => { + let c = color.as_deref().unwrap_or("#000"); + assert!(neutral(c), "bunte Linie {cls}: {c}"); + if cls == "elevation-surface-pattern" { + pattern = true; + assert_eq!(c, MONO_PATTERN_INK, "Muster grau, nicht schwarz"); + } + } + _ => {} + } + } + assert!(shadow && pattern); + let json = serde_json::to_string(&prims).unwrap(); + assert!(json.contains(GLASS_FILL_MONO) && !json.contains("#c0603a")); + } + /// [G3] Formöffnung: Rahmen als Umriss (viele Ecken), Glas eingerückt; [103] Dachfenster auf der /// Südfläche sichtbar. #[test] diff --git a/src-tauri/core/src/plan/extras.rs b/src-tauri/core/src/plan/extras.rs index 4f7a8eaf..4149b106 100644 --- a/src-tauri/core/src/plan/extras.rs +++ b/src-tauri/core/src/plan/extras.rs @@ -416,7 +416,11 @@ impl Post { fn hatch(&self, h: &mut HatchRender) { if self.mono && h.pattern != HatchPattern::None { - h.color = (if h.pattern == HatchPattern::Solid { HATCH_INK } else { MONO_INK }).into(); + if h.pattern == HatchPattern::Solid { + h.color = HATCH_INK.into(); + } else if !is_neutral(&h.color) { + h.color = MONO_INK.into(); + } } if self.lw != 1.0 { h.line_weight = scale_weight(h.line_weight, self.lw); @@ -430,9 +434,16 @@ impl Post { if self.mono { let solid = hatch.pattern == HatchPattern::Solid; if *fill != "none" { - *fill = (if solid { HATCH_INK } else { "#ffffff" }).into(); + if solid { + *fill = HATCH_INK.into(); + } else if !is_neutral(fill) { + *fill = "#ffffff".into(); + } + } + // [140] „none" bleibt (Wandschichten ohne Umriss: sonst Kontur statt Schraffur). + if *stroke != "none" && !is_neutral(stroke) { + *stroke = MONO_INK.into(); } - *stroke = MONO_INK.into(); } self.hatch(hatch); if self.lw != 1.0 { @@ -445,7 +456,7 @@ impl Post { } } Primitive::Line { weight_mm, color, .. } => { - if self.mono { + if self.mono && !color.as_deref().is_some_and(is_neutral) { *color = Some(MONO_INK.into()); } if self.lw != 1.0 { @@ -463,10 +474,24 @@ 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 }, scale_weight(w, self.lw)) + (if self.mono && !color.is_some_and(is_neutral) { Some(MONO_INK) } else { color }, scale_weight(w, self.lw)) } } +/// [140] Unbunte Farbe (Grau/Schwarz/Weiss, `#rgb`/`#rrggbb`/`#rrggbbaa`): bleibt in Schwarz-Weiss erhalten +/// (Schatten, Gelände-Grau, Treppen-Grau); bunte Farben werden Tinte bzw. Papier. +pub fn is_neutral(c: &str) -> bool { + let h = c.trim().trim_start_matches('#'); + let ch = |i: usize, n: usize| u8::from_str_radix(h.get(i..i + n)?, 16).ok().map(|v| if n == 1 { v * 17 } else { v }); + let rgb = match h.len() { + 3 | 4 => (ch(0, 1), ch(1, 1), ch(2, 1)), + 6 | 8 => (ch(0, 2), ch(2, 2), ch(4, 2)), + _ => return false, + }; + let (Some(r), Some(g), Some(b)) = rgb else { return false }; + r.max(g).max(b) - r.min(g).min(b) <= 20 +} + /// [32] Strichstärken nach Massstab auf Schnitt-/Ansichts-Primitive (wie im Grundriss über [`post_for`]): /// Faktor [`line_weight_factor`] auf Linien, Umrisse und Schraffurlinien; ohne Projekt-Option nichts. pub fn scale_line_weights(p: &Project, scale: f64, prims: &mut [Primitive]) { @@ -785,4 +810,42 @@ mod tests { } assert_eq!(post.line(None, 0.25), (Some(MONO_INK), 0.25)); } + + /// [140] Schwarz-Weiss als Tusche-Standard: Wandschichten ohne Umriss bleiben ohne Umriss (sonst verdrängt + /// die Kontur die Schraffur), Grautöne (Schatten, Gelände, Treppe) bleiben, bunte Farben werden Tinte/Papier. + #[test] + fn mono_behaelt_grau_und_ohne_umriss() { + let post = Post { mono: true, lw: 1.0, sketch: 0.0 }; + let mut p = flat_polygon(vec![], "#3c3c3c", 0.0); + if let Primitive::Polygon { stroke, hatch, .. } = &mut p { + *stroke = "none".into(); + *hatch = HatchRender { pattern: HatchPattern::Diagonal, color: "#808080".into(), ..no_hatch() }; + } + post.apply(&mut p); + match &p { + Primitive::Polygon { fill, stroke, hatch, .. } => { + assert_eq!(fill, "#3c3c3c"); + assert_eq!(stroke, "none"); + assert_eq!(hatch.color, "#808080"); + } + _ => unreachable!(), + } + let mut q = flat_polygon(vec![], "#e8dcc0", 0.0); + if let Primitive::Polygon { stroke, hatch, .. } = &mut q { + *stroke = "#b06030".into(); + *hatch = HatchRender { pattern: HatchPattern::Diagonal, color: "#c04020".into(), ..no_hatch() }; + } + post.apply(&mut q); + match &q { + Primitive::Polygon { fill, stroke, hatch, .. } => { + assert_eq!(fill, "#ffffff"); + assert_eq!(stroke, MONO_INK); + assert_eq!(hatch.color, MONO_INK); + } + _ => unreachable!(), + } + assert_eq!(post.line(Some("#8a8a8a"), 0.13), (Some("#8a8a8a"), 0.13)); + assert_eq!(post.line(Some("#a05a2c"), 0.13), (Some(MONO_INK), 0.13)); + assert!(is_neutral("#fff") && is_neutral("#1a1a1aff") && !is_neutral("#ff0000") && !is_neutral("rot")); + } } diff --git a/src-tauri/core/src/plan/openings.rs b/src-tauri/core/src/plan/openings.rs index 8023c09f..7dbdbfd3 100644 --- a/src-tauri/core/src/plan/openings.rs +++ b/src-tauri/core/src/plan/openings.rs @@ -85,8 +85,11 @@ fn plan_opening_inner(buf: &[f64]) -> Option> { let (sx, sy, ex, ey, total, ref_off) = (r.num()?, r.num()?, r.num()?, r.num()?, r.num()?, r.num()?); let (position, width) = (r.num()?, r.num()?); let is_door = r.num()? != 0.0; - let detail = match r.num()? as i64 { - 0 => Detail::Grob, + // [140] Code −1 = Übersicht (grob ab 1:500): Türen ohne Aufschlag-Bogen. + let detail_code = r.num()? as i64; + let overview = detail_code < 0; + let detail = match detail_code { + i64::MIN..=0 => Detail::Grob, 1 => Detail::Mittel, _ => Detail::Fein, }; @@ -185,7 +188,7 @@ fn plan_opening_inner(buf: &[f64]) -> Option> { }; for leaf in leaves(&door) { o.line(C_LEAF, hair, 0.0, 0.0, leaf.hinge, leaf.open_end); - if detail != Detail::Grob { + if !overview { o.arc(hair, leaf.hinge, leaf.closed_end, leaf.open_end, leaf.radius); } } @@ -194,7 +197,7 @@ fn plan_opening_inner(buf: &[f64]) -> Option> { let other = DoorParams { swing_right: !door.swing_right, ..door }; for leaf in leaves(&other) { o.line(C_LEAF, hair, 0.0, 3.0, leaf.hinge, leaf.open_end); - if detail != Detail::Grob { + if !overview { // Bögen laufen gegen den Uhrzeigersinn von `from` nach `to`: kurzen Bogen wählen. let (a, b) = (sub(leaf.closed_end, leaf.hinge), sub(leaf.open_end, leaf.hinge)); let (from, to) = if a.x * b.y - a.y * b.x >= 0.0 { (leaf.closed_end, leaf.open_end) } else { (leaf.open_end, leaf.closed_end) }; @@ -257,14 +260,16 @@ fn plan_opening_inner(buf: &[f64]) -> Option> { } None => (ref_off - total / 2.0, ref_off + total / 2.0), }; - if has_type { + if has_type && detail != Detail::Grob { let zone = if win_inset_side == 1.0 { (f_hi, ref_off + total / 2.0) } else { (ref_off - total / 2.0, f_lo) }; rebate_nibs(&mut o, &w, position, width, rebate, Some(zone)); } if detail == Detail::Grob { - let idx = sym.glass_lines.len() / 2; - if let Some(g) = sym.glass_lines.get(idx).or_else(|| sym.glass_lines.first()) { - o.line(C_GLASS, sash_w, 4.0, 0.0, g.0, g.1); + // [140] Grob: zwei Striche quer durch die Öffnung in den Wandfluchten (kein Rahmen, Glas, Bank). + if let Some((js, je)) = opening_jambs(&w, position, width) { + for off in [ref_off - total / 2.0, ref_off + total / 2.0] { + o.line(C_WINDOW_FRAME, frame_hair, 2.0, 0.0, add(js, scale(wn, off)), add(je, scale(wn, off))); + } } } else { o.polygon(1.0, frame_view_w, 3.0, &sym.frame); @@ -586,9 +591,13 @@ mod tests { t } + /// [140] Grob (auch automatisch ab 1:200): Tür mit Blatt UND Aufschlag-Bogen; Übersicht (1:500, Code −1) + /// nur das Blatt. #[test] - fn tuer_grob_hat_pick_blatt_und_zwei_sturzlinien() { + fn tuer_grob_hat_pick_blatt_bogen_und_zwei_sturzlinien() { let t = tags(&plan_opening(&input(true, 0.0, false, &[]))); + assert_eq!(t, vec![1.0, 2.0, 3.0, 2.0, 2.0]); + let t = tags(&plan_opening(&input(true, -1.0, false, &[]))); assert_eq!(t, vec![1.0, 2.0, 2.0, 2.0]); } @@ -599,10 +608,24 @@ mod tests { assert_eq!(t.len(), 1 + 1 + 1 + 2 + 2); } + /// [140] Fenster grob: nur zwei Striche quer durch die Öffnung in den Wandfluchten (kein Rahmen, kein Glas, + /// keine Bank, kein Anschlag) — auch mit Fenstertyp, Anschlag und Bank. #[test] - fn fenster_grob_hat_eine_glaslinie() { - let t = tags(&plan_opening(&input(false, 0.0, false, &[]))); - assert_eq!(t, vec![1.0, 2.0]); + fn fenster_grob_zwei_striche_in_der_wandflucht() { + let sashes = [[0.0, 1.0, NAN, NAN, 1.0], [0.0, 1.0, NAN, NAN, 1.0]]; + for (has_type, sa) in [(false, &[][..]), (true, &sashes[..])] { + let mut b = input(false, 0.0, has_type, sa); + b[DETAILS] = 0.04; // Anschlag + b[DETAILS + 1] = 3.0; // Bank beidseitig + let f = plan_opening(&b); + assert_eq!(tags(&f), vec![1.0, 2.0, 2.0], "Lücke + zwei Striche"); + let mut ys: Vec = lines(&f).iter().map(|l| { + assert!((l.3 - l.5).abs() < 1e-9 && (l.2 - 1.0).abs() < 1e-9 && (l.4 - 1.9).abs() < 1e-9, "quer durch die Öffnung: {l:?}"); + l.3 + }).collect(); + ys.sort_by(f64::total_cmp); + assert!((ys[0] + 0.15).abs() < 1e-9 && (ys[1] - 0.15).abs() < 1e-9, "Wandfluchten: {ys:?}"); + } } #[test] @@ -751,9 +774,13 @@ mod tests { assert_eq!(count_cls(&f, C_GLASS), 2); b[KIND] = 3.0; assert_eq!(arcs(&plan_opening(&b)), 2); - // Grob: keine Bögen, aber beide Blätter. + // Grob: Bögen und beide Blätter; Übersicht (1:500): keine Bögen. b[9] = 0.0; let f = plan_opening(&b); + assert_eq!(arcs(&f), 2); + assert_eq!(count_cls(&f, C_LEAF), 2); + b[9] = -1.0; + let f = plan_opening(&b); assert_eq!(arcs(&f), 0); assert_eq!(count_cls(&f, C_LEAF), 2); } diff --git a/src-tauri/core/src/plan/svg.rs b/src-tauri/core/src/plan/svg.rs index 9cd116b1..e8938c59 100644 --- a/src-tauri/core/src/plan/svg.rs +++ b/src-tauri/core/src/plan/svg.rs @@ -187,13 +187,14 @@ pub fn plan_svg(parts: &mut [Part], o: &SvgOptions) -> Option { out.push(String::new()); stitch.add(attrs.clone(), run, out.len() - 1); } - continue; + } else { + out.push(format!( + "", + num(f[2] * mm_to_m), + op(greyed, opacity(4)) + )); } - out.push(format!( - "", - num(f[2] * mm_to_m), - op(greyed, opacity(4)) - )); + // [140] Schraffur auch bei Kantenläufen (Wandschichten mit offenen Kanten). if o.hatch && f[3] >= 0.0 { let (_, h, color) = hatches.get(whole(f[3])?)?.clone(); if h.pattern != Pattern::None && h.pattern != Pattern::Solid && h.kind != hatch::HatchKind::Image { diff --git a/src-tauri/core/src/plan/walls.rs b/src-tauri/core/src/plan/walls.rs index 84d4107f..c2aa2ec1 100644 --- a/src-tauri/core/src/plan/walls.rs +++ b/src-tauri/core/src/plan/walls.rs @@ -388,6 +388,8 @@ fn opening_symbol(c: &Ctx, out: &mut Vec, w: &Wall, o: &Opening, colo ]; let b01 = |b: bool| if b { 1.0 } else { 0.0 }; let detail_code = match detail { + // [140] Übersicht (1:500 und kleiner): Türen ohne Aufschlag-Bogen. + Detail::Grob if c.a.scale >= super::domains::OVERVIEW_FROM => -1.0, Detail::Grob => 0.0, Detail::Mittel => 1.0, Detail::Fein => 2.0, diff --git a/src-tauri/core/src/queries.rs b/src-tauri/core/src/queries.rs index a2a9f6ba..5348007f 100644 --- a/src-tauri/core/src/queries.rs +++ b/src-tauri/core/src/queries.rs @@ -240,14 +240,16 @@ pub fn run_bin(p: &Project, name: &str, args: &[f64], text: &str) -> Result= 2 => { let mut a = domains::PlanArgs::parse(1.0, "{}")?; a.scale = args[0]; let c = domains::Ctx::new(p, &a); + let flags = if args[1].is_finite() && args[1] >= 0.0 { args[1] as u32 } else { 0 }; // Strichstärken nach Massstab wie im übrigen Plan. - let post = Some(crate::plan::extras::Post { mono: false, lw: crate::plan::extras::line_weight_factor(p, args[0]), sketch: 0.0 }).filter(crate::plan::extras::Post::active); - buf_with(post, |sink| drawings::underlay_lines(&c, &args[2..], args[1] != 0.0, sink)) + let post = Some(crate::plan::extras::Post { mono: flags & 2 != 0, lw: crate::plan::extras::line_weight_factor(p, args[0]), sketch: 0.0 }).filter(crate::plan::extras::Post::active); + buf_with(post, |sink| drawings::underlay_lines(&c, &args[2..], flags & 1 != 0, sink)) } // Primitive einer Zeichnung (JSON in `text`, ohne Override-Regeln) beim Massstab `args[0]`. ("drawingPrims", 1) => { diff --git a/src/cli/main.ts b/src/cli/main.ts index 75c23c80..338307e1 100644 --- a/src/cli/main.ts +++ b/src/cli/main.ts @@ -5,10 +5,11 @@ // dossier-cli info // dossier-cli validate // dossier-cli migrate [--out neu.obp] -// dossier-cli plan [--level EG] [--ceiling] [--scale 100] [--sketch] [--hatch] [--format svg|json] [--out eg.svg] +// dossier-cli plan [--level EG] [--ceiling] [--scale 100] [--sketch] [--hatch] [--color] [--format svg|json] [--out eg.svg] // json = render2d-Szene (planToRenderScene) -// dossier-cli section [--sketch] [--hatch] [--out schnitt.svg] (--format json: render2d-Szene) -// dossier-cli elevation [--sketch] [--hatch] [--out ansicht.svg] (--sketch: Skizzenstil [67]) +// dossier-cli section [--sketch] [--hatch] [--color] [--out schnitt.svg] (--format json: render2d-Szene) +// dossier-cli elevation [--sketch] [--hatch] [--color] [--out ansicht.svg] (--sketch: Skizzenstil [67]) +// --color: Darstellung „Farbig" statt Tusche (Standard, [140]) // dossier-cli ifc [--ebkph] [--ebenen] (IFC mit eBKP-H-Hauptgruppen bzw. Modell-Ebenen als Klassifikation) // --schema 4|2x3: IFC4 (Standard) oder IFC2x3 (Coordination View 2.0) // dossier-cli dxf [--binary] [--scale 100] [--dim-unit cm] [--layout]|dwg|ifc|step|obj|stl|glb|gltf|schedule [--openings|--elements] [--format json|csv|svg|pdf]|kennzahlen [--sia416] [--ivhb] [--format json|csv|svg|pdf] [--agsf m2] [--gruenflaeche m2] [--agf-basis gf|ngf|nf] [--untergeschosse]|raumprogramm [--import tabelle] [--sheet name|nr] [--mode replace|append] [--tolerance %] [--generate] [--format json|csv|svg|pdf] [--save projekt.obp]|sun [--level EG] [--out datei] @@ -446,6 +447,11 @@ async function importAny(path: string, args: Args): Promise { return fail(`Eingabeformat nicht unterstützt: .${ext} (obp, dxf, dwg, ifc, pdf, obj, stl, gltf, glb, ply)`); } +/** [140] Darstellung wie der App-Standard „Tusche" (Schwarz-Weiss); `--color` = „Farbig". */ +function inkArg(args: Args): boolean { + return !(args.flags.has("color") && args.flags.get("color") !== "false"); +} + /** `convert `: Eingabe nach Endung lesen, Ausgabe nach Endung schreiben, dann `--cmd` ausführen. */ async function convert(input: string | undefined, output: string | undefined, args: Args): Promise { if (!input || !output) { @@ -606,7 +612,7 @@ async function execute(project: Project, file: string, command: string, rest: st if (!own) planProject = { ...project, drawingLevels: [...project.drawingLevels, lvl] }; } // Massstab geht in die Plan-Erzeugung ein (Bemassung in Papier-mm, Strichstärken nach Massstab). - const plan = generatePlan(withSketch(planProject, lvl.id, args), lvl.id, allCodes, undefined, "mittel", false, false, true, scale); + const plan = generatePlan(withSketch(planProject, lvl.id, args), lvl.id, allCodes, undefined, "mittel", false, inkArg(args), true, scale); if (args.flags.get("format") === "json") { out(args, JSON.stringify(planToRenderScene(plan, scale)), `${lvl.name}.scene.json`); return 0; @@ -628,9 +634,9 @@ async function execute(project: Project, file: string, command: string, rest: st const o = await computeSection(sp, lvl); if (!o) fail("keine gültige Schnittlinie"); // Wie die App: verdeckte Kanten nach der Ebene, geschnittene Fenster/Türen. - plan = generateSectionPlan(o, false, { visibleCodes: allCodes, hiddenLines: lvl.hiddenLines, openings: true, scaleDenominator: scale }); + plan = generateSectionPlan(o, inkArg(args), { visibleCodes: allCodes, hiddenLines: lvl.hiddenLines, openings: true, scaleDenominator: scale }); } else { - plan = generateElevationPlan(sp, lvl, { scaleDenominator: scale }); + plan = generateElevationPlan(sp, lvl, { scaleDenominator: scale, mono: inkArg(args) }); if (!plan) fail("keine gültige Ansichtslinie"); } if (args.flags.get("format") === "json") { diff --git a/src/plan/generatePlan.ts b/src/plan/generatePlan.ts index 6e492661..274708db 100644 --- a/src/plan/generatePlan.ts +++ b/src/plan/generatePlan.ts @@ -243,11 +243,11 @@ export function generatePlan( /** * Kompakte Linien-Unterlage statt dauerhafter 'line'-Primitive (s. * {@link UnderlayGroup}) — NUR für die interaktive GPU-Ansicht. Aus bei - * Export/mono (reiner Schwarz-Weiss-Plan ohne Unterlage). + * Export/Druck. */ compactUnderlay = false, ): Plan { - const compact = compactUnderlay && !mono && !forPrint; + const compact = compactUnderlay && !forPrint; // Blatt-Ebene eines Layouts (Papier 1:1): ohne projektglobale Zutaten (Kontext, Luftbilder, // Schnittlinien, Schatten, Baurecht) — die gehören zum Modell, nicht aufs Papier. if (project.drawingLevels.some((l) => l.id === floorId && l.layoutId)) includeGlobal = false; @@ -275,12 +275,12 @@ export function generatePlan( // Kompakte Linien-Unterlage (s. {@link UnderlayGroup}): die Linien einfacher Zeichnungen fehlen // im Puffer und entstehen erst bei Bedarf, PRO KATEGORIE gruppiert — das Ein-/Ausblenden einer // Ebene entfernt dann nur deren Gruppe, die Chunks aller anderen Ebenen bleiben gültig. - const underlay = compact ? underlayGroups(project, dom, scaleDenominator) : []; + const underlay = compact ? underlayGroups(project, dom, scaleDenominator, mono) : []; // Georeferenzierte Luftbilder als Hintergrund-Ebenen (nur interaktive Ansicht, - // nicht Teil der Vektor-Primitive) — im Mono-Modus ausgeblendet (reiner S/W-Plan). + // nicht Teil der Vektor-Primitive) — auch in Schwarz-Weiss, dem Standard ([140]). // Projektglobal (nicht je Geschoss), s. `includeGlobal` oben. - const backgroundImages: PlanImage[] = !includeGlobal || mono + const backgroundImages: PlanImage[] = !includeGlobal ? [] : (project.context ?? []) .filter((o): o is Extract => o.type === "image") @@ -599,7 +599,7 @@ function readPlanMulti( * Domäne der 2D-Zeichnungen): je (gedimmt, Ebene) die Zeichnungen, deren Linien der Plan-Puffer * nicht enthält. `build` holt die Linien einer Teilmenge bei Bedarf (`drawingLines`). */ -function underlayGroups(project: Project, dom: DomainPrims, scaleDenominator: number): UnderlayGroup[] { +function underlayGroups(project: Project, dom: DomainPrims, scaleDenominator: number, mono: boolean): UnderlayGroup[] { const bytes = documentFor(project).queryBin("drawingUnderlay", [1], dom.args); if (bytes.byteLength % 8 !== 0) throw new Error("drawingUnderlay: unerwartete Antwort"); const f = new Float64Array(bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength)); @@ -614,7 +614,7 @@ function underlayGroups(project: Project, dom: DomainPrims, scaleDenominator: nu return index.get(d); }; // Alles, wovon `build` abhängt: ändert sich eine davon, werden die GPU-Chunks neu erzeugt. - const ctx = [project.lineStyles, project.hatches, layersStyleSig(project.layers), scaleDenominator, project.overrideRules, project.scaleLineWeights]; + const ctx = [project.lineStyles, project.hatches, layersStyleSig(project.layers), scaleDenominator, project.overrideRules, project.scaleLineWeights, mono]; const out: UnderlayGroup[] = []; let k = 1; for (let g = 0; g < f[0]; g++) { @@ -624,7 +624,8 @@ function underlayGroups(project: Project, dom: DomainPrims, scaleDenominator: nu for (let i = 0; i < n; i++) drawings[i] = all[f[k + 2 + i]]; k += 2 + n; const buildBuf = (list: Drawing2D[]): DecodedPlanBuf => { - const args = [scaleDenominator, catGreyed ? 1 : 0]; + // Schalter: Bit 1 = gedimmt, Bit 2 = Schwarz-Weiss ([140]). + const args = [scaleDenominator, (catGreyed ? 1 : 0) + (mono ? 2 : 0)]; for (const d of list) { const i = indexOf(d); if (i !== undefined) args.push(i); diff --git a/src/state/viewSlice.ts b/src/state/viewSlice.ts index 99d2e05a..e9ed5b9d 100644 --- a/src/state/viewSlice.ts +++ b/src/state/viewSlice.ts @@ -41,8 +41,8 @@ export interface ViewSlice { // nicht im Projekt) und der Abstand je Geschoss in Metern. explode3d: boolean; explode3dGap: number; - // Farb-Modus des Grundrisses: "color" = Kategorie-/Element-Farben (heute), - // "mono" = reiner Schwarz-Weiss-Plan (Tinte, keine Farb-/Schraffurfarben). + // Farb-Modus von Grundriss/Schnitt/Ansicht: "mono" = Tusche (Standard, [140]: Schwarz/Grau, bunte + // Farben werden Tinte bzw. Papier, Grautöne wie Schatten bleiben), "color" = „Farbig" (Materialfarben). planColorMode: "color" | "mono"; // Wand-Achslinien im Grundriss. referenceLines: boolean; @@ -97,7 +97,7 @@ export function createViewSlice(api: StoreApi): ViewSlice { grid3dVisible: true, explode3d: false, explode3dGap: 3, - planColorMode: "color", + planColorMode: "mono", referenceLines: false, lineMode: "display", scaleDenominator: 100,