[94] Fenster/Türen: Leibung mittig, Anschlag, Sturz, Fensterbänke, Storenkasten im Sturz
Neue optionale Typ-Felder (ohne sie bleibt alles wie bisher): insetFace "mitte", rebateDepth (Wandnase je Schicht im Grundriss, 3D-Teil, kleinere Ansicht von der Anschlag-Seite), lintelHeight (Schnitt), Fensterbank nach sillBoard (Grundriss fein, Schnitt bei ausdrücklicher Wahl), shading.mount "sturz" (verdeckter Storenkasten, Führungsschienen, Schnitt mit Lamellenpaket). UI im Dialog „Fenster bearbeiten“.
This commit is contained in:
16 files changed
+703
-60
No files matched your search
@@ -272,6 +272,13 @@ fn collect_openings(p: &Project, frame: &[f64; 9]) -> Vec<ProjOpening> {
|
||||
wt.and_then(|t| t.mullion_cols).unwrap_or(f64::NAN),
|
||||
if matches!(wt.and_then(|t| t.sill_board), Some(WindowTypeSillBoard::Keine | WindowTypeSillBoard::Innen)) { 0.0 } else { 1.0 },
|
||||
wt.map_or(0.0, |t| sash_kind(t.kind)),
|
||||
// Anschlag nur mit Leibung (Einzug > 0 oder mittig), sonst gibt es keine Wandnase.
|
||||
match (dt, wt) {
|
||||
(Some(t), _) if t.inset_face == Some(DoorTypeInsetFace::Mitte) || t.inset_from_face.unwrap_or(0.0) > 1e-4 => t.rebate_depth.unwrap_or(0.0),
|
||||
(_, Some(t)) if t.inset_face == Some(WindowTypeInsetFace::Mitte) || t.inset_from_face.unwrap_or(0.0) > 1e-4 => t.rebate_depth.unwrap_or(0.0),
|
||||
_ => 0.0,
|
||||
},
|
||||
if (door && dt.and_then(|t| t.inset_face) == Some(DoorTypeInsetFace::Innen)) || (!door && wt.and_then(|t| t.inset_face) == Some(WindowTypeInsetFace::Innen)) { -1.0 } else { 1.0 },
|
||||
]);
|
||||
// Flügel: (pfosten, postWidth, autoWidth, width, opening, hingeLeft).
|
||||
let mut sashes: Vec<[f64; 6]> = Vec::new();
|
||||
|
||||
@@ -1321,6 +1321,8 @@ const DEFAULT_FRAME_DEPTH: f64 = 0.07;
|
||||
const DEFAULT_FRAME_WIDTH: f64 = 0.06;
|
||||
const DOOR_LEAF_THICKNESS: f64 = 0.04;
|
||||
const MIN_CROSS: f64 = 0.15;
|
||||
const LINTEL_FILL: &str = "#d4d7db";
|
||||
const SHADING_PACK_FILL: &str = "#e6e8eb";
|
||||
|
||||
fn rect(u0: f64, u1: f64, v0: f64, v1: f64) -> Vec<Vec2> {
|
||||
vec![v2(min(u0, u1), v0), v2(max(u0, u1), v0), v2(max(u0, u1), v1), v2(min(u0, u1), v1)]
|
||||
@@ -1418,6 +1420,7 @@ fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection) -> Result
|
||||
frame_depth: t.frame_depth.unwrap_or(f64::NAN),
|
||||
inset_from_face: t.inset_from_face.unwrap_or(f64::NAN),
|
||||
inset_inner: t.inset_face == Some(WindowTypeInsetFace::Innen),
|
||||
inset_mid: t.inset_face == Some(WindowTypeInsetFace::Mitte),
|
||||
});
|
||||
let finite = [wall.start.x, wall.start.y, wall.end.x, wall.end.y, total, ref_off, o.position, o.width].iter().all(|x| x.is_finite());
|
||||
let sym = if finite {
|
||||
@@ -1463,11 +1466,63 @@ fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection) -> Result
|
||||
}
|
||||
out.push(l);
|
||||
}
|
||||
if let Some(t) = wt {
|
||||
let shading = t.shading.as_ref().filter(|s| s.create);
|
||||
let sturz_box = shading.filter(|s| s.mount == Some(WindowShadingMount::Sturz)).map_or(0.0, |s| max(0.0, s.r#box.depth));
|
||||
lintel_cut(&mut out, o, c, t.lintel_height, sturz_box);
|
||||
// Fensterbänke nur bei ausdrücklicher Wahl (bisherige Schnitte bleiben gleich).
|
||||
let zb = c.z_bottom;
|
||||
if matches!(t.sill_board, Some(WindowTypeSillBoard::Aussen | WindowTypeSillBoard::Beide)) {
|
||||
// Aussen: mit Gefälle, bis 4 cm vor die Aussenfläche.
|
||||
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)];
|
||||
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, GLASS_MM, no_hatch_base());
|
||||
if let Primitive::Polygon { opening_id, .. } = &mut pack {
|
||||
*opening_id = Some(o.id.clone());
|
||||
}
|
||||
out.push(pack);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
fn door_cut(o: &Opening, c: &CrossSection) -> Vec<Primitive> {
|
||||
/// Sturz im Schnitt ([94]): eigener Querschnitt über der Öffnung (Beton grau), neben einem
|
||||
/// Storenkasten im Sturz (`box_depth` ab der Aussenfläche) nur über den Rest der Wanddicke.
|
||||
fn lintel_cut(out: &mut Vec<Primitive>, o: &Opening, c: &CrossSection, height: Option<f64>, box_depth: f64) {
|
||||
let h = height.unwrap_or(0.0);
|
||||
if !(h > 1e-4) {
|
||||
return;
|
||||
}
|
||||
let s0 = min(c.face_max, c.face_min + box_depth);
|
||||
if c.face_max - s0 <= 1e-4 {
|
||||
return;
|
||||
}
|
||||
let mut pr = polygon(rect(c.u_at(s0), c.u_at(c.face_max), c.z_top, c.z_top + h), LINTEL_FILL, OPENING_INK, FRAME_MM, no_hatch_base());
|
||||
if let Primitive::Polygon { opening_id, .. } = &mut pr {
|
||||
*opening_id = Some(o.id.clone());
|
||||
}
|
||||
out.push(pr);
|
||||
}
|
||||
|
||||
fn door_cut(p: &Project, o: &Opening, c: &CrossSection) -> Vec<Primitive> {
|
||||
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)];
|
||||
lintel_cut(&mut out, o, c, p.door_type(o).and_then(|t| t.lintel_height), 0.0);
|
||||
if o.door_type == Some(OpeningDoorType::Wandoeffnung) {
|
||||
return out;
|
||||
}
|
||||
@@ -1503,7 +1558,7 @@ pub fn section_opening_primitives(p: &Project, level: &LevelSpec, vis: &Visibili
|
||||
continue;
|
||||
}
|
||||
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)? } else { door_cut(o, &c) };
|
||||
let prims = if o.kind == ElementKind::Window { window_cut(p, wall, o, &c)? } else { door_cut(p, o, &c) };
|
||||
let greyed = vis.greyed(&o.category_code);
|
||||
for pr in prims {
|
||||
out.push(if greyed { pr.with_greyed(true) } else { pr });
|
||||
@@ -1644,6 +1699,36 @@ mod tests {
|
||||
assert!(!serde_json::to_string(&hidden).unwrap().contains("\"roofId\""));
|
||||
}
|
||||
|
||||
/// [94] Sturz, Fensterbänke und Storenkasten im Sturz erscheinen im Schnitt nur, wenn gesetzt.
|
||||
#[test]
|
||||
fn sturz_baenke_und_storenkasten_im_schnitt() {
|
||||
let mut p = sample();
|
||||
// Schnittlinie quer durch die Mitte von O1 (Wand W1).
|
||||
let o1 = p.openings.as_deref().unwrap().iter().find(|o| o.id == "O1").unwrap().clone();
|
||||
let w1 = p.walls.iter().find(|w| w.id == o1.host_wall_id).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 vis = Visibility::default();
|
||||
let base = section_opening_primitives(&p, &l, &vis).unwrap();
|
||||
assert!(!base.is_empty());
|
||||
let typed = p.openings.as_deref().unwrap_or(&[]).iter().filter(|o| o.type_id.is_some()).count();
|
||||
assert!(typed > 0);
|
||||
for t in p.window_types.iter_mut().flatten() {
|
||||
t.lintel_height = Some(0.2);
|
||||
t.sill_board = Some(WindowTypeSillBoard::Beide);
|
||||
t.shading = Some(WindowShading { create: true, kind: WindowShadingKind::Raffstore, r#box: WindowShadingBox { width: 0.0, height: 0.3, depth: 0.18, ..Default::default() }, mount: Some(WindowShadingMount::Sturz), ..Default::default() });
|
||||
}
|
||||
for t in p.door_types.iter_mut().flatten() {
|
||||
t.lintel_height = Some(0.2);
|
||||
}
|
||||
let more = section_opening_primitives(&p, &l, &vis).unwrap();
|
||||
assert!(more.len() > base.len(), "{} {}", more.len(), base.len());
|
||||
let json = serde_json::to_string(&more).unwrap();
|
||||
assert!(json.contains(LINTEL_FILL) && json.contains(SHADING_PACK_FILL), "{json}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn beschnittene_baender_behalten_ihre_ebene() {
|
||||
// Von der Dominanz beschnittene Wand-/Deckenstücke tragen ihre Kategorie weiter: Ebene aus → weg.
|
||||
|
||||
@@ -184,12 +184,7 @@ fn wall_poche(c: &Ctx, out: &mut Vec<Primitive>, e: &EffWall, gaps: &[(f64, f64)
|
||||
if let Some(s) = styles.get(&li) {
|
||||
return Ok(s.clone());
|
||||
}
|
||||
let layer = wt.layers.get(li).ok_or("Schicht fehlt")?;
|
||||
let comp = p.component_or_fallback(&layer.component_id);
|
||||
let hid = resolve_hatch_id(w.hatch_id.as_deref(), w.hatch_source, category, Some(&comp.hatch_id)).unwrap_or(&comp.hatch_id);
|
||||
let hatch = super::domains::resolve_hatch_or_none(p, hid, Some(angle), resolve_foreground(comp, w.foreground.as_deref(), category, w.foreground_source));
|
||||
let bg = resolve_background(comp, w.background.as_deref(), category, w.background_source);
|
||||
let fill = bg.unwrap_or(if hatch.pattern == HatchPattern::Solid { HATCH_INK } else { HATCH_PAPER }).to_string();
|
||||
let (hatch, fill) = layer_style(p, w, wt, li, category, angle)?;
|
||||
styles.insert(li, (hatch.clone(), fill.clone()));
|
||||
Ok((hatch, fill))
|
||||
};
|
||||
@@ -249,6 +244,17 @@ fn wall_poche(c: &Ctx, out: &mut Vec<Primitive>, e: &EffWall, gaps: &[(f64, f64)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Schraffur und Füllung der Schicht `li` im Wandschnitt (Bauteil, Wand- und Kategorie-Übersteuerung).
|
||||
fn layer_style(p: &Project, w: &Wall, wt: &WallType, li: usize, category: Option<&LayerCategory>, angle: f64) -> Result<(HatchRender, String), String> {
|
||||
let layer = wt.layers.get(li).ok_or("Schicht fehlt")?;
|
||||
let comp = p.component_or_fallback(&layer.component_id);
|
||||
let hid = resolve_hatch_id(w.hatch_id.as_deref(), w.hatch_source, category, Some(&comp.hatch_id)).unwrap_or(&comp.hatch_id);
|
||||
let hatch = super::domains::resolve_hatch_or_none(p, hid, Some(angle), resolve_foreground(comp, w.foreground.as_deref(), category, w.foreground_source));
|
||||
let bg = resolve_background(comp, w.background.as_deref(), category, w.background_source);
|
||||
let fill = bg.unwrap_or(if hatch.pattern == HatchPattern::Solid { HATCH_INK } else { HATCH_PAPER }).to_string();
|
||||
Ok((hatch, fill))
|
||||
}
|
||||
|
||||
/// Sashes eines Fenstertyps (`sashesOfWindowType`): fehlend → aus `wingCount` gleichmässig.
|
||||
fn sashes(wt: &WindowType) -> Vec<SashDef> {
|
||||
if let Some(s) = wt.sashes.as_ref().filter(|s| !s.is_empty()) {
|
||||
@@ -272,7 +278,7 @@ fn window_type<'a>(p: &'a Project, o: &Opening) -> Option<&'a WindowType> {
|
||||
|
||||
/// Ö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) -> Result<(), String> {
|
||||
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> {
|
||||
let p = c.p;
|
||||
let total = thickness(&wall_type(p, w)?.layers);
|
||||
let ref_off = joins::reference_offset(crate::model3d::wall_reference(w), total);
|
||||
@@ -321,7 +327,11 @@ fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, colo
|
||||
t.frame_width.unwrap_or(0.06),
|
||||
b01(t.frame_kind == Some(DoorTypeFrameKind::Blockrahmen)),
|
||||
t.inset_from_face.unwrap_or(0.0),
|
||||
b01(t.inset_face == Some(DoorTypeInsetFace::Innen)),
|
||||
match t.inset_face {
|
||||
Some(DoorTypeInsetFace::Innen) => 1.0,
|
||||
Some(DoorTypeInsetFace::Mitte) => 2.0,
|
||||
_ => 0.0,
|
||||
},
|
||||
]),
|
||||
None => b.extend([0.0, 0.0, 0.0, 0.0, 0.0]),
|
||||
}
|
||||
@@ -330,7 +340,11 @@ fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, colo
|
||||
b.push(wt.map_or(0.0, |t| t.frame_width.unwrap_or(0.06)));
|
||||
b.push(wt.and_then(|t| t.frame_depth).unwrap_or(f64::NAN));
|
||||
b.push(wt.and_then(|t| t.inset_from_face).unwrap_or(f64::NAN));
|
||||
b.push(b01(wt.and_then(|t| t.inset_face) == Some(WindowTypeInsetFace::Innen)));
|
||||
b.push(match wt.and_then(|t| t.inset_face) {
|
||||
Some(WindowTypeInsetFace::Innen) => 1.0,
|
||||
Some(WindowTypeInsetFace::Mitte) => 2.0,
|
||||
_ => 0.0,
|
||||
});
|
||||
b.push(o.wing_count.unwrap_or(f64::NAN));
|
||||
b.push(if detail == Detail::Fein { 2.0 } else { 1.0 });
|
||||
let sill = wt.and_then(|t| t.sill_line.as_ref());
|
||||
@@ -351,6 +365,22 @@ fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, colo
|
||||
b.push(frame_view_weight);
|
||||
b.push(o.sash_line.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_HAIRLINE_MM));
|
||||
b.push(o.sill_line_style.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_HAIRLINE_MM));
|
||||
// Details ([94]): Anschlag, Fensterbank, Storenkasten.
|
||||
b.push(if door { dt.and_then(|t| t.rebate_depth) } else { wt.and_then(|t| t.rebate_depth) }.unwrap_or(0.0));
|
||||
b.push(match wt.and_then(|t| t.sill_board) {
|
||||
Some(WindowTypeSillBoard::Keine) => 1.0,
|
||||
Some(WindowTypeSillBoard::Innen) => 2.0,
|
||||
Some(WindowTypeSillBoard::Beide) => 3.0,
|
||||
Some(WindowTypeSillBoard::Aussen) => 4.0,
|
||||
_ => 0.0,
|
||||
});
|
||||
b.push(b01(shading.is_some_and(|s| s.mount == Some(WindowShadingMount::Sturz))));
|
||||
b.push(shading.map_or(0.0, |s| s.r#box.depth));
|
||||
b.push(match shading.map(|s| s.kind) {
|
||||
Some(WindowShadingKind::Raffstore) => 1.0,
|
||||
Some(WindowShadingKind::Markise) => 2.0,
|
||||
_ => 0.0,
|
||||
});
|
||||
b.push(sash_list.len() as f64);
|
||||
for s in &sash_list {
|
||||
b.extend([
|
||||
@@ -374,6 +404,34 @@ fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, colo
|
||||
let count = f[i + 4] as usize;
|
||||
let pts: Vec<Vec2> = (0..count).map(|j| v2(f[i + 5 + 2 * j], f[i + 6 + 2 * j])).collect();
|
||||
let frame = f[i + 1] == 1.0;
|
||||
if f[i + 1] == 2.0 {
|
||||
// Anschlag: Wandnase, je Wandschicht (aussen → innen) in deren Schnitt-Darstellung.
|
||||
i += 5 + 2 * count;
|
||||
if pts.len() != 4 {
|
||||
continue;
|
||||
}
|
||||
let wtype = wall_type(p, w)?;
|
||||
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;
|
||||
let (_, n) = crate::opening_geom::WallRef { start: crate::opening_geom::v(w.start.x, w.start.y), end: crate::opening_geom::v(w.end.x, w.end.y), total, ref_off }.frame();
|
||||
let off = |q: &Vec2| (q.x - w.start.x) * n.x + (q.y - w.start.y) * n.y;
|
||||
let (lo, hi) = (off(&pts[0]), off(&pts[2]));
|
||||
let a = v2(pts[0].x - n.x * lo, pts[0].y - n.y * lo);
|
||||
let bq = v2(pts[1].x - n.x * lo, pts[1].y - n.y * lo);
|
||||
let at = |q: Vec2, d: f64| v2(q.x + n.x * d, q.y + n.y * d);
|
||||
let mut l0 = ref_off - total / 2.0;
|
||||
for (li, layer) in wtype.layers.iter().enumerate() {
|
||||
let l1 = l0 + layer.thickness;
|
||||
let (s0, s1) = (lo.max(l0), hi.min(l1));
|
||||
l0 = l1;
|
||||
if s1 - s0 <= 1e-6 {
|
||||
continue;
|
||||
}
|
||||
let (hatch, fill) = layer_style(p, w, wtype, li, category, angle)?;
|
||||
out.push(wall_polygon(vec![at(a, s0), at(bq, s0), at(bq, s1), at(a, s1)], &fill, wall_line.0, wall_line.1, hatch, greyed, None, Some(&w.id), id));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
out.push(wall_polygon(pts, "none", if frame { slot(f[i + 3]) } else { "none" }, f[i + 2], no_hatch(), greyed, None, None, id));
|
||||
i += 5 + 2 * count;
|
||||
} else if f[i] == 2.0 {
|
||||
@@ -460,7 +518,8 @@ pub fn plan_walls(c: &Ctx, reference_lines: bool, out: &mut Vec<Primitive>, boun
|
||||
Some(DetailLevel::Fein) => Detail::Fein,
|
||||
_ => c.a.detail,
|
||||
};
|
||||
opening_symbol(c, out, w, o, color, c.greyed(&o.category_code), detail, olw)?;
|
||||
let wall_line = (e.color.as_deref().unwrap_or(POCHE_STROKE), lw * c.a.detail.outline_factor());
|
||||
opening_symbol(c, out, w, o, color, c.greyed(&o.category_code), detail, olw, wall_line)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in new issue
Block a user