[260] Fenster/Türen im Grundriss symbolisch oder geschnitten
Modell OpeningPlanMode (symbolisch|geschnitten) an Öffnung, Fenster-/Türtyp und Modelldarstellung (walls.openingPlanMode); Rangfolge Element > Typ > Modelldarstellung, Vorgabe symbolisch. Symbolisch: Öffnungssymbol in der Wandlücke unabhängig von der Schnitthöhe (Formöffnungen mit voller Breite); geschnitten: nach der Schnitthöhe, darüber/darunter Wand geschlossen + Linie über/unter Schnitt, hell auf schwarzer Wand. Objekteinstellungen (T) Feld „Im Grundriss“ für alle gewählten Öffnungen in einem Undo-Schritt (auch macOS-Nebenfenster über die Handler-Weiterleitung), Typen und Modelldarstellung in den Ressourcen. Goldens Musterhaus komplex nachgeführt (Fenster über der Schnitthöhe jetzt als Symbol). Rust-, vitest- und e2e-Tests; Doku, Release-Notes (Frage 12 erledigt), Mac-Prüfzeile 13.29.
This commit is contained in:
32 files changed
+497
-48
No files matched your search
@@ -986,6 +986,10 @@ pub struct DoorType {
|
||||
#[serde(rename = "lintelLineStyle", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub lintel_line_style: Option<LintelLineStyle>,
|
||||
/// [260] Darstellung im Grundriss: symbolisch (Symbol unabhängig von der Schnitthöhe) oder geschnitten; fehlt ⇒ Modelldarstellung.
|
||||
#[serde(rename = "planMode", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub plan_mode: Option<OpeningPlanMode>,
|
||||
/// Rahmen-Detail ([105]): Blendrahmen je Seite, Flügelrahmen, Pfosten/Kämpfer, Zusatzprofile,
|
||||
/// Anschlag je Seite. Fehlt ⇒ wie bisher (`frameWidth`, `rebateDepth`).
|
||||
#[serde(rename = "frameDetail", default, skip_serializing_if = "Option::is_none")]
|
||||
@@ -1336,6 +1340,10 @@ pub struct WindowType {
|
||||
#[serde(rename = "planSwingArcs", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub plan_swing_arcs: Option<bool>,
|
||||
/// [260] Darstellung im Grundriss: symbolisch (Symbol unabhängig von der Schnitthöhe) oder geschnitten; fehlt ⇒ Modelldarstellung.
|
||||
#[serde(rename = "planMode", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub plan_mode: Option<OpeningPlanMode>,
|
||||
/// Auf-/Untersicht-Andeutung im Grundriss (mittel/fein): eine Referenzlinie an
|
||||
/// der gewählten Fläche(n) — sinnvoll, wenn die Öffnung die Schnittebene NICHT
|
||||
/// regulär durchschneidet (z. B. bodentiefes Fenster oder hoch sitzendes
|
||||
@@ -2434,6 +2442,10 @@ pub struct ModelViewWalls {
|
||||
#[serde(rename = "contrastOnSolid", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub contrast_on_solid: Option<bool>,
|
||||
/// [260] Fenster/Türen im Grundriss: symbolisch oder geschnitten, solange Element und Typ nichts sagen (Basis: symbolisch).
|
||||
#[serde(rename = "openingPlanMode", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub opening_plan_mode: Option<OpeningPlanMode>,
|
||||
#[serde(flatten)]
|
||||
#[ts(skip)]
|
||||
pub extra: Extra,
|
||||
@@ -3535,6 +3547,21 @@ pub enum OpeningHinge {
|
||||
Unknown,
|
||||
}
|
||||
|
||||
/// [260] Darstellungsart von Fenstern und Türen im Grundriss.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize, TS)]
|
||||
pub enum OpeningPlanMode {
|
||||
/// Öffnungssymbol nach Norm (Rahmen, Glas/Flügel, Aufschlag, Brüstung) unabhängig von der Schnitthöhe.
|
||||
#[default]
|
||||
#[serde(rename = "symbolisch")]
|
||||
Symbolisch,
|
||||
/// Nach der tatsächlichen Schnitthöhe: über/unter dem Schnitt bleibt die Wand geschlossen, die Öffnung als Linie über/unter Schnitt.
|
||||
#[serde(rename = "geschnitten")]
|
||||
Geschnitten,
|
||||
#[serde(other)]
|
||||
#[ts(skip)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
/// Linientyp der Sturzlinien einer Tür im Grundriss ([105]; Strichmuster in Papier-mm wie [153]).
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize, TS)]
|
||||
pub enum LintelLineStyle {
|
||||
@@ -3798,6 +3825,10 @@ pub struct Opening {
|
||||
#[serde(rename = "planSwingArcs", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub plan_swing_arcs: Option<bool>,
|
||||
/// [260] Darstellung im Grundriss (übersteuert Tür-/Fenstertyp und Modelldarstellung); fehlt ⇒ wie Typ.
|
||||
#[serde(rename = "planMode", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub plan_mode: Option<OpeningPlanMode>,
|
||||
/// Referenz auf einen Bauteil-Typ (Bibliothek): {@link DoorType} bei
|
||||
/// `kind: "door"`, {@link WindowType} bei `kind: "window"`. Fehlt sie, gilt
|
||||
/// das heutige Inline-Verhalten (rückwärtskompatibel). Typ-Defaults liefern
|
||||
|
||||
@@ -3205,6 +3205,15 @@ mod tests {
|
||||
let o1 = p.openings.as_mut().unwrap().iter_mut().find(|o| o.id == "O1").unwrap();
|
||||
(o1.sill_height, o1.height) = (1.5, 0.6);
|
||||
let codes = ["20", "21", "30", "60"];
|
||||
// [260] Vorgabe symbolisch: auch mit Oberkante Lücke in der Wand, Symbol ausgezogen.
|
||||
let symbolic = {
|
||||
let mut q = p.clone();
|
||||
set_range(&mut q, "eg", Some(2.5), None, None);
|
||||
serde_json::to_value(&plan_domains(&q, &args("eg", 1.0, &codes)).unwrap().walls).unwrap()
|
||||
};
|
||||
assert!(!symbolic.to_string().contains("view-range"));
|
||||
// Darstellung nach der Schnitthöhe.
|
||||
p.openings.as_mut().unwrap().iter_mut().find(|o| o.id == "O1").unwrap().plan_mode = Some(OpeningPlanMode::Geschnitten);
|
||||
let run = |p: &Project| {
|
||||
let r = plan_domains(p, &args("eg", 1.0, &codes)).unwrap();
|
||||
(serde_json::to_value(&r.walls).unwrap(), serde_json::to_string(&r.rooms).unwrap())
|
||||
@@ -3212,16 +3221,17 @@ mod tests {
|
||||
let of = |v: &serde_json::Value, id: &str| -> Vec<serde_json::Value> { v.as_array().unwrap().iter().filter(|x| x["openingId"] == id).cloned().collect() };
|
||||
let w1_polys = |v: &serde_json::Value| v.as_array().unwrap().iter().filter(|x| x["kind"] == "polygon" && x["wallId"] == "W1").count();
|
||||
let dashed = |xs: &[serde_json::Value]| xs.iter().filter(|x| x["kind"] == "line").all(|x| x["dash"] == serde_json::json!([6.0, 1.5, 0.0, 1.5]));
|
||||
// Ohne Grenzen: wie bisher (Lücke in der Wand, Symbol ausgezogen).
|
||||
assert!(w1_polys(&symbolic) > 0);
|
||||
// [260] Geschnitten auch ohne Grenzen: Oberlicht „über Schnitt“, Wand ohne Lücke.
|
||||
let (w0, r0) = run(&p);
|
||||
assert!(!of(&w0, "O1").is_empty() && !dashed(&of(&w0, "O1")));
|
||||
assert!(!w0.to_string().contains("view-range"));
|
||||
let s0 = of(&w0, "O1");
|
||||
assert!(s0.iter().any(|x| x["kind"] == "line") && dashed(&s0), "{s0:?}");
|
||||
// Oberkante 2.5 m: Oberlicht „über Schnitt“ strichpunktiert, Wand im Schnitt ohne Lücke.
|
||||
set_range(&mut p, "eg", Some(2.5), None, None);
|
||||
let (w1, r1) = run(&p);
|
||||
let s1 = of(&w1, "O1");
|
||||
assert!(s1.iter().any(|x| x["kind"] == "line") && dashed(&s1), "{s1:?}");
|
||||
assert!(w1_polys(&w1) < w1_polys(&w0), "{} {}", w1_polys(&w1), w1_polys(&w0));
|
||||
assert!(w1_polys(&w1) < w1_polys(&symbolic), "{} {}", w1_polys(&w1), w1_polys(&symbolic));
|
||||
// Tür und Fenster im Schnitt bleiben ausgezogen.
|
||||
assert!(!dashed(&of(&w1, "D1")) && !dashed(&of(&w1, "O2")));
|
||||
// Oberkante 1.2 m: Oberlicht entfällt, Wand bleibt geschlossen.
|
||||
@@ -3241,6 +3251,8 @@ mod tests {
|
||||
let mut p = sample();
|
||||
let o1 = p.openings.as_mut().unwrap().iter_mut().find(|o| o.id == "O1").unwrap();
|
||||
(o1.sill_height, o1.height) = (0.1, 0.3);
|
||||
// [260] Nur „geschnitten“ richtet sich nach der Schnitthöhe (Vorgabe symbolisch: Symbol in der Lücke).
|
||||
o1.plan_mode = Some(OpeningPlanMode::Geschnitten);
|
||||
let codes = ["20", "21", "30", "60"];
|
||||
let run = |p: &Project| serde_json::to_value(&plan_domains(p, &args("eg", 1.0, &codes)).unwrap().walls).unwrap();
|
||||
let of = |v: &serde_json::Value, id: &str| -> Vec<serde_json::Value> { v.as_array().unwrap().iter().filter(|x| x["openingId"] == id).cloned().collect() };
|
||||
|
||||
@@ -251,6 +251,16 @@ pub struct WallOpts {
|
||||
pub cut_hatch_mv: Option<bool>,
|
||||
/// [256] Öffnungs-Symbole über/unter Schnitt auf schwarzer Wand hell (Basis: ja).
|
||||
pub contrast_on_solid: bool,
|
||||
/// [260] Fenster/Türen im Grundriss: Vorgabe der Modelldarstellung (fehlt ⇒ symbolisch).
|
||||
pub opening_plan_mode_mv: Option<OpeningPlanMode>,
|
||||
}
|
||||
|
||||
impl WallOpts {
|
||||
/// [260] Darstellungsart einer Öffnung im Grundriss: Element > Typ > Modelldarstellung > symbolisch.
|
||||
pub fn opening_plan_mode(&self, element: Option<OpeningPlanMode>, ty: Option<OpeningPlanMode>) -> OpeningPlanMode {
|
||||
let known = |m: Option<OpeningPlanMode>| m.filter(|m| *m != OpeningPlanMode::Unknown);
|
||||
known(element).or(known(ty)).or(known(self.opening_plan_mode_mv)).unwrap_or(OpeningPlanMode::Symbolisch)
|
||||
}
|
||||
}
|
||||
|
||||
/// Decken und Böden.
|
||||
@@ -528,6 +538,7 @@ pub fn resolve(mv: Option<&ModelViewOption>, detail: Detail, scale: f64) -> Opti
|
||||
reveals: wl.and_then(|w| w.reveals).unwrap_or(true),
|
||||
cut_hatch_mv: wl.and_then(|w| w.cut_hatch),
|
||||
contrast_on_solid: wl.and_then(|w| w.contrast_on_solid).unwrap_or(true),
|
||||
opening_plan_mode_mv: wl.and_then(|w| w.opening_plan_mode),
|
||||
},
|
||||
slab: SlabOpts {
|
||||
layers: layer_mode(sl.and_then(|s| s.layers)),
|
||||
@@ -593,3 +604,6 @@ mod tests2;
|
||||
#[cfg(test)]
|
||||
#[path = "model_view_tests3.rs"]
|
||||
mod tests3;
|
||||
#[cfg(test)]
|
||||
#[path = "opening_plan_mode_tests.rs"]
|
||||
mod opening_plan_mode_tests;
|
||||
@@ -291,6 +291,8 @@ fn ueber_schnitt_hell_auf_schwarzer_wand() {
|
||||
let mut p = sample();
|
||||
let o1 = p.openings.as_mut().unwrap().iter_mut().find(|o| o.id == "O1").unwrap();
|
||||
(o1.sill_height, o1.height) = (1.5, 0.6);
|
||||
// [260] Nur „geschnitten“ schliesst die Wand (Vorgabe symbolisch zeigt das Symbol in der Lücke).
|
||||
o1.plan_mode = Some(OpeningPlanMode::Geschnitten);
|
||||
p.drawing_levels.iter_mut().find(|l| l.id == "eg").unwrap().view_top = Some(2.5);
|
||||
let codes: Vec<String> = p.walls.iter().map(|w| w.category_code.clone()).chain(p.openings.iter().flatten().map(|o| o.category_code.clone())).collect();
|
||||
let run = |p: &Project, scale: f64| -> DomainPrims {
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
//! [260] Darstellungsart von Fenstern und Türen im Grundriss: symbolisch (Vorgabe, Symbol unabhängig von der
|
||||
//! Schnitthöhe) oder geschnitten (nach der Schnitthöhe: Wand geschlossen, Öffnung als Linie über/unter Schnitt).
|
||||
//! Rangfolge Element > Typ > Modelldarstellung > symbolisch.
|
||||
|
||||
use crate::model::*;
|
||||
use crate::plan::domains::{plan_domains, DomainPrims, PlanArgs};
|
||||
use crate::plan::prim::Primitive;
|
||||
|
||||
|
||||
fn sample() -> Project {
|
||||
serde_json::from_str(include_str!("../../tests/fixtures/sample_project.json")).unwrap()
|
||||
}
|
||||
|
||||
/// Musterprojekt mit dem Badfenster O1: Brüstung 1.10 m, Höhe 0.6 m — ganz über der Schnitthöhe 1.0 m.
|
||||
fn bath_window() -> Project {
|
||||
let mut p = sample();
|
||||
let o1 = p.openings.as_mut().unwrap().iter_mut().find(|o| o.id == "O1").unwrap();
|
||||
(o1.sill_height, o1.height) = (1.1, 0.6);
|
||||
p
|
||||
}
|
||||
|
||||
fn o1_mut(p: &mut Project) -> &mut Opening {
|
||||
p.openings.as_mut().unwrap().iter_mut().find(|o| o.id == "O1").unwrap()
|
||||
}
|
||||
|
||||
fn with_mv(mut p: Project, mode: &str) -> Project {
|
||||
let v = serde_json::json!({"id": "mv", "name": "Eigene", "walls": {"openingPlanMode": mode}});
|
||||
p.model_view_options = Some(vec![serde_json::from_value(v).unwrap()]);
|
||||
p.drawing_levels.iter_mut().find(|l| l.id == "eg").unwrap().model_view_option_id = Some("mv".into());
|
||||
p
|
||||
}
|
||||
|
||||
fn run(p: &Project) -> DomainPrims {
|
||||
let codes: Vec<String> = p.walls.iter().map(|w| w.category_code.clone()).chain(p.openings.iter().flatten().map(|o| o.category_code.clone())).collect();
|
||||
let t = serde_json::json!({"floor": "eg", "show": codes, "scale": 100.0}).to_string();
|
||||
plan_domains(p, &PlanArgs::parse_in(p, 1.0, &t).unwrap()).unwrap()
|
||||
}
|
||||
|
||||
/// Mitte der Öffnung O1 auf der Wandachse.
|
||||
fn o1_center(p: &Project) -> Vec2 {
|
||||
let o = p.openings.iter().flatten().find(|o| o.id == "O1").unwrap();
|
||||
let w = p.walls.iter().find(|w| w.id == o.host_wall_id).unwrap();
|
||||
let (dx, dy) = (w.end.x - w.start.x, w.end.y - w.start.y);
|
||||
let l = (dx * dx + dy * dy).sqrt();
|
||||
let s = o.position + o.width / 2.0;
|
||||
Vec2 { x: w.start.x + dx / l * s, y: w.start.y + dy / l * s }
|
||||
}
|
||||
|
||||
fn inside(pts: &[Vec2], q: Vec2) -> bool {
|
||||
let mut c = false;
|
||||
let n = pts.len();
|
||||
for i in 0..n {
|
||||
let (a, b) = (pts[i], pts[(i + 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
|
||||
}
|
||||
|
||||
/// Schliesst eine gefüllte Wandfläche die Öffnung (Wand im Grundriss geschlossen)?
|
||||
fn wall_closed_at(d: &DomainPrims, q: Vec2) -> bool {
|
||||
d.walls.iter().any(|x| matches!(x, Primitive::Polygon { pts, fill, wall_id: Some(_), opening_id: None, .. } if fill != "none" && inside(pts, q)))
|
||||
}
|
||||
|
||||
/// Linien „über Schnitt“ (Strichpunkt) bzw. „unter Schnitt“ (gepunktet) im Wand-Bereich.
|
||||
fn view_range_lines(d: &DomainPrims) -> usize {
|
||||
d.walls.iter().filter(|x| matches!(x, Primitive::Line { cls, .. } if cls == "view-range")).count()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn symbolisch_badfenster_ab_110_als_symbol() {
|
||||
let p = bath_window();
|
||||
let d = run(&p);
|
||||
let c = o1_center(&p);
|
||||
assert!(!wall_closed_at(&d, c), "Vorgabe symbolisch: Wandlücke wie ein geschnittenes Fenster");
|
||||
assert_eq!(view_range_lines(&d), 0, "keine Linie über Schnitt");
|
||||
// Dieselbe Darstellung wie ein Fenster, das die Schnittebene trifft (Lücke, Symbol im Wandbereich).
|
||||
let mut q = sample();
|
||||
(o1_mut(&mut q).sill_height, o1_mut(&mut q).height) = (0.9, 1.2);
|
||||
assert!(!wall_closed_at(&run(&q), c));
|
||||
// Auch unter der Schnittebene (Kellerfenster) und ganz darüber (Oberlicht) symbolisch.
|
||||
let mut k = sample();
|
||||
(o1_mut(&mut k).sill_height, o1_mut(&mut k).height) = (0.1, 0.5);
|
||||
let dk = run(&k);
|
||||
assert!(!wall_closed_at(&dk, c) && view_range_lines(&dk) == 0, "Kellerfenster");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn geschnitten_wand_geschlossen_linie_ueber_schnitt() {
|
||||
let mut p = bath_window();
|
||||
o1_mut(&mut p).plan_mode = Some(OpeningPlanMode::Geschnitten);
|
||||
let d = run(&p);
|
||||
let c = o1_center(&p);
|
||||
assert!(wall_closed_at(&d, c), "geschnitten: die Wand bleibt über der Öffnung geschlossen");
|
||||
let dash = crate::plan::view_range::ABOVE_DASH.to_vec();
|
||||
let above: Vec<&Primitive> = d.walls.iter().filter(|x| matches!(x, Primitive::Line { cls, dash: Some(Some(v)), .. } if cls == "view-range" && *v == dash)).collect();
|
||||
assert!(!above.is_empty(), "Öffnung als Linie über Schnitt (Strichpunkt)");
|
||||
// [256] Auf schwarzer Wand (1:100) hell.
|
||||
assert!(above.iter().any(|x| matches!(x, Primitive::Line { color: Some(k), .. } if k == crate::plan::contrast::CONTRAST_INK)));
|
||||
// Unter der Schnittebene: gepunktet.
|
||||
let mut k = sample();
|
||||
(o1_mut(&mut k).sill_height, o1_mut(&mut k).height) = (0.1, 0.5);
|
||||
o1_mut(&mut k).plan_mode = Some(OpeningPlanMode::Geschnitten);
|
||||
let dk = run(&k);
|
||||
let dotted = crate::plan::view_range::UNDER_DASH.to_vec();
|
||||
assert!(wall_closed_at(&dk, c));
|
||||
assert!(dk.walls.iter().any(|x| matches!(x, Primitive::Line { cls, dash: Some(Some(v)), .. } if cls == "view-range" && *v == dotted)), "unter Schnitt gepunktet");
|
||||
// Trifft der Schnitt die Öffnung, bleibt sie geschnitten wie bisher.
|
||||
let mut q = sample();
|
||||
o1_mut(&mut q).plan_mode = Some(OpeningPlanMode::Geschnitten);
|
||||
let dq = run(&q);
|
||||
assert!(!wall_closed_at(&dq, c) && view_range_lines(&dq) == 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rangfolge_element_vor_typ_vor_modelldarstellung() {
|
||||
let c = o1_center(&bath_window());
|
||||
let closed = |p: &Project| wall_closed_at(&run(p), c);
|
||||
// Modelldarstellung geschnitten ⇒ geschlossen.
|
||||
let mv = with_mv(bath_window(), "geschnitten");
|
||||
assert!(closed(&mv));
|
||||
// Typ symbolisch geht vor der Modelldarstellung.
|
||||
let mut ty = mv.clone();
|
||||
let tid = o1_mut(&mut ty).type_id.clone().unwrap();
|
||||
ty.window_types.as_mut().unwrap().iter_mut().find(|t| t.id == tid).unwrap().plan_mode = Some(OpeningPlanMode::Symbolisch);
|
||||
assert!(!closed(&ty));
|
||||
// Element geschnitten geht vor dem Typ.
|
||||
let mut el = ty.clone();
|
||||
o1_mut(&mut el).plan_mode = Some(OpeningPlanMode::Geschnitten);
|
||||
assert!(closed(&el));
|
||||
// Typ geschnitten ohne Modelldarstellung, Element symbolisch geht vor.
|
||||
let mut t2 = bath_window();
|
||||
t2.window_types.as_mut().unwrap().iter_mut().find(|t| t.id == tid).unwrap().plan_mode = Some(OpeningPlanMode::Geschnitten);
|
||||
assert!(closed(&t2));
|
||||
o1_mut(&mut t2).plan_mode = Some(OpeningPlanMode::Symbolisch);
|
||||
assert!(!closed(&t2));
|
||||
// Auflösung direkt.
|
||||
let o = crate::plan::model_view::resolve(None, crate::plan::style::Detail::Mittel, 100.0);
|
||||
assert_eq!(o.wall.opening_plan_mode(None, None), OpeningPlanMode::Symbolisch);
|
||||
assert_eq!(o.wall.opening_plan_mode(None, Some(OpeningPlanMode::Geschnitten)), OpeningPlanMode::Geschnitten);
|
||||
assert_eq!(o.wall.opening_plan_mode(Some(OpeningPlanMode::Symbolisch), Some(OpeningPlanMode::Geschnitten)), OpeningPlanMode::Symbolisch);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tuer_typ_geschnitten_gilt_fuer_tueren() {
|
||||
// Tür D1 mit Brüstung über der Schnittebene (z. B. Oberlicht-Tür in einer Schachtwand), Türtyp geschnitten.
|
||||
let mut p = sample();
|
||||
let d1 = p.openings.as_mut().unwrap().iter_mut().find(|o| o.id == "D1").unwrap();
|
||||
(d1.sill_height, d1.height) = (1.2, 0.8);
|
||||
let base = run(&p);
|
||||
assert_eq!(view_range_lines(&base), 0);
|
||||
p.door_types.as_mut().unwrap().iter_mut().find(|t| t.id == "door-standard").unwrap().plan_mode = Some(OpeningPlanMode::Geschnitten);
|
||||
assert!(view_range_lines(&run(&p)) > 0);
|
||||
}
|
||||
@@ -614,6 +614,15 @@ fn window_type<'a>(p: &'a Project, o: &Opening) -> Option<&'a WindowType> {
|
||||
p.window_types.as_deref()?.iter().find(|t| t.id == id)
|
||||
}
|
||||
|
||||
/// [260] Darstellungsart des Tür-/Fenstertyps im Grundriss (fehlt ⇒ Modelldarstellung).
|
||||
fn opening_type_plan_mode(p: &Project, o: &Opening) -> Option<OpeningPlanMode> {
|
||||
if o.kind == ElementKind::Door {
|
||||
door_type(p, o).and_then(|t| t.plan_mode)
|
||||
} else {
|
||||
window_type(p, o).and_then(|t| t.plan_mode)
|
||||
}
|
||||
}
|
||||
|
||||
/// Öffnungs-Symbol (`addOpeningSymbol`).
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, color: Option<&str>, greyed: bool, detail: Detail, lw: f64, wall_line: (&str, f64)) -> Result<(), String> {
|
||||
@@ -1112,10 +1121,23 @@ pub fn plan_walls(c: &Ctx, reference_lines: bool, out: &mut Vec<Primitive>, boun
|
||||
ref_off: joins::reference_offset(crate::model3d::wall_reference(w), wr_total),
|
||||
};
|
||||
let all_openings: Vec<(std::borrow::Cow<Opening>, Zone)> = p.openings_of_wall(&w.id).map(|o| {
|
||||
// [260] Symbolisch (Vorgabe): das Öffnungssymbol nach Norm unabhängig von der Schnitthöhe — auch das
|
||||
// Badfenster ab 1.10 m, das Oberlicht oder das Kellerfenster; Formöffnungen mit voller Breite statt der Sehne.
|
||||
if c.mv().wall.opening_plan_mode(o.plan_mode, opening_type_plan_mode(p, o)) != OpeningPlanMode::Geschnitten {
|
||||
return (std::borrow::Cow::Borrowed(o), Zone::Cut);
|
||||
}
|
||||
let (ob, ot) = super::view_range::opening_vertical_extent(p, w, o);
|
||||
// [36] Auch ohne eigenen Bereich: eine Öffnung ganz unter der Schnittebene (Brüstungs-/Kellerfenster) schneidet
|
||||
// keine Lücke in die Wand; ganz darüber (Oberlicht) bleibt es ohne Bereich wie bisher.
|
||||
let oz = if range.custom { range.classify(ob, ot) } else if ot < cut_z { Zone::Below } else { Zone::Cut };
|
||||
// [36]/[260] Geschnitten: nach der Schnitthöhe. Auch ohne eigenen Bereich schneidet eine Öffnung ganz unter
|
||||
// (Brüstungs-/Kellerfenster) oder ganz über der Schnittebene (Oberlicht) keine Lücke in die Wand.
|
||||
let oz = if range.custom {
|
||||
range.classify(ob, ot)
|
||||
} else if ot < cut_z {
|
||||
Zone::Below
|
||||
} else if ob > cut_z {
|
||||
Zone::Above
|
||||
} else {
|
||||
Zone::Cut
|
||||
};
|
||||
match shaped_plan_cut(&wr, o, ob, ot, cut_z).filter(|_| oz == Zone::Cut && zone == Zone::Cut) {
|
||||
Some(Ok(chord)) => (std::borrow::Cow::Owned(chord), oz),
|
||||
Some(Err(miss)) => (std::borrow::Cow::Borrowed(o), miss),
|
||||
@@ -1975,7 +1997,13 @@ pub(crate) mod tests {
|
||||
/// [G3] Projekt wie [`pocket_project`], statt der Tür ein Fenster 1.0..2.2 (Breite 1.2) mit Form.
|
||||
fn shaped_window(shape: OpeningShape, sill: f64, height: f64) -> Project {
|
||||
let mut p = pocket_project(DoorTypeKind::Dreh, None, 1.0);
|
||||
p.openings = Some(vec![Opening { id: "o".into(), host_wall_id: "w".into(), kind: ElementKind::Window, category_code: "20".into(), position: 1.0, width: 1.2, height, sill_height: sill, shape: Some(shape), ..Default::default() }]);
|
||||
p.openings = Some(vec![Opening { id: "o".into(), host_wall_id: "w".into(), kind: ElementKind::Window, category_code: "20".into(), position: 1.0, width: 1.2, height, sill_height: sill, shape: Some(shape), plan_mode: Some(OpeningPlanMode::Geschnitten), ..Default::default() }]);
|
||||
p
|
||||
}
|
||||
|
||||
/// [260] Dieselbe Formöffnung symbolisch (Vorgabe): volle Breite, unabhängig von der Schnitthöhe.
|
||||
fn symbolic(mut p: Project) -> Project {
|
||||
p.openings.as_mut().unwrap()[0].plan_mode = None;
|
||||
p
|
||||
}
|
||||
|
||||
@@ -2010,6 +2038,9 @@ pub(crate) mod tests {
|
||||
assert!((g - (u1 - u0) * 0.16).abs() < 1e-6, "{g} {}", (u1 - u0) * 0.16);
|
||||
let (x0, x1) = symbol_x(&wall_prims(&p));
|
||||
assert!(x0 >= 1.0 + u0 - 1e-6 && x1 <= 1.0 + u1 + 1e-6, "{x0} {x1}");
|
||||
// [260] Symbolisch: Lücke des umschreibenden Rechtecks.
|
||||
let g = gap(&symbolic(p.clone()));
|
||||
assert!((g - rect).abs() < 1e-9, "{g}");
|
||||
// Rundbogen mit Kämpfer über der Schnitthöhe: wie Rechteck (gleiche Lücke).
|
||||
let g = gap(&shaped_window(OpeningShape::Rundbogen, 0.2, 1.8));
|
||||
assert!((g - rect).abs() < 1e-9, "{g}");
|
||||
@@ -2122,5 +2153,9 @@ pub(crate) mod tests {
|
||||
let prims = wall_prims(&p);
|
||||
assert!((hatched(&prims).0 - full).abs() < 1e-9, "Wand geschlossen");
|
||||
assert!(prims.iter().any(|q| matches!(q, Primitive::Line { cls, .. } if cls == "view-range")), "Symbol gepunktet");
|
||||
// [260] Symbolisch: Lücke und Symbol wie ein geschnittenes Fenster.
|
||||
let prims = wall_prims(&symbolic(p));
|
||||
assert!(hatched(&prims).0 < full - 0.1, "Wandlücke");
|
||||
assert!(!prims.iter().any(|q| matches!(q, Primitive::Line { cls, .. } if cls == "view-range")));
|
||||
}
|
||||
}
|
||||
@@ -871,6 +871,7 @@ fn opening_selection(lk: &Lookup, o: &Value) -> Result<J, String> {
|
||||
.raw("lintelLineStyle", o, "lintelLineStyle")
|
||||
.raw("sashSymbols", o, "sashSymbols")
|
||||
.raw("planSwingArcs", o, "planSwingArcs")
|
||||
.raw("planMode", o, "planMode")
|
||||
.raw("typeId", o, "typeId")
|
||||
.raw("detailLevel", o, "detailLevel")
|
||||
.v("zBottom", zb)
|
||||
|
||||
Reference in new issue
Block a user