[68] Baugrube: Verbau als echte Wand (Art + Dicke, Schnitt mit Schraffur, Wandband im Grundriss), Sohlenfläche exakt, Arbeitsraum-Prüfung an Ecken/Nischen

This commit is contained in:
Claude committed 2026-11-11 19:09:28 +00:00
1 parent 776ed12388
commit e5d601a563
16 files changed
+482 -19

No files matched your search

+7 -3
View File
@@ -434,9 +434,13 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `*
- ◐ **[T6]** Glattes Gelände aus Höhenlinien (`terrain.rs`). Natural-Neighbour/Clough-Tocher statt Hermite-Teilung;
Erdreich-Band nicht „bis zur Planunterkante“; Glättung ohne Kantenerhalt; Baugrube ist eigene Kategorie und
bleibt beim Ausblenden von „02“ stehen; gespeicherte Ansichten übernehmen beim Öffnen ihre `layerVisibility`. · L
- ◐ **[68]** Baugrube/Geländebearbeitung (Kontext-Objekt `excavation`). Verbau als echte Wand im Schnitt mit Dicke/
Schraffur; Überlappung der Sohlenfläche nur gerastert; Arbeitsraum an konkaven Ecken ohne Prüfung; IVHB-Terrain
nach kantonalem Recht. · M
- ◐ **[68]** Baugrube/Geländebearbeitung (Kontext-Objekt `excavation`). (11.11.) Verbau ist jetzt eine echte Wand:
Modellfelder `shoringKind` (Spundwand/Rühlwand/Bohrpfahlwand) und `shoringThickness` (Vorgabe 0.2/0.3/0.6 m), im
Schnitt geschnittene Fläche mit Schraffur der Art (Stahl/Holz/Beton), unten Sohle − 1 m Einbindung, Erdreich-Band
spart sie aus; im Grundriss Wandband an der Kante (Klasse der Baugrube, Pick = Baugrube); Sohlenfläche bei
überlappenden Gruben exakt (i_overlay); Arbeitsraum-Prüfung `working_space_check` (enge Nischen, gekappte Gehrung):
rotes Kreuz im Plan, Warnung im Panel. Offen: Einbindetiefe fest 1 m (kein Feld), Verbau je Kante nur eine Art,
Verbau noch nicht in Ansicht/3D; nicht in der App angesehen; IVHB-Terrain nach kantonalem Recht. · M
- ◐ **[143]** Baugrube erstellen. (9.11.) DXF/DWG-Höhenlinien werden beim Import erkannt (Layer-Name Höhenlinie/HL/
Contour/Kote …, Erhebung Gruppe 38, 3D-Polylinien mit konstantem Z, sonst Höhentexte nahe der Linie) und als
`contourSet` „02 Gelände“ statt als 2D-Zeichnung übernommen: Kern `import_terrain.rs`, Option „Höhenlinien als Gelände
+220 -14
View File
@@ -36,6 +36,12 @@ pub struct ExSpec {
pub cut_tan: Vec<f64>,
/// Kante mit senkrechtem Verbau (Spundwand): keine Böschung, keine Schraffur.
pub shored: Vec<bool>,
/// [68] Art des Verbaus (`sheetPile`, `soldierPile`, `borePile`) und Wanddicke in m.
pub shore_kind: &'static str,
pub shore_t: f64,
/// [68] Umriss vor dem Arbeitsraum (Gebäude-Grundfläche, gegen den Uhrzeigersinn) und Arbeitsraum in m.
pub base: Vec<P2>,
pub ws: f64,
pub fill_tan: f64,
pub berm_w: f64,
pub berm_h: f64,
@@ -117,9 +123,12 @@ impl ExSpec {
}
// Arbeitsraum: Sohle um `workingSpace` nach aussen (Gehrung, höchstens 4× so weit an spitzen Ecken).
let ws = e.working_space.filter(|v| v.is_finite() && *v > 0.0).unwrap_or(0.0);
let base = ring.clone();
if ws > 0.0 {
ring = offset_ring(&ring, ws);
}
let (shore_kind, default_t) = shoring_kind(e.shoring_kind.as_deref());
let shore_t = e.shoring_thickness.filter(|v| v.is_finite() && *v > 0.0).unwrap_or(default_t);
let bw = e.berm_width.filter(|v| v.is_finite() && *v > 0.0).unwrap_or(0.0);
let bh = e.berm_height.filter(|v| v.is_finite() && *v > 0.0).unwrap_or(0.0);
Some(ExSpec {
@@ -127,6 +136,10 @@ impl ExSpec {
bottom: e.bottom + dz,
cut_tan,
shored,
shore_kind,
shore_t,
base,
ws,
fill_tan: tan_deg(e.fill_slope.filter(|s| s.is_finite() && *s > 0.0).unwrap_or(DEFAULT_FILL_SLOPE)),
berm_w: if bh > 0.0 { bw } else { 0.0 },
berm_h: if bw > 0.0 { bh } else { 0.0 },
@@ -216,6 +229,124 @@ impl ExSpec {
}
}
// ── Verbau ([68]) ────────────────────────────────────────────────────────────
/// Einbindetiefe der Verbauwand unter die Sohle (m).
pub const SHORING_EMBED: f64 = 1.0;
/// Art des Verbaus und ihre Vorgabe-Dicke (m); Unbekanntes = Spundwand.
pub fn shoring_kind(k: Option<&str>) -> (&'static str, f64) {
match k {
Some("soldierPile") => ("soldierPile", 0.3),
Some("borePile") => ("borePile", 0.6),
_ => ("sheetPile", 0.2),
}
}
/// Schraffur-Id der Verbauart (SIA: Stahl, Holz, Beton).
pub fn shoring_hatch_id(kind: &str) -> &'static str {
match kind {
"soldierPile" => "std-h-holz",
"borePile" => "std-h-beton",
_ => "std-h-stahl-detail",
}
}
impl ExSpec {
/// Wandbänder der verbauten Kanten: Vierecke von der Sohlkante um die Wanddicke nach aussen (Gehrung an den
/// Ecken, wie der Arbeitsraum). Index der Kante, Viereck.
pub fn shoring_quads(&self) -> Vec<(usize, Vec<P2>)> {
if !self.shored.iter().any(|b| *b) || !(self.shore_t > 0.0) {
return Vec::new();
}
let n = self.ring.len();
let off = offset_ring(&self.ring, self.shore_t);
(0..n).filter(|i| self.shored[*i]).map(|i| (i, vec![self.ring[i], self.ring[(i + 1) % n], off[(i + 1) % n], off[i]])).collect()
}
}
/// Prüfung des Arbeitsraums an den Ecken des Umrisses ([68]).
#[derive(Clone, Debug, PartialEq)]
pub struct WsCheck {
/// Verlangte Breite (m).
pub required: f64,
/// Kleinster Abstand zwischen Gebäude-Umriss und Sohle (m), 0 bei Überschneidung.
pub min_width: f64,
pub ok: bool,
/// Stellen, an denen die Breite fehlt (Ecken der Sohle bzw. des Umrisses, Selbstüberschneidungen).
pub spots: Vec<P2>,
}
fn seg_cross(a: P2, b: P2, c: P2, d: P2) -> Option<P2> {
let (r, s) = ([b[0] - a[0], b[1] - a[1]], [d[0] - c[0], d[1] - c[1]]);
let den = r[0] * s[1] - r[1] * s[0];
if den.abs() < 1e-12 {
return None;
}
let q = [c[0] - a[0], c[1] - a[1]];
let t = (q[0] * s[1] - q[1] * s[0]) / den;
let u = (q[0] * r[1] - q[1] * r[0]) / den;
(t > 1e-9 && t < 1.0 - 1e-9 && u > 1e-9 && u < 1.0 - 1e-9).then(|| [a[0] + t * r[0], a[1] + t * r[1]])
}
fn ring_dist(p: P2, r: &[P2]) -> f64 {
let n = r.len();
(0..n).map(|i| seg_dist(p, r[i], r[(i + 1) % n])).fold(f64::INFINITY, f64::min)
}
/// Arbeitsraum an konkaven und spitzen Ecken: Die Sohle ist der um `ws` versetzte Gebäude-Umriss. In engen Nischen
/// (< 2·ws) kreuzen sich die versetzten Kanten, an spitzen Ecken kappt die Gehrung bei 4·ws — dort fehlt Breite.
/// `None` ohne Arbeitsraum.
pub fn working_space_check(spec: &ExSpec) -> Option<WsCheck> {
if !(spec.ws > 0.0) {
return None;
}
let (base, sole) = (&spec.base, &spec.ring);
let mut spots: Vec<P2> = Vec::new();
let mut min_w = f64::INFINITY;
// Ecken der Sohle zum Umriss (innen = Verletzung) und Ecken des Umrisses zur Sohle (aussen = Verletzung).
for &v in sole {
let w = if point_in_ring(v, base) { 0.0 } else { ring_dist(v, base) };
if w < spec.ws - 1e-6 {
spots.push(v);
}
min_w = min_w.min(w);
}
for &v in base {
let w = if point_in_ring(v, sole) { ring_dist(v, sole) } else { 0.0 };
if w < spec.ws - 1e-6 {
spots.push(v);
}
min_w = min_w.min(w);
}
// Selbstüberschneidung der Sohle (zu enge Nische) und Kreuzung mit dem Umriss.
let (n, m) = (sole.len(), base.len());
for i in 0..n {
for j in i + 2..n {
if i == 0 && j == n - 1 {
continue;
}
if let Some(x) = seg_cross(sole[i], sole[(i + 1) % n], sole[j], sole[(j + 1) % n]) {
spots.push(x);
}
}
for j in 0..m {
if let Some(x) = seg_cross(sole[i], sole[(i + 1) % n], base[j], base[(j + 1) % m]) {
spots.push(x);
min_w = 0.0;
}
}
}
let mut uniq: Vec<P2> = Vec::new();
for s in spots {
if !uniq.iter().any(|u| (u[0] - s[0]).hypot(u[1] - s[1]) < 1e-3) {
uniq.push(s);
}
}
let min_width = if min_w.is_finite() { min_w } else { spec.ws };
Some(WsCheck { required: spec.ws, min_width, ok: uniq.is_empty(), spots: uniq })
}
/// Regelmässiges Raster über einem Rechteck (Knoten).
struct Grid {
x0: f64,
@@ -412,7 +543,7 @@ pub struct Volumes {
/// je Probe geht der Höhenunterschied einer Baugrube an sie allein — die Summe ist die Vereinigung.
/// Integriert über ein Raster der Weite ≤ `h` (Mittelpunkte, höchstens ~1.5 Mio. Proben).
/// `footprint`: Gebäude-Grundfläche (Ringe); Abtrag darin zählt nicht zur Hinterfüllung.
/// Sohlenfläche = Fläche des Umrisses ohne die der vorherigen Baugruben (Überlappung per Raster).
/// Sohlenfläche = Fläche des Umrisses ohne die der vorherigen Baugruben (exakt, Polygon-Booleans).
pub fn volumes_union(orig: &Tin, specs: &[&ExSpec], h: f64, footprint: &[Vec<P2>]) -> Vec<Volumes> {
if specs.is_empty() {
return Vec::new();
@@ -431,12 +562,7 @@ pub fn volumes_union(orig: &Tin, specs: &[&ExSpec], h: f64, footprint: &[Vec<P2>
let (nx, ny) = (((w / h).ceil() as usize).max(1), ((hh / h).ceil() as usize).max(1));
let (hx, hy) = (w / nx as f64, hh / ny as f64);
let cell = hx * hy;
let boxes: Vec<[f64; 4]> = specs.iter().map(|e| e.bbox()).collect();
let overlaps: Vec<bool> = (0..specs.len())
.map(|k| (0..k).any(|j| boxes[j][0] < boxes[k][2] && boxes[k][0] < boxes[j][2] && boxes[j][1] < boxes[k][3] && boxes[k][1] < boxes[j][3]))
.collect();
let mut out: Vec<Volumes> = specs.iter().map(|e| Volumes { bottom_area: signed_area(&e.ring).abs(), ..Default::default() }).collect();
let mut shared = vec![0.0; specs.len()];
let mut out: Vec<Volumes> = specs.iter().map(|_| Volumes::default()).collect();
for j in 0..ny {
for i in 0..nx {
let p = [reg[0] + (i as f64 + 0.5) * hx, reg[1] + (j as f64 + 0.5) * hy];
@@ -444,9 +570,6 @@ pub fn volumes_union(orig: &Tin, specs: &[&ExSpec], h: f64, footprint: &[Vec<P2>
let mut cur = t;
let outside_fp = !footprint.iter().any(|f| point_in_ring(p, f));
for (k, ex) in specs.iter().enumerate() {
if overlaps[k] && p[0] >= boxes[k][0] && p[0] <= boxes[k][2] && p[1] >= boxes[k][1] && p[1] <= boxes[k][3] && point_in_ring(p, &ex.ring) && (0..k).any(|q| point_in_ring(p, &specs[q].ring)) {
shared[k] += cell;
}
let next = ex.apply(cur, p);
let dz = cur - next;
if dz > 0.0 {
@@ -461,8 +584,11 @@ pub fn volumes_union(orig: &Tin, specs: &[&ExSpec], h: f64, footprint: &[Vec<P2>
}
}
}
for (v, s) in out.iter_mut().zip(shared) {
v.bottom_area = (v.bottom_area - s).max(0.0);
// Sohlenfläche exakt: Fläche des Umrisses ohne die der vorherigen Baugruben (Polygon-Booleans, [68]).
for (k, v) in out.iter_mut().enumerate() {
let prev: Vec<crate::flat::Polygon> = specs[..k].iter().map(|e| vec![e.ring.clone()]).collect();
let left = crate::polygon_bool::difference(&[vec![specs[k].ring.clone()]], &prev);
v.bottom_area = left.iter().flat_map(|poly| poly.iter().map(|r| signed_area(r))).sum::<f64>().max(0.0);
}
out
}
@@ -615,6 +741,12 @@ pub struct ExQty {
pub cut: f64,
pub fill: f64,
pub backfill: f64,
/// [68] Arbeitsraum: verlangte Breite, kleinster Abstand Umriss–Sohle, eingehalten? Ohne Arbeitsraum 0 / 0 / true.
pub working_space: f64,
pub working_space_min: f64,
pub working_space_ok: bool,
/// Stellen mit fehlender Breite (Modell-x/y).
pub working_space_spots: Vec<[f64; 2]>,
}
pub fn quantities(p: &Project) -> Vec<ExQty> {
@@ -631,9 +763,22 @@ pub fn quantities(p: &Project) -> Vec<ExQty> {
let (x0, x1) = specs.iter().flat_map(|s| s.ring.iter().map(|q| q[0])).fold((f64::INFINITY, f64::NEG_INFINITY), |a, x| (a.0.min(x), a.1.max(x)));
let h = ((x1 - x0).max(1.0) / 400.0).clamp(0.02, 0.5);
let vols = volumes_union(&st.orig, &specs, h, &fp);
for ((id, ..), v) in hits.iter().zip(vols) {
for ((id, spec, _), v) in hits.iter().zip(vols) {
let Some(e) = excavations(p).into_iter().find(|e| e.id == *id) else { continue };
done.push(ExQty { id: e.id.clone(), name: e.name.clone(), bottom: e.bottom, bottom_area: v.bottom_area, cut: v.cut, fill: v.fill, backfill: v.backfill });
let ws = working_space_check(spec);
done.push(ExQty {
id: e.id.clone(),
name: e.name.clone(),
bottom: e.bottom,
bottom_area: v.bottom_area,
cut: v.cut,
fill: v.fill,
backfill: v.backfill,
working_space: ws.as_ref().map_or(0.0, |w| w.required),
working_space_min: ws.as_ref().map_or(0.0, |w| w.min_width),
working_space_ok: ws.as_ref().is_none_or(|w| w.ok),
working_space_spots: ws.map_or_else(Vec::new, |w| w.spots),
});
}
}
// Reihenfolge wie im Modell.
@@ -917,6 +1062,67 @@ mod tests {
assert!(sum < single.cut + sep.cut - 1.0 && sum > single.cut, "{sum}");
}
#[test]
fn sohlenflaeche_ueberlappung_exakt() {
// Zwei 10 × 10-Gruben, die zweite um 6 m versetzt: gemeinsam 4 × 10, also bleiben 60 m² (exakt, nicht gerastert).
let t = flat(0.0, 50.0);
let sa = ExSpec::of(&square(5.0, -3.0), 0.0).unwrap();
let mut c = square(5.0, -3.0);
for q in &mut c.outline {
q.x += 6.0 + 0.0123;
}
let sc = ExSpec::of(&c, 0.0).unwrap();
let u = volumes_union(&t, &[&sa, &sc], 0.5, &[]);
assert!((u[0].bottom_area - 100.0).abs() < 1e-6, "{}", u[0].bottom_area);
assert!((u[1].bottom_area - (100.0 - 10.0 * (5.0 - (1.0 + 0.0123)))).abs() < 1e-6, "{}", u[1].bottom_area);
// Vollständig überdeckt: 0.
let same = volumes_union(&t, &[&sa, &sa], 0.5, &[]);
assert!(same[1].bottom_area.abs() < 1e-6);
}
#[test]
fn arbeitsraum_ecken_und_nischen() {
let v = |x: f64, y: f64| Vec2 { x, y };
let pit = |pts: Vec<Vec2>, ws: f64| Excavation { id: "bg".into(), outline: pts, bottom: -3.0, working_space: Some(ws), ..Default::default() };
// Rechteck und L-Form (konkave Ecke): Breite eingehalten.
let l = pit(vec![v(0.0, 0.0), v(10.0, 0.0), v(10.0, 4.0), v(4.0, 4.0), v(4.0, 10.0), v(0.0, 10.0)], 1.0);
let c = working_space_check(&ExSpec::of(&l, 0.0).unwrap()).unwrap();
assert!(c.ok && c.spots.is_empty() && (c.min_width - 1.0).abs() < 1e-6, "{c:?}");
// Schmale Nische (1 m < 2 · 1 m Arbeitsraum): die versetzten Kanten kreuzen sich, Stelle gemeldet.
let u = pit(vec![v(0.0, 0.0), v(10.0, 0.0), v(10.0, 10.0), v(5.5, 10.0), v(5.5, 3.0), v(4.5, 3.0), v(4.5, 10.0), v(0.0, 10.0)], 1.0);
let c = working_space_check(&ExSpec::of(&u, 0.0).unwrap()).unwrap();
assert!(!c.ok && !c.spots.is_empty(), "{c:?}");
// Breite Nische (3 m): in Ordnung.
let w = pit(vec![v(0.0, 0.0), v(10.0, 0.0), v(10.0, 10.0), v(6.5, 10.0), v(6.5, 3.0), v(3.5, 3.0), v(3.5, 10.0), v(0.0, 10.0)], 1.0);
assert!(working_space_check(&ExSpec::of(&w, 0.0).unwrap()).unwrap().ok);
// Sehr spitze Ecke: Gehrung wird gekappt, dort fehlt Breite.
let spike = pit(vec![v(0.0, 0.0), v(20.0, 0.5), v(0.0, 1.0)], 1.0);
assert!(!working_space_check(&ExSpec::of(&spike, 0.0).unwrap()).unwrap().ok);
// Ohne Arbeitsraum keine Prüfung.
assert!(working_space_check(&ExSpec::of(&square(5.0, -3.0), 0.0).unwrap()).is_none());
}
#[test]
fn verbau_baender_und_arten() {
let mut e = square(5.0, -3.0);
e.edge_shoring = Some(vec![true, false, false, false]);
let spec = ExSpec::of(&e, 0.0).unwrap();
assert_eq!((spec.shore_kind, spec.shore_t), ("sheetPile", 0.2));
let q = spec.shoring_quads();
assert_eq!(q.len(), 1);
// 10 m × 0.2 m plus die Gehrungsdreiecke an den Enden.
assert!((signed_area(&q[0].1).abs() - 2.04).abs() < 1e-9, "{}", signed_area(&q[0].1));
// Band liegt ausserhalb der Sohle.
assert!(q[0].1.iter().skip(2).all(|p| !point_in_ring(*p, &spec.ring)));
e.shoring_kind = Some("borePile".into());
e.shoring_thickness = Some(0.9);
let spec = ExSpec::of(&e, 0.0).unwrap();
assert_eq!((spec.shore_kind, spec.shore_t), ("borePile", 0.9));
assert_eq!(shoring_hatch_id(spec.shore_kind), "std-h-beton");
// Ohne Verbau keine Bänder.
assert!(ExSpec::of(&square(5.0, -3.0), 0.0).unwrap().shoring_quads().is_empty());
}
#[test]
fn luftbildfarben_auf_geaendertem_gelaende() {
// Original-Netz mit Farbverlauf in x; nach der Baugrube behalten alle neuen Punkte die Farbe ihrer (x, y).
+9
View File
@@ -6370,6 +6370,15 @@ pub struct Excavation {
#[serde(rename = "edgeShoring", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub edge_shoring: Option<Vec<bool>>,
/// [68] Art des Verbaus auf den verbauten Kanten: `sheetPile` (Spundwand, Vorgabe), `soldierPile` (Rühlwand),
/// `borePile` (Bohrpfahlwand). Bestimmt Vorgabe-Dicke und Schraffur im Schnitt und Grundriss.
#[serde(rename = "shoringKind", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub shoring_kind: Option<String>,
/// [68] Dicke der Verbauwand in m (nach aussen von der Sohlkante); fehlt = Vorgabe der Art.
#[serde(rename = "shoringThickness", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub shoring_thickness: Option<f64>,
#[serde(flatten)]
#[ts(skip)]
pub extra: Extra,
+50
View File
@@ -365,6 +365,8 @@ pub(super) fn outside_bb(a: Vec2, b: Vec2, rings: &[Vec<Vec2>], bb: [f64; 4]) ->
ts.windows(2).filter(|w| w[1] - w[0] > 1e-9 && !rings.iter().any(|r| inside(at((w[0] + w[1]) / 2.0), r))).map(|w| (at(w[0]), at(w[1]))).collect()
}
const EXCAVATION_INK: &str = "#1f242c";
/// [68] Warnmarke: Arbeitsraum zu schmal.
const WS_WARN_INK: &str = "#d6001c";
fn ink_line(a: Vec2, b: Vec2, w: f64, color: &str, dash: Option<Vec<f64>>) -> Primitive {
Primitive::Line { a, b, cls: "context-line".into(), weight_mm: w, dash: dash.map(Some), zigzag: None, motif: None, color: Some(color.into()), drawing_id: None, opening_id: None, stair_id: None, greyed: None, opacity: None }
@@ -810,6 +812,28 @@ fn excavation_lines(c: &Ctx, e: &Excavation, out: &mut Vec<Primitive>, bands: &m
}
}
}
// [68] Verbauwand als Wandband an der Kante: Dicke nach aussen, Schraffur der Verbauart; Pick wählt die Baugrube.
let quads = spec.shoring_quads();
if !quads.is_empty() {
let hatch = crate::plan::style::resolve_hatch(c.p, crate::excavation::shoring_hatch_id(spec.shore_kind), None, None, None)
.unwrap_or_else(no_hatch);
for (_, q) in quads {
let mut band = super::section::polygon(q.iter().map(|p| v2(p[0], p[1])).collect(), crate::plan::style::HATCH_PAPER, EXCAVATION_INK, 0.25, hatch.clone());
if let Primitive::Polygon { context_object_id, .. } = &mut band {
*context_object_id = Some(e.id.clone());
}
out.push(band);
}
}
// [68] Arbeitsraum zu schmal (enge Nische, gekappte Ecke): rotes Kreuz an der Stelle.
if let Some(chk) = crate::excavation::working_space_check(spec).filter(|w| !w.ok) {
let r = 0.0025 * c.a.scale.max(1.0);
for s in chk.spots {
for (dx, dy) in [(1.0, 1.0), (1.0, -1.0)] {
out.push(ink_line(v2(s[0] - dx * r, s[1] - dy * r), v2(s[0] + dx * r, s[1] + dy * r), 0.35, WS_WARN_INK, None));
}
}
}
break;
}
}
@@ -1471,6 +1495,32 @@ mod tests {
assert_eq!(sohle.iter().filter(|(a, b)| (a.x - 12.0).abs() < 1e-9 && (b.x - 12.0).abs() < 1e-9).count(), 1, "Westrand ganz");
}
/// [68] Verbau als Wandband im Grundriss (mit Schraffur der Verbauart, Pick = Baugrube) und rotes Kreuz, wo der
/// Arbeitsraum an einer engen Nische nicht reicht.
#[test]
fn verbauband_und_arbeitsraum_marke() {
let mut p = sample_with_walls(serde_json::json!([["h1", "eg", 14.0, 0.0, 26.0, 0.0]]));
let t = TerrainMesh { id: "t".into(), category_code: "02".into(), positions: vec![0.0, -10.0, 0.0, 40.0, -10.0, 0.0, 40.0, 30.0, 0.0, 0.0, 30.0, 0.0], indices: vec![0.0, 1.0, 2.0, 0.0, 2.0, 3.0], ..Default::default() };
let mut pit = Excavation { id: "bg".into(), category_code: "02".into(), outline: vec![v2(12.0, -2.0), v2(28.0, -2.0), v2(28.0, 10.0), v2(12.0, 10.0)], bottom: -3.0, edge_shoring: Some(vec![true, false, false, false]), shoring_kind: Some("soldierPile".into()), ..Default::default() };
p.context = Some(vec![ContextObject::TerrainMesh(t.clone()), ContextObject::Excavation(pit.clone())]);
let a = super::super::domains::PlanArgs::parse(1.0, r#"{"floor": "eg", "show": ["02", "90", "80", "02"], "scale": 100}"#).unwrap();
let c = Ctx::new(&p, &a);
let mut ctx = Vec::new();
plan_context(&c, &mut ctx);
let bands: Vec<&Primitive> = ctx.iter().filter(|q| matches!(q, Primitive::Polygon { stroke, context_object_id: Some(id), .. } if stroke == EXCAVATION_INK && id == "bg")).collect();
assert_eq!(bands.len(), 1, "ein Band für die eine verbaute Kante");
assert!(!ctx.iter().any(|q| matches!(q, Primitive::Line { color: Some(k), .. } if k == WS_WARN_INK)), "kein Arbeitsraum, keine Marke");
// Enge Nische mit Arbeitsraum: Marken.
pit.outline = vec![v2(12.0, -2.0), v2(28.0, -2.0), v2(28.0, 10.0), v2(20.5, 10.0), v2(20.5, 3.0), v2(19.5, 3.0), v2(19.5, 10.0), v2(12.0, 10.0)];
pit.edge_shoring = None;
pit.working_space = Some(1.0);
p.context = Some(vec![ContextObject::TerrainMesh(t), ContextObject::Excavation(pit)]);
let c = Ctx::new(&p, &a);
let mut ctx = Vec::new();
plan_context(&c, &mut ctx);
assert!(ctx.iter().any(|q| matches!(q, Primitive::Line { color: Some(k), .. } if k == WS_WARN_INK)));
}
/// [157] Schnittmarken-Beschriftung nicht auf der Böschungsschraffur: Sohle, Böschungsoberkante und Schraffur
/// der sichtbaren Baugrube sind Hindernisse („B-B“ lag im Musterhaus komplex in der Böschung).
#[test]
+74
View File
@@ -249,9 +249,78 @@ pub(super) fn append_terrain_profiles(out: &mut Output, p: &Project, base: (f64,
}
}
}
append_shoring(out, p, base, u, range);
append_earth(out, p, base, u);
}
/// [68] Verbauwände der Baugruben im Schnitt: das Wandband jeder verbauten Sohlkante (Dicke nach aussen) wird mit
/// der Schnittebene geschnitten; oben das gewachsene Gelände, unten Sohle minus Einbindetiefe. Bänder ausserhalb
/// der Schnittweite fallen weg.
fn append_shoring(out: &mut Output, p: &Project, base: (f64, f64), u: (f64, f64), range: Option<(f64, f64)>) {
let mut done: Vec<String> = Vec::new();
for t in crate::excavation::terrains(p) {
if t.positions.len() < 9 {
continue;
}
let st = crate::excavation::site_terrain(p, t);
let idx = st.index_orig();
for (id, spec, _) in &st.items {
if done.contains(id) {
continue;
}
let Some(e) = crate::excavation::excavations(p).into_iter().find(|e| e.id == *id) else { continue };
let quads = spec.shoring_quads();
if quads.is_empty() {
continue;
}
done.push(id.clone());
let hatch_id = crate::excavation::shoring_hatch_id(spec.shore_kind);
let hatch = crate::plan::style::resolve_hatch(p, hatch_id, None, None, None)
.unwrap_or(HatchRender { pattern: HatchPattern::Diagonal, scale: 1.0, angle: 45.0, color: HATCH_INK.into(), line_weight: 0.1, ..no_hatch_base() });
let z_bottom = e.bottom - crate::excavation::SHORING_EMBED;
for (_, quad) in quads {
// Schnitt der Geraden base + s·u mit dem Viereck: erster und letzter Durchgang.
let mut ss: Vec<f64> = Vec::new();
for i in 0..quad.len() {
let (a, b) = (quad[i], quad[(i + 1) % quad.len()]);
let (ex, ey) = (b[0] - a[0], b[1] - a[1]);
let den = u.0 * ey - u.1 * ex;
if den.abs() < 1e-12 {
continue;
}
let (wx, wy) = (a[0] - base.0, a[1] - base.1);
let s_ = (wx * ey - wy * ex) / den;
let t_ = (wx * u.1 - wy * u.0) / den;
if (0.0..1.0).contains(&t_) {
ss.push(s_);
}
}
ss.sort_by(|a, b| a.total_cmp(b));
let (Some(&s0), Some(&s1)) = (ss.first(), ss.last()) else { continue };
if s1 - s0 < 1e-6 {
continue;
}
if let Some((lo, hi)) = range {
if s1 < lo - TERRAIN_MARGIN || s0 > hi + TERRAIN_MARGIN {
continue;
}
}
let top = |s: f64| idx.z_at(base.0 + u.0 * s, base.1 + u.1 * s).map(|z| z - st.datum);
let (Some(z0), Some(z1)) = (top(s0), top(s1)) else { continue };
if z0.max(z1) <= e.bottom + 1e-3 {
continue;
}
out.shoring.push(ShoringCut {
ring: vec![[s0, z_bottom], [s1, z_bottom], [s1, z1.max(e.bottom)], [s0, z0.max(e.bottom)]],
hatch: hatch.clone(),
category: e.category_code.clone(),
excavation_id: e.id.clone(),
});
}
}
}
}
/// Geschlossenes Dreiecksnetz: jede Kante gehört zu genau zwei Dreiecken.
fn is_closed(indices: &[f64]) -> bool {
if indices.len() < 12 {
@@ -291,6 +360,11 @@ fn append_earth(out: &mut Output, p: &Project, base: (f64, f64), u: (f64, f64))
return;
}
let mut band = crate::polygon_bool::union(&band);
// [68] Verbauwände stehen im Erdreich: das Band lässt sie aus.
if !out.shoring.is_empty() {
let walls: Vec<crate::flat::Polygon> = out.shoring.iter().map(|w| vec![w.ring.clone()]).collect();
band = crate::polygon_bool::difference(&band, &walls);
}
// Gebäude-Inneres: Abschnitte der Schnittlinie in der Grundfläche.
let mut holes: Vec<crate::flat::Polygon> = Vec::new();
for poly in crate::site_rules::building_footprint(p) {
+13 -1
View File
@@ -480,6 +480,16 @@ pub struct Profile {
pub natural: bool,
}
/// [68] Schnitt durch die Verbauwand einer Baugrube.
#[derive(Clone, Debug)]
pub struct ShoringCut {
pub ring: Vec<[f64; 2]>,
pub hatch: HatchRender,
/// Klasse der Baugrube.
pub category: String,
pub excavation_id: String,
}
/// Ergebnis eines Schnitts (`SectionOutput`).
#[derive(Clone, Debug, Default)]
pub struct Output {
@@ -489,6 +499,8 @@ pub struct Output {
pub profiles: Vec<Profile>,
/// [T6] Erdreich unter dem gestalteten Terrain (Band, ohne Gebäude-Inneres), mit Schraffur.
pub earth: Vec<(Vec<[f64; 2]>, HatchRender)>,
/// [68] Verbauwände der Baugruben (Spundwand, Rühlwand, Bohrpfahlwand) als Schnittflächen mit Schraffur.
pub shoring: Vec<ShoringCut>,
/// [137] Gelände, zu dem das Erdreich-Band gehört (Pick-Id: Klick ins Band wählt das Gelände).
pub terrain_id: Option<String>,
/// [152] Importierte Netze im Schnitt (Index = `Cut::index`/`Edge::index` bei `Kind::Mesh`).
@@ -631,7 +643,7 @@ pub(super) fn compute_plane(p: &Project, level: &LevelSpec, bodies: &[BodyMesh],
let (mut visible, hidden) = projection_edges(p, &plane, &walls_r, &wi, &slabs_r, &bodies, &meshes, &cuts, level.hidden_lines, level.depth, strip.map_or(&[][..], |s| &s.half[..]), &skip);
shaped_projection(&mut visible, p, &walls_r, &plane);
let meshes = meshes.iter().map(|m| MeshMeta { id: m.mesh.id.clone(), name: m.mesh.name.clone(), category: Some(m.mesh.category_code.clone()) }).collect();
let mut out = Output { cuts, visible, hidden, profiles: Vec::new(), earth: Vec::new(), terrain_id: None, meshes, mesh_lines, edge_cats };
let mut out = Output { cuts, visible, hidden, profiles: Vec::new(), earth: Vec::new(), shoring: Vec::new(), terrain_id: None, meshes, mesh_lines, edge_cats };
append_terrain_profiles(&mut out, p, base, u);
if let Some(s) = strip {
unfold::clip_output(&mut out, s);
@@ -449,6 +449,18 @@ pub fn section_primitives_mv(out: &Output, mono: bool, hidden_lines: bool, vis:
}
// [157] Verdeckte Kanten kommen hier hinein (unter die Schnittflächen, die sie verdecken).
let cut_start = prims.len();
// [68] Verbauwände der Baugruben (Klasse der Baugrube), mit Schraffur der Verbauart; Pick wählt die Baugrube.
for w in out.shoring.iter().filter(|w| shown(&w.category)) {
let hatch = if mono { HatchRender { color: SECTION_INK.into(), ..w.hatch.clone() } } else { w.hatch.clone() };
let mut pr = polygon(w.ring.iter().map(|q| v2(q[0], q[1])).collect(), HATCH_PAPER, SECTION_INK, SECTION_JOINT_MM, hatch);
if let Primitive::Polygon { context_object_id, greyed, .. } = &mut pr {
*context_object_id = Some(w.excavation_id.clone());
*greyed = Some(vis.greyed(&w.category));
}
w.ring.iter().for_each(|q| acc.add(q[0], q[1]));
cut_rings.push(vec![w.ring.clone()]);
prims.push(pr);
}
for cp in &merged {
if cp.pts.len() < 3 {
continue;
+43
View File
@@ -861,6 +861,49 @@ fn gelaende_mit_baugrube_im_schnitt() {
assert!(!f.is_empty() && f.iter().all(|q| q.natural == Some(0.0) && q.designed.is_some_and(|z| (z + 2.0).abs() < 1e-6)));
}
/// [68] Verbau im Schnitt: verbaute Kanten werden zu geschnittenen Wänden mit Dicke und Schraffur der Verbauart,
/// das Erdreich-Band spart sie aus; Klasse der Baugrube steuert die Sichtbarkeit.
#[test]
fn verbauwand_im_schnitt() {
let mut p = sample();
let flat = TerrainMesh {
id: "t".into(),
positions: vec![-50.0, -50.0, 0.0, 50.0, -50.0, 0.0, 50.0, 50.0, 0.0, -50.0, 50.0, 0.0],
indices: vec![0.0, 1.0, 2.0, 0.0, 2.0, 3.0],
category_code: "02".into(),
..Default::default()
};
let pit = Excavation {
id: "bg".into(),
category_code: "07".into(),
outline: vec![Vec2 { x: -1.0, y: -1.0 }, Vec2 { x: 6.0, y: -1.0 }, Vec2 { x: 6.0, y: 5.0 }, Vec2 { x: -1.0, y: 5.0 }],
bottom: -2.0,
edge_shoring: Some(vec![true; 4]),
shoring_kind: Some("borePile".into()),
shoring_thickness: Some(0.5),
..Default::default()
};
p.context = Some(vec![ContextObject::TerrainMesh(flat), ContextObject::Excavation(pit)]);
let out = compute_section(&p, &level(&p, "schnitt-a"), &[]).unwrap().unwrap();
assert!(!out.shoring.is_empty(), "Verbauwand geschnitten");
for w in &out.shoring {
let zs: Vec<f64> = w.ring.iter().map(|q| q[1]).collect();
let (lo, hi) = (zs.iter().cloned().fold(f64::INFINITY, f64::min), zs.iter().cloned().fold(f64::NEG_INFINITY, f64::max));
assert!((lo + 3.0).abs() < 1e-6 && hi.abs() < 1e-6, "Sohle −2 minus Einbindung 1, Oberkante Gelände 0: {lo} {hi}");
assert!(w.ring[1][0] - w.ring[0][0] >= 0.5 - 1e-6, "mindestens die Wanddicke");
assert_eq!(w.category, "07");
}
let (prims, _) = section_primitives(&out, false, false, &Visibility::default());
assert!(prims.iter().any(|q| matches!(q, Primitive::Polygon { hatch, context_object_id: Some(id), .. } if id == "bg" && hatch.pattern != HatchPattern::None)));
// Das Erdreich-Band lässt die Wand aus.
let wall_area: f64 = out.shoring.iter().map(|w| (w.ring[1][0] - w.ring[0][0]) * (w.ring[3][1] - w.ring[0][1])).sum();
assert!(wall_area > 1.0);
// Klasse aus: keine Wand.
let vis = Visibility { has_vis: true, invisible: ["07".to_string()].into_iter().collect(), ..Default::default() };
let (prims, _) = section_primitives(&out, false, false, &vis);
assert!(!prims.iter().any(|q| matches!(q, Primitive::Polygon { context_object_id: Some(id), .. } if id == "bg")));
}
fn ov_rule(conds: serde_json::Value, actions: serde_json::Value) -> OverrideRule {
let c = conds.as_array().unwrap();
serde_json::from_value(serde_json::json!({"id": "r", "name": "r", "enabled": true, "condition": c[0], "conditions": c[1..].to_vec(), "actions": actions})).unwrap()
@@ -200,6 +200,7 @@ pub(super) fn clip_output(out: &mut Output, s: &Strip) {
.collect();
out.profiles = std::mem::take(&mut out.profiles).into_iter().flat_map(|pr| clip_line_to_u(&pr.pts, lo, hi).into_iter().map(move |pts| Profile { pts, ..pr.clone() })).collect();
out.earth = std::mem::take(&mut out.earth).into_iter().filter_map(|(pts, h)| clip_poly_u(&pts, None, lo, hi).map(|(p, _)| (p, h))).collect();
out.shoring = std::mem::take(&mut out.shoring).into_iter().filter_map(|mut w| clip_poly_u(&w.ring, None, lo, hi).map(|(p, _)| { w.ring = p; w })).collect();
out.mesh_lines = std::mem::take(&mut out.mesh_lines).into_iter().flat_map(|(k, pts)| clip_line_to_u(&pts, lo, hi).into_iter().map(move |p| (k, p))).collect();
}
@@ -216,6 +217,7 @@ pub(super) fn shift_output(out: &mut Output, du: f64) {
}
out.profiles.iter_mut().flat_map(|p| p.pts.iter_mut()).for_each(sh);
out.earth.iter_mut().flat_map(|p| p.0.iter_mut()).for_each(sh);
out.shoring.iter_mut().flat_map(|w| w.ring.iter_mut()).for_each(sh);
out.mesh_lines.iter_mut().flat_map(|p| p.1.iter_mut()).for_each(sh);
}
@@ -230,6 +232,7 @@ pub(super) fn merge_output(acc: &mut Option<Output>, o: Output) {
a.hidden.extend(o.hidden);
a.profiles.extend(o.profiles);
a.earth.extend(o.earth);
a.shoring.extend(o.shoring);
a.mesh_lines.extend(o.mesh_lines);
a.edge_cats.extend(o.edge_cats);
if a.terrain_id.is_none() {
+6
View File
@@ -18,6 +18,12 @@ export interface ExcavationQuantity {
fill: number;
/** Hinterfüllung (m³). */
backfill: number;
/** Arbeitsraum: verlangte Breite (m, 0 = keiner), kleinster Abstand Umriss–Sohle, eingehalten? */
workingSpace: number;
workingSpaceMin: number;
workingSpaceOk: boolean;
/** Stellen mit fehlender Arbeitsraum-Breite (Modell-x/y). */
workingSpaceSpots: [number, number][];
}
export function excavationQuantities(project: Project): ExcavationQuantity[] {
+6
View File
@@ -2410,6 +2410,12 @@ export const de = {
"site.excavation.noTerrain": "Kein Gelände unter der Baugrube",
"site.excavation.workingSpace": "Arbeitsraum [m]",
"site.excavation.shoring": "Verbau (senkrecht), Kante",
"site.excavation.shoringKind": "Verbauart",
"site.excavation.shoringKind.sheetPile": "Spundwand (Stahl)",
"site.excavation.shoringKind.soldierPile": "Rühlwand (Träger + Holz)",
"site.excavation.shoringKind.borePile": "Bohrpfahlwand (Beton)",
"site.excavation.shoringThickness": "Wanddicke [m]",
"site.excavation.workingSpaceWarn": "Arbeitsraum zu schmal: {min} m statt {need} m an {n} Stelle(n) (rotes Kreuz im Plan)",
"site.excavation.shoringHint": "Gewählte Kanten: senkrechte Wand (Spundwand) statt Böschung",
"site.earthDepth": "Erdreich-Band im Schnitt [m]",
"site.terrain.visible": "Gelände sichtbar",
+6
View File
@@ -2396,6 +2396,12 @@ export const en: Record<TranslationKey, string> = {
"site.excavation.bermHeight": "Berm every [m]",
"site.excavation.workingSpace": "Working space [m]",
"site.excavation.shoring": "Shoring (vertical), edge",
"site.excavation.shoringKind": "Shoring type",
"site.excavation.shoringKind.sheetPile": "Sheet piling (steel)",
"site.excavation.shoringKind.soldierPile": "Soldier pile wall (beams + timber)",
"site.excavation.shoringKind.borePile": "Bored pile wall (concrete)",
"site.excavation.shoringThickness": "Wall thickness [m]",
"site.excavation.workingSpaceWarn": "Working space too narrow: {min} m instead of {need} m at {n} spot(s) (red cross in the plan)",
"site.excavation.shoringHint": "Selected edges: vertical wall (sheet piling) instead of a slope",
"site.earthDepth": "Earth band in section [m]",
"site.terrain.visible": "Terrain visible",
+1 -1
View File
@@ -822,7 +822,7 @@ export function buildComplexSampleProject(): Project {
type: "excavation", id: "baugrube", name: "Baugrube Haupthaus", categoryCode: "07",
// Umriss = Gebäude-Grundfläche UG (mit Erker), Arbeitsraum 0.8 m; Neigungen in Grad.
outline: rect(-HA, -HA, 17.2, 10 + HA), bottom: -3.35, slope: 60, fillSlope: 33.7,
edgeSlopes: [60, 50, 90, 60], edgeShoring: [false, false, true, false], workingSpace: 0.8,
edgeSlopes: [60, 50, 90, 60], edgeShoring: [false, false, true, false], shoringKind: "soldierPile", workingSpace: 0.8,
},
],
roomProgram: [
+7
View File
@@ -1279,6 +1279,13 @@ export type Excavation = {
* [68] Senkrechter Verbau (Spundwand) je Kante (wie `edgeSlopes`): keine Böschung, Wand steht senkrecht.
*/
edgeShoring?: Array<boolean>;
/**
* [68] Art des Verbaus auf den verbauten Kanten: `sheetPile` (Spundwand, Vorgabe), `soldierPile` (Rühlwand),
* `borePile` (Bohrpfahlwand). Bestimmt Vorgabe-Dicke und Schraffur im Schnitt und Grundriss.
*/
shoringKind?: string;
/** [68] Dicke der Verbauwand in m (nach aussen von der Sohlkante); fehlt = Vorgabe der Art. */
shoringThickness?: number;
};
/** Ein extrudierter Körper: geschlossenes Profil (Modell-Meter) + Höhe. */
+22
View File
@@ -50,6 +50,11 @@ function ExcavationQty({ q }: { q: ExcavationQuantity | undefined }) {
return (
<div className="site-qty">
{t("site.excavation.qty", { cut: fmt1(q.cut), fill: fmt1(q.fill), backfill: fmt1(q.backfill) })}
{q.workingSpace > 0 && !q.workingSpaceOk && (
<div className="site-warn" role="alert" data-testid="excavation-ws-warning">
{t("site.excavation.workingSpaceWarn", { min: q.workingSpaceMin.toFixed(2), need: q.workingSpace.toFixed(2), n: q.workingSpaceSpots.length })}
</div>
)}
</div>
);
}
@@ -182,6 +187,23 @@ export function ContextObjectProps({ obj, quantities }: { obj: ContextObject; qu
))}
</span>
</div>
{obj.edgeShoring?.some(Boolean) && (
<>
<label className="site-prop">
<span>{t("site.excavation.shoringKind")}</span>
<select
data-testid="excavation-shoring-kind"
value={obj.shoringKind ?? "sheetPile"}
onChange={(e) => host.onPatchContextObject(obj.id, { shoringKind: e.target.value }, `site-${obj.id}-shoringKind`)}
>
<option value="sheetPile">{t("site.excavation.shoringKind.sheetPile")}</option>
<option value="soldierPile">{t("site.excavation.shoringKind.soldierPile")}</option>
<option value="borePile">{t("site.excavation.shoringKind.borePile")}</option>
</select>
</label>
<NumField label={t("site.excavation.shoringThickness")} value={obj.shoringThickness} step={0.05} min={0.05} placeholder={obj.shoringKind === "borePile" ? "0.6" : obj.shoringKind === "soldierPile" ? "0.3" : "0.2"} onChange={patch("shoringThickness")} />
</>
)}
<ExcavationQty q={quantities.find((x) => x.id === obj.id)} />
</div>
);
+3
View File
@@ -4962,6 +4962,9 @@ body {
grid-column: 1 / -1;
color: var(--text-dim, inherit);
}
.site-panel .site-warn {
color: #d6001c;
}
.site-panel .site-check {
display: flex;
align-items: center;