[284] Geschoss löschen nimmt 2D, Körper, Bäume, Kameras mit; Geländer in Darstellungs-Regeln, Klasse der Auswahl, Mass-Assoziation; Robustheits-Fixture wettbewerb neu
check / check (push) Has been cancelled
check / licenses (push) Has been cancelled
check / e2e (push) Has been cancelled
macos / native (push) Has been cancelled

This commit is contained in:
Claude committed 2026-11-18 09:54:46 +00:00
1 parent eeb320f96c
commit bd201830a8
8 files changed
+80 -4

No files matched your search

+8 -2
View File
@@ -245,7 +245,7 @@ fn drawing_shape(d: &Value) -> Option<Shape> {
}
/// Listen, in denen Ecke/Kante/Mitte ihr Element suchen (in dieser Reihenfolge).
const SHAPE_LISTS: [&str; 6] = ["columns", "ceilings", "roofs", "rooms", "drawings2d", "stairs"];
const SHAPE_LISTS: [&str; 7] = ["columns", "ceilings", "roofs", "rooms", "drawings2d", "stairs", "railings"];
/// Treppe: Umriss (gerade/L: Aussenlinie; Wendel: die vier Ecken der Schliesslinien), Podest als
/// weiterer Umriss, Mittelpunkt nur bei der Wendel.
@@ -275,6 +275,8 @@ fn shape_of(coll: &str, e: &Value) -> Option<Shape> {
"rooms" => Some(Shape::new(pts_list(e.get("boundary")), true, None)),
"drawings2d" => drawing_shape(e),
"stairs" => stair_shape(e),
// [284] Geländer: Achse als offener bzw. geschlossener Zug.
"railings" => Some(Shape::new(pts_list(e.get("points")), e.get("closed").and_then(Value::as_bool).unwrap_or(false), None)),
_ => None,
}
}
@@ -675,7 +677,7 @@ fn with(v: &Value, key: &str, x: Value) -> Value {
}
/// Felder, deren Änderung Bezüge verschieben kann.
pub const SOURCE_FIELDS: [&str; 8] = ["walls", "wallTypes", "openings", "columns", "ceilings", "roofs", "rooms", "drawings2d"];
pub const SOURCE_FIELDS: [&str; 9] = ["walls", "wallTypes", "openings", "columns", "ceilings", "roofs", "rooms", "drawings2d", "railings"];
/// Nachführ-Ops: je Bemassung mit Bezügen, deren aufgelöste Lage oder Gültigkeit sich geändert hat,
/// ein `replace` mit neuen `pts`/`refs`.
@@ -788,6 +790,7 @@ mod tests {
"openings": [{"id": "O", "hostWallId": "A", "position": 2, "width": 1.5}],
"columns": [{"id": "S", "floorId": "eg", "position": {"x": 5, "y": 3}, "profile": {"kind": "rect", "width": 0.4, "depth": 0.2}, "rotation": 0}],
"ceilings": [{"id": "C", "floorId": "eg", "outline": [{"x": 0, "y": 0}, {"x": 4, "y": 0}, {"x": 4, "y": 4}]}],
"railings": [{"id": "G", "floorId": "eg", "points": [{"x": 40, "y": 0}, {"x": 44, "y": 0}, {"x": 44, "y": 3}]}],
"drawings2d": [
{"id": "L", "levelId": "eg", "geom": {"shape": "line", "a": {"x": 20, "y": 0}, "b": {"x": 24, "y": 0}}},
{"id": "K", "levelId": "eg", "geom": {"shape": "circle", "center": {"x": 30, "y": 0}, "r": 1}}
@@ -822,6 +825,9 @@ mod tests {
((24.0, 0.0), DimFeature::Vertex),
((22.0, 0.0), DimFeature::Edge),
((30.0, 0.0), DimFeature::Center),
// [284] Geländer: Eckpunkt und Kante der Achse.
((44.0, 0.0), DimFeature::Vertex),
((42.0, 0.0), DimFeature::Edge),
];
for (s, f) in cases {
let rf = at(&r, s);
+12
View File
@@ -360,6 +360,8 @@ pub struct SelectionMembers {
pub column_ids: Vec<String>,
pub roof_ids: Vec<String>,
pub opening_ids: Vec<String>,
/// [284] Geländer.
pub railing_ids: Vec<String>,
}
/// Kategorie-Codes aller gewählten Objekte (eindeutig, in Fundreihenfolge; leere Codes zählen nicht).
@@ -386,6 +388,7 @@ pub fn selection_category_codes(p: &Project, sel: &SelectionMembers) -> Vec<Stri
scan(&sel.column_ids, &mut p.beams.iter().flatten().map(|o| (o.id.as_str(), o.category_code.as_str())));
scan(&sel.roof_ids, &mut p.roofs.iter().flatten().map(|o| (o.id.as_str(), o.category_code.as_str())));
scan(&sel.opening_ids, &mut p.openings.iter().flatten().map(|o| (o.id.as_str(), o.category_code.as_str())));
scan(&sel.railing_ids, &mut p.railings.iter().flatten().map(|o| (o.id.as_str(), o.category_code.as_str())));
out
}
@@ -414,6 +417,15 @@ mod tests {
flatten(t).iter().map(|c| code_of(c).unwrap().to_string()).collect()
}
/// [284] „Klasse der Auswahl“ kennt Geländer.
#[test]
fn auswahl_klasse_gelaender() {
let mut p: Project = serde_json::from_str(include_str!("../tests/fixtures/sample_project.json")).unwrap();
p.railings = Some(vec![serde_json::from_value(json!({"id": "g1", "type": "railing", "floorId": "eg", "categoryCode": "41", "points": [{"x": 0, "y": 0}, {"x": 4, "y": 0}], "height": 1.0, "kind": "bars"})).unwrap()]);
let sel = SelectionMembers { railing_ids: vec!["g1".into()], ..Default::default() };
assert_eq!(selection_category_codes(&p, &sel), vec!["41".to_string()]);
}
#[test]
fn abflachen_und_finden() {
let t = tree();
+19
View File
@@ -355,6 +355,12 @@ pub fn hidden_elements(p: &Project, v: RuleView) -> HashSet<String> {
out.insert(b.id.clone());
}
}
// [284] Geländer.
for g in p.railings.iter().flatten() {
if test("railing", &g.category_code, Some(&crate::railing::label(g))) {
out.insert(g.id.clone());
}
}
for r in p.rooms.iter().flatten() {
if test("room", &r.category_code, Some(&r.name)) {
out.insert(r.id.clone());
@@ -721,6 +727,19 @@ mod tests {
assert!(hidden_elements(&p, RuleView::default().view("plan")).is_empty());
}
/// [284] „Ausblenden“ erfasst auch Geländer (Bauteilart „railing“).
#[test]
fn ausgeblendete_gelaender() {
let mut p = sample();
p.railings = Some(vec![serde_json::from_value(serde_json::json!({"id": "g1", "type": "railing", "floorId": "eg", "categoryCode": "41", "points": [{"x": 0, "y": 0}, {"x": 4, "y": 0}], "height": 1.0, "kind": "bars"})).unwrap()]);
let mut r = rule(true, cond(ElementKind, Equals, "railing"), None, None, None);
r.actions.hide = Some(true);
p.override_rules = Some(vec![r]);
let h = hidden_elements(&p, RuleView::default().view("plan"));
assert!(h.contains("g1"));
assert!(p.walls.iter().all(|w| !h.contains(&w.id)));
}
/// [33] Schatten und Gelände folgen nur Regeln, die die Bauteilart ausdrücklich nennen; Linienstil und
/// Ausblenden wirken; Linienstil aus Schicht-Regeln auf Schichten.
#[test]