[K4] Höhen der 3D-Griffe im Kern, tote Geometrie-Helfer gelöscht

Die 3D-Griffe (Griff-Lagen, Arbeitsebene) holen UK/OK von Wänden und Decken
über die Wurzel-Abfrage `verticalExtents` (selection_info.rs, Fassade in
geometry/grips.ts). Gelöscht, weil ohne Aufrufer: lineIntersect, clippedBand,
wallBand, stairVerticalExtent, nextFloorAbove, openingGapQuad, roofBBox,
stairBBox (+ Bindung stair_bbox_flat), outlineBBox, localToLv95, roofEdgeList.
Die vertikalen Ausdehnungen in TS bleiben nur für die Plan-Ableitung.

Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
Claude committed 2026-10-29 10:26:42 +00:00
1 parent 365500516f
commit 0c15c0ede3
21 files changed
+149 -317

No files matched your search

+5
View File
@@ -114,6 +114,11 @@ pub fn run_root(root: &serde_json::Map<String, serde_json::Value>, name: &str, t
let ids: Vec<String> = serde_json::from_str(text).map_err(|e| format!("drawingBBoxes: {e}"))?;
Ok(crate::selection_info::drawing_bboxes(root, &ids).into_string())
}
// UK/OK von Wänden und Decken (3D-Griffe): `text` = `{walls: […], ceilings: […]}` (ganze Elemente).
"verticalExtents" => {
let a: crate::selection_info::ExtentArgs = serde_json::from_str(text).map_err(|e| format!("verticalExtents: {e}"))?;
Ok(crate::selection_info::vertical_extents(root, &a).into_string())
}
_ => Err(format!("Unbekannte Wurzel-Abfrage: {name}")),
}
}
+45 -3
View File
@@ -337,6 +337,35 @@ fn vertical_extent(root: &Map<String, Value>, el: &Value) -> (f64, f64) {
(zb, zt)
}
/// (UK, OK) einer Decke (`ceilingVerticalExtent`): OK aus `top` sonst Geschoss-Oberkante (Basis + Höhe), UK aus
/// `bottom` sonst OK − `thickness` (die Decke wächst nach unten).
fn ceiling_extent(root: &Map<String, Value>, c: &Value, thickness: f64) -> (f64, f64) {
let floor_top = level(root, field(c, "floorId")).map_or(0.0, |f| num_or(field(f, "baseElevation"), 0.0) + num_or(field(f, "floorHeight"), 0.0));
let zt = anchor(root, field(c, "top")).unwrap_or(floor_top);
let zb = anchor(root, field(c, "bottom")).unwrap_or(zt - thickness);
(zb, zt)
}
/// Anfrage `verticalExtents`: Wände und Decken als ganze Elemente (die 3D-Griffe zeigen auch gerade gezogene,
/// noch nicht übernommene Fassungen).
#[derive(serde::Deserialize, Default)]
#[serde(default)]
pub struct ExtentArgs {
pub walls: Vec<Value>,
pub ceilings: Vec<Value>,
}
/// (UK, OK) der Wände, dann der Decken, flach: `[zb, zt, zb, zt, …]`.
pub fn vertical_extents(root: &Map<String, Value>, a: &ExtentArgs) -> J {
let walls = a.walls.iter().map(|w| vertical_extent(root, w));
let ceilings = a.ceilings.iter().map(|c| ceiling_extent(root, c, ceiling_thickness(root, c)));
J::arr(walls.chain(ceilings).flat_map(|(zb, zt)| [zb, zt]).map(|x| {
let mut out = Vec::new();
js_num(x).emit(&mut out);
J(out)
}))
}
/// Aufbau-Typ einer Decke (`getCeilingType`): eigener Deckentyp, sonst Alt-Wandtyp, sonst Fehler.
fn ceiling_type<'a>(root: &'a Map<String, Value>, c: &Value) -> Result<&'a Value, String> {
if truthy(field(c, "ceilingTypeId")) {
@@ -546,9 +575,7 @@ fn ceiling_selection(root: &Map<String, Value>, c: &Value) -> Result<J, String>
let outer = component(root, arr(field(wt, "layers")).first().and_then(|l| field(l, "componentId")))?;
let (fg, bg, hatch) = effective(c, Some(outer), cat);
let floor = level(root, field(c, "floorId"));
let floor_top = floor.map_or(0.0, |f| num_or(field(f, "baseElevation"), 0.0) + num_or(field(f, "floorHeight"), 0.0));
let zt = anchor(root, field(c, "top")).unwrap_or(floor_top);
let zb = anchor(root, field(c, "bottom")).unwrap_or(zt - thickness);
let (zb, zt) = ceiling_extent(root, c, thickness);
let area = ceiling_area(field(c, "outline"));
let openings: Vec<J> = arr(field(c, "openings"))
.iter()
@@ -1215,6 +1242,21 @@ mod tests {
assert_eq!(sel(&bad, json!({"wallIds": ["w"]})).unwrap_err(), "Unbekannter Wandtyp: x");
}
#[test]
fn hoehen_von_waenden_und_decken() {
let r = root(json!({
"wallTypes": [{"id": "t", "layers": [{"componentId": "a", "thickness": 0.3}]}],
"drawingLevels": [{"id": "eg", "kind": "floor", "baseElevation": 1, "floorHeight": 3}, {"id": "og", "kind": "floor", "baseElevation": 4}],
}));
let a: ExtentArgs = serde_json::from_value(json!({
"walls": [{"floorId": "eg", "height": 2.5}, {"floorId": "eg", "height": 2.5, "top": {"mode": "floor", "floorId": "og", "offset": -0.2}}, {"floorId": "x"}],
"ceilings": [{"floorId": "eg", "wallTypeId": "t"}, {"floorId": "eg", "thickness": 0.25, "bottom": {"mode": "custom", "z": 3}}, {"floorId": "x", "ceilingTypeId": "fehlt"}],
}))
.unwrap();
let v: Value = serde_json::from_str(&vertical_extents(&r, &a).into_string()).unwrap();
assert_eq!(v, json!([1, 3.5, 1, 3.8, 0, "\u{1}NaN", 3.7, 4, 3, 4, -0.2, 0]));
}
#[test]
fn typ_beschriftung_wie_ts() {
let r = root(json!({"components": [{"id": "a", "abbrev": "BET"}, {"id": "b", "abbrev": "GKB"}]}));
-6
View File
@@ -21,12 +21,6 @@ pub fn stair_cut_flat(geometry: &[f64], cut_rise: f64) -> Vec<f64> {
s::cut(geometry, cut_rise)
}
/// `[minX, minY, maxX, maxY]` aller Tritte + Podest.
#[wasm_bindgen]
pub fn stair_bbox_flat(geometry: &[f64]) -> Vec<f64> {
s::bbox(geometry)
}
/// Vorgabe-Stufenzahl aus Steighöhe und Lauflänge.
#[wasm_bindgen]
pub fn stair_default_step_count(total_rise: f64, run_length: f64) -> u32 {