Merge branch 'worktree-agent-a9db6ba58d240f2f9' into claude/practical-noether-1hb2s1
This commit is contained in:
16 files changed
+662
-68
No files matched your search
@@ -1889,6 +1889,34 @@ Reihenfolge = Abhängigkeiten. Neue Geometrie entsteht in Rust ([K]).
|
||||
`--color`) in Chromium (Linux). Offen: nicht in der Tauri-App und nicht im Overrides-Tab per e2e geprüft; „Ausblenden“
|
||||
wirkt in Grundriss/Schnitt noch nicht, Öffnungen selbst ausblenden nicht (Wandloch); Linienstil-Aktion in der Ansicht
|
||||
ohne Wirkung; Schlagschatten und Gelände nicht über Regeln steuerbar.
|
||||
(6.11., Ausblenden überall) **„Ausblenden“ in Grundriss, Deckenspiegel und Schnitt** (`overrides::hidden_elements`, nur
|
||||
Element-Regeln): Wände, Öffnungen, Decken/Bodenplatten, Dächer, Treppen, Stützen, Räume; eine ausgeblendete Wand nimmt
|
||||
ihre Öffnungen mit. Grundriss: wie eine ausgeblendete Kategorie (`Ctx::vis`, Element samt Poché, Schraffur, Symbol,
|
||||
Raumstempel; Wandanschlüsse rechnen ohne die Wand, die Nachbarwand zeigt ihr Ende). Schnitt: Projekt ohne die Elemente
|
||||
(`section::without_elements`) — sie verdecken nichts; der Schnitt-Cache trägt eine Kennung der ausgeblendeten ids.
|
||||
Bemassung bleibt (2D-Zeichnungen werden nicht angefasst, auch wenn sie nur an ausgeblendeten Elementen hängen); eine
|
||||
allein ausgeblendete Öffnung lässt im Grundriss das Wandloch stehen (nur Symbol weg). Im Grundriss trägt das Subjekt
|
||||
jetzt auch die **Bauteilart** (Wand, Öffnung, Decke/Bodenplatte, Treppe, Stütze, Raum): Farbe/Strichstärke-Regeln mit
|
||||
Bauteilart wirken dort. **Linienstil** (`linetypeId`): in der Ansicht auf Kanten der Flächen und Öffnungsteilungen
|
||||
(Element- und Schicht-Regeln, `SurfOv::dash`); aus Schicht-Regeln (`LayerActions::linetype_id`, nur Regeln mit
|
||||
Schicht-Bedingung — Element-Regeln mit Linienstil lösen keine geschichtete Wand aus) auf die Fugen der Schicht im
|
||||
Grundriss (`layer-joint`) und im Schnitt (Fugen als eigene gestrichelte Linien `section-joint`; die schwere
|
||||
Schnittkante bleibt durchgezogen). **Schatten und Gelände** als Bauteilart („Schatten“, „Gelände“, dazu „Raum“ in der
|
||||
Auswahl): Schlagschatten der Ansicht samt Leibungsschatten (Ausblenden, Füllung, Linie = Umriss), Gelände/Höhenlinien im
|
||||
Grundriss (Ausblenden, Linie samt Höhenkoten-Farbe), Geländelinie/Erdreich im Schnitt (Ausblenden → Grundlinie,
|
||||
Linie, Füllung/Schraffur des Erdreichs) und Gelände-Silhouette der Ansicht (Ausblenden, Füllung der Geländefläche,
|
||||
Linie). Sie folgen nur Regeln, die die Bauteilart ausdrücklich nennen (`overrides::SPECIAL_KINDS`, gleich/enthält/
|
||||
beginnt mit) — allgemeine Regeln wie „Ansicht ohne Materialschraffur“ (Bauteilart ≠ Fenster/Tür) lassen sie in Ruhe.
|
||||
Overrides-Tab: Aktion heisst nur noch „Ausblenden“. Ohne Regeln unverändert (Goldens unverändert). Tests:
|
||||
`ausgeblendete_elemente`, `schatten_gelaende_und_linienstil`, `ausblenden_und_linienstil_im_grundriss`,
|
||||
`ausblenden_gelaende_und_linienstil_im_schnitt`, `linienstil_schatten_und_gelaende_in_der_ansicht`, Gelände-Regel in
|
||||
`context.rs` (Höhenlinien), e2e `overridesTab.spec.ts` (Regel Darstellung = Ansicht + Ausblenden im Overrides-Tab →
|
||||
Ansicht Süd verliert ihre Bauteile). Geprüft: cargo test Kern, tsc, vitest, e2e overridesTab + viewTemplates, CLI
|
||||
Musterhaus komplex EG/Schnitt A-A/Ansicht Süd 1:100 mit Prüfregeln (Innenwände aus, Wandkanten gestrichelt, Schatten
|
||||
aus, Gelände grün gestrichelt) in Chromium (Linux). Offen: nicht in der Tauri-App (Metal) geprüft; ausgeblendete
|
||||
Elemente bleiben im Grundriss anwählbar/fangbar (Pick/Fang fragen das Modell); Schlagschatten im Grundriss
|
||||
(Sonnenstudie) nicht über Regeln; Linienstil auf Polygon-Umrissen im Grundriss (Wand-Umriss, Decken) ohne Wirkung;
|
||||
kurze Geländesegmente zeigen das Strichmuster je Segment neu beginnend.
|
||||
- ◐ **[34] Ansichtsvorlagen.** (30.10.) `Project.viewTemplates` (Rust-Modell): benannter Satz aus Detailgrad,
|
||||
Massstab, Kategorien, Override-Regeln, Darstellungsmodus, Schwarz-Weiss, Schatten, verdeckte Kanten,
|
||||
Strichstärken-Skalierung und Ansichtsbereich; Ansicht (`DrawingLevel.templateId/templateLinked`) und
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// [33] Overrides-Tab: eine Regel „Darstellung = Ansicht → Ausblenden“ anlegen — die Ansicht Süd des
|
||||
// Musterhaus komplex verliert ihre Bauteile (gezählt über die SVG-Elemente der Zeichnung, nicht über Pixel).
|
||||
import { discardIfAsked, expect, fileMenu, showSnapshot, startNewProject, test } from "./app";
|
||||
|
||||
test("Overrides-Tab: Regel Darstellung = Ansicht mit Ausblenden ändert die Ansicht ([33])", async ({ page }) => {
|
||||
test.setTimeout(120_000);
|
||||
await startNewProject(page);
|
||||
await fileMenu(page, /Musterhaus \(komplex\)/);
|
||||
await discardIfAsked(page);
|
||||
await expect(page.locator(".project-name")).toHaveText("Musterhaus komplex", { timeout: 30_000 });
|
||||
await showSnapshot(page, "Ansicht Süd");
|
||||
await expect(page.locator("svg.plan-svg").first()).toBeVisible({ timeout: 30_000 });
|
||||
const count = () => page.locator("svg.plan-svg polyline, svg.plan-svg line, svg.plan-svg polygon, svg.plan-svg path").count();
|
||||
await expect.poll(count, { timeout: 30_000 }).toBeGreaterThan(100);
|
||||
// Die Ansicht rechnet asynchron: warten, bis zwei Zählungen im Abstand von 700 ms gleich sind.
|
||||
let before = -1;
|
||||
for (let i = 0; i < 40; i++) {
|
||||
const n = await count();
|
||||
if (n === before) break;
|
||||
before = n;
|
||||
await page.waitForTimeout(700);
|
||||
}
|
||||
|
||||
await page.getByRole("button", { name: "Fenster", exact: true }).first().click();
|
||||
await page.getByRole("option", { name: /Ressourcen/ }).click();
|
||||
await page.getByRole("tab", { name: "Overrides" }).click();
|
||||
await page.locator(".res-window").getByRole("button", { name: /Neu$/ }).click();
|
||||
const detail = page.getByTestId("override-rule-detail");
|
||||
const pick = async (field: string, option: string) => {
|
||||
await detail.locator(".res-field", { has: page.locator(".res-field-label", { hasText: new RegExp(`^${field}$`) }) }).first().locator(".tb-dd-trigger").click();
|
||||
await page.getByRole("option", { name: option, exact: true }).click();
|
||||
};
|
||||
await pick("Kriterium", "Darstellung");
|
||||
await pick("Wert", "Ansicht");
|
||||
await detail.getByRole("checkbox", { name: "Ausblenden" }).first().check();
|
||||
await expect(detail.getByRole("checkbox", { name: "Ausblenden" })).toHaveCount(2);
|
||||
await page.locator(".res-window").getByRole("button", { name: "Schließen" }).first().click();
|
||||
|
||||
// Wände, Decken, Dach und Öffnungen sind weg (Gelände und Schatten bleiben: nur mit Bauteilart).
|
||||
await expect.poll(count, { timeout: 30_000 }).toBeLessThan(before / 2);
|
||||
});
|
||||
@@ -4053,8 +4053,8 @@ pub struct OverrideActions {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub outline: Option<bool>,
|
||||
/// [33] Bauteil ausblenden (wirkt in der Ansicht: Flächen, Kanten, Ansichtsschraffur und — bei Wänden —
|
||||
/// deren Öffnungen entfallen und verdecken nichts).
|
||||
/// [33] Bauteil ausblenden (Grundriss, Deckenspiegel, Schnitt, Ansicht: Element samt Linien, Schraffur und
|
||||
/// Beschriftung entfällt und verdeckt nichts; eine Wand nimmt ihre Öffnungen mit; Bemassung bleibt).
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub hide: Option<bool>,
|
||||
|
||||
@@ -114,7 +114,7 @@ fn soffits(c: &Ctx, cut: f64, limit: f64, out: &mut Vec<Primitive>, bounds: &mut
|
||||
.as_deref()
|
||||
.unwrap_or(&[])
|
||||
.iter()
|
||||
.filter(|x| c.shown(&x.category_code) && x.outline.len() >= 3)
|
||||
.filter(|x| c.vis(&x.category_code, &x.id) && x.outline.len() >= 3)
|
||||
.map(|x| (x, p.ceiling_vertical_extent(x).0))
|
||||
.filter(|(_, zb)| *zb > cut + 1e-6 && *zb < limit)
|
||||
.collect();
|
||||
@@ -233,7 +233,7 @@ impl RoofUnder {
|
||||
fn roof_soffits(c: &Ctx, cut: f64, limit: f64, soffits: &[Soffit], out: &mut Vec<Primitive>, bounds: &mut Bounds) -> Vec<RoofUnder> {
|
||||
let p = c.p;
|
||||
let mut unders = Vec::new();
|
||||
for roof in p.roofs.as_deref().unwrap_or(&[]).iter().filter(|r| c.shown(&r.category_code)) {
|
||||
for roof in p.roofs.as_deref().unwrap_or(&[]).iter().filter(|r| c.vis(&r.category_code, &r.id)) {
|
||||
let rb = p.roof_base_elevation(roof);
|
||||
let geo = crate::roof::roof_geometry(&roof.params(), 0.0);
|
||||
let top = rb + max(0.0, geo.ridge_height);
|
||||
@@ -347,7 +347,7 @@ fn room_labels(c: &Ctx, soffits: &[Soffit], roofs: &[RoofUnder], out: &mut Vec<P
|
||||
if c.a.detail == Detail::Grob {
|
||||
return;
|
||||
}
|
||||
for room in c.p.rooms.as_deref().unwrap_or(&[]).iter().filter(|r| r.floor_id == c.a.floor && c.shown(&r.category_code) && r.boundary.len() >= 3) {
|
||||
for room in c.p.rooms.as_deref().unwrap_or(&[]).iter().filter(|r| r.floor_id == c.a.floor && c.vis(&r.category_code, &r.id) && r.boundary.len() >= 3) {
|
||||
let pts: Vec<[f64; 2]> = room.boundary.iter().map(|v| [v.x, v.y]).collect();
|
||||
let at = room.stamp_anchor.unwrap_or(pv(crate::room_area::label_point(&pts)));
|
||||
let z = soffits.iter().filter(|s| super::pick::point_in_polygon(at.x, at.y, &s.ring)).map(|s| s.z).fold(f64::INFINITY, f64::min);
|
||||
|
||||
@@ -80,6 +80,16 @@ pub fn plan_context(c: &Ctx, out: &mut Vec<Primitive>) {
|
||||
if matches!(obj, ContextObject::TerrainMesh(t) if t.hidden == Some(true)) || matches!(obj, ContextObject::ImportedMesh(m) if m.hidden == Some(true)) {
|
||||
continue;
|
||||
}
|
||||
// [33] Gelände und Höhenlinien über Regeln (Bauteilart „Gelände“): Ausblenden, Linie (Farbe, Stärke, Linienstil).
|
||||
let tov = match obj {
|
||||
ContextObject::TerrainMesh(t) => super::overrides::terrain_override(c.p, c.rule_view(), code, &t.name),
|
||||
ContextObject::ContourSet(s) => super::overrides::terrain_override(c.p, c.rule_view(), code, &s.name),
|
||||
_ => None,
|
||||
};
|
||||
if tov.as_ref().is_some_and(|(a, _)| a.hidden()) {
|
||||
continue;
|
||||
}
|
||||
let start = out.len();
|
||||
match obj {
|
||||
ContextObject::ContourSet(s) => {
|
||||
// [137] Rahmen als Pick-Fläche (unter dem daraus erzeugten Gelände; Cmd+Klick schaltet durch).
|
||||
@@ -123,10 +133,39 @@ pub fn plan_context(c: &Ctx, out: &mut Vec<Primitive>) {
|
||||
ContextObject::Excavation(e) => excavation_lines(c, e, out, &mut late),
|
||||
ContextObject::Image(_) => {}
|
||||
}
|
||||
if let Some((a, _)) = &tov {
|
||||
restyle_lines(c.p, a, &mut out[start..]);
|
||||
}
|
||||
}
|
||||
out.append(&mut late);
|
||||
}
|
||||
|
||||
/// [33] Linien (und Beschriftungen) nach den Element-Aktionen einer Regel: Farbe, Strichstärke, Linienstil.
|
||||
pub(super) fn restyle_lines(p: &Project, a: &super::overrides::Actions, prims: &mut [Primitive]) {
|
||||
let dash = super::overrides::linetype_dash(p, a.linetype_id.as_deref());
|
||||
for q in prims {
|
||||
match q {
|
||||
Primitive::Line { color, weight_mm, dash: d, .. } => {
|
||||
if let Some(c) = &a.color {
|
||||
*color = Some(c.clone());
|
||||
}
|
||||
if let Some(w) = a.lineweight.filter(|w| w.is_finite() && *w >= 0.0) {
|
||||
*weight_mm = w;
|
||||
}
|
||||
if let Some(x) = &dash {
|
||||
*d = Some(x.clone());
|
||||
}
|
||||
}
|
||||
Primitive::DrawingText { color, .. } => {
|
||||
if let Some(c) = &a.color {
|
||||
*color = c.clone();
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [140] Gelände/Höhenlinien grau statt braun.
|
||||
const TERRAIN_INK: &str = "#6e6e6e";
|
||||
/// [140] Kleinster Papierabstand (mm) zwischen Höhenlinien; enger werden Zwischenlinien ausgelassen.
|
||||
@@ -468,6 +507,19 @@ mod tests {
|
||||
let lines: Vec<(Vec2, Vec2)> = out.iter().filter_map(|q| match q { Primitive::Line { a, b, color: Some(c), .. } if c == TERRAIN_INK => Some((*a, *b)), _ => None }).collect();
|
||||
assert!(lines.iter().any(|(a, _)| (a.x - 5.0).abs() < 1e-6), "Höhenlinie ausserhalb fehlt");
|
||||
assert!(lines.iter().all(|(a, b)| !((a.x - 15.0).abs() < 1e-6 && (a.y + b.y) / 2.0 > 0.0 && (a.y + b.y) / 2.0 < 10.0)), "Höhenlinie im Haus");
|
||||
// [33] Regel für Gelände (Bauteilart „Gelände“): Linie umgefärbt/gestrichelt, dann ausgeblendet.
|
||||
let rule = |actions: serde_json::Value| -> OverrideRule {
|
||||
serde_json::from_value(serde_json::json!({"id": "t", "name": "t", "enabled": true, "condition": {"type": "element_kind", "operator": "equals", "value": "terrain"}, "actions": actions})).unwrap()
|
||||
};
|
||||
p.override_rules = Some(vec![rule(serde_json::json!({"color": "#00aa00", "linetypeId": "hatch-dash"}))]);
|
||||
let mut out = Vec::new();
|
||||
plan_context(&Ctx::new(&p, &a), &mut out);
|
||||
let ls: Vec<_> = out.iter().filter_map(|q| match q { Primitive::Line { color, dash, .. } => Some((color.clone(), dash.clone())), _ => None }).collect();
|
||||
assert!(!ls.is_empty() && ls.iter().all(|(c, d)| c.as_deref() == Some("#00aa00") && d == &Some(Some(vec![0.35, 0.3]))));
|
||||
p.override_rules = Some(vec![rule(serde_json::json!({"hide": true}))]);
|
||||
let mut out = Vec::new();
|
||||
plan_context(&Ctx::new(&p, &a), &mut out);
|
||||
assert!(out.is_empty(), "Gelände samt Höhenlinien und Pick-Fläche ausgeblendet");
|
||||
}
|
||||
|
||||
/// [140] Steile Stellen (Stützmauer, Böschung): Höhenlinien enger als 0.6 mm auf dem Papier werden
|
||||
|
||||
@@ -111,6 +111,8 @@ pub struct Ctx<'a> {
|
||||
pub a: &'a PlanArgs,
|
||||
/// Code → Kategorie (bei doppeltem Code gewinnt die letzte, wie `Map.set` in TS).
|
||||
cats: HashMap<&'a str, &'a LayerCategory>,
|
||||
/// [33] Von einer Regel „Ausblenden“ ausgeblendete Elemente (`overrides::hidden_elements`).
|
||||
hidden: HashSet<String>,
|
||||
}
|
||||
|
||||
impl<'a> Ctx<'a> {
|
||||
@@ -119,13 +121,19 @@ impl<'a> Ctx<'a> {
|
||||
for c in p.flat_categories() {
|
||||
cats.insert(c.code.as_str(), c);
|
||||
}
|
||||
Ctx { p, a, cats }
|
||||
let hidden = overrides::hidden_elements(p, overrides::RuleView::at(a.scale, a.rules.as_ref()).view("plan"));
|
||||
Ctx { p, a, cats, hidden }
|
||||
}
|
||||
|
||||
pub fn shown(&self, code: &str) -> bool {
|
||||
self.a.show.contains(code)
|
||||
}
|
||||
|
||||
/// [33] Element sichtbar: Kategorie eingeblendet und keine Regel „Ausblenden“ trifft es.
|
||||
pub fn vis(&self, code: &str, id: &str) -> bool {
|
||||
self.shown(code) && !self.hidden.contains(id)
|
||||
}
|
||||
|
||||
/// [140] Schnittflächen dieser Ebene schwarz (`style::solid_cut`; Feld `cutHatch` der Ebene).
|
||||
pub fn solid_cut(&self) -> bool {
|
||||
let cut_hatch = self.p.floor(&self.a.floor).and_then(|l| l.cut_hatch).unwrap_or(false);
|
||||
@@ -145,9 +153,9 @@ impl<'a> Ctx<'a> {
|
||||
overrides::RuleView::at(self.a.scale, self.a.rules.as_ref()).view("plan")
|
||||
}
|
||||
|
||||
/// Effektive Override-Aktionen eines Elements (`overrideFor` in TS).
|
||||
pub fn overrides(&self, code: &str, object_name: Option<&str>) -> Actions {
|
||||
overrides::effective(self.p.override_rules.as_deref(), &Subject { layer_name: self.cat(code).map(|c| c.name.as_str()), layer_code: Some(code), object_name, ..Default::default() }, self.rule_view())
|
||||
/// Effektive Override-Aktionen eines Elements (`overrideFor` in TS); `kind` = Bauteilart ([33]).
|
||||
pub fn overrides(&self, kind: Option<&str>, code: &str, object_name: Option<&str>) -> Actions {
|
||||
overrides::effective(self.p.override_rules.as_deref(), &Subject { layer_name: self.cat(code).map(|c| c.name.as_str()), layer_code: Some(code), object_name, element_kind: kind, ..Default::default() }, self.rule_view())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +278,7 @@ pub(super) fn resolve_hatch_or_none(p: &Project, hatch_id: &str, wall_angle_deg:
|
||||
pub fn wall_footprints(c: &Ctx) -> Vec<WallFootprint> {
|
||||
c.p.walls
|
||||
.iter()
|
||||
.filter(|w| w.floor_id == c.a.floor && c.shown(&w.category_code))
|
||||
.filter(|w| w.floor_id == c.a.floor && c.vis(&w.category_code, &w.id))
|
||||
.map(|w| {
|
||||
let t = c.p.wall_thickness(w, 0.2);
|
||||
let ref_off = crate::joins::reference_offset(crate::model3d::wall_reference(w), t);
|
||||
@@ -292,6 +300,11 @@ pub(super) fn ceiling_layers<'a>(p: &'a Project, c: &Ceiling) -> Result<&'a [Lay
|
||||
Ok(p.wall_types.iter().find(|t| t.id == c.wall_type_id).map_or(Project::fallback_layers(), |t| t.layers.as_slice()))
|
||||
}
|
||||
|
||||
/// [33] Bauteilart einer Decke für die Override-Regeln: "ground_slab" oder "slab".
|
||||
pub(crate) fn ceiling_kind(p: &Project, c: &Ceiling) -> &'static str {
|
||||
if ceiling_layers(p, c).is_ok_and(|l| overrides::is_ground_slab(p, c, l)) { "ground_slab" } else { "slab" }
|
||||
}
|
||||
|
||||
/// Typname einer Decke für `object_name` (Maps in TS: letzter Eintrag je id gewinnt).
|
||||
pub(crate) fn ceiling_type_name<'a>(p: &'a Project, c: &Ceiling) -> Option<&'a str> {
|
||||
let ct = c.ceiling_type_id.as_deref().filter(|s| !s.is_empty()).and_then(|id| p.ceiling_types.as_deref().unwrap_or(&[]).iter().rev().find(|t| t.id == id));
|
||||
@@ -330,7 +343,7 @@ fn floor_finishes(c: &Ctx, out: &mut Vec<Primitive>) {
|
||||
let p = c.p;
|
||||
let base = p.floor(&c.a.floor).and_then(|f| f.base_elevation).unwrap_or(0.0);
|
||||
let cut = super::extras::cut_z(p, &c.a.floor);
|
||||
for ce in p.ceilings.as_deref().unwrap_or(&[]).iter().filter(|x| c.shown(&x.category_code)) {
|
||||
for ce in p.ceilings.as_deref().unwrap_or(&[]).iter().filter(|x| c.vis(&x.category_code, &x.id)) {
|
||||
let top = p.ceiling_vertical_extent(ce).1;
|
||||
if !(top >= base - 0.3 && top <= cut) {
|
||||
continue;
|
||||
@@ -358,7 +371,7 @@ fn ceilings(c: &Ctx, out: &mut Vec<Primitive>, bounds: &mut Bounds) -> Result<()
|
||||
.as_deref()
|
||||
.unwrap_or(&[])
|
||||
.iter()
|
||||
.filter(|x| c.shown(&x.category_code))
|
||||
.filter(|x| c.vis(&x.category_code, &x.id))
|
||||
.filter_map(|x| {
|
||||
let (zb, zt) = p.ceiling_vertical_extent(x);
|
||||
let zone = range.classify(zb, zt);
|
||||
@@ -375,7 +388,7 @@ fn ceilings(c: &Ctx, out: &mut Vec<Primitive>, bounds: &mut Bounds) -> Result<()
|
||||
for q in &ce.outline {
|
||||
bounds.acc(q.x, q.y);
|
||||
}
|
||||
let ov = c.overrides(&ce.category_code, ceiling_type_name(p, ce));
|
||||
let ov = c.overrides(Some(ceiling_kind(p, ce)), &ce.category_code, ceiling_type_name(p, ce));
|
||||
let color = ov.color.as_deref().or(ce.color.as_deref());
|
||||
let greyed = c.greyed(&ce.category_code);
|
||||
let category = c.cat(&ce.category_code);
|
||||
@@ -441,7 +454,7 @@ fn roofs(c: &Ctx, out: &mut Vec<Primitive>, bounds: &mut Bounds) {
|
||||
let below = |r: &Roof| r.floor_id != c.a.floor && p.floor(&r.floor_id).is_some_and(|f| f.base_elevation.unwrap_or(0.0) < floor_base - 1e-6);
|
||||
// Ansichtsbereich ([36]): Dächer höherer Geschosse bis zur Oberkante „über Schnitt“ (Vordach, Dach darüber).
|
||||
let above = |r: &Roof| range.custom && range.top.is_some() && r.floor_id != c.a.floor && p.floor(&r.floor_id).is_some_and(|f| f.base_elevation.unwrap_or(0.0) > floor_base + 1e-6);
|
||||
for roof in p.roofs.as_deref().unwrap_or(&[]).iter().filter(|r| (r.floor_id == c.a.floor || below(r) || above(r)) && c.shown(&r.category_code)) {
|
||||
for roof in p.roofs.as_deref().unwrap_or(&[]).iter().filter(|r| (r.floor_id == c.a.floor || below(r) || above(r)) && c.vis(&r.category_code, &r.id)) {
|
||||
let greyed = Some(c.greyed(&roof.category_code));
|
||||
let category = c.cat(&roof.category_code);
|
||||
let stroke = roof.color.as_deref().or(category.map(|k| k.color.as_str())).unwrap_or(POCHE_STROKE);
|
||||
@@ -547,7 +560,7 @@ pub(super) fn roof_windows(c: &Ctx, out: &mut Vec<Primitive>, roof: &Roof) {
|
||||
let p = c.p;
|
||||
let Some(ri) = p.roofs.as_deref().and_then(|r| r.iter().position(|x| x.id == roof.id)) else { return };
|
||||
for (o, f) in crate::opening_shape::roof_openings(p, ri) {
|
||||
if !c.shown(&o.category_code) {
|
||||
if !c.vis(&o.category_code, &o.id) {
|
||||
continue;
|
||||
}
|
||||
let greyed = Some(c.greyed(&o.category_code));
|
||||
@@ -828,11 +841,11 @@ fn place_stamp(ring: &[[f64; 2]], candidates: &[Vec2], obst: &super::stamp_place
|
||||
}
|
||||
|
||||
fn rooms(c: &Ctx, out: &mut Vec<Primitive>, bounds: &mut Bounds, obstacles: &super::stamp_place::Obstacles) {
|
||||
for room in c.p.rooms.as_deref().unwrap_or(&[]).iter().filter(|r| r.floor_id == c.a.floor && c.shown(&r.category_code)) {
|
||||
for room in c.p.rooms.as_deref().unwrap_or(&[]).iter().filter(|r| r.floor_id == c.a.floor && c.vis(&r.category_code, &r.id)) {
|
||||
for q in &room.boundary {
|
||||
bounds.acc(q.x, q.y);
|
||||
}
|
||||
let ov = c.overrides(&room.category_code, Some(&room.name));
|
||||
let ov = c.overrides(Some("room"), &room.category_code, Some(&room.name));
|
||||
let color = ov.color.as_deref().unwrap_or(&room.color);
|
||||
let greyed = Some(c.greyed(&room.category_code));
|
||||
if room.boundary.len() < 3 {
|
||||
@@ -892,7 +905,7 @@ pub fn column_label(col: &Column) -> String {
|
||||
pub(super) fn columns(c: &Ctx, out: &mut Vec<Primitive>) {
|
||||
let p = c.p;
|
||||
let range = super::view_range::ViewRange::of(p, &c.a.floor);
|
||||
for col in p.columns.as_deref().unwrap_or(&[]).iter().filter(|k| k.floor_id == c.a.floor && c.shown(&k.category_code)) {
|
||||
for col in p.columns.as_deref().unwrap_or(&[]).iter().filter(|k| k.floor_id == c.a.floor && c.vis(&k.category_code, &k.id)) {
|
||||
let (zb, zt) = p.column_vertical_extent(col);
|
||||
let zone = range.classify(zb, zt);
|
||||
if zone == super::view_range::Zone::Hidden {
|
||||
@@ -901,7 +914,7 @@ pub(super) fn columns(c: &Ctx, out: &mut Vec<Primitive>) {
|
||||
let out_start = out.len();
|
||||
let greyed = Some(c.greyed(&col.category_code));
|
||||
let category = c.cat(&col.category_code);
|
||||
let ov = c.overrides(&col.category_code, Some(&column_label(col)));
|
||||
let ov = c.overrides(Some("column"), &col.category_code, Some(&column_label(col)));
|
||||
let lw = ov.lineweight.unwrap_or_else(|| resolve_stroke_weight(col.stroke_weight, col.stroke_weight_source, category, category.map_or(WALL_FALLBACK_MM, |k| k.lw)));
|
||||
let color = ov.color.as_deref().or(col.color.as_deref());
|
||||
let cat_color = category.map(|k| k.color.as_str());
|
||||
@@ -927,7 +940,7 @@ pub(super) fn columns(c: &Ctx, out: &mut Vec<Primitive>) {
|
||||
let (mut clip, mut merge): (Vec<Vec<Vec2>>, Vec<crate::plan::wall_poche::WallFootprint>) = (Vec::new(), Vec::new());
|
||||
if zone == super::view_range::Zone::Cut {
|
||||
use super::wall_columns::{band_polys, end_in_column, relation, Rel};
|
||||
for w in p.walls.iter().filter(|w| w.floor_id == c.a.floor && c.shown(&w.category_code)) {
|
||||
for w in p.walls.iter().filter(|w| w.floor_id == c.a.floor && c.vis(&w.category_code, &w.id)) {
|
||||
let (zb, zt) = p.wall_vertical_extent(w);
|
||||
if range.classify(zb, zt) != super::view_range::Zone::Cut || end_in_column(w, &fp).is_none() {
|
||||
continue;
|
||||
@@ -1564,6 +1577,46 @@ mod tests {
|
||||
assert!(f50.iter().zip(&before50).any(|(a, b)| a.0 == "#ffffff" && a.1 == HatchPattern::None && b.1 != HatchPattern::None));
|
||||
}
|
||||
|
||||
/// [33] „Ausblenden“ im Grundriss: Wände samt ihren Öffnungen (Symbole) weg, Decken/Räume bleiben; eine
|
||||
/// Regel nur für den Schnitt wirkt nicht; Bauteilart wirkt auch auf Farbe; Linienstil einer Schicht-Regel
|
||||
/// auf die Fugen der Wandschicht.
|
||||
#[test]
|
||||
fn ausblenden_und_linienstil_im_grundriss() {
|
||||
let mut p = sample();
|
||||
let run = |p: &Project| {
|
||||
let t = serde_json::json!({ "floor": "eg", "show": ["20", "21", "30", "60"], "grey": [], "scale": 50 }).to_string();
|
||||
plan_domains(p, &PlanArgs::parse(1.0, &t).unwrap()).unwrap()
|
||||
};
|
||||
let wall_polys = |d: &DomainPrims| d.walls.iter().filter(|q| matches!(q, Primitive::Polygon { wall_id: Some(_), .. })).count();
|
||||
let opening_prims = |d: &DomainPrims| d.walls.iter().filter(|q| matches!(q, Primitive::Line { opening_id: Some(_), .. } | Primitive::Arc { opening_id: Some(_), .. } | Primitive::Polygon { opening_id: Some(_), .. })).count();
|
||||
let before = run(&p);
|
||||
assert!(wall_polys(&before) > 0 && opening_prims(&before) > 0);
|
||||
let rule = |view: &str, actions: serde_json::Value| -> OverrideRule {
|
||||
serde_json::from_value(serde_json::json!({"id": "h", "name": "h", "enabled": true,
|
||||
"condition": {"type": "element_kind", "operator": "equals", "value": "wall"},
|
||||
"conditions": [{"type": "view_kind", "operator": "equals", "value": view}], "actions": actions})).unwrap()
|
||||
};
|
||||
p.override_rules = Some(vec![rule("section", serde_json::json!({"hide": true}))]);
|
||||
assert_eq!(wall_polys(&run(&p)), wall_polys(&before), "Regel nur für den Schnitt");
|
||||
p.override_rules = Some(vec![rule("plan", serde_json::json!({"hide": true}))]);
|
||||
let d = run(&p);
|
||||
assert_eq!(wall_polys(&d), 0, "Wände ausgeblendet");
|
||||
assert_eq!(opening_prims(&d), 0, "Öffnungen der Wände mit");
|
||||
// Decken bleiben (ihre Umrisslinien laufen ohne die Wände durch).
|
||||
let ceiling_polys = |d: &DomainPrims| d.ceilings.iter().filter(|q| matches!(q, Primitive::Polygon { ceiling_id: Some(_), .. })).count();
|
||||
assert!(ceiling_polys(&d) > 0 && ceiling_polys(&d) == ceiling_polys(&before));
|
||||
assert_eq!(d.rooms.len(), before.rooms.len());
|
||||
// Bauteilart wirkt im Grundriss auch auf die Farbe.
|
||||
p.override_rules = Some(vec![rule("plan", serde_json::json!({"color": "#ff0000"}))]);
|
||||
assert!(run(&p).walls.iter().any(|q| matches!(q, Primitive::Line { color: Some(c), .. } if c == "#ff0000") || matches!(q, Primitive::Polygon { stroke, .. } if stroke == "#ff0000")));
|
||||
// Linienstil aus einer Schicht-Regel: Fugen an der Dämmschicht gestrichelt.
|
||||
let dashed = |d: &DomainPrims| d.walls.iter().filter(|q| matches!(q, Primitive::Line { cls, dash: Some(Some(m)), .. } if cls == "layer-joint" && m == &vec![0.35, 0.3])).count();
|
||||
assert_eq!(dashed(&before), 0);
|
||||
p.override_rules = Some(vec![serde_json::from_value(serde_json::json!({"id": "l", "name": "l", "enabled": true,
|
||||
"condition": {"type": "material_category", "operator": "equals", "value": "insulation"}, "actions": {"linetypeId": "hatch-dash"}})).unwrap()]);
|
||||
assert!(dashed(&run(&p)) > 0);
|
||||
}
|
||||
|
||||
/// [140] „mittel" ab 1:200 wie „grob" (Wände als Sammelfläche), „fein" bleibt; explizit „grob" ohne Stempel.
|
||||
#[test]
|
||||
fn mittel_ab_1_200_automatisch_grob() {
|
||||
|
||||
@@ -289,7 +289,7 @@ impl<'a> Memo<'a> {
|
||||
self.last = i;
|
||||
return &self.entries[i];
|
||||
}
|
||||
let e = MemoEntry { key, shown: c.shown(key.0), greyed: c.greyed(key.0), cat: c.cat(key.0), ov: c.overrides(key.0, Some(key.1)) };
|
||||
let e = MemoEntry { key, shown: c.shown(key.0), greyed: c.greyed(key.0), cat: c.cat(key.0), ov: c.overrides(None, key.0, Some(key.1)) };
|
||||
let i = if self.entries.len() < Self::MAX {
|
||||
self.entries.push(e);
|
||||
self.entries.len() - 1
|
||||
|
||||
@@ -103,19 +103,24 @@ struct SurfOv {
|
||||
outline: Option<bool>,
|
||||
color: Option<String>,
|
||||
lineweight: Option<f64>,
|
||||
/// Linienstil der Regel (Strichmuster; `Some(None)` = durchgezogen).
|
||||
dash: Option<Option<Vec<f64>>>,
|
||||
hide: bool,
|
||||
}
|
||||
|
||||
impl SurfOv {
|
||||
/// Linie in Regel-Farbe/-Stärke.
|
||||
/// Linie in Regel-Farbe/-Stärke/-Linienstil.
|
||||
fn restyle(&self, mut l: Primitive) -> Primitive {
|
||||
if let Primitive::Line { color, weight_mm, .. } = &mut l {
|
||||
if let Primitive::Line { color, weight_mm, dash, .. } = &mut l {
|
||||
if let Some(c) = &self.color {
|
||||
*color = Some(c.clone());
|
||||
}
|
||||
if let Some(w) = self.lineweight {
|
||||
*weight_mm = w;
|
||||
}
|
||||
if let Some(d) = &self.dash {
|
||||
*dash = Some(d.clone());
|
||||
}
|
||||
}
|
||||
l
|
||||
}
|
||||
@@ -141,8 +146,9 @@ fn surf_ov(p: &Project, v: RuleView, kind: &str, code: &str, name: Option<&str>,
|
||||
Some("none") => (true, None),
|
||||
Some(id) => super::style::resolve_hatch(p, id, None, None, None).map_or((false, None), |h| (true, Some(h))),
|
||||
};
|
||||
let o = SurfOv { fill: ly.fill_color, no_pattern, hatch, outline: ly.outline, color: el.color, lineweight: el.lineweight, hide: hide == Some(true) };
|
||||
(o.fill.is_some() || o.no_pattern || o.outline.is_some() || o.color.is_some() || o.lineweight.is_some() || o.hide).then(|| Rc::new(o))
|
||||
let dash = ovr::linetype_dash(p, el.linetype_id.as_deref());
|
||||
let o = SurfOv { fill: ly.fill_color, no_pattern, hatch, outline: ly.outline, color: el.color, lineweight: el.lineweight, dash, hide: hide == Some(true) };
|
||||
(o.fill.is_some() || o.no_pattern || o.outline.is_some() || o.color.is_some() || o.lineweight.is_some() || o.dash.is_some() || o.hide).then(|| Rc::new(o))
|
||||
}
|
||||
|
||||
/// [33] Override-Regeln je Ansichtsfläche: Wand (Wandtyp, sichtbare Seite = äusserste bzw. innerste
|
||||
@@ -1527,6 +1533,21 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool,
|
||||
}
|
||||
}
|
||||
|
||||
// [33] Schlagschatten über Regeln (Bauteilart „Schatten“): Ausblenden, Füllung, Linie (Umriss).
|
||||
let sov = if shadows { super::overrides::shadow_override(p, rv) } else { None };
|
||||
let shadows = shadows && !sov.as_ref().is_some_and(|(a, _)| a.hidden());
|
||||
let shadow_style = |mut q: Primitive| -> Primitive {
|
||||
if let (Some((a, l)), Primitive::Polygon { fill, stroke, stroke_width_mm, .. }) = (&sov, &mut q) {
|
||||
if let Some(f) = &l.fill_color {
|
||||
*fill = f.clone();
|
||||
}
|
||||
if a.color.is_some() || a.lineweight.is_some() {
|
||||
*stroke = a.color.clone().unwrap_or_else(|| EDGE_INK.into());
|
||||
*stroke_width_mm = a.lineweight.unwrap_or(EDGE_MM);
|
||||
}
|
||||
}
|
||||
q
|
||||
};
|
||||
if shadows {
|
||||
let wall_faces: Vec<&Face> = faces.iter().filter(|f| f.role == Role::Wall).collect();
|
||||
let mut casters: Vec<&Face> = faces.iter().filter(|f| f.role == Role::Slab).collect();
|
||||
@@ -1550,7 +1571,7 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool,
|
||||
if let Primitive::Polygon { context_object_id, .. } = &mut prim {
|
||||
*context_object_id = Some(crate::plan::extras::SITE_PICK_VIEW_SHADOWS.into());
|
||||
}
|
||||
items.push(Item { depth: depth - EPS * 10.0, seq, rank: None, prim });
|
||||
items.push(Item { depth: depth - EPS * 10.0, seq, rank: None, prim: shadow_style(prim) });
|
||||
seq += 1;
|
||||
}
|
||||
}
|
||||
@@ -1616,11 +1637,12 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool,
|
||||
let f_v = min(0.3, 0.08 / max(h_v, 1e-6));
|
||||
for (fa0, fa1, fz0, fz1) in [(0.0, 1.0, 1.0 - f_v, 1.0), (0.0, f_u, 0.0, 1.0 - f_v)] {
|
||||
let r = [quad_at(fa0, fz0), quad_at(fa1, fz0), quad_at(fa1, fz1), quad_at(fa0, fz1)];
|
||||
push(polygon(to_vec(&r), if mono { OPENING_SHADOW_FILL_MONO } else { OPENING_SHADOW_FILL }, "none", 0.0, no_hatch()));
|
||||
push(shadow_style(polygon(to_vec(&r), if mono { OPENING_SHADOW_FILL_MONO } else { OPENING_SHADOW_FILL }, "none", 0.0, no_hatch())));
|
||||
}
|
||||
}
|
||||
for (a, b) in &op.divisions {
|
||||
push(line(v2(a[0], a[1]), v2(b[0], b[1]), "elevation-division", edge_mm, ink));
|
||||
let l = line(v2(a[0], a[1]), v2(b[0], b[1]), "elevation-division", edge_mm, ink);
|
||||
push(match &ov { Some(o) => o.restyle(l), None => l });
|
||||
}
|
||||
for (a, b) in &op.symbol {
|
||||
let mut l = line(v2(a[0], a[1]), v2(b[0], b[1]), "elevation-opening-symbol", 0.1, SYMBOL_INK);
|
||||
@@ -1679,6 +1701,12 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool,
|
||||
if !terrain_shown(t.category_code.as_deref()) || t.hidden == Some(true) {
|
||||
continue;
|
||||
}
|
||||
// [33] Gelände über Regeln (Bauteilart „Gelände“): Ausblenden, Füllung der Geländefläche, Linie.
|
||||
let tov = super::overrides::terrain_override(p, rv, t.category_code.as_deref(), &t.name);
|
||||
if tov.as_ref().is_some_and(|(a, _)| a.hidden()) {
|
||||
continue;
|
||||
}
|
||||
let tfill = tov.as_ref().and_then(|(_, l)| l.fill_color.clone()).unwrap_or_else(|| "#ffffff".into());
|
||||
for l in terrain_silhouette(p, t, &frame, (acc.min_x - 6.0, acc.max_x + 6.0), depth_max) {
|
||||
has_terrain = true;
|
||||
let low = l.iter().map(|q| q[1]).fold(acc.min_y, f64::min) - 1.0;
|
||||
@@ -1686,7 +1714,7 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool,
|
||||
ring.push(v2(l[l.len() - 1][0], low));
|
||||
ring.push(v2(l[0][0], low));
|
||||
// [137] Die Geländefläche wählt das Gelände (Pick-Id).
|
||||
let mut mask = polygon(ring, "#ffffff", "none", 0.0, no_hatch());
|
||||
let mut mask = polygon(ring, &tfill, "none", 0.0, no_hatch());
|
||||
if let Primitive::Polygon { context_object_id, .. } = &mut mask {
|
||||
*context_object_id = Some(t.id.clone());
|
||||
}
|
||||
@@ -1694,7 +1722,11 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool,
|
||||
for w in l.windows(2) {
|
||||
acc.add(w[0][0], w[0][1]);
|
||||
acc.add(w[1][0], w[1][1]);
|
||||
prims.push(line(v2(w[0][0], w[0][1]), v2(w[1][0], w[1][1]), "elevation-terrain", GROUND_MM, GROUND_INK));
|
||||
let mut tl = [line(v2(w[0][0], w[0][1]), v2(w[1][0], w[1][1]), "elevation-terrain", GROUND_MM, GROUND_INK)];
|
||||
if let Some((a, _)) = &tov {
|
||||
super::context::restyle_lines(p, a, &mut tl);
|
||||
}
|
||||
prims.extend(tl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2451,6 +2483,58 @@ mod tests {
|
||||
assert!(n_edges(&prims) < n_edges(&render_rules(&p, false, None)), "Wandkanten ohne Umriss");
|
||||
}
|
||||
|
||||
/// [33] Linienstil in der Ansicht (Element- und Schicht-Regel), Schlagschatten und Gelände über Regeln
|
||||
/// (Bauteilart „Schatten“/„Gelände“: Füllung, Linie, Ausblenden); allgemeine Regeln lassen beide in Ruhe.
|
||||
#[test]
|
||||
fn linienstil_schatten_und_gelaende_in_der_ansicht() {
|
||||
let mut p = sample();
|
||||
p.context = Some(vec![ContextObject::TerrainMesh(TerrainMesh {
|
||||
id: "t".into(),
|
||||
name: "Gelände".into(),
|
||||
positions: vec![-50.0, -50.0, -0.5, 50.0, -50.0, -0.5, 50.0, 50.0, 0.3, -50.0, 50.0, 0.3],
|
||||
indices: vec![0.0, 1.0, 2.0, 0.0, 2.0, 3.0],
|
||||
..Default::default()
|
||||
})]);
|
||||
let render = |p: &Project| {
|
||||
let l = p.drawing_levels.iter().find(|l| l.id == "ansicht-sued").unwrap();
|
||||
elevation_primitives_with(p, &LevelSpec::from_json(&serde_json::to_value(l).unwrap()), true, false, &Visibility::default(), 50.0, None).unwrap().unwrap().0
|
||||
};
|
||||
let dashed = |prims: &[Primitive]| prims.iter().filter(|q| matches!(q, Primitive::Line { cls, dash: Some(Some(m)), .. } if cls.starts_with("elevation-outline") && m == &vec![0.35, 0.3])).count();
|
||||
let shadows = |prims: &[Primitive]| prims.iter().filter_map(|q| match q { Primitive::Polygon { fill, context_object_id: Some(id), .. } if id == crate::plan::extras::SITE_PICK_VIEW_SHADOWS => Some(fill.clone()), _ => None }).collect::<Vec<_>>();
|
||||
let terrain = |prims: &[Primitive]| prims.iter().filter_map(|q| match q { Primitive::Line { cls, color, dash, .. } if cls == "elevation-terrain" => Some((color.clone(), dash.clone())), _ => None }).collect::<Vec<_>>();
|
||||
let mask = |prims: &[Primitive]| prims.iter().filter_map(|q| match q { Primitive::Polygon { fill, context_object_id: Some(id), .. } if id == "t" => Some(fill.clone()), _ => None }).collect::<Vec<_>>();
|
||||
let base = render(&p);
|
||||
assert_eq!(dashed(&base), 0);
|
||||
assert!(!shadows(&base).is_empty() && !terrain(&base).is_empty() && !mask(&base).is_empty());
|
||||
// Linienstil: Element-Regel (Wand) und Schicht-Regel (Baustoff der sichtbaren Schicht).
|
||||
p.override_rules = Some(vec![ov_rule("w", serde_json::json!([{"type": "element_kind", "operator": "equals", "value": "wall"}]), serde_json::json!({"linetypeId": "hatch-dash"}))]);
|
||||
assert!(dashed(&render(&p)) > 0);
|
||||
p.override_rules = Some(vec![ov_rule("m", serde_json::json!([{"type": "material", "operator": "equals", "value": "Aussenputz"}]), serde_json::json!({"linetypeId": "hatch-dash"}))]);
|
||||
assert!(dashed(&render(&p)) > 0);
|
||||
// Allgemeine Regel („Ansicht ohne Materialschraffur“-artig): Schatten und Gelände bleiben.
|
||||
p.override_rules = Some(vec![ov_rule("g", serde_json::json!([{"type": "element_kind", "operator": "not_equals", "value": "opening"}]), serde_json::json!({"fillColor": "#ffffff", "color": "#ff0000"}))]);
|
||||
let prims = render(&p);
|
||||
assert_eq!(shadows(&prims), shadows(&base));
|
||||
assert_eq!(terrain(&prims), terrain(&base));
|
||||
// Schatten: Füllung, dann ausblenden.
|
||||
p.override_rules = Some(vec![ov_rule("s", serde_json::json!([{"type": "element_kind", "operator": "equals", "value": "shadow"}]), serde_json::json!({"fillColor": "#3355ff"}))]);
|
||||
let s = shadows(&render(&p));
|
||||
assert!(!s.is_empty() && s.iter().all(|f| f == "#3355ff"));
|
||||
p.override_rules.as_mut().unwrap()[0].actions.hide = Some(true);
|
||||
let prims = render(&p);
|
||||
assert!(shadows(&prims).is_empty());
|
||||
assert!(!prims.iter().any(|q| matches!(q, Primitive::Polygon { fill, .. } if fill == OPENING_SHADOW_FILL)), "Leibungsschatten auch");
|
||||
// Gelände: Linie (Farbe, Linienstil) und Füllung, dann ausblenden (Grundlinie statt Silhouette).
|
||||
p.override_rules = Some(vec![ov_rule("t", serde_json::json!([{"type": "element_kind", "operator": "equals", "value": "terrain"}]), serde_json::json!({"color": "#00aa00", "linetypeId": "hatch-dash", "fillColor": "#eeeeee"}))]);
|
||||
let prims = render(&p);
|
||||
assert!(terrain(&prims).iter().all(|(c, d)| c.as_deref() == Some("#00aa00") && d == &Some(Some(vec![0.35, 0.3]))));
|
||||
assert!(mask(&prims).iter().all(|f| f == "#eeeeee"));
|
||||
p.override_rules.as_mut().unwrap()[0].actions.hide = Some(true);
|
||||
let prims = render(&p);
|
||||
assert!(terrain(&prims).is_empty() && mask(&prims).is_empty());
|
||||
assert!(prims.iter().any(|q| matches!(q, Primitive::Line { cls, .. } if cls == "elevation-ground")));
|
||||
}
|
||||
|
||||
/// [33] Baustoff-Kriterium greift auf die sichtbare Oberflächenschicht (äusserste Wandschicht, Dachdeckung);
|
||||
/// Schraffur „ohne“ unterdrückt die Ansichtsschraffur, eine Projekt-Schraffur legt sie auf die Fläche.
|
||||
#[test]
|
||||
|
||||
@@ -62,7 +62,8 @@ pub struct Subject<'a> {
|
||||
pub layer_code: Option<&'a str>,
|
||||
/// Element-/Typ-Name (Wandtyp, Raum, Öffnungs-Label …).
|
||||
pub object_name: Option<&'a str>,
|
||||
/// [33] Bauteilart: "wall", "slab", "ground_slab", "roof".
|
||||
/// [33] Bauteilart: "wall", "slab", "ground_slab", "roof", "stair", "column", "opening", "room", dazu
|
||||
/// [`SPECIAL_KINDS`] "shadow" (Schlagschatten der Ansicht) und "terrain" (Gelände/Höhenlinien).
|
||||
pub element_kind: Option<&'a str>,
|
||||
/// [33] Funktion der Schicht ([`function_key`]).
|
||||
pub layer_function: Option<&'a str>,
|
||||
@@ -84,12 +85,34 @@ pub struct Actions {
|
||||
pub color: Option<String>,
|
||||
pub lineweight: Option<f64>,
|
||||
pub linetype_id: Option<String>,
|
||||
/// [33] Ausblenden (Element samt Linien, Schraffur, Beschriftung).
|
||||
pub hide: Option<bool>,
|
||||
}
|
||||
|
||||
impl Actions {
|
||||
pub fn any(&self) -> bool {
|
||||
self.color.is_some() || self.lineweight.is_some() || self.linetype_id.is_some()
|
||||
}
|
||||
pub fn hidden(&self) -> bool {
|
||||
self.hide == Some(true)
|
||||
}
|
||||
}
|
||||
|
||||
/// [33] Bauteilarten ohne eigenes Element im Modell (Schlagschatten der Ansicht, Gelände/Höhenlinien): Sie
|
||||
/// folgen nur Regeln, die die Bauteilart ausdrücklich nennen (gleich/enthält/beginnt mit) — sonst würden
|
||||
/// allgemeine Regeln („Ebene ≠ …“, „Bauteilart ≠ Fenster/Tür“) sie plötzlich mitfärben.
|
||||
pub const SPECIAL_KINDS: [&str; 2] = ["shadow", "terrain"];
|
||||
|
||||
/// [33] Wirkt die Regel auf diese Bauteilart? Für [`SPECIAL_KINDS`] nur mit positiver Bauteilart-Bedingung.
|
||||
fn kind_ok(rule: &OverrideRule, s: &Subject) -> bool {
|
||||
!s.element_kind.is_some_and(|k| SPECIAL_KINDS.contains(&k)) || conditions(rule).any(|c| c.r#type == OverrideConditionType::ElementKind && matches!(c.operator, OverrideOperator::Equals | OverrideOperator::Contains | OverrideOperator::StartsWith))
|
||||
}
|
||||
|
||||
/// [33] Strichmuster eines Linienstils (Aktion `linetypeId`) als `dash` einer Linie: `Some(None)` =
|
||||
/// durchgezogen, `None` = kein bzw. unbekannter Linienstil.
|
||||
pub fn linetype_dash(p: &Project, id: Option<&str>) -> Option<Option<Vec<f64>>> {
|
||||
let id = id.map(js_trim).filter(|s| !s.is_empty())?;
|
||||
p.line_styles.iter().find(|l| l.id == id).map(|l| l.dash.clone().filter(|d| !d.is_empty()))
|
||||
}
|
||||
|
||||
/// [33] Effektive Schicht-Aktionen (Füllung, Schraffur, Umriss) einer Schicht.
|
||||
@@ -99,6 +122,8 @@ pub struct LayerActions {
|
||||
/// "none", "material" oder id einer Schraffur.
|
||||
pub hatch: Option<String>,
|
||||
pub outline: Option<bool>,
|
||||
/// [33] Linienstil der Fugen/Umrisse der Schicht (nur aus Schicht-Regeln, [`is_layer_rule`]).
|
||||
pub linetype_id: Option<String>,
|
||||
}
|
||||
|
||||
impl LayerActions {
|
||||
@@ -107,7 +132,7 @@ impl LayerActions {
|
||||
self.fill_color.is_some() || self.hatch.is_some()
|
||||
}
|
||||
pub fn any(&self) -> bool {
|
||||
self.styles() || self.outline.is_some()
|
||||
self.styles() || self.outline.is_some() || self.linetype_id.is_some()
|
||||
}
|
||||
/// Fläche ohne Muster (Schraffur "none")?
|
||||
pub fn plain(&self) -> bool {
|
||||
@@ -186,7 +211,7 @@ pub fn effective(rules: Option<&[OverrideRule]>, s: &Subject, v: RuleView) -> Ac
|
||||
let Some(rules) = rules else { return out };
|
||||
let s = &Subject { view_kind: v.view, ..*s };
|
||||
for rule in rules {
|
||||
if !v.active(rule) || is_layer_rule(rule) || !rule_matches(rule, s) {
|
||||
if !v.active(rule) || is_layer_rule(rule) || !kind_ok(rule, s) || !rule_matches(rule, s) {
|
||||
continue;
|
||||
}
|
||||
let a = &rule.actions;
|
||||
@@ -199,7 +224,10 @@ pub fn effective(rules: Option<&[OverrideRule]>, s: &Subject, v: RuleView) -> Ac
|
||||
if out.linetype_id.is_none() {
|
||||
out.linetype_id = a.linetype_id.clone();
|
||||
}
|
||||
if out.color.is_some() && out.lineweight.is_some() && out.linetype_id.is_some() {
|
||||
if out.hide.is_none() {
|
||||
out.hide = a.hide;
|
||||
}
|
||||
if out.color.is_some() && out.lineweight.is_some() && out.linetype_id.is_some() && out.hide.is_some() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -213,9 +241,13 @@ pub fn effective_layer(rules: Option<&[OverrideRule]>, s: &Subject, v: RuleView)
|
||||
let s = &Subject { view_kind: v.view, ..*s };
|
||||
for rule in rules {
|
||||
let a = &rule.actions;
|
||||
if !v.active(rule) || (a.fill_color.is_none() && a.hatch.is_none() && a.outline.is_none()) || !rule_matches(rule, s) {
|
||||
let lt = if is_layer_rule(rule) { a.linetype_id.as_deref().map(js_trim).filter(|x| !x.is_empty()) } else { None };
|
||||
if !v.active(rule) || (a.fill_color.is_none() && a.hatch.is_none() && a.outline.is_none() && lt.is_none()) || !rule_matches(rule, s) {
|
||||
continue;
|
||||
}
|
||||
if out.linetype_id.is_none() {
|
||||
out.linetype_id = lt.map(String::from);
|
||||
}
|
||||
if out.fill_color.is_none() {
|
||||
out.fill_color = a.fill_color.as_deref().map(js_trim).filter(|x| !x.is_empty()).map(String::from);
|
||||
}
|
||||
@@ -238,7 +270,7 @@ pub fn effective_surface(rules: Option<&[OverrideRule]>, s: &Subject, v: RuleVie
|
||||
let s = &Subject { view_kind: v.view, ..*s };
|
||||
let text = |x: &Option<String>| x.as_deref().map(js_trim).filter(|x| !x.is_empty()).map(String::from);
|
||||
for rule in rules {
|
||||
if !v.active(rule) || !rule_matches(rule, s) {
|
||||
if !v.active(rule) || !kind_ok(rule, s) || !rule_matches(rule, s) {
|
||||
continue;
|
||||
}
|
||||
let a = &rule.actions;
|
||||
@@ -260,7 +292,90 @@ pub fn has_active(p: &Project, v: RuleView) -> bool {
|
||||
|
||||
/// Gibt es überhaupt aktive Regeln mit Schicht-Aktionen? (Schnellpfad: sonst nichts auswerten.)
|
||||
pub fn has_layer_actions(p: &Project, v: RuleView) -> bool {
|
||||
p.override_rules.iter().flatten().any(|r| v.active(r) && (r.actions.fill_color.is_some() || r.actions.hatch.is_some() || r.actions.outline.is_some()))
|
||||
p.override_rules.iter().flatten().any(|r| v.active(r) && (r.actions.fill_color.is_some() || r.actions.hatch.is_some() || r.actions.outline.is_some() || (r.actions.linetype_id.is_some() && is_layer_rule(r))))
|
||||
}
|
||||
|
||||
/// [33] Gibt es aktive Element-Regeln mit „Ausblenden“? (Schnellpfad für [`hidden_elements`].)
|
||||
pub fn has_hide(p: &Project, v: RuleView) -> bool {
|
||||
p.override_rules.iter().flatten().any(|r| v.active(r) && r.actions.hide == Some(true) && !is_layer_rule(r))
|
||||
}
|
||||
|
||||
/// [33] Elemente, die eine Regel „Ausblenden“ in Grundriss/Deckenspiegel/Schnitt ausblendet (ids): Wände,
|
||||
/// Öffnungen, Decken/Bodenplatten, Dächer, Treppen, Stützen, Räume — Bedingungen wie bei [`effective`]
|
||||
/// (Element-Regeln: Ebene, Name, Bauteilart, Darstellung, Massstab). Eine ausgeblendete Wand nimmt ihre
|
||||
/// Öffnungen mit. Leer ohne aktive Regel mit „Ausblenden“.
|
||||
pub fn hidden_elements(p: &Project, v: RuleView) -> HashSet<String> {
|
||||
let mut out = HashSet::new();
|
||||
if !has_hide(p, v) {
|
||||
return out;
|
||||
}
|
||||
let rules = p.override_rules.as_deref();
|
||||
let mut memo: std::collections::HashMap<(&'static str, String, Option<String>), bool> = std::collections::HashMap::new();
|
||||
let mut test = |kind: &'static str, code: &str, name: Option<&str>| -> bool {
|
||||
*memo.entry((kind, code.to_string(), name.map(String::from))).or_insert_with(|| {
|
||||
let s = Subject { layer_name: p.layer_category(code).map(|c| c.name.as_str()), layer_code: Some(code), object_name: name, element_kind: Some(kind), ..Default::default() };
|
||||
effective(rules, &s, v).hidden()
|
||||
})
|
||||
};
|
||||
for w in &p.walls {
|
||||
if test("wall", &w.category_code, Some(&p.wall_type_or_fallback(w).name)) {
|
||||
out.insert(w.id.clone());
|
||||
}
|
||||
}
|
||||
for o in p.openings.iter().flatten() {
|
||||
if out.contains(&o.host_wall_id) || test("opening", &o.category_code, Some(&super::walls::opening_label(o))) {
|
||||
out.insert(o.id.clone());
|
||||
}
|
||||
}
|
||||
for c in p.ceilings.iter().flatten() {
|
||||
let layers = super::domains::ceiling_layers(p, c).unwrap_or(&[]);
|
||||
let kind = if is_ground_slab(p, c, layers) { "ground_slab" } else { "slab" };
|
||||
if test(kind, &c.category_code, super::domains::ceiling_type_name(p, c)) {
|
||||
out.insert(c.id.clone());
|
||||
}
|
||||
}
|
||||
for r in p.roofs.iter().flatten() {
|
||||
if test("roof", &r.category_code, None) {
|
||||
out.insert(r.id.clone());
|
||||
}
|
||||
}
|
||||
for s in p.stairs.iter().flatten() {
|
||||
if test("stair", &s.category_code, Some(&super::stairs::stair_label(s))) {
|
||||
out.insert(s.id.clone());
|
||||
}
|
||||
}
|
||||
for c in p.columns.iter().flatten() {
|
||||
if test("column", &c.category_code, Some(&super::domains::column_label(c))) {
|
||||
out.insert(c.id.clone());
|
||||
}
|
||||
}
|
||||
for r in p.rooms.iter().flatten() {
|
||||
if test("room", &r.category_code, Some(&r.name)) {
|
||||
out.insert(r.id.clone());
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// [33] Override für Gelände/Höhenlinien (Bauteilart "terrain", s. [`SPECIAL_KINDS`]): Linie (Farbe, Stärke,
|
||||
/// Linienstil), Füllung, Ausblenden (`Actions::hide`). `None` ohne wirksame Regel.
|
||||
pub fn terrain_override(p: &Project, v: RuleView, code: Option<&str>, name: &str) -> Option<(Actions, LayerActions)> {
|
||||
special_override(p, v, "terrain", code, Some(name))
|
||||
}
|
||||
|
||||
/// [33] Override für den Schlagschatten der Ansicht (Bauteilart "shadow").
|
||||
pub fn shadow_override(p: &Project, v: RuleView) -> Option<(Actions, LayerActions)> {
|
||||
special_override(p, v, "shadow", None, None)
|
||||
}
|
||||
|
||||
fn special_override(p: &Project, v: RuleView, kind: &str, code: Option<&str>, name: Option<&str>) -> Option<(Actions, LayerActions)> {
|
||||
if !has_active(p, v) {
|
||||
return None;
|
||||
}
|
||||
let s = Subject { layer_name: code.and_then(|c| p.layer_category(c)).map(|c| c.name.as_str()), layer_code: code, object_name: name, element_kind: Some(kind), ..Default::default() };
|
||||
let (mut el, ly, hide) = effective_surface(p.override_rules.as_deref(), &s, v);
|
||||
el.hide = hide;
|
||||
(el.any() || el.hidden() || ly.fill_color.is_some()).then_some((el, ly))
|
||||
}
|
||||
|
||||
/// Schlüssel einer Schichtfunktion (wie im JSON).
|
||||
@@ -416,7 +531,7 @@ mod tests {
|
||||
rule(true, cond(LayerName, Equals, "Wände"), None, Some(0.1), Some("dashed")),
|
||||
];
|
||||
let a = effective(Some(&rules), &WALL, RuleView::default());
|
||||
assert_eq!(a, Actions { color: Some("#f00".into()), lineweight: Some(0.7), linetype_id: Some("dashed".into()) });
|
||||
assert_eq!(a, Actions { color: Some("#f00".into()), lineweight: Some(0.7), linetype_id: Some("dashed".into()), hide: None });
|
||||
assert!(!effective(None, &WALL, RuleView::default()).any());
|
||||
assert!(!effective(Some(&[]), &WALL, RuleView::default()).any());
|
||||
}
|
||||
@@ -445,7 +560,7 @@ mod tests {
|
||||
// Nicht aufs Element (auch nicht die Farbe).
|
||||
assert!(!effective(Some(std::slice::from_ref(&white)), &WALL, RuleView::default()).any());
|
||||
let a = effective_layer(Some(std::slice::from_ref(&white)), &screed, RuleView::default());
|
||||
assert_eq!(a, LayerActions { fill_color: Some("#ffffff".into()), hatch: Some("none".into()), outline: Some(true) });
|
||||
assert_eq!(a, LayerActions { fill_color: Some("#ffffff".into()), hatch: Some("none".into()), outline: Some(true), linetype_id: None });
|
||||
assert!(!effective_layer(Some(std::slice::from_ref(&white)), &core, RuleView::default()).any());
|
||||
// Weitere Bedingung verfehlt: Wand.
|
||||
assert!(!effective_layer(Some(std::slice::from_ref(&white)), &Subject { element_kind: Some("wall"), ..screed }, RuleView::default()).any());
|
||||
@@ -525,4 +640,68 @@ mod tests {
|
||||
assert!(layer_actions(&p, RuleView::default(), "ground_slab", "30", None, &deck)[1].plain());
|
||||
assert!(!layer_actions(&p, RuleView::default(), "wall", "20", None, &deck)[1].any());
|
||||
}
|
||||
|
||||
fn sample() -> Project {
|
||||
serde_json::from_str(include_str!("../../tests/fixtures/sample_project.json")).unwrap()
|
||||
}
|
||||
|
||||
/// [33] „Ausblenden“ für Grundriss/Schnitt: Element-Regeln (Bauteilart, Ebene, Darstellung), eine
|
||||
/// ausgeblendete Wand nimmt ihre Öffnungen mit; Schicht-Regeln blenden nichts aus.
|
||||
#[test]
|
||||
fn ausgeblendete_elemente() {
|
||||
let mut p = sample();
|
||||
assert!(hidden_elements(&p, RuleView::default()).is_empty());
|
||||
let mut r = rule(true, cond(ElementKind, Equals, "wall"), None, None, None);
|
||||
r.actions.hide = Some(true);
|
||||
r.conditions = Some(vec![cond(ViewKind, Equals, "section")]);
|
||||
p.override_rules = Some(vec![r.clone()]);
|
||||
assert!(hidden_elements(&p, RuleView::default().view("plan")).is_empty(), "nur im Schnitt");
|
||||
let h = hidden_elements(&p, RuleView::default().view("section"));
|
||||
assert!(p.walls.iter().all(|w| h.contains(&w.id)));
|
||||
assert!(p.openings.iter().flatten().all(|o| h.contains(&o.id)), "Öffnungen der Wand mit");
|
||||
assert!(p.ceilings.iter().flatten().all(|c| !h.contains(&c.id)));
|
||||
// Nur die Öffnungen (Ebene 21): Wände bleiben.
|
||||
r.condition = cond(LayerName, Equals, "21");
|
||||
r.conditions = None;
|
||||
p.override_rules = Some(vec![r.clone()]);
|
||||
let h = hidden_elements(&p, RuleView::default().view("plan"));
|
||||
assert!(p.walls.iter().all(|w| !h.contains(&w.id)) && p.openings.iter().flatten().all(|o| h.contains(&o.id)));
|
||||
// Schicht-Regel: blendet keine Elemente aus.
|
||||
r.condition = cond(MaterialCategory, Equals, "insulation");
|
||||
p.override_rules = Some(vec![r]);
|
||||
assert!(hidden_elements(&p, RuleView::default().view("plan")).is_empty());
|
||||
}
|
||||
|
||||
/// [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]
|
||||
fn schatten_gelaende_und_linienstil() {
|
||||
let mut p = sample();
|
||||
let mut general = rule(true, cond(ElementKind, NotEquals, "opening"), Some("#ff0000"), None, None);
|
||||
general.actions.fill_color = Some("#ffffff".into());
|
||||
p.override_rules = Some(vec![general.clone()]);
|
||||
assert!(shadow_override(&p, RuleView::default()).is_none(), "allgemeine Regel lässt Schatten in Ruhe");
|
||||
assert!(terrain_override(&p, RuleView::default(), Some("02"), "Gelände").is_none());
|
||||
let mut sh = rule(true, cond(ElementKind, Equals, "shadow"), None, None, None);
|
||||
sh.actions.hide = Some(true);
|
||||
let mut te = rule(true, cond(ElementKind, Equals, "terrain"), Some("#00aa00"), Some(0.5), Some("hatch-dash"));
|
||||
te.actions.fill_color = Some("#eeeeee".into());
|
||||
p.override_rules = Some(vec![sh, te, general]);
|
||||
assert!(shadow_override(&p, RuleView::default()).is_some_and(|(a, _)| a.hidden()));
|
||||
let (a, l) = terrain_override(&p, RuleView::default(), None, "Gelände").unwrap();
|
||||
assert_eq!((a.color.as_deref(), a.lineweight, a.linetype_id.as_deref(), l.fill_color.as_deref(), a.hidden()), (Some("#00aa00"), Some(0.5), Some("hatch-dash"), Some("#eeeeee"), false));
|
||||
assert_eq!(linetype_dash(&p, Some("hatch-dash")), Some(Some(vec![0.35, 0.3])));
|
||||
assert_eq!(linetype_dash(&p, Some("thin")), Some(None), "durchgezogen");
|
||||
assert_eq!(linetype_dash(&p, Some("gibts-nicht")), None);
|
||||
// Linienstil: aus Schicht-Regeln auf die Schicht, Element-Regeln nicht (Wandschichten blieben sonst neu gezeichnet).
|
||||
let s = Subject { element_kind: Some("wall"), material_category: Some("insulation"), ..WALL };
|
||||
let el = rule(true, cond(LayerName, Equals, "20"), None, None, Some("hatch-dash"));
|
||||
assert_eq!(effective_layer(Some(std::slice::from_ref(&el)), &s, RuleView::default()).linetype_id, None);
|
||||
let ly = rule(true, cond(MaterialCategory, Equals, "insulation"), None, None, Some("hatch-dash"));
|
||||
assert_eq!(effective_layer(Some(std::slice::from_ref(&ly)), &s, RuleView::default()).linetype_id.as_deref(), Some("hatch-dash"));
|
||||
p.override_rules = Some(vec![el]);
|
||||
assert!(!has_layer_actions(&p, RuleView::default()));
|
||||
p.override_rules = Some(vec![ly]);
|
||||
assert!(has_layer_actions(&p, RuleView::default()));
|
||||
}
|
||||
}
|
||||
@@ -210,6 +210,8 @@ pub struct CutOv {
|
||||
pub fill: Option<String>,
|
||||
pub hatch: HatchOv,
|
||||
pub outline: Option<bool>,
|
||||
/// [33] Linienstil der Fugen/Umrisse (Schicht-Regel): `Some(None)` durchgezogen, `Some(Some(m))` Muster.
|
||||
pub dash: Option<Option<Vec<f64>>>,
|
||||
}
|
||||
|
||||
impl CutOv {
|
||||
@@ -225,15 +227,51 @@ impl CutOv {
|
||||
pub struct CutRules {
|
||||
pub loose: HashSet<String>,
|
||||
pub ov: Vec<Option<CutOv>>,
|
||||
/// [33] Regeln für Gelände (Geländelinie, Erdreich): Ausblenden, Linie, Füllung/Schraffur.
|
||||
pub terrain: Option<(super::overrides::Actions, super::overrides::LayerActions)>,
|
||||
/// [33] Strichmuster der Gelände-Regel (Linienstil).
|
||||
pub terrain_dash: Option<Option<Vec<f64>>>,
|
||||
/// [33] Projekt-Schraffur der Gelände-Regel fürs Erdreich.
|
||||
pub terrain_hatch: Option<HatchRender>,
|
||||
}
|
||||
|
||||
impl CutRules {
|
||||
/// `v`: Massstab und eingeschaltete Regeln der Darstellung ([`super::overrides::RuleView`]).
|
||||
pub fn of(p: &Project, out: &Output, v: RuleView) -> CutRules {
|
||||
CutRules { loose: loose_fill_components(p), ov: cut_overrides(p, &out.cuts, v) }
|
||||
let ts = crate::excavation::terrains(p);
|
||||
let t = out.terrain_id.as_deref().and_then(|id| ts.iter().find(|t| t.id == id)).or(ts.first());
|
||||
let terrain = if out.profiles.is_empty() && out.earth.is_empty() { None } else { t.and_then(|t| super::overrides::terrain_override(p, v, t.category_code.as_deref(), &t.name)) };
|
||||
let terrain_dash = terrain.as_ref().and_then(|(a, _)| super::overrides::linetype_dash(p, a.linetype_id.as_deref()));
|
||||
let terrain_hatch = terrain.as_ref().and_then(|(_, l)| l.hatch.as_deref()).filter(|h| !matches!(*h, "none" | "material")).and_then(|id| resolve_hatch(p, id, None, None, None));
|
||||
CutRules { loose: loose_fill_components(p), ov: cut_overrides(p, &out.cuts, v), terrain, terrain_dash, terrain_hatch }
|
||||
}
|
||||
}
|
||||
|
||||
/// [33] Projekt ohne die Elemente `ids` (Regel „Ausblenden“ im Schnitt): verdecken dann auch nichts.
|
||||
pub fn without_elements(p: &Project, ids: &HashSet<String>) -> Project {
|
||||
let mut q = p.clone();
|
||||
q.walls.retain(|w| !ids.contains(&w.id));
|
||||
if let Some(v) = &mut q.openings {
|
||||
v.retain(|x| !ids.contains(&x.id));
|
||||
}
|
||||
if let Some(v) = &mut q.ceilings {
|
||||
v.retain(|x| !ids.contains(&x.id));
|
||||
}
|
||||
if let Some(v) = &mut q.roofs {
|
||||
v.retain(|x| !ids.contains(&x.id));
|
||||
}
|
||||
if let Some(v) = &mut q.stairs {
|
||||
v.retain(|x| !ids.contains(&x.id));
|
||||
}
|
||||
if let Some(v) = &mut q.columns {
|
||||
v.retain(|x| !ids.contains(&x.id));
|
||||
}
|
||||
if let Some(v) = &mut q.rooms {
|
||||
v.retain(|x| !ids.contains(&x.id));
|
||||
}
|
||||
q
|
||||
}
|
||||
|
||||
/// [33] Overrides je Schnittfläche: Bauteil (Wand, Decke/Bodenplatte, Dach) und Schicht der Fläche, dann
|
||||
/// `overrides::layer_actions`. Ohne aktive Regel mit Schicht-Aktionen leer.
|
||||
pub fn cut_overrides(p: &Project, cuts: &[Cut], v: RuleView) -> Vec<Option<CutOv>> {
|
||||
@@ -289,7 +327,7 @@ pub fn cut_overrides(p: &Project, cuts: &[Cut], v: RuleView) -> Vec<Option<CutOv
|
||||
Some("material") => HatchOv::Material,
|
||||
Some(id) => resolve_hatch(p, id, angle, None, None).map_or(HatchOv::Keep, HatchOv::Pattern),
|
||||
};
|
||||
Some(CutOv { fill: a.fill_color.clone(), hatch, outline: a.outline })
|
||||
Some(CutOv { fill: a.fill_color.clone(), hatch, outline: a.outline, dash: super::overrides::linetype_dash(p, a.linetype_id.as_deref()) })
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@@ -2615,12 +2653,21 @@ pub fn section_primitives_at(out: &Output, mono: bool, hidden_lines: bool, vis:
|
||||
let mut acc = Acc::new();
|
||||
let shown = |code: &str| vis.visible(code) && vis.render(code);
|
||||
let mut cut_rings: Vec<crate::flat::Polygon> = Vec::new();
|
||||
let mut late_joints: Vec<Primitive> = Vec::new();
|
||||
// [T6] Erdreich zuerst (unter allem), ohne Umriss; Kategorie wie das Gelände.
|
||||
let terrain_shown = out.profiles.iter().all(|pr| pr.category.as_deref().is_none_or(shown));
|
||||
// [33] Regel für Gelände: Ausblenden, Füllung/Schraffur des Erdreichs, Linie der Geländelinie.
|
||||
let tov = rules.terrain.as_ref();
|
||||
let terrain_shown = out.profiles.iter().all(|pr| pr.category.as_deref().is_none_or(shown)) && !tov.is_some_and(|(a, _)| a.hidden());
|
||||
if terrain_shown {
|
||||
for (ring, hatch) in &out.earth {
|
||||
let hatch = if mono { HatchRender { color: SECTION_INK.into(), ..hatch.clone() } } else { hatch.clone() };
|
||||
let mut q = polygon(ring.iter().map(|q| v2(q[0], q[1])).collect(), "none", "none", 0.0, hatch);
|
||||
let hatch = match tov.and_then(|(_, l)| l.hatch.as_deref()) {
|
||||
Some("none") => no_hatch(),
|
||||
Some("material") | None => hatch.clone(),
|
||||
Some(_) => rules.terrain_hatch.clone().unwrap_or_else(|| hatch.clone()),
|
||||
};
|
||||
let hatch = if mono { HatchRender { color: SECTION_INK.into(), ..hatch } } else { hatch };
|
||||
let fill = tov.and_then(|(_, l)| l.fill_color.as_deref()).unwrap_or("none");
|
||||
let mut q = polygon(ring.iter().map(|q| v2(q[0], q[1])).collect(), fill, "none", 0.0, hatch);
|
||||
if let Primitive::Polygon { context_object_id, .. } = &mut q {
|
||||
*context_object_id = out.terrain_id.clone();
|
||||
}
|
||||
@@ -2676,7 +2723,21 @@ pub fn section_primitives_at(out: &Output, mono: bool, hidden_lines: bool, vis:
|
||||
let outline = ov.and_then(|o| o.outline);
|
||||
let src = cp.source_id.clone();
|
||||
let stroked = if black { outline == Some(true) } else { outline != Some(false) };
|
||||
let mut pr = if stroked { polygon(pts, &fill, SECTION_INK, SECTION_JOINT_MM, hatch) } else { polygon(pts, &fill, "none", 0.0, hatch) };
|
||||
// [33] Linienstil aus einer Schicht-Regel: Fugen der Fläche als eigene Linien mit Strichmuster.
|
||||
let dash = ov.and_then(|o| o.dash.clone()).filter(|_| stroked);
|
||||
if let Some(d) = &dash {
|
||||
let n = cp.pts.len();
|
||||
let skip: Vec<usize> = cp.nse.iter().flatten().map(|x| *x as usize).collect();
|
||||
for i in (0..n).filter(|i| !skip.contains(i)) {
|
||||
let (a, b) = (cp.pts[i], cp.pts[(i + 1) % n]);
|
||||
let mut l = line(v2(a[0], a[1]), v2(b[0], b[1]), "section-joint", SECTION_JOINT_MM, SECTION_INK);
|
||||
if let Primitive::Line { dash: ld, .. } = &mut l {
|
||||
*ld = Some(d.clone());
|
||||
}
|
||||
late_joints.push(l);
|
||||
}
|
||||
}
|
||||
let mut pr = if stroked && dash.is_none() { polygon(pts, &fill, SECTION_INK, SECTION_JOINT_MM, hatch) } else { polygon(pts, &fill, "none", 0.0, hatch) };
|
||||
if let Primitive::Polygon { wall_id, ceiling_id, roof_id, stair_id, extruded_solid_id, no_stroke_edges, greyed, .. } = &mut pr {
|
||||
*wall_id = if cp.kind == Kind::Wall { src.clone() } else { None };
|
||||
*ceiling_id = if cp.kind == Kind::Slab && cp.stair_id.is_none() { src.clone() } else { None };
|
||||
@@ -2689,6 +2750,7 @@ pub fn section_primitives_at(out: &Output, mono: bool, hidden_lines: bool, vis:
|
||||
cut_rings.push(vec![cp.pts.clone()]);
|
||||
prims.push(pr);
|
||||
}
|
||||
prims.append(&mut late_joints);
|
||||
// [140] Schnittkante: Umriss der vereinigten Schnittflächen schwer, Fugen dazwischen bleiben fein.
|
||||
for poly in crate::polygon_bool::union(&cut_rings) {
|
||||
for ring in &poly {
|
||||
@@ -2704,6 +2766,9 @@ pub fn section_primitives_at(out: &Output, mono: bool, hidden_lines: bool, vis:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if !terrain_shown {
|
||||
continue;
|
||||
}
|
||||
for w in pr.pts.windows(2) {
|
||||
acc.add(w[0][0], w[0][1]);
|
||||
acc.add(w[1][0], w[1][1]);
|
||||
@@ -2713,6 +2778,19 @@ pub fn section_primitives_at(out: &Output, mono: bool, hidden_lines: bool, vis:
|
||||
*dash = Some(Some(SECTION_NATURAL_DASH.to_vec()));
|
||||
}
|
||||
}
|
||||
if let Some((a, _)) = tov.filter(|_| !pr.natural) {
|
||||
if let Primitive::Line { color, weight_mm, dash, .. } = &mut l {
|
||||
if let Some(c) = &a.color {
|
||||
*color = Some(c.clone());
|
||||
}
|
||||
if let Some(w) = a.lineweight.filter(|w| w.is_finite() && *w >= 0.0) {
|
||||
*weight_mm = w;
|
||||
}
|
||||
if let Some(d) = &rules.terrain_dash {
|
||||
*dash = Some(d.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
prims.push(l);
|
||||
}
|
||||
}
|
||||
@@ -3126,11 +3204,12 @@ pub fn section_opening_primitives(p: &Project, level: &LevelSpec, vis: &Visibili
|
||||
const CACHE_SLOTS: usize = 6;
|
||||
|
||||
thread_local! {
|
||||
static CACHE: std::cell::RefCell<Vec<(f64, std::rc::Rc<Output>)>> = const { std::cell::RefCell::new(Vec::new()) };
|
||||
static CACHE: std::cell::RefCell<Vec<((f64, u64), std::rc::Rc<Output>)>> = const { std::cell::RefCell::new(Vec::new()) };
|
||||
}
|
||||
|
||||
fn cache_get(key: f64) -> Option<std::rc::Rc<Output>> {
|
||||
if !(key > 0.0) {
|
||||
/// Schlüssel: (Schlüssel des Aufrufers, [33] Kennung der ausgeblendeten Elemente, 0 = keine).
|
||||
fn cache_get(key: (f64, u64)) -> Option<std::rc::Rc<Output>> {
|
||||
if !(key.0 > 0.0) {
|
||||
return None;
|
||||
}
|
||||
CACHE.with(|c| {
|
||||
@@ -3143,8 +3222,8 @@ fn cache_get(key: f64) -> Option<std::rc::Rc<Output>> {
|
||||
})
|
||||
}
|
||||
|
||||
fn cache_put(key: f64, o: std::rc::Rc<Output>) {
|
||||
if !(key > 0.0) {
|
||||
fn cache_put(key: (f64, u64), o: std::rc::Rc<Output>) {
|
||||
if !(key.0 > 0.0) {
|
||||
return;
|
||||
}
|
||||
CACHE.with(|c| {
|
||||
@@ -3169,6 +3248,20 @@ pub fn section_plan_buf(p: &Project, args: &[f64], text: &str) -> Result<Vec<u8>
|
||||
let mono = args.first().is_some_and(|&x| x != 0.0);
|
||||
let openings = args.get(1).is_some_and(|&x| x != 0.0);
|
||||
let key = args.get(2).copied().unwrap_or(0.0);
|
||||
let scale = v.get("scale").and_then(|s| s.as_f64()).filter(|s| *s > 0.0 && s.is_finite()).unwrap_or(100.0);
|
||||
// [33] Eingeschaltete Override-Regeln eines Blatt-Viewports (`rules`: ids; fehlt = Schalter im Projekt).
|
||||
let on: Option<HashSet<String>> = v.get("rules").and_then(|a| a.as_array()).map(|a| a.iter().filter_map(|s| s.as_str().map(String::from)).collect());
|
||||
let rv = RuleView::at(scale, on.as_ref()).view("section");
|
||||
// [33] Regel „Ausblenden“: Schnitt ohne diese Elemente (sie verdecken nichts, Wände samt Öffnungen).
|
||||
let hidden_ids = super::overrides::hidden_elements(p, rv);
|
||||
let filtered = (!hidden_ids.is_empty()).then(|| without_elements(p, &hidden_ids));
|
||||
let p = filtered.as_ref().unwrap_or(p);
|
||||
let hkey = {
|
||||
let mut ids: Vec<&String> = hidden_ids.iter().collect();
|
||||
ids.sort();
|
||||
ids.iter().flat_map(|s| s.bytes().chain([0u8])).fold(if ids.is_empty() { 0 } else { 0xcbf2_9ce4_8422_2325u64 }, |h, b| (h ^ b as u64).wrapping_mul(0x0000_0100_0000_01b3))
|
||||
};
|
||||
let key = (key, hkey);
|
||||
let mut w = crate::plan::buf::Writer::new(true);
|
||||
// Der Schnitt selbst hängt nur am Projektstand, an der Ebene und den Körpern (= ein Aufruf von
|
||||
// `computeSection` in TS, Schlüssel `key`); Schwarz-Weiss, Sichtbarkeit und verdeckte Kanten nur an
|
||||
@@ -3184,11 +3277,7 @@ pub fn section_plan_buf(p: &Project, args: &[f64], text: &str) -> Result<Vec<u8>
|
||||
}
|
||||
};
|
||||
let hidden = v.get("hiddenLines").and_then(|b| b.as_bool()).unwrap_or(false);
|
||||
let scale = v.get("scale").and_then(|s| s.as_f64()).filter(|s| *s > 0.0 && s.is_finite()).unwrap_or(100.0);
|
||||
let detail = Detail::parse(v.get("detail").and_then(|d| d.as_str()).unwrap_or("mittel"));
|
||||
// [33] Eingeschaltete Override-Regeln eines Blatt-Viewports (`rules`: ids; fehlt = Schalter im Projekt).
|
||||
let on: Option<HashSet<String>> = v.get("rules").and_then(|a| a.as_array()).map(|a| a.iter().filter_map(|s| s.as_str().map(String::from)).collect());
|
||||
let rv = RuleView::at(scale, on.as_ref()).view("section");
|
||||
let (mut prims, bounds) = section_primitives_at(&out, mono, hidden, &vis, scale, detail, level.cut_hatch, &CutRules::of(p, &out, rv));
|
||||
w.post = super::extras::sketch_post(Some(level.sketch), scale);
|
||||
// Strichstärken nach Massstab ([32]) wie im Grundriss.
|
||||
@@ -3422,7 +3511,7 @@ mod tests {
|
||||
};
|
||||
let loose: HashSet<String> = ["mager".to_string()].into();
|
||||
let fills = |scale: f64, loose: &HashSet<String>| -> Vec<(String, HatchPattern, String)> {
|
||||
let (prims, _) = section_primitives_at(&out, true, false, &Visibility::default(), scale, Detail::Mittel, false, &CutRules { loose: loose.clone(), ov: Vec::new() });
|
||||
let (prims, _) = section_primitives_at(&out, true, false, &Visibility::default(), scale, Detail::Mittel, false, &CutRules { loose: loose.clone(), ..Default::default() });
|
||||
prims.iter().filter_map(|q| match q { Primitive::Polygon { fill, hatch, stroke, ceiling_id: Some(_), .. } => Some((fill.clone(), hatch.pattern, stroke.clone())), _ => None }).collect()
|
||||
};
|
||||
let f = fills(100.0, &loose);
|
||||
@@ -3894,6 +3983,61 @@ mod tests {
|
||||
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)));
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
/// [33] „Ausblenden“ im Schnitt: Wände samt Öffnungen weg (auch nicht im Schnitt-Cache vom Lauf ohne Regel),
|
||||
/// Decken bleiben; Gelände über Regeln (ausblenden, Linie, Füllung); Linienstil einer Schicht-Regel als
|
||||
/// gestrichelte Fugen.
|
||||
#[test]
|
||||
fn ausblenden_gelaende_und_linienstil_im_schnitt() {
|
||||
let mut p = sample();
|
||||
p.context = Some(vec![ContextObject::TerrainMesh(TerrainMesh {
|
||||
id: "t".into(),
|
||||
name: "Gelände".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],
|
||||
..Default::default()
|
||||
})]);
|
||||
let l = p.drawing_levels.iter().find(|l| l.id == "schnitt-a").unwrap();
|
||||
let text = serde_json::json!({ "level": serde_json::to_value(l).unwrap(), "scale": 50 }).to_string();
|
||||
// Gleicher Schlüssel (7) wie ein vorbereiteter Schnitt: die Regel darf nicht den gemerkten Schnitt treffen.
|
||||
let run = |p: &Project| -> Vec<Vec<Primitive>> {
|
||||
let (prims, groups, _) = crate::plan::buf::decode(§ion_plan_buf(p, &[0.0, 1.0, 7.0, 0.0], &text).unwrap()).unwrap();
|
||||
groups.iter().map(|&(a, b)| prims[a..b].to_vec()).collect()
|
||||
};
|
||||
let walls = |g: &[Vec<Primitive>]| g[0].iter().filter(|q| matches!(q, Primitive::Polygon { wall_id: Some(_), .. })).count();
|
||||
let slabs = |g: &[Vec<Primitive>]| g[0].iter().filter(|q| matches!(q, Primitive::Polygon { ceiling_id: Some(_), .. })).count();
|
||||
let before = run(&p);
|
||||
assert!(walls(&before) > 0 && slabs(&before) > 0);
|
||||
p.override_rules = Some(vec![ov_rule(serde_json::json!([{"type": "element_kind", "operator": "equals", "value": "wall"}, {"type": "view_kind", "operator": "equals", "value": "section"}]), serde_json::json!({"hide": true}))]);
|
||||
let g = run(&p);
|
||||
assert_eq!(walls(&g), 0, "Wände ausgeblendet");
|
||||
assert!(slabs(&g) > 0);
|
||||
assert!(g.get(1).is_none_or(|ops| ops.is_empty()), "Öffnungen der Wände mit");
|
||||
p.override_rules.as_mut().unwrap()[0].enabled = false;
|
||||
assert_eq!(walls(&run(&p)), walls(&before));
|
||||
// Gelände: Linie und Erdreich-Füllung, dann ausblenden.
|
||||
let terrain = |g: &[Vec<Primitive>]| g[0].iter().filter_map(|q| match q { Primitive::Line { cls, color, weight_mm, .. } if cls == "section-terrain" => Some((color.clone(), *weight_mm)), _ => None }).collect::<Vec<_>>();
|
||||
let earth = |g: &[Vec<Primitive>]| g[0].iter().filter_map(|q| match q { Primitive::Polygon { context_object_id: Some(id), fill, .. } if id == "t" => Some(fill.clone()), _ => None }).collect::<Vec<_>>();
|
||||
assert!(!terrain(&before).is_empty() && !earth(&before).is_empty());
|
||||
p.override_rules = Some(vec![ov_rule(serde_json::json!([{"type": "element_kind", "operator": "equals", "value": "terrain"}]), serde_json::json!({"color": "#00aa00", "lineweight": 0.7, "fillColor": "#eeeeee"}))]);
|
||||
let g = run(&p);
|
||||
assert!(terrain(&g).iter().all(|(c, w)| c.as_deref() == Some("#00aa00") && (*w - 0.7).abs() < 1e-9));
|
||||
assert!(earth(&g).iter().all(|f| f == "#eeeeee"));
|
||||
p.override_rules = Some(vec![ov_rule(serde_json::json!([{"type": "element_kind", "operator": "equals", "value": "terrain"}]), serde_json::json!({"hide": true}))]);
|
||||
let g = run(&p);
|
||||
assert!(terrain(&g).is_empty() && earth(&g).is_empty());
|
||||
assert!(g[0].iter().any(|q| matches!(q, Primitive::Line { cls, .. } if cls == "section-ground")), "ohne Gelände die Grundlinie");
|
||||
// Linienstil einer Schicht-Regel (Dämmung): Fugen der Schicht gestrichelt.
|
||||
let dashed = |g: &[Vec<Primitive>]| g[0].iter().filter(|q| matches!(q, Primitive::Line { cls, dash: Some(Some(m)), .. } if cls == "section-joint" && m == &vec![0.35, 0.3])).count();
|
||||
assert_eq!(dashed(&before), 0);
|
||||
p.override_rules = Some(vec![ov_rule(serde_json::json!([{"type": "material_category", "operator": "equals", "value": "insulation"}]), serde_json::json!({"linetypeId": "hatch-dash"}))]);
|
||||
assert!(dashed(&run(&p)) > 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn beschnittene_baender_behalten_ihre_ebene() {
|
||||
// Von der Dominanz beschnittene Wand-/Deckenstücke tragen ihre Kategorie weiter: Ebene aus → weg.
|
||||
|
||||
@@ -32,9 +32,9 @@ pub fn plan_stairs(c: &Ctx, out: &mut Vec<Primitive>, bounds: &mut Bounds) {
|
||||
let p = c.p;
|
||||
let cut_height = p.floor(&c.a.floor).and_then(|f| f.cut_height).unwrap_or(1.0);
|
||||
let range = super::view_range::ViewRange::of(p, &c.a.floor);
|
||||
for s in p.stairs.as_deref().unwrap_or(&[]).iter().filter(|s| s.floor_id == c.a.floor && c.shown(&s.category_code)) {
|
||||
for s in p.stairs.as_deref().unwrap_or(&[]).iter().filter(|s| s.floor_id == c.a.floor && c.vis(&s.category_code, &s.id)) {
|
||||
let greyed = Some(c.greyed(&s.category_code));
|
||||
let ov = c.overrides(&s.category_code, Some(&stair_label(s)));
|
||||
let ov = c.overrides(Some("stair"), &s.category_code, Some(&stair_label(s)));
|
||||
let lw = ov.lineweight.unwrap_or_else(|| c.cat(&s.category_code).map_or(WALL_FALLBACK_MM, |k| k.lw));
|
||||
let stroke = ov.color.as_deref().or(s.color.as_deref()).unwrap_or(POCHE_STROKE).to_string();
|
||||
let (zb, zt) = p.stair_vertical_extent(s);
|
||||
|
||||
@@ -336,8 +336,10 @@ fn wall_poche(c: &Ctx, out: &mut Vec<Primitive>, e: &EffWall, gaps: &[(f64, f64)
|
||||
if (art == 1.0 && skip_joint(li, Some(li + 1))) || (art == 0.0 && skip_joint(li, None)) {
|
||||
continue;
|
||||
}
|
||||
// [33] Linienstil aus einer Schicht-Regel (Fuge: eine der beiden Schichten).
|
||||
let ov_dash = |k: usize| super::overrides::linetype_dash(p, ov_of(k).and_then(|o| o.linetype_id.as_deref()));
|
||||
if art == 0.0 {
|
||||
out.push(mk_line(a, b, "layer-joint-l", layer_mm, None, Some(stroke), greyed, None));
|
||||
out.push(mk_line(a, b, "layer-joint-l", layer_mm, ov_dash(li), Some(stroke), greyed, None));
|
||||
} else if art == 1.0 {
|
||||
let jls = wt.layers.get(li).and_then(|l| l.joint_line_style_id.as_deref()).filter(|s| !s.is_empty()).and_then(|id| p.line_style(id));
|
||||
let mut l = mk_line(
|
||||
@@ -358,6 +360,11 @@ fn wall_poche(c: &Ctx, out: &mut Vec<Primitive>, e: &EffWall, gaps: &[(f64, f64)
|
||||
*motif = s.motif.clone();
|
||||
}
|
||||
}
|
||||
if let (Primitive::Line { dash, zigzag, motif, .. }, Some(d)) = (&mut l, ov_dash(li).or_else(|| ov_dash(li + 1))) {
|
||||
*dash = Some(d);
|
||||
*zigzag = None;
|
||||
*motif = None;
|
||||
}
|
||||
out.push(l);
|
||||
} else {
|
||||
out.push(mk_line(a, b, "wall-outline", outline_mm, None, Some(stroke), greyed, None));
|
||||
@@ -791,9 +798,9 @@ pub fn plan_walls(c: &Ctx, reference_lines: bool, out: &mut Vec<Primitive>, boun
|
||||
let walls: Vec<EffWall> = p
|
||||
.walls
|
||||
.iter()
|
||||
.filter(|w| w.floor_id == c.a.floor && c.shown(&w.category_code))
|
||||
.filter(|w| w.floor_id == c.a.floor && c.vis(&w.category_code, &w.id))
|
||||
.map(|w| {
|
||||
let ov = c.overrides(&w.category_code, type_names.get(w.wall_type_id.as_str()).copied());
|
||||
let ov = c.overrides(Some("wall"), &w.category_code, type_names.get(w.wall_type_id.as_str()).copied());
|
||||
EffWall { w, color: ov.color.or_else(|| w.color.clone()), stroke_weight: ov.lineweight.or(w.stroke_weight) }
|
||||
})
|
||||
.collect();
|
||||
@@ -918,11 +925,11 @@ pub fn plan_walls(c: &Ctx, reference_lines: bool, out: &mut Vec<Primitive>, boun
|
||||
}
|
||||
for (o, oz) in &all_openings {
|
||||
let (o, oz) = (o.as_ref(), *oz);
|
||||
if !c.shown(&o.category_code) || oz == Zone::Hidden {
|
||||
if !c.vis(&o.category_code, &o.id) || oz == Zone::Hidden {
|
||||
continue;
|
||||
}
|
||||
let sym_start = out.len();
|
||||
let ov = c.overrides(&o.category_code, Some(&opening_label(o)));
|
||||
let ov = c.overrides(Some("opening"), &o.category_code, Some(&opening_label(o)));
|
||||
let olw = ov.lineweight.unwrap_or_else(|| c.cat(&o.category_code).map_or(LAYER_LINE_MM, |k| k.lw));
|
||||
let color = ov.color.as_deref().or(o.color.as_deref());
|
||||
let detail = match o.detail_level {
|
||||
@@ -958,7 +965,7 @@ pub(super) fn cut_columns<'a>(c: &Ctx<'a>, range: &super::view_range::ViewRange)
|
||||
.as_deref()
|
||||
.unwrap_or(&[])
|
||||
.iter()
|
||||
.filter(|k| k.floor_id == c.a.floor && c.shown(&k.category_code))
|
||||
.filter(|k| k.floor_id == c.a.floor && c.vis(&k.category_code, &k.id))
|
||||
.filter(|k| {
|
||||
let (zb, zt) = p.column_vertical_extent(k);
|
||||
range.classify(zb, zt) == super::view_range::Zone::Cut
|
||||
|
||||
+4
-1
@@ -1238,7 +1238,10 @@ export const de = {
|
||||
"resources.overrides.val.element_kind.stair": "Treppe",
|
||||
"resources.overrides.val.element_kind.column": "Stütze",
|
||||
"resources.overrides.val.element_kind.opening": "Fenster / Tür",
|
||||
"resources.overrides.action.hide": "Ausblenden (Ansicht)",
|
||||
"resources.overrides.val.element_kind.room": "Raum",
|
||||
"resources.overrides.val.element_kind.shadow": "Schatten",
|
||||
"resources.overrides.val.element_kind.terrain": "Gelände",
|
||||
"resources.overrides.action.hide": "Ausblenden",
|
||||
"resources.overrides.value.material": "Name, Kennung oder std-c-…",
|
||||
"resources.overrides.and": "und",
|
||||
"resources.overrides.andCondition": "und",
|
||||
|
||||
+4
-1
@@ -1232,7 +1232,10 @@ export const en: Record<TranslationKey, string> = {
|
||||
"resources.overrides.val.element_kind.stair": "Stair",
|
||||
"resources.overrides.val.element_kind.column": "Column",
|
||||
"resources.overrides.val.element_kind.opening": "Window / door",
|
||||
"resources.overrides.action.hide": "Hide (elevation)",
|
||||
"resources.overrides.val.element_kind.room": "Room",
|
||||
"resources.overrides.val.element_kind.shadow": "Shadow",
|
||||
"resources.overrides.val.element_kind.terrain": "Terrain",
|
||||
"resources.overrides.action.hide": "Hide",
|
||||
"resources.overrides.value.material": "Name, id or std-c-…",
|
||||
"resources.overrides.and": "and",
|
||||
"resources.overrides.andCondition": "and",
|
||||
|
||||
@@ -2191,8 +2191,8 @@ export type OverrideActions = {
|
||||
*/
|
||||
outline?: boolean;
|
||||
/**
|
||||
* [33] Bauteil ausblenden (wirkt in der Ansicht: Flächen, Kanten, Ansichtsschraffur und — bei Wänden —
|
||||
* deren Öffnungen entfallen und verdecken nichts).
|
||||
* [33] Bauteil ausblenden (Grundriss, Deckenspiegel, Schnitt, Ansicht: Element samt Linien, Schraffur und
|
||||
* Beschriftung entfällt und verdeckt nichts; eine Wand nimmt ihre Öffnungen mit; Bemassung bleibt).
|
||||
*/
|
||||
hide?: boolean;
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ const OVERRIDE_TYPE_OPTIONS: { value: OverrideConditionType; labelKey: string }[
|
||||
|
||||
/** [33] Feste Werte je Kriterium (Auswahl statt Freitext); Beschriftung `resources.overrides.val.<typ>.<wert>`. */
|
||||
const ENUM_VALUES: Partial<Record<OverrideConditionType, readonly string[]>> = {
|
||||
element_kind: ["wall", "slab", "ground_slab", "roof", "stair", "column", "opening"],
|
||||
element_kind: ["wall", "slab", "ground_slab", "roof", "stair", "column", "opening", "room", "shadow", "terrain"],
|
||||
layer_function: ["structure", "insulation", "screed", "finish", "plaster", "substructure", "membrane", "cladding", "air"],
|
||||
layer_position: ["above", "structure", "below"],
|
||||
view_kind: ["plan", "section", "elevation"],
|
||||
|
||||
Reference in new issue
Block a user