diff --git a/TODO.md b/TODO.md index 5950a3f4..c4516ac5 100644 --- a/TODO.md +++ b/TODO.md @@ -325,6 +325,18 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `* ## Schnitt und Ansicht +- ◐ **[184]** Fenster/Türen im Schnitt und in der Ansicht nach Detailgrad wie im Grundriss (11.11., Wunsch Maintainer). + EINE Auflösung `model_view::Options::opening_detail`/`section_look` (Element-Detailgrad > Stufe > Basis; Fenster + „Vereinfacht" = grob; ohne Stufe der Massstab-Detailgrad des Grundrisses, mittel ab 1:200 = grob, `for_view_scaled`). + Schnitt grob: NUR ein Strich in der Öffnung (Rahmenmitte), kein Rahmen/Fensterbank/Sturz-Fläche/Storen (Sturz und + Brüstung = Wandschnitt); Tür grob: Öffnung + Blatt als ein Strich. Mittel: Rechteck-Rahmen oben/unten + Glaslinie, + Fensterbank als einfache Fläche, Tür-Blatt als Fläche. Fein: volles Profil wie bisher. Storenkasten im Schnitt nur + mit `windows.shadingBox` (Basis aus). `sectionDetail` der Stufe ist jetzt optional (ja = voll, nein = höchstens + mittel, fehlt = Detailgrad). Ansicht: Fensterteilung folgt dem Detailgrad (grob/vereinfacht: keine), `elevationDivision` + geht vor. 11.11. Nachbesserung: grob = Sturz unten und Brüstung oben im Wandschnitt FLACH (kein Anschlag, keine Nase, + kein Schichteinzug [168]; `Visibility.flat_openings` aus `section_look == Line`, im Cache-Schlüssel, `section/bands.rs` + `section_reveal`, `parallel_reveal_cuts`); Grundriss grob: Leibung gerade, keine Anschlag-Nasen (Wand-Nasen in + `walls.rs`, Tür-Nasen in `plan/openings.rs`). Offen: Ansicht-Details (Rahmen/Laibung) nach Stufe; nicht in der Tauri-App geprüft. - ◐ **[178]** Deckenauflager an Aussenwänden (11.11., Wunsch Maintainer). Decke endet an der Aussenkante des Kerns ([33] `layer_positions`), Aussendämmung/Putz laufen an der Stirn durch — abgeleitet, Umriss bleibt (`model3d/bearing.rs`: Platten-Umriss minus Aussenschicht-Streifen, wo vor der Wand keine Decke liegt → `emit_slabs` diff --git a/src-tauri/core/src/model/generated.rs b/src-tauri/core/src/model/generated.rs index 07b49f8a..1bcdaf67 100644 --- a/src-tauri/core/src/model/generated.rs +++ b/src-tauri/core/src/model/generated.rs @@ -2222,7 +2222,7 @@ pub struct ModelViewDoors { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub threshold: Option, - /// Zarge, Blatt und Sturz im Schnitt (Basis: ja; nein = nur das Blatt). + /// Zarge, Blatt und Sturz im Schnitt: ja = voll, nein = höchstens das Blatt; ohne Wert folgt es dem Detailgrad (grob: Blatt als Strich). #[serde(rename = "sectionDetail", default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub section_detail: Option, @@ -2277,11 +2277,11 @@ pub struct ModelViewWindows { #[serde(rename = "lintelLine", default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub lintel_line: Option, - /// Rahmen, Kämpfer, Sturz, Fensterbank und Storen im Schnitt (Basis: ja; nein = Rahmen und Glas). + /// Rahmen, Kämpfer, Sturz, Fensterbank im Schnitt: ja = voll, nein = höchstens einfacher Rahmen und Glas; ohne Wert folgt es dem Detailgrad (grob: ein Strich, mittel: einfach, fein: voll). #[serde(rename = "sectionDetail", default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub section_detail: Option, - /// Fensterteilung (Flügel, Sprossen, Kämpfer) in der Ansicht (Basis: ja). + /// Fensterteilung (Flügel, Sprossen, Kämpfer) in der Ansicht; ohne Wert folgt sie dem Detailgrad (grob: keine). #[serde(rename = "elevationDivision", default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub elevation_division: Option, diff --git a/src-tauri/core/src/plan/elevation/mod.rs b/src-tauri/core/src/plan/elevation/mod.rs index c0f00d11..a5c3a614 100644 --- a/src-tauri/core/src/plan/elevation/mod.rs +++ b/src-tauri/core/src/plan/elevation/mod.rs @@ -297,7 +297,7 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool, // Ansichtsfarbe und -schraffur ([100]) der sichtbaren Bauteilseite. let (mut pattern_lines, mut pattern_styles) = surface_patterns(p, &mut faces, &frame, scale, mono); // [173] Öffnungslinien der Fenster nach der Modelldarstellung der Ebene (Element und Typ gehen vor). - let mvo = crate::plan::model_view::for_view(p, level.model_view.as_deref(), crate::plan::style::Detail::Mittel, scale); + let mvo = crate::plan::model_view::for_view_scaled(p, level.model_view.as_deref(), crate::plan::style::Detail::Mittel, scale); let win = &mvo.window; let mut openings = collect_openings(p, &frame, win); // [180] Öffnungen nach ihrer Klasse und der ihres Wirts (Wand, Dach): ausgeblendet ⇒ ohne Öffnung. @@ -312,8 +312,10 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool, openings.retain(|op| all.iter().find(|o| o.id == op.id).is_none_or(|o| shown(&o.category_code) && host_shown(o))); } // [173] Fensterteilung (Flügel, Sprossen, Kämpfer) nach der Modelldarstellung. - if !win.elevation_division { - for op in openings.iter_mut().filter(|op| p.openings.as_deref().unwrap_or(&[]).iter().any(|o| o.id == op.id && o.kind != ElementKind::Door)) { + // [184] Ohne ausdrückliche Wahl folgt sie dem Detailgrad der Öffnung wie Grundriss und Schnitt (grob/vereinfacht: keine). + for op in openings.iter_mut() { + let Some(o) = p.openings.as_deref().unwrap_or(&[]).iter().find(|o| o.id == op.id && o.kind != ElementKind::Door) else { continue }; + if !win.elevation_division.unwrap_or_else(|| mvo.opening_detail(false, o.detail_level) != crate::plan::style::Detail::Grob) { op.divisions.clear(); op.sash_rects.clear(); } diff --git a/src-tauri/core/src/plan/model_view.rs b/src-tauri/core/src/plan/model_view.rs index 918204fa..722863be 100644 --- a/src-tauri/core/src/plan/model_view.rs +++ b/src-tauri/core/src/plan/model_view.rs @@ -84,8 +84,9 @@ pub struct DoorOpts { pub leaf_rect: bool, /// Schwelle im Grundriss. pub threshold: Threshold, - /// Zarge, Blatt und Sturz im Schnitt (sonst nur das Blatt). - pub section_detail: bool, + /// [184] Zarge, Blatt und Sturz im Schnitt: `Some(true)` voll, `Some(false)` höchstens vereinfacht (nur das + /// Blatt); `None` = folgt dem Detailgrad (s. [`Options::section_look`]). + pub section_detail: Option, } /// Schwelle der Türen im Grundriss. @@ -133,10 +134,11 @@ pub struct WindowOpts { pub shading_box: bool, /// Sturzlinie im Grundriss. pub lintel_line: bool, - /// Rahmen, Kämpfer, Sturz, Fensterbank und Storen im Schnitt (sonst Rahmen und Glas). - pub section_detail: bool, - /// Fensterteilung (Flügel, Sprossen, Kämpfer) in der Ansicht. - pub elevation_division: bool, + /// [184] Rahmen, Kämpfer, Sturz, Fensterbank im Schnitt: `Some(true)` voll, `Some(false)` höchstens vereinfacht + /// (Rahmen und Glas); `None` = folgt dem Detailgrad (s. [`Options::section_look`]). + pub section_detail: Option, + /// Fensterteilung (Flügel, Sprossen, Kämpfer) in der Ansicht: `None` = folgt dem Detailgrad (grob/vereinfacht: keine). + pub elevation_division: Option, } impl WindowOpts { @@ -324,7 +326,51 @@ pub struct Options { pub dims: DimOpts, } +/// [184] Wie ein geschnittenes Fenster/eine geschnittene Tür im Schnitt aussieht (Stufen wie im Grundriss). +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] +pub enum SectionLook { + /// Grob: Leibungen offen, ein Strich in der Rahmenmitte (Tür: Blatt als Linie); kein Profil, kein Sturz. + Line, + /// Mittel: Rechteck-Rahmen und Glaslinie (Tür: Blatt), Fensterbank als einfache Fläche; kein Sturz, kein Kämpfer. + Simple, + /// Fein: volles Profil mit Sturz, Kämpfer, Fensterbank. + Full, +} + impl Options { + /// [184] EINE Auflösung des Detailgrads einer Öffnung für Grundriss, Schnitt und Ansicht: Element-Detailgrad > + /// Detailgrad der Ansicht (Modelldarstellung über Basis, im Grundriss massstabsabhängig); bei Fenstern übersteuert + /// „Vereinfacht (3 Linien)" alles mit grob. Der Grundriss löst den Element-Detailgrad vorab auf + /// ([`Options::element_detail`]) und wendet danach nur die „Vereinfacht"-Regel an (`element: None`). + pub fn opening_detail(&self, door: bool, element: Option) -> Detail { + if !door && self.window.simplified { + Detail::Grob + } else { + self.element_detail(element) + } + } + + /// Detailgrad eines Elements mit eigenem Detailgrad (sonst der der Ansicht). + pub fn element_detail(&self, element: Option) -> Detail { + element.and_then(detail_of).unwrap_or(self.detail) + } + + /// [184] Schnittdarstellung einer Öffnung: aus dem Detailgrad ([`Options::opening_detail`]; grob → Linie, mittel → + /// einfach, fein → voll); die Option „Schnittdetail" der Stufe geht vor (ja = voll, nein = höchstens einfach). + pub fn section_look(&self, door: bool, element: Option) -> SectionLook { + let base = match self.opening_detail(door, element) { + Detail::Grob => SectionLook::Line, + Detail::Mittel => SectionLook::Simple, + Detail::Fein => SectionLook::Full, + }; + let opt = if door { self.door.section_detail } else { self.window.section_detail }; + match opt { + Some(true) if door || !self.window.simplified => SectionLook::Full, + Some(false) => base.min(SectionLook::Simple), + _ => base, + } + } + /// Schnittflächen schraffiert: Ebene > Modelldarstellung > nein. pub fn cut_hatch(&self, level: Option) -> bool { level.or(self.wall.cut_hatch_mv).unwrap_or(false) @@ -376,6 +422,18 @@ pub fn for_view(p: &Project, id: Option<&str>, detail: Detail, scale: f64) -> Op resolve(id.and_then(|id| find(p, id)), detail, scale) } +/// [184] Wie [`for_view`], mit dem massstabsabhängigen Detailgrad des Grundrisses ([140]: „mittel" ab 1:200 wie „grob"): +/// für Schnitt und Ansicht, deren Öffnungen wie im Grundriss aufgelöst werden. +pub fn for_view_scaled(p: &Project, id: Option<&str>, detail: Detail, scale: f64) -> Options { + let o = for_view(p, id, detail, scale); + let (d, _) = super::domains::effective_detail(o.detail, scale); + if d == o.detail { + o + } else { + resolve(id.filter(|s| !s.is_empty()).and_then(|id| find(p, id)), d, scale) + } +} + fn layer_mode(m: Option) -> LayerMode { match m { Some(ModelViewLayers::All) => LayerMode::All, @@ -437,7 +495,7 @@ pub fn resolve(mv: Option<&ModelViewOption>, detail: Detail, scale: f64) -> Opti Some(ModelViewThreshold::All) => Threshold::All, _ => Threshold::Off, }, - section_detail: d.and_then(|d| d.section_detail).unwrap_or(true), + section_detail: d.and_then(|d| d.section_detail), }, window: WindowOpts { sash_symbols_mv: w.and_then(|w| w.sash_symbols), @@ -447,8 +505,8 @@ pub fn resolve(mv: Option<&ModelViewOption>, detail: Detail, scale: f64) -> Opti simplified: w.and_then(|w| w.simplified).unwrap_or(false), shading_box: w.and_then(|w| w.shading_box).unwrap_or(false), lintel_line: w.and_then(|w| w.lintel_line).unwrap_or(false), - section_detail: w.and_then(|w| w.section_detail).unwrap_or(true), - elevation_division: w.and_then(|w| w.elevation_division).unwrap_or(true), + section_detail: w.and_then(|w| w.section_detail), + elevation_division: w.and_then(|w| w.elevation_division), }, stair: StairOpts { walk_line: s.and_then(|s| s.walk_line).unwrap_or(true), diff --git a/src-tauri/core/src/plan/model_view_tests2.rs b/src-tauri/core/src/plan/model_view_tests2.rs index 86b789fa..b0c1974b 100644 --- a/src-tauri/core/src/plan/model_view_tests2.rs +++ b/src-tauri/core/src/plan/model_view_tests2.rs @@ -160,7 +160,7 @@ fn schnitt_oeffnungsdetail() { t.lintel_height = Some(0.2); t.sill_board = Some(WindowTypeSillBoard::Beide); } - let ops = |p: &Project| count(§ion(p, 50.0, "mittel"), |q| matches!(q, Primitive::Polygon { opening_id: Some(_), .. } | Primitive::Line { opening_id: Some(_), .. })); + let ops = |p: &Project| count(§ion(p, 50.0, "fein"), |q| matches!(q, Primitive::Polygon { opening_id: Some(_), .. } | Primitive::Line { opening_id: Some(_), .. })); let n0 = ops(&p); let mut q = with_mv(p.clone(), serde_json::json!({"windows": {"sectionDetail": false}, "doors": {"sectionDetail": false}})); set_level_mv(&mut q, "schnitt-a", "mv"); @@ -418,3 +418,45 @@ fn grundriss_dach_geschnitten_schichten() { p.roofs.as_mut().unwrap()[0].base_elevation = None; assert!(cut_polys(&p, 50.0).is_empty()); } + +/// [184] (Profil-Flächen, Linien) der geschnittenen Öffnung O1 im Schnitt. +fn o1_parts(p: &Project, scale: f64, detail: &str) -> (usize, usize) { + let s = section(p, scale, detail); + let profiles = count(&s, |q| matches!(q, Primitive::Polygon { opening_id: Some(id), fill, .. } if id == "O1" && fill != "none")); + let lines = count(&s, |q| matches!(q, Primitive::Line { opening_id: Some(id), .. } if id == "O1")); + (profiles, lines) +} + +#[test] +fn schnitt_fenster_stufen_wie_grundriss() { + let mut p = through_window(sample()); + for t in p.window_types.iter_mut().flatten() { + t.lintel_height = Some(0.2); + t.sill_board = Some(WindowTypeSillBoard::Beide); + } + // 1:200 mittel gilt wie im Grundriss als grob: nur ein Strich, kein Profil. + assert_eq!(o1_parts(&p, 200.0, "mittel"), (0, 1), "1:200 grob: ein Mittelstrich"); + assert_eq!(o1_parts(&p, 50.0, "grob"), (0, 1)); + // Mittel: einfacher Rahmen + Glaslinie + Fensterbank als Fläche; fein: volles Profil (mehr Flächen: Sturz). + let (mp, ml) = o1_parts(&p, 50.0, "mittel"); + let (fp, fl) = o1_parts(&p, 50.0, "fein"); + assert!(mp >= 2 && ml == 1, "mittel: Rahmen {mp}, Linien {ml}"); + assert!(fp > mp && fl >= 1, "fein: Profil {fp} > mittel {mp}"); + // Stufe mit „Vereinfacht" macht auch bei 1:50 fein einen Strich. + let mut q = with_mv(p.clone(), serde_json::json!({"baseDetail": "fein", "windows": {"simplified": true}})); + set_level_mv(&mut q, "schnitt-a", "mv"); + assert_eq!(o1_parts(&q, 50.0, "fein"), (0, 1), "simplified: grob"); +} + +#[test] +fn schnitt_storenkasten_nur_mit_option() { + let mut p = through_window(sample()); + for t in p.window_types.iter_mut().flatten() { + t.shading = Some(serde_json::from_value(serde_json::json!({"create": true, "mount": "vorgesetzt", "box": {"width": 1.0, "height": 0.2, "depth": 0.15}})).unwrap()); + } + let n = |p: &Project| o1_parts(p, 50.0, "fein").0; + let n0 = n(&p); + let mut q = with_mv(p.clone(), serde_json::json!({"baseDetail": "fein", "windows": {"shadingBox": true}})); + set_level_mv(&mut q, "schnitt-a", "mv"); + assert!(n(&q) > n0, "Storenkasten nur mit Option ({} > {n0})", n(&q)); +} diff --git a/src-tauri/core/src/plan/openings.rs b/src-tauri/core/src/plan/openings.rs index 3502476d..b3503047 100644 --- a/src-tauri/core/src/plan/openings.rs +++ b/src-tauri/core/src/plan/openings.rs @@ -238,7 +238,10 @@ fn plan_opening_inner(buf: &[f64]) -> Option> { } if has_frame { let zone = frame_band(&mut o, &w, position, width, frame_width, frame_block, frame_inset, frame_inset_side, hair); - rebate_nibs(&mut o, &w, position, width, rebate, zone); + // [184] Grob: Leibung gerade durchgezogen, keine Anschlag-Nase. + if detail != Detail::Grob { + rebate_nibs(&mut o, &w, position, width, rebate, zone); + } } if lintel != 0 { let half_d = total / 2.0; diff --git a/src-tauri/core/src/plan/section/bands.rs b/src-tauri/core/src/plan/section/bands.rs index d1ab4a02..e499b965 100644 --- a/src-tauri/core/src/plan/section/bands.rs +++ b/src-tauri/core/src/plan/section/bands.rs @@ -347,7 +347,7 @@ fn split_layers_along(cp: &Cut, p: &Project, layers: &[Layer], owner: &Wall, u_w } /// `splitWallLayers`: stehende Teil-Rechtecke je Schicht quer zur Dicke (u). -pub(super) fn split_wall_layers(cp: &Cut, p: &Project, layers: &[Layer], owner: &Wall, u_world: (f64, f64), plane: &Plane) -> Result, String> { +pub(super) fn split_wall_layers(cp: &Cut, p: &Project, layers: &[Layer], owner: &Wall, u_world: (f64, f64), plane: &Plane, flat: &HashSet) -> Result, String> { let total = sum_thickness(layers); let [u_min, u_max, v_min, v_max] = bbox(&cp.pts); let u_span = u_max - u_min; @@ -364,7 +364,7 @@ pub(super) fn split_wall_layers(cp: &Cut, p: &Project, layers: &[Layer], owner: let mut out = Vec::with_capacity(layers.len()); // [106] Schichteinzug am Sturz (Stück liegt über der Öffnung) bzw. an der Brüstung (darunter), // [94] Anschlag: die Schichten vor dem Rahmen reichen um die Anschlagtiefe in die Öffnung. - let (top, bottom) = section_reveal(p, owner, plane, v_min, v_max); + let (top, bottom) = section_reveal(p, owner, plane, v_min, v_max, flat); let n = layers.len(); let offsets: Vec = layers.iter().scan(0.0, |acc, l| { let o = *acc; *acc += l.thickness; Some(o) }).collect(); let mut acc = 0.0; @@ -444,13 +444,13 @@ pub(super) fn split_wall_layers(cp: &Cut, p: &Project, layers: &[Layer], owner: } /// Anschlag-Nasen eines einschaligen Wandbands (ganze Dicke als eine Schicht). -fn single_layer_nibs(p: &Project, owner: &Wall, cp: &Cut, u_world: (f64, f64), plane: &Plane) -> Vec<[f64; 4]> { +fn single_layer_nibs(p: &Project, owner: &Wall, cp: &Cut, u_world: (f64, f64), plane: &Plane, flat: &HashSet) -> Vec<[f64; 4]> { let total = sum_thickness(&p.wall_type_or_fallback(owner).layers); let [u_min, u_max, v_min, v_max] = bbox(&cp.pts); if !(total > 1e-9 && u_max - u_min > 1e-9) { return Vec::new(); } - let (top, bottom) = section_reveal(p, owner, plane, v_min, v_max); + let (top, bottom) = section_reveal(p, owner, plane, v_min, v_max, flat); if top.is_none() && bottom.is_none() { return Vec::new(); } @@ -536,7 +536,7 @@ fn rebate_nibs(top: &Option, bottom: &Option, (l0, l1): (f64 /// Schichteinzug und Anschlag der Öffnung, deren Sturz (unten an `v_min`) bzw. Brüstung (oben an `v_max`) /// dieses Wandstück ist und die die Schnittebene quert. -fn section_reveal(p: &Project, wall: &Wall, plane: &Plane, v_min: f64, v_max: f64) -> (Option, Option) { +fn section_reveal(p: &Project, wall: &Wall, plane: &Plane, v_min: f64, v_max: f64, flat: &HashSet) -> (Option, Option) { let (mut top, mut bottom) = (None, None); let u_raw = plane.u_model(); let l = hypot2(u_raw.0, u_raw.1); @@ -547,6 +547,10 @@ fn section_reveal(p: &Project, wall: &Wall, plane: &Plane, v_min: f64, v_max: f6 // Bogenwand: `wall` ist hier die Sehnen-Teilwand (mit Bulge) — die Öffnung sitzt auf der echten Wand. let host = p.walls.iter().find(|w| w.id == wall.id).unwrap_or(wall); for o in p.openings_of_wall(&wall.id) { + // [184] Grob: nur ein Strich, Sturz und Brüstung des Wandschnitts bleiben flach (kein Anschlag, kein Einzug). + if flat.contains(&o.id) { + continue; + } // Bogenwand ([T2]): Einzug auf der Sehne zwischen den Laibungen. let chord = arc_chord_opening(host, o); let (wall, o) = match &chord { @@ -584,7 +588,7 @@ fn section_reveal(p: &Project, wall: &Wall, plane: &Plane, v_min: f64, v_max: f6 } /// `attachCutStyles`: Stil, Herkunft, Schicht-Bänder, Terminierung, Dominanz. -pub(super) fn attach_cut_styles(cuts: Vec, p: &Project, plane: &Plane, walls: &[Option<&Wall>], slabs: &[SlabOwner]) -> Result, String> { +pub(super) fn attach_cut_styles(cuts: Vec, p: &Project, plane: &Plane, walls: &[Option<&Wall>], slabs: &[SlabOwner], flat: &HashSet) -> Result, String> { if cuts.is_empty() { return Ok(cuts); } @@ -606,7 +610,7 @@ pub(super) fn attach_cut_styles(cuts: Vec, p: &Project, plane: &Plane, wall if let Some(o) = owner { let wt = p.wall_type_or_fallback(o); if wt.layers.len() > 1 { - bands.extend(split_wall_layers(&cp, p, &wt.layers, o, u_world, plane)?); + bands.extend(split_wall_layers(&cp, p, &wt.layers, o, u_world, plane, flat)?); continue; } } @@ -617,7 +621,7 @@ pub(super) fn attach_cut_styles(cuts: Vec, p: &Project, plane: &Plane, wall cp.join_priority = owner.and_then(|o| wall_representative_priority(p, o)); cp.component_id = owner.and_then(|o| wall_representative_component_id(p, o)); // [94] Anschlag-Nase der einschaligen Wand: Band und Nase als ein Umriss. - let nibs = owner.map(|o| single_layer_nibs(p, o, &cp, u_world, plane)).unwrap_or_default(); + let nibs = owner.map(|o| single_layer_nibs(p, o, &cp, u_world, plane, flat)).unwrap_or_default(); if !nibs.is_empty() { let mut polys = vec![vec![cp.pts.clone()]]; polys.extend(nibs.iter().map(|r| vec![vec![[r[0], r[3]], [r[1], r[3]], [r[1], r[2]], [r[0], r[2]]]])); diff --git a/src-tauri/core/src/plan/section/mod.rs b/src-tauri/core/src/plan/section/mod.rs index b49eeadb..34c72921 100644 --- a/src-tauri/core/src/plan/section/mod.rs +++ b/src-tauri/core/src/plan/section/mod.rs @@ -174,6 +174,9 @@ pub struct Visibility { pub has_display: bool, pub norender: HashSet, pub grey: HashSet, + /// [184] Öffnungen, die im Schnitt nur als Strich erscheinen (grob): im Wandschnitt an Sturz und Brüstung + /// weder Anschlag-Nase noch Schichteinzug (flache Kante). Vom Aufrufer aus dem Detailgrad gefüllt (`query.rs`). + pub flat_openings: HashSet, } impl Visibility { @@ -185,6 +188,7 @@ impl Visibility { has_display: v.get("hasDisplay").and_then(|b| b.as_bool()).unwrap_or(false), norender: set("norender"), grey: set("grey"), + flat_openings: HashSet::new(), } } /// `visibleCodes.has(code)` (ohne `visibleCodes`: wahr). @@ -614,7 +618,7 @@ pub(super) fn compute_plane(p: &Project, level: &LevelSpec, bodies: &[BodyMesh], let shown = |c: &str| vis.visible(c) && vis.render(c); let skip = |k: Kind, i: usize| edge_cats.get(&(k, i)).is_some_and(|c| !shown(c)); cuts.retain(|c| !skip(c.kind, c.index)); - let cuts = attach_cut_styles(cuts, p, &plane, &walls, &slabs)?; + let cuts = attach_cut_styles(cuts, p, &plane, &walls, &slabs, &vis.flat_openings)?; let cuts = merge_monolith_cuts(cuts, &slabs_r, &stair_flight_sections(p, plane.base(), plane.u_model())); let base = plane.base(); let u = plane.u_model(); @@ -624,7 +628,7 @@ pub(super) fn compute_plane(p: &Project, level: &LevelSpec, bodies: &[BodyMesh], bodies.retain(|b| !skip(Kind::Body, b.index)); let cuts = subtract_body_voids_in_section(cuts, &void_bodies, base, u); let cuts = subtract_pockets_in_section(cuts, p, base, u); - let mut cuts = parallel_reveal_cuts(cuts, p, &plane, &walls)?; + let mut cuts = parallel_reveal_cuts(cuts, p, &plane, &walls, &vis.flat_openings)?; append_body_sections(&mut cuts, p, &bodies, base, u); // [152] Netzkörper: geschnitten (Flächen bzw. offene Linien) und in der Projektion. Gelände ist ein eigenes // Element (`terrainMesh`, auch IFC-Gelände seit dem Import, [181]) und wird Geländelinie (`append_terrain_profiles`). diff --git a/src-tauri/core/src/plan/section/openings.rs b/src-tauri/core/src/plan/section/openings.rs index f2badabc..d59bf4f3 100644 --- a/src-tauri/core/src/plan/section/openings.rs +++ b/src-tauri/core/src/plan/section/openings.rs @@ -3,6 +3,7 @@ //! `section_plan_buf()` (`query.rs`). use super::*; +use crate::plan::model_view::{Options, SectionLook}; const OPENING_INK: &str = "#1f242c"; const FRAME_MM: f64 = 0.25; @@ -102,7 +103,8 @@ pub(crate) fn sashes_of_window_type(wt: &WindowType) -> Vec Result, String> { +fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection, look: SectionLook, shading_box: bool) -> Result, String> { + let full = look == SectionLook::Full; let wt = p.window_type(o); let fw = max(0.02, wt.and_then(|t| t.frame_width).unwrap_or(DEFAULT_FRAME_WIDTH)); let (_, n) = axis_frame(wall); @@ -171,9 +173,20 @@ fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection, detail: b let (sp, sh) = det.as_ref().map_or((0.0, 0.0), |f| (min(f.sill_profile, h / 4.0), min(f.shading_profile, h / 4.0))); let (fwb, fwt) = det.as_ref().map_or((fwv, fwv), |f| (min(max(0.02, f.sides.bottom), h / 3.0), min(max(0.02, f.sides.top), h / 3.0))); let mut out = vec![opening_poly(rect(c.u_at(c.face_min), c.u_at(c.face_max), c.z_bottom, c.z_top), false, &o.id)]; - // [173] Ohne Detail (Modelldarstellung): Rahmen oben/unten und eine Glaslinie, kein Sturz, keine - // Fensterbank, kein Kämpfer, keine Storen. - if !detail { + // [184] Grob: Leibungen offen (Wandschnitt) und ein Strich in der Rahmenmitte, kein Profil, kein Sturz, + // keine Fensterbank, keine Storen: nur der Strich. + if look == SectionLook::Line { + let u = (u0 + u1) / 2.0; + let mut l = line(v2(u, c.z_bottom), v2(u, c.z_top), "section-window-glass", GLASS_MM, OPENING_INK); + if let Primitive::Line { opening_id, .. } = &mut l { + *opening_id = Some(o.id.clone()); + } + out.push(l); + return Ok(out); + } + // [184] Mittel: einfacher Rahmen (Rechteck oben/unten) und eine Glaslinie; Fensterbank als einfache Fläche, + // kein Sturz, kein Kämpfer. + if !full { out.push(opening_poly(rect(u0, u1, c.z_bottom, c.z_bottom + fwv), true, &o.id)); out.push(opening_poly(rect(u0, u1, c.z_top - fwv, c.z_top), true, &o.id)); let u = (u0 + u1) / 2.0; @@ -182,6 +195,7 @@ fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection, detail: b *opening_id = Some(o.id.clone()); } out.push(l); + sill_and_shading(&mut out, p, o, c, (f_min, f_max), look, shading_box); return Ok(out); } let (zb0, zt0) = (c.z_bottom + sp, c.z_top - sh); @@ -225,43 +239,62 @@ fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection, detail: b } } if let Some(t) = wt { - // Formöffnung ([G3]): kein Sturz-Querschnitt, kein Storenkasten (Bogen/Schräge statt Sturz). - let shaped = crate::opening_shape::is_shaped(o); - let shading = t.shading.as_ref().filter(|s| s.create && !shaped); - let sturz_box = shading.filter(|s| s.mount == Some(WindowShadingMount::Sturz)).map_or(0.0, |s| max(0.0, s.r#box.depth)); - if !shaped { - lintel_cut(&mut out, o, c, t.lintel_height, sturz_box); + // Formöffnung ([G3]): kein Sturz-Querschnitt (Bogen/Schräge statt Sturz). + if !crate::opening_shape::is_shaped(o) { + lintel_cut(&mut out, o, c, t.lintel_height, sturz_box_depth(t, o, shading_box)); } - // Fensterbänke nur bei ausdrücklicher Wahl (bisherige Schnitte bleiben gleich). - let zb = c.z_bottom; + } + sill_and_shading(&mut out, p, o, c, (f_min, f_max), look, shading_box); + Ok(out) +} + +/// Tiefe des Storenkastens im Sturz (ab der Aussenfläche in die Wand), 0 = keiner (Option "Storenkasten" aus, +/// Formöffnung oder Kasten vorgesetzt). +fn sturz_box_depth(t: &WindowType, o: &Opening, shading_box: bool) -> f64 { + let shading = t.shading.as_ref().filter(|s| s.create && shading_box && !crate::opening_shape::is_shaped(o)); + shading.filter(|s| s.mount == Some(WindowShadingMount::Sturz)).map_or(0.0, |s| max(0.0, s.r#box.depth)) +} + +/// Fensterbaenke und Storenkasten im Schnitt. Fensterbaenke nur bei ausdruecklicher Wahl am Typ: fein mit Gefaelle, +/// sonst als einfache Flaeche. Der Storenkasten nur mit der Option "Storenkasten" der Modelldarstellung (Basis aus, +/// wie im Grundriss, [184]). +fn sill_and_shading(out: &mut Vec, p: &Project, o: &Opening, c: &CrossSection, frame: (f64, f64), look: SectionLook, shading_box: bool) { + let (f_min, f_max) = frame; + let Some(t) = p.window_type(o) else { return }; + let zb = c.z_bottom; + // Grob: keine Fensterbank (Wandschnitt genuegt). + if look != SectionLook::Line { if matches!(t.sill_board, Some(WindowTypeSillBoard::Aussen | WindowTypeSillBoard::Beide)) { - // Aussen: mit Gefälle, bis 4 cm vor die Aussenfläche. + // Aussen: bis 4 cm vor die Aussenfläche, fein mit Gefälle. let out_s = min(f_min, c.face_min) - 0.04; - let pts = vec![v2(c.u_at(f_min), zb), v2(c.u_at(out_s), zb - 0.015), v2(c.u_at(out_s), zb - 0.045), v2(c.u_at(f_min), zb - 0.03)]; + let pts = if look == SectionLook::Full { + vec![v2(c.u_at(f_min), zb), v2(c.u_at(out_s), zb - 0.015), v2(c.u_at(out_s), zb - 0.045), v2(c.u_at(f_min), zb - 0.03)] + } else { + rect(c.u_at(f_min), c.u_at(out_s), zb - 0.03, zb) + }; out.push(opening_poly(pts, true, &o.id)); } if matches!(t.sill_board, Some(WindowTypeSillBoard::Innen | WindowTypeSillBoard::Beide)) { let in_s = max(f_max, c.face_max) + 0.02; out.push(opening_poly(rect(c.u_at(f_max), c.u_at(in_s), zb - 0.025, zb), true, &o.id)); } - if let Some(sh) = shading { - let h = max(0.0, sh.r#box.height); - let d = max(0.0, sh.r#box.depth); - if h > 1e-4 && d > 1e-4 { - // Im Sturz: ab der Aussenfläche in die Wand; vorgesetzt: vor der Rahmen-Vorderkante. - let (s0, s1) = if sturz_box > 0.0 { (c.face_min, c.face_min + d) } else { (f_min - d, f_min) }; - out.push(opening_poly(rect(c.u_at(s0), c.u_at(s1), c.z_top, c.z_top + h), true, &o.id)); - // Lamellen-/Rollpaket im Kasten. - let m = min(0.02, d / 4.0); - let mut pack = polygon(rect(c.u_at(s0 + m), c.u_at(s1 - m), c.z_top + m, c.z_top + h * 0.6), SHADING_PACK_FILL, OPENING_INK, crate::plan::style::SYMBOL_LINE_MM, no_hatch_base()); - if let Primitive::Polygon { opening_id, .. } = &mut pack { - *opening_id = Some(o.id.clone()); - } - out.push(pack); - } - } } - Ok(out) + let Some(sh) = t.shading.as_ref().filter(|s| s.create && shading_box && !crate::opening_shape::is_shaped(o)) else { return }; + let sturz = sh.mount == Some(WindowShadingMount::Sturz); + let h = max(0.0, sh.r#box.height); + let d = max(0.0, sh.r#box.depth); + if h > 1e-4 && d > 1e-4 { + // Im Sturz: ab der Aussenfläche in die Wand; vorgesetzt: vor der Rahmen-Vorderkante. + let (s0, s1) = if sturz { (c.face_min, c.face_min + d) } else { (f_min - d, f_min) }; + out.push(opening_poly(rect(c.u_at(s0), c.u_at(s1), c.z_top, c.z_top + h), true, &o.id)); + // Lamellen-/Rollpaket im Kasten. + let m = min(0.02, d / 4.0); + let mut pack = polygon(rect(c.u_at(s0 + m), c.u_at(s1 - m), c.z_top + m, c.z_top + h * 0.6), SHADING_PACK_FILL, OPENING_INK, crate::plan::style::SYMBOL_LINE_MM, no_hatch_base()); + if let Primitive::Polygon { opening_id, .. } = &mut pack { + *opening_id = Some(o.id.clone()); + } + out.push(pack); + } } /// Sturz im Schnitt ([94]): eigener Querschnitt über der Öffnung (Beton grau), neben einem @@ -282,14 +315,23 @@ fn lintel_cut(out: &mut Vec, o: &Opening, c: &CrossSection, height: O out.push(pr); } -fn door_cut(p: &Project, o: &Opening, c: &CrossSection, detail: bool) -> Vec { +fn door_cut(p: &Project, o: &Opening, c: &CrossSection, look: SectionLook) -> Vec { let mut out = vec![opening_poly(rect(c.u_at(c.face_min), c.u_at(c.face_max), c.z_bottom, c.z_top), false, &o.id)]; - // [173] Ohne Detail (Modelldarstellung): nur das Blatt in der Wandmitte (Wandöffnung: nur die Lücke). - if !detail { + // [184] Ohne Detail (Modelldarstellung): grob das Blatt als Linie, mittel als Fläche, beide in der Wandmitte + // (Wandöffnung: nur die Lücke). + if look != SectionLook::Full { let kind = p.door_type(o).map(|t| t.kind); if o.door_type != Some(OpeningDoorType::Wandoeffnung) && kind != Some(DoorTypeKind::Wandoeffnung) { let mid = (c.face_min + c.face_max) / 2.0; - out.push(opening_poly(rect(c.u_at(mid - DOOR_LEAF_THICKNESS / 2.0), c.u_at(mid + DOOR_LEAF_THICKNESS / 2.0), c.z_bottom + 0.01, c.z_top), true, &o.id)); + if look == SectionLook::Line { + let mut l = line(v2(c.u_at(mid), c.z_bottom), v2(c.u_at(mid), c.z_top), "section-window-glass", GLASS_MM, OPENING_INK); + if let Primitive::Line { opening_id, .. } = &mut l { + *opening_id = Some(o.id.clone()); + } + out.push(l); + } else { + out.push(opening_poly(rect(c.u_at(mid - DOOR_LEAF_THICKNESS / 2.0), c.u_at(mid + DOOR_LEAF_THICKNESS / 2.0), c.z_bottom + 0.01, c.z_top), true, &o.id)); + } } return out; } @@ -357,13 +399,17 @@ fn door_frame_cut(out: &mut Vec, o: &Opening, c: &CrossSection, df: & } /// `sectionOpeningPrimitives`. +#[cfg(test)] pub fn section_opening_primitives(p: &Project, level: &LevelSpec, vis: &Visibility) -> Result, String> { - section_opening_primitives_mv(p, level, vis, true, true) + let mut o = crate::plan::model_view::resolve(None, crate::plan::style::Detail::Fein, 50.0); + o.window.shading_box = true; + section_opening_primitives_mv(p, level, vis, &o) } -/// [173] Wie [`section_opening_primitives`] mit dem Detail der Modelldarstellung: `doors`/`windows` = Zarge, -/// Sturz, Kämpfer, Fensterbank und Storen zeigen (sonst nur Blatt bzw. Rahmen und Glas). -pub fn section_opening_primitives_mv(p: &Project, level: &LevelSpec, vis: &Visibility, doors: bool, windows: bool) -> Result, String> { +/// [173]/[184] Geschnittene Öffnungen nach der Modelldarstellung `mv` (Detailgrad wie im Grundriss, Rangfolge Element > +/// Stufe > Basis, EINE Auflösung `Options::section_look`): grob Linie, mittel einfacher Rahmen, fein volles Profil; +/// Storenkasten nach `windows.shadingBox`. +pub fn section_opening_primitives_mv(p: &Project, level: &LevelSpec, vis: &Visibility, mv: &Options) -> Result, String> { let Some(plane) = level.plane() else { return Ok(Vec::new()) }; if level.kind != "section" { return Ok(Vec::new()); @@ -403,7 +449,7 @@ pub fn section_opening_primitives_mv(p: &Project, level: &LevelSpec, vis: &Visib None => (wall, o), }; let Some(c) = cross_section(p, wall, o, p0, u)? else { continue }; - let prims = if o.kind == ElementKind::Window { window_cut(p, wall, o, &c, windows)? } else { door_cut(p, o, &c, doors) }; + let prims = if o.kind == ElementKind::Window { window_cut(p, wall, o, &c, mv.section_look(false, o.detail_level), mv.window.shading_box)? } else { door_cut(p, o, &c, mv.section_look(true, o.detail_level)) }; let greyed = vis.greyed(&o.category_code); for pr in prims { out.push(if greyed { pr.with_greyed(true) } else { pr }); diff --git a/src-tauri/core/src/plan/section/query.rs b/src-tauri/core/src/plan/section/query.rs index 1ccdcdf9..3aeef6fa 100644 --- a/src-tauri/core/src/plan/section/query.rs +++ b/src-tauri/core/src/plan/section/query.rs @@ -48,7 +48,7 @@ fn cache_put(key: (f64, u64), o: std::rc::Rc) { pub fn section_plan_buf(p: &Project, args: &[f64], text: &str) -> Result, String> { let v: serde_json::Value = serde_json::from_str(text).map_err(|e| format!("Schnitt-Argumente: {e}"))?; let level = LevelSpec::from_json(v.get("level").unwrap_or(&serde_json::Value::Null)); - let vis = Visibility::from_json(&v); + let mut vis = Visibility::from_json(&v); let mono = args.first().is_some_and(|&x| x != 0.0); let openings = args.get(1).is_some_and(|&x| x != 0.0); let key = args.get(2).copied().unwrap_or(0.0); @@ -60,6 +60,21 @@ pub fn section_plan_buf(p: &Project, args: &[f64], text: &str) -> Result let hidden_ids = crate::plan::overrides::hidden_elements(p, rv); let filtered = (!hidden_ids.is_empty()).then(|| without_elements(p, &hidden_ids)); let p = filtered.as_ref().unwrap_or(p); + // [184] Öffnungen mit Detailgrad grob (Strich im Schnitt): Wandschnitt an Sturz/Brüstung flach. Das ändert die + // Schnittflächen, gehört also in den Schlüssel (unten) und in die Sichtbarkeit. + let open_mv = { + let detail = Detail::parse(v.get("detail").and_then(|d| d.as_str()).unwrap_or("mittel")); + let mv_id = v.get("modelView").and_then(|m| m.as_str()).filter(|m| !m.is_empty()).or(level.model_view.as_deref()); + crate::plan::model_view::for_view_scaled(p, mv_id, detail, scale) + }; + vis.flat_openings = p + .openings + .as_deref() + .unwrap_or(&[]) + .iter() + .filter(|o| open_mv.section_look(o.kind == crate::model::ElementKind::Door, o.detail_level) == crate::plan::model_view::SectionLook::Line) + .map(|o| o.id.clone()) + .collect(); // [180] Ausgeblendete Klassen gehören in den Schlüssel: sie nehmen an der Verdeckung nicht teil, der Schnitt // hängt also an ihnen (graue nicht). let hkey = { @@ -68,8 +83,16 @@ pub fn section_plan_buf(p: &Project, args: &[f64], text: &str) -> Result let mut codes: Vec<&String> = vis.hidden_codes().collect(); codes.sort(); codes.dedup(); - let empty = ids.is_empty() && codes.is_empty(); - ids.iter().flat_map(|s| s.bytes().chain([0u8])).chain([1u8]).chain(codes.iter().flat_map(|s| s.bytes().chain([0u8]))).fold(if empty { 0 } else { 0xcbf2_9ce4_8422_2325u64 }, |h, b| (h ^ b as u64).wrapping_mul(0x0000_0100_0000_01b3)) + let mut flat: Vec<&String> = vis.flat_openings.iter().collect(); + flat.sort(); + let empty = ids.is_empty() && codes.is_empty() && flat.is_empty(); + ids.iter() + .flat_map(|s| s.bytes().chain([0u8])) + .chain([1u8]) + .chain(codes.iter().flat_map(|s| s.bytes().chain([0u8]))) + .chain([2u8]) + .chain(flat.iter().flat_map(|s| s.bytes().chain([0u8]))) + .fold(if empty { 0 } else { 0xcbf2_9ce4_8422_2325u64 }, |h, b| (h ^ b as u64).wrapping_mul(0x0000_0100_0000_01b3)) }; let key = (key, hkey); let mut w = crate::plan::buf::Writer::new(true); @@ -110,11 +133,11 @@ pub fn section_plan_buf(p: &Project, args: &[f64], text: &str) -> Result trees.extend(unfold::bend_lines(&level, bounds)); let prims = trees; w.group(&prims); - let (door_detail, window_detail) = mvo.as_ref().map_or((true, true), |o| (o.door.section_detail, o.window.section_detail)); + // [184] Öffnungen wie im Grundriss: Detailgrad aus Stufe bzw. Massstab (mittel ab 1:200 grob). let mut ops = Vec::new(); if openings { for (l, s) in &parts { - ops.extend(unfold::clip_prims(section_opening_primitives_mv(p, l, &vis, door_detail, window_detail)?, s.as_ref())); + ops.extend(unfold::clip_prims(section_opening_primitives_mv(p, l, &vis, &open_mv)?, s.as_ref())); } } crate::plan::extras::scale_line_weights(p, scale, &mut ops); diff --git a/src-tauri/core/src/plan/section/shapes.rs b/src-tauri/core/src/plan/section/shapes.rs index d2b03ef4..2b81eba9 100644 --- a/src-tauri/core/src/plan/section/shapes.rs +++ b/src-tauri/core/src/plan/section/shapes.rs @@ -355,7 +355,7 @@ pub(super) fn is_void_solid(s: &ExtrudedSolid) -> bool { /// [106] Schnitt parallel zur Wand durch die Leibungen: Die geschnittene Schicht springt an den /// Öffnungen um ihren Rücksprung zurück (Loch geweitet), ihre Zusatzstücke (Leibungsdämmung, Putz, /// Überdämmung), die die Schnittebene quert, kommen als Schnittfläche im Stil der Schicht dazu. -pub(super) fn parallel_reveal_cuts(mut cuts: Vec, p: &Project, plane: &Plane, walls: &[Option<&Wall>]) -> Result, String> { +pub(super) fn parallel_reveal_cuts(mut cuts: Vec, p: &Project, plane: &Plane, walls: &[Option<&Wall>], flat: &HashSet) -> Result, String> { use crate::opening_detail::SIDES; let (base, u_raw) = (plane.base(), plane.u_model()); let l = hypot2(u_raw.0, u_raw.1); @@ -403,6 +403,9 @@ pub(super) fn parallel_reveal_cuts(mut cuts: Vec, p: &Project, plane: &Plan vec![[ua, z0], [ub, z0], [ub, z1], [ua, z1]] }; for o in p.openings_of_wall(&w.id) { + if flat.contains(&o.id) { + continue; + } let Some(r) = crate::opening_detail::opening_reveal(p, w, o) else { continue }; let (zb, zt) = opening_extent(p, w, o); // Rücksprung je Seite dieser Schicht; die seitlichen reichen in die Ecken oben/unten. diff --git a/src-tauri/core/src/plan/section/tests.rs b/src-tauri/core/src/plan/section/tests.rs index 3abb5890..59a767ea 100644 --- a/src-tauri/core/src/plan/section/tests.rs +++ b/src-tauri/core/src/plan/section/tests.rs @@ -556,6 +556,43 @@ fn anschlag_im_schnitt_sturz_nase_und_bruestung() { assert_eq!(k, count["insulation"], "Einzug gehört zum Band"); } +/// [184] Grob (Fenster nur als Strich): Sturz-Unterkante und Brüstungs-Oberkante des Wandschnitts sind flach — +/// kein Anschlag, keine Nase, kein Schichteinzug. Fein (ohne `flat_openings`) bleibt wie bisher. +#[test] +fn grob_wandschnitt_an_oeffnung_flach() { + let mut p = sample_flush(); + let o1 = p.openings.as_deref().unwrap().iter().find(|o| o.id == "O1").unwrap().clone(); + let w1 = p.walls.iter().find(|w| w.id == "W1").unwrap().clone(); + let (u, n) = axis_frame(&w1); + let m = o1.position + o1.width / 2.0; + let c = (w1.start.x + u.0 * m, w1.start.y + u.1 * m); + let l = LevelSpec { kind: "section".into(), line: Some([Vec2 { x: c.0 - n.0 * 3.0, y: c.1 - n.1 * 3.0 }, Vec2 { x: c.0 + n.0 * 3.0, y: c.1 + n.1 * 3.0 }]), ..Default::default() }; + let (zb, zt) = opening_extent(&p, &w1, &o1); + // Anschlag 5 cm und Überdämmung 3 cm: im Fein-Schnitt Nase bzw. Einzug. + for t in p.window_types.iter_mut().flatten() { + t.inset_face = Some(WindowTypeInsetFace::Aussen); + t.inset_from_face = Some(0.18); + t.rebate_depth = Some(0.05); + } + for o in p.openings.iter_mut().flatten().filter(|o| o.id == "O1") { + o.layer_reveals = Some(vec![crate::model::LayerReveal { layer: 1.0, mode: crate::model::RevealMode::Ueberdaemmt, amount: Some(0.03), ..Default::default() }]); + } + // Alle Wandschnitt-Kanten in der Öffnungshöhe: nur zb und zt (keine Stufe dazwischen). + let ys = |vis: &Visibility| -> Vec { + let out = compute_section_vis(&p, &l, &[], vis).unwrap().unwrap(); + let mut ys: Vec = out.cuts.iter().filter(|c| c.kind == Kind::Wall && c.source_id.as_deref() == Some("W1")).flat_map(|c| c.pts.iter().map(|q| q[1])).filter(|y| *y > zb - 0.1 && *y < zt + 0.1).collect(); + ys.sort_by(|a, b| a.partial_cmp(b).unwrap()); + ys.dedup_by(|a, b| (*a - *b).abs() < 1e-6); + ys + }; + let fine = ys(&Visibility::default()); + assert!(fine.iter().any(|y| (y - (zt - 0.05)).abs() < 1e-6) && fine.iter().any(|y| (y - (zb + 0.05)).abs() < 1e-6), "fein: Anschlag {fine:?}"); + let flat = Visibility { flat_openings: ["O1".to_string()].into(), ..Default::default() }; + let rough = ys(&flat); + assert!(rough.iter().all(|y| (y - zb).abs() < 1e-6 || (y - zt).abs() < 1e-6), "grob: keine Stufe {rough:?}"); + assert!(rough.iter().any(|y| (y - zb).abs() < 1e-6) && rough.iter().any(|y| (y - zt).abs() < 1e-6), "{rough:?}"); +} + /// [G3] Rundbogen-Fenster: an der Schnittstelle reicht die Wand bis an den Bogen, Rahmen/Glas folgen. #[test] fn rundbogen_im_schnitt() { diff --git a/src-tauri/core/src/plan/section/ts_faelle.rs b/src-tauri/core/src/plan/section/ts_faelle.rs index 0a66bd50..9228ebc0 100644 --- a/src-tauri/core/src/plan/section/ts_faelle.rs +++ b/src-tauri/core/src/plan/section/ts_faelle.rs @@ -264,8 +264,8 @@ fn schichten_aussen_aussen_und_override_auf_allen_schichten() { let w2 = p.walls.iter().find(|w| w.id == "W2").unwrap().clone(); let w4 = p.walls.iter().find(|w| w.id == "W4").unwrap().clone(); let u = (1.0, 0.0); - let b2 = split_wall_layers(&cp, &p, &layers, &w2, u, &Plane { point: [0.0; 3], normal: [1.0, 0.0, 0.0] }).unwrap(); - let b4 = split_wall_layers(&cp, &p, &layers, &w4, u, &Plane { point: [0.0; 3], normal: [1.0, 0.0, 0.0] }).unwrap(); + let b2 = split_wall_layers(&cp, &p, &layers, &w2, u, &Plane { point: [0.0; 3], normal: [1.0, 0.0, 0.0] }, &Default::default()).unwrap(); + let b4 = split_wall_layers(&cp, &p, &layers, &w4, u, &Plane { point: [0.0; 3], normal: [1.0, 0.0, 0.0] }, &Default::default()).unwrap(); // W4 (Aussenseite −x): layers[0] an uMin; W2 gespiegelt: layers[0] an uMax. assert_eq!(b4[0].component_id.as_deref(), Some(layers[0].component_id.as_str())); assert!(close(bbox(&b4[0].pts)[0], 0.0)); @@ -273,6 +273,6 @@ fn schichten_aussen_aussen_und_override_auf_allen_schichten() { // Override der Wand gilt für jede Schicht p.walls[1].background = Some("#123456".into()); let w = p.walls[1].clone(); - let bands = split_wall_layers(&cp, &p, &layers, &w, u, &Plane { point: [0.0; 3], normal: [1.0, 0.0, 0.0] }).unwrap(); + let bands = split_wall_layers(&cp, &p, &layers, &w, u, &Plane { point: [0.0; 3], normal: [1.0, 0.0, 0.0] }, &Default::default()).unwrap(); assert!(bands.iter().all(|b| b.fill.as_deref() == Some("#123456"))); } diff --git a/src-tauri/core/src/plan/walls.rs b/src-tauri/core/src/plan/walls.rs index b0ede96d..5ab36651 100644 --- a/src-tauri/core/src/plan/walls.rs +++ b/src-tauri/core/src/plan/walls.rs @@ -641,7 +641,7 @@ fn opening_symbol(c: &Ctx, out: &mut Vec, w: &Wall, o: &Opening, colo // [173] Modelldarstellung (bei eigenem Detailgrad der Öffnung über deren Basis). let mo = c.mv_for(detail); // [173] Fenster „vereinfacht" (3 Linien): wie grob, auch bei mittel/fein. - let detail = if !door && mo.window.simplified { Detail::Grob } else { detail }; + let detail = mo.opening_detail(door, None); let detail_code = match detail { // [140] Übersicht (1:500 und kleiner): Türen ohne Aufschlag-Bogen (ausser die Modelldarstellung will ihn). Detail::Grob if c.a.scale >= super::domains::OVERVIEW_FROM && mo.door.swing_arc != Some(true) => -1.0, @@ -984,7 +984,8 @@ fn opening_detail_plan(c: &Ctx, out: &mut Vec, w: &Wall, o: &Opening, let id = Some(o.id.as_str()); let frame = od::frame_of(p, o); // Anschlag je Seite. - if let (Some(r), Some(f)) = (rebate, frame.as_ref()) { + // [184] Grob: Leibung gerade, kein Anschlag. + if let (Some(r), Some(f)) = (rebate.filter(|_| s.detail != Detail::Grob), frame.as_ref()) { if let Some((z0, z1)) = f.rebate_zone(total) { let category = c.cat(&w.category_code); let angle = atan2(w.end.y - w.start.y, w.end.x - w.start.x) * 180.0 / std::f64::consts::PI; @@ -1159,12 +1160,7 @@ pub fn plan_walls(c: &Ctx, reference_lines: bool, out: &mut Vec, boun let ov = c.overrides(Some("opening"), &o.category_code, Some(&opening_label(o))); let olw = ov.lineweight.unwrap_or_else(|| c.cat(&o.category_code).map_or(LAYER_LINE_MM, |k| k.lw)); let color = ov.color.as_deref().or(o.color.as_deref()); - let detail = match o.detail_level { - Some(DetailLevel::Grob) => Detail::Grob, - Some(DetailLevel::Mittel) => Detail::Mittel, - Some(DetailLevel::Fein) => Detail::Fein, - _ => c.a.detail, - }; + let detail = c.mv().element_detail(o.detail_level); let wall_line = (e.color.as_deref().unwrap_or(POCHE_STROKE), lw * c.a.detail.outline_factor()); let mut tmp = Vec::new(); opening_symbol(c, &mut tmp, wv, o, color, c.greyed(&o.category_code), detail, olw, wall_line)?; diff --git a/src/model/types.generated.ts b/src/model/types.generated.ts index e74d043e..22c3bf6d 100644 --- a/src/model/types.generated.ts +++ b/src/model/types.generated.ts @@ -2068,7 +2068,9 @@ export type ModelViewDoors = { leaf?: ModelViewLeaf; /** Schwelle im Grundriss: aus, nur Hebeschiebetüren oder alle Türen (Basis: aus). */ threshold?: ModelViewThreshold; - /** Zarge, Blatt und Sturz im Schnitt (Basis: ja; nein = nur das Blatt). */ + /** + * Zarge, Blatt und Sturz im Schnitt: ja = voll, nein = höchstens das Blatt; ohne Wert folgt es dem Detailgrad (grob: Blatt als Strich). + */ sectionDetail?: boolean; }; @@ -2254,10 +2256,12 @@ export type ModelViewWindows = { */ lintelLine?: boolean; /** - * Rahmen, Kämpfer, Sturz, Fensterbank und Storen im Schnitt (Basis: ja; nein = Rahmen und Glas). + * Rahmen, Kämpfer, Sturz, Fensterbank im Schnitt: ja = voll, nein = höchstens einfacher Rahmen und Glas; ohne Wert folgt es dem Detailgrad (grob: ein Strich, mittel: einfach, fein: voll). */ sectionDetail?: boolean; - /** Fensterteilung (Flügel, Sprossen, Kämpfer) in der Ansicht (Basis: ja). */ + /** + * Fensterteilung (Flügel, Sprossen, Kämpfer) in der Ansicht; ohne Wert folgt sie dem Detailgrad (grob: keine). + */ elevationDivision?: boolean; };