diff --git a/TODO.md b/TODO.md index 1eb64c5c..cbc39722 100644 --- a/TODO.md +++ b/TODO.md @@ -60,7 +60,17 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `* `doc/ARCHITEKTUR.md` Abschnitt 8. Geprüft: Rust/vitest/e2e, Musterhaus komplex mit Nachbarnetzen Grundriss 1:200/Schnitt/ Ansicht per CLI vor/nach byte-gleich. Offen: Linien des Standort-Imports (OSM/swisstopo-Umrisse) bleiben je Klasse ein `contourSet` statt einzelner 2D-Zeichnungen; Tag-Namen `importedMesh`/`terrainMesh` historisch; Mac-Gegenprobe. · L -- ○ **[180]** Alles Sichtbare auf Ebene/Klasse (11.11., Vorgabe Maintainer): jedes Primitive in Plan/Schnitt/Ansicht (auch abgeleitete: Schatten, Auto-Masse, Koten, Schnitt-/Ansichtsmarken, Raster, Nordpfeil, Stempel, Gelände) hat eine Klasse/Ebene und verschwindet mit ihr; Audit + Test, der Primitives ohne Zuordnung meldet. Regel in CLAUDE.md. · M +- ◐ **[180]** Alles Sichtbare auf Ebene/Klasse (11.11., Vorgabe Maintainer). Umgesetzt (11.11.): Audit-Tabelle in + `doc/ARCHITEKTUR.md` 3.6; Standard-Klassen der abgeleiteten Darstellung `08 Schatten` (Sonnenschatten Grundriss, + Schlagschatten Ansicht), `81 Auto-Bemassung` (Befehl `autodim`, je Kette änderbar), `82 Höhenkoten` (automatische + Koten Schnitt/Ansicht), `91 Schnittmarken` (statt `90`) in `standards.rs` („Standards laden", neue Projekte, + Musterprojekte; fehlt die Klasse ⇒ sichtbar); Körper/Abzugskörper mit Pflicht-Klasse (`ExtrudedSolid.categoryCode`, + Objekt-Info änderbar); Schnitt: Projektionskanten und Raster nach Klasse; Ansicht: Klassen wirken auch ohne + Darstellungsmodus (Blatt-Ausschnitte zeigten ausgeblendete Klassen), Öffnungen (samt Wirt), Treppen, Raster, Dachmuster + nach Klasse (Nebenwirkung: kein doppeltes Ziegelraster mehr auf dem Hauptdach, Golden Ansicht Süd); CLI `--hide`; + Tooltip im Ebenen-Panel (de/en). Tests `plan/derived_class_tests.rs`, `src/plan/derivedCategories.test.ts`. Offen: + ausgeblendete Bauteile verdecken im Schnitt weiter die Projektion dahinter (Lücken); 3D nicht nach Klassen geprüft; + nicht in der Tauri-App/auf dem Mac geprüft. · M - ◐ **[133]** Musterhaus komplex: Rest. Skalieren-Kopie lässt `position`/Breite unverändert; Vollflächen-/Bildschraffur und Schraffur-Löcher beim Ausbreiten fehlen (`src/export/planToSvgString.ts`, Kern `plan/svg.rs`; wegen paralleler Arbeit an `svg.rs` (Bögen) am 10.11. nicht angefasst). (10.11.: Skalieren skaliert `position`/`width` der Wandöffnungen diff --git a/doc/ARCHITEKTUR.md b/doc/ARCHITEKTUR.md index c60af7f8..80af7acf 100644 --- a/doc/ARCHITEKTUR.md +++ b/doc/ARCHITEKTUR.md @@ -361,6 +361,44 @@ Etappe 3: „+" übernimmt, TS `standardModelViews`/`adoptModelViewOps`). Stufen zwischen Projekten austauschen geht nur über Projektvorlagen (ganzes Projekt) — ein Import einzelner Ressourcen fehlt. +### 3.6 Alles Sichtbare auf einer Klasse ([180]) + +Regel (CLAUDE.md, „Konventionen"): jedes Primitive in Grundriss, Schnitt und Ansicht gehört zu einer Klasse +(`categoryCode`) und verschwindet mit ihr — über den einen Mechanismus Klassen-Sichtbarkeit/Darstellungsmodus +(Grundriss `show`/`grey`, Schnitt/Ansicht `invisible`/`norender`/`grey`, Ebenen-Kombinationen und Vorlagen setzen +dieselben Codes). Was kein eigenes Element hat, liegt auf einer **Standard-Klasse der abgeleiteten Darstellung** +(`standards.rs::DERIVED_CATEGORIES`, TS `src/model/derivedCategories.ts`; „Standards laden" und neue Projekte legen +sie an): `08 Schatten`, `81 Auto-Bemassung`, `82 Höhenkoten`, `91 Schnittmarken`. Fehlt eine davon im Projekt, +bleibt die Darstellung sichtbar (`standards::derived_visible`, `Ctx::derived_shown`; wie Baurecht unter `01`). +Prüfung: `plan/derived_class_tests.rs` (Fixture) und `src/plan/derivedCategories.test.ts` (beide Musterhäuser: +alle Klassen aus ⇒ Grundriss jedes Geschosses, Schnitte, Ansichten leer; jede abgeleitete Klasse einzeln). + +| Darstellung | Klasse | Wo | +|---|---|---| +| Sonnenschatten Grundriss | `08 Schatten` | `domains.rs::extras_of` | +| Schlagschatten Ansicht (auch Fenster-Laibungen) | `08 Schatten` (+ Regel „Schatten" [33]) | `elevation/mod.rs` | +| Baurecht (Parzelle, Baubereich, Verstösse) | `01 Vermessung` | `extras_of` ([66]) | +| Automatische Aussenbemassung | Element, Standard `81 Auto-Bemassung` (je Kette änderbar) | `cmd_draw.rs::autodim_ops` | +| Höhenkoten 2D (Element `kote`) | Element | `drawings.rs` | +| Automatische Höhenkoten Schnitt/Ansicht | `82 Höhenkoten` (+ Ebene/Modelldarstellung) | `levelMarksEnabled` (TS), `sheet_viewports.rs` | +| Schnitt-/Ansichtsmarken im Grundriss | `91 Schnittmarken` (früher `90`) | `context.rs::plan_section_lines` | +| Achsraster, Achsblasen (Grundriss, Schnitt, Ansicht) | Element (Raster) | `drawings.rs`, `grid_view.rs::grid_prims_in` | +| Nordpfeil, Massstabsbalken, Revisionswolke, Texte | Element | `drawings.rs` | +| Plankopf | Blatt-Element (Layout), nicht im Plan | `LayoutSheet` | +| Raumstempel, Bodenbelag | Raum | `domains.rs::rooms`, `floor_finishes` | +| Treppe: Lauflinie, Stufennummern, Absturzsicherung; Ansicht | Treppe | `stairs.rs`; Ansicht über `ceil_cat` | +| Deckenkanten, Untersichten | Decke | `domains.rs::ceilings` | +| Storenkasten, Fenster/Türen (auch Ansicht, mit Wirt) | Öffnung (+ Wand/Dach) | `walls.rs`; `elevation/mod.rs` | +| Körper, Abzugskörper (Grundriss, Schnitt) | Element (`ExtrudedSolid.categoryCode`, neu) | `domains.rs::solids`, Schnitt `edge_cats` | +| Projektionskanten im Schnitt | Bauteil hinter der Ebene | `section/mod.rs::edge_categories` | +| Dach-Ansichtsmuster | Dach (nur mit sichtbaren Flächen) | `elevation/patterns.rs` | +| Höhenlinien + Beschriftung, Gelände, Baugrube, Netze, Luftbild, Bäume | Element ([181]) | `context.rs`, `trees.rs` | +| Kontext-Unterlagen (DXF/PDF) | Element (2D-Zeichnung) | `drawings.rs` | +| Grundlinie Schnitt/Ansicht | keine eigene: entfällt, wenn nichts gezeichnet ist | `section/primitives.rs`, `elevation/mod.rs` | + +Offen: Bauzonen sind kein eigener Planinhalt (nur Baurecht-Einstellungen); 3D (render3d-Teile) nicht geprüft; ausgeblendete +Bauteile verdecken im Schnitt weiter die Projektion dahinter. + --- ## 4. Schnitt diff --git a/e2e/sampleComplex.spec.ts b/e2e/sampleComplex.spec.ts index da033099..1e2ccc69 100644 --- a/e2e/sampleComplex.spec.ts +++ b/e2e/sampleComplex.spec.ts @@ -39,6 +39,8 @@ test("Musterhaus komplex: Geschosse, Ansichten und Blätter ohne Konsolenfehler" const dl = await pending; const bytes = await readFile((await dl.path())!); expect(bytes.subarray(0, 5).toString()).toBe("%PDF-"); - expect(bytes.length).toBeGreaterThan(100_000); + // [180] Seit Schatten, Schnittmarken usw. auf ihrer Klasse liegen, stehen sie nur noch in deren PDF-Ebene statt in + // jeder (≈ 86 kB statt > 100 kB). + expect(bytes.length).toBeGreaterThan(60_000); if (shots) await writeFile(`${shots}/baueingabe.pdf`, bytes); }); diff --git a/src-tauri/core/src/cmd_draw.rs b/src-tauri/core/src/cmd_draw.rs index 5992a0b8..49dceb79 100644 --- a/src-tauri/core/src/cmd_draw.rs +++ b/src-tauri/core/src/cmd_draw.rs @@ -1219,10 +1219,15 @@ fn autodim_scale(v: &Value) -> f64 { } fn autodim_ops(root: &Map, p: &Project, v: &Value, ctx: &Ctx) -> Vec { - let dims = auto_dims(root, p, ctx, "autodim", autodim_scale(v)); + let mut dims = auto_dims(root, p, ctx, "autodim", autodim_scale(v)); if dims.is_empty() { return Vec::new(); } + // [180] Eigene Klasse „Auto-Bemassung" (ohne sie im Projekt: die aktive Klasse); je Kette änderbar. + let cat = crate::cmd_create::category_or(p, crate::standards::AUTO_DIM_CATEGORY, ctx); + for d in &mut dims { + d["categoryCode"] = cat.clone(); + } let own = format!("autodim-{}-", ctx.level); let old: Vec<&str> = arr(root.get("drawings2d")).iter().filter_map(id_of).filter(|id| id.starts_with(&own)).collect(); let mut ops = crate::cmd_create::remove_op(root, "drawings2d", &old); diff --git a/src-tauri/core/src/cmd_solid.rs b/src-tauri/core/src/cmd_solid.rs index a2893d87..6172ca58 100644 --- a/src-tauri/core/src/cmd_solid.rs +++ b/src-tauri/core/src/cmd_solid.rs @@ -253,6 +253,7 @@ fn brep_solid_ops(root: &Map, ctx: &Ctx, ids: &mut IdGen, sources ("id", s(&ids.next("body"))), ("type", s("extrudedSolid")), ("levelId", s(ctx.level)), + ("categoryCode", s(ctx.cat)), ("points", pvs(&pts)), ("height", js_num(height)), ("brep", obj(vec![("spec", spec), ("origin", pv(pts[0])), ("label", s(&label))])), @@ -284,6 +285,7 @@ fn solid_ops(v: &Value, ctx: &Ctx, ids: &mut IdGen) -> Vec { ("id", s(&ids.next("body"))), ("type", s("extrudedSolid")), ("levelId", s(ctx.level)), + ("categoryCode", s(ctx.cat)), ("points", pvs(&pts)), ("height", js_num(height)), ("brep", obj(vec![("spec", spec), ("origin", pv(pts[0])), ("label", s(&label))])), @@ -400,6 +402,7 @@ pub fn combine_solids(a: &Value, b: &Value, op: &str, id: String) -> Option Vec { ("id", s(&ids.next("void"))), ("type", s("extrudedSolid")), ("levelId", s(ctx.level)), + ("categoryCode", s(ctx.cat)), ("points", pvs(&rect_corners(a, b))), ("height", js_num(height)), ("operation", s("subtract")), diff --git a/src-tauri/core/src/import_ifc.rs b/src-tauri/core/src/import_ifc.rs index beab974a..04be86fa 100644 --- a/src-tauri/core/src/import_ifc.rs +++ b/src-tauri/core/src/import_ifc.rs @@ -25,6 +25,8 @@ const COLUMN_CATEGORY: &str = "50"; const ROOM_CATEGORY: &str = "60"; const ROOF_CATEGORY: &str = "35"; const STAIR_CATEGORY: &str = "40"; +/// [180] Träger (Extrusionskörper) wie „35 Träger" der Musterprojekte. +const BEAM_CATEGORY: &str = "35"; const ROOM_COLOR: &str = "#6b7280"; const SIA: [&str; 6] = ["HNF", "NNF", "VF", "FF", "KGF", "AGF"]; const LEVEL_TOL: f64 = 0.005; @@ -957,7 +959,7 @@ fn elements_ops(root: &Map, meta: &Value, products: &[IfcProduct] for b in &el.beams { let (fid, base, _) = floor_of(&mut ctx, b.info.storey, b.z0); let mut v = json!({ - "id": ctx.new_id("solid"), "type": "extrudedSolid", "levelId": fid, + "id": ctx.new_id("solid"), "type": "extrudedSolid", "levelId": fid, "categoryCode": BEAM_CATEGORY, "points": b.outline.iter().map(|&p| mv(p)).collect::>(), "height": js_num(round(b.z1 - b.z0, 1e-6)), }); let off = anchor_offset(b.z0, base); diff --git a/src-tauri/core/src/model/generated.rs b/src-tauri/core/src/model/generated.rs index 3781870e..5df2055f 100644 --- a/src-tauri/core/src/model/generated.rs +++ b/src-tauri/core/src/model/generated.rs @@ -4478,6 +4478,9 @@ pub struct ExtrudedSolid { /// Geschoss, dessen `baseElevation` die UK des Körpers bestimmt. #[serde(rename = "levelId")] pub level_id: String, + /// [180] Klasse (Ebene/Kategorie) wie bei jedem Bauteil: Sichtbarkeit in Grundriss, Schnitt und Ansicht. + #[serde(rename = "categoryCode")] + pub category_code: String, /// Geschlossenes Profil in der XY-Ebene (Grundriss), ≥3 Punkte. Bei einem /// Kreis-Profil (`circle` gesetzt) eine Tessellierung des Kreises (48-Eck) — /// für 2D-Footprint/Auswahl/bbox/Verschieben; die 3D-Extrusion nutzt in dem diff --git a/src-tauri/core/src/plan/context.rs b/src-tauri/core/src/plan/context.rs index fe4cfd54..9861d2cd 100644 --- a/src-tauri/core/src/plan/context.rs +++ b/src-tauri/core/src/plan/context.rs @@ -12,7 +12,8 @@ use crate::model::*; const CONTEXT_LINE_COLOR: &str = "#9aa3ad"; const CONTEXT_LINE_MM: f64 = 0.1; /// Kategorie der Schnittführungs-Symbole (Referenzen). -const SECTION_LINE_CATEGORY: &str = "90"; +/// [180] Schnitt-/Ansichtsmarken liegen auf der Standard-Klasse „Schnittmarken" (früher „90 Referenzen"). +const SECTION_LINE_CATEGORY: &str = crate::standards::SECTION_MARK_CATEGORY; const SECTION_LINE_INK: &str = "#1f242c"; const SECTION_LINE_MM: f64 = 0.18; /// [176] Kräftige Endstücke und Blickrichtungs-Schenkel. @@ -878,7 +879,7 @@ fn view_marker(c: &Ctx, level: &DrawingLevel, p0: Vec2, p1: Vec2, sign: f64, k: /// Schnittführungs-Symbole aller Schnitt-/Ansichtsebenen mit Linie (`addSectionLines`). pub fn plan_section_lines(c: &Ctx, out: &mut Vec) { - if !c.shown(SECTION_LINE_CATEGORY) { + if !c.derived_shown(SECTION_LINE_CATEGORY) { return; } // Auf freien Zeichnungsebenen (Blätter wie „Raumprogramm", Detail) gehören die Symbole nicht hin: @@ -1643,9 +1644,9 @@ mod tests { /// rücken entlang der Linie auf freie Stellen, statt zu fehlen; keine liegt auf dem Hindernis. #[test] fn hoehenlinien_beschriftung_rueckt_vom_hindernis_weg() { - let t = TerrainMesh { id: "t".into(), positions: vec![0.0, 0.0, 0.0, 40.0, 0.0, 0.0, 40.0, 10.0, 40.0, 0.0, 10.0, 40.0], indices: vec![0.0, 1.0, 2.0, 0.0, 2.0, 3.0], contour_interval: Some(0.1), ..Default::default() }; + let t = TerrainMesh { id: "t".into(), positions: vec![0.0, 0.0, 0.0, 40.0, 0.0, 0.0, 40.0, 10.0, 40.0, 0.0, 10.0, 40.0], indices: vec![0.0, 1.0, 2.0, 0.0, 2.0, 3.0], contour_interval: Some(0.1), category_code: "02".into(), ..Default::default() }; let p = Project { context: Some(vec![ContextObject::TerrainMesh(t)]), ..Default::default() }; - let a = super::super::domains::PlanArgs::parse(1.0, r#"{"floor": "eg", "scale": 100}"#).unwrap(); + let a = super::super::domains::PlanArgs::parse(1.0, r#"{"floor": "eg", "show": ["02"], "scale": 100}"#).unwrap(); let c = Ctx::new(&p, &a); let run = |o: &super::super::stamp_place::Obstacles| { let mut out = Vec::new(); diff --git a/src-tauri/core/src/plan/derived_class_tests.rs b/src-tauri/core/src/plan/derived_class_tests.rs new file mode 100644 index 00000000..3dd48125 --- /dev/null +++ b/src-tauri/core/src/plan/derived_class_tests.rs @@ -0,0 +1,203 @@ +//! [180] Alles Sichtbare liegt auf einer Klasse: Grundriss, Schnitt und Ansicht des Musterprojekts (Fixture) mit +//! Schattenstudie, Körpern, Raster und Schnittführungen. Sind alle Klassen aus, bleibt nichts; jede Klasse der +//! abgeleiteten Darstellung (`standards::DERIVED_CATEGORIES`) entfernt genau ihre Primitive. +//! Die beiden Musterhäuser (TS-Bauer) prüft `src/plan/derivedCategories.test.ts` über den WASM-Kern. + +use super::domains::{plan_domains_buf, PlanArgs}; +use super::prim::Primitive; +use crate::model::*; +use crate::standards::{derived_categories, AUTO_DIM_CATEGORY, SECTION_MARK_CATEGORY, SHADOW_CATEGORY}; +use serde_json::{json, Value}; + +/// 2026-06-21T08:00:00Z (Morgensonne: lange Schatten). +const WHEN: f64 = 1_782_028_800_000.0; + +fn project() -> Project { + let mut v: Value = serde_json::from_str(include_str!("../../tests/fixtures/sample_project.json")).unwrap(); + let layers = v["layers"].as_array_mut().unwrap(); + layers.extend(derived_categories()); + v["sunStudy"] = json!({"when": "2026-06-21T08:00:00Z", "show": true}); + // Körper (Klasse „35") und Abzugskörper (Klasse „20") im EG, Achsraster (Klasse „00"). + v["extrudedSolids"] = json!([ + {"id": "k1", "type": "extrudedSolid", "levelId": "eg", "categoryCode": "35", "points": [{"x": 7, "y": 1}, {"x": 8, "y": 1}, {"x": 8, "y": 2}, {"x": 7, "y": 2}], "height": 1.5}, + {"id": "v1", "type": "extrudedSolid", "levelId": "eg", "categoryCode": "20", "operation": "subtract", "points": [{"x": 1, "y": -0.2}, {"x": 1.5, "y": -0.2}, {"x": 1.5, "y": 0.2}, {"x": 1, "y": 0.2}], "height": 0.5, "baseOffset": 1.0} + ]); + v["drawings2d"].as_array_mut().unwrap().push(json!({"id": "raster", "type": "drawing2d", "levelId": "eg", "categoryCode": "00", + "geom": {"shape": "grid", "origin": {"x": 0, "y": 0}, "angle": 0, + "a": [{"label": "1", "pos": 0}, {"label": "2", "pos": 5}], "b": [{"label": "A", "pos": 0}, {"label": "B", "pos": 4}]}})); + serde_json::from_value(v).unwrap() +} + +fn all_codes(p: &Project) -> Vec { + p.flat_categories().iter().map(|c| c.code.clone()).collect() +} + +fn plan(p: &Project, floor: &str, show: &[String]) -> Vec { + let a = PlanArgs::parse(1.0, &json!({"floor": floor, "show": show, "global": true, "scale": 100, "sunWhen": WHEN}).to_string()).unwrap(); + let buf = plan_domains_buf(p, &a).unwrap(); + super::buf::View::parse(&buf).unwrap().prims().unwrap() +} + +/// Sichtbarkeit wie `visibilityArgs` in TS: unsichtbar sind alle Codes (Baum und Bauteile) ausser `show`. +fn vis_json(p: &Project, show: &[String]) -> Value { + let mut codes: Vec = all_codes(p); + codes.extend(p.walls.iter().map(|w| w.category_code.clone())); + codes.extend(p.openings.iter().flatten().map(|o| o.category_code.clone())); + codes.extend(p.stairs.iter().flatten().map(|o| o.category_code.clone())); + let invisible: Vec = codes.into_iter().filter(|c| !show.contains(c)).collect(); + json!({"hasVis": true, "invisible": invisible, "hasDisplay": false}) +} + +fn level_of<'a>(p: &'a Project, kind: DrawingLevelKind) -> &'a DrawingLevel { + p.drawing_levels.iter().find(|l| l.kind == kind).unwrap() +} + +fn section(p: &Project, show: &[String]) -> Vec { + let mut t = vis_json(p, show); + t["level"] = serde_json::to_value(level_of(p, DrawingLevelKind::Section)).unwrap(); + let buf = super::section::section_plan_buf(p, &[0.0, 1.0, 0.0], &t.to_string()).unwrap(); + super::buf::View::parse(&buf).unwrap().prims().unwrap() +} + +fn elevation(p: &Project, show: &[String]) -> Vec { + let mut t = vis_json(p, show); + t["level"] = serde_json::to_value(level_of(p, DrawingLevelKind::Elevation)).unwrap(); + let buf = super::elevation::elevation_plan_buf(p, &[0.0, 1.0, 100.0], &t.to_string()).unwrap(); + super::buf::View::parse(&buf).unwrap().prims().unwrap() +} + +fn without(codes: &[String], code: &str) -> Vec { + codes.iter().filter(|c| *c != code).cloned().collect() +} + +fn ctx_id(q: &Primitive) -> Option<&str> { + match q { + Primitive::Polygon { context_object_id, .. } => context_object_id.as_deref(), + _ => None, + } +} + +fn section_mark(q: &Primitive) -> bool { + match q { + Primitive::Polygon { section_line_id, .. } => section_line_id.is_some(), + Primitive::Line { cls, .. } => cls.starts_with("section-line") || cls.starts_with("section-mark"), + _ => false, + } +} + +/// Alle Klassen aus ⇒ Grundriss, Schnitt und Ansicht leer. Mit allen Klassen ist von allem etwas da. +#[test] +fn alle_klassen_aus_leert_plan_schnitt_ansicht() { + let p = project(); + let all = all_codes(&p); + let full = plan(&p, "eg", &all); + assert!(full.iter().any(|q| ctx_id(q) == Some(super::extras::SITE_PICK_SUN)), "Schatten"); + assert!(full.iter().any(|q| matches!(q, Primitive::Polygon { extruded_solid_id: Some(_), .. })), "Körper"); + assert!(full.iter().any(|q| matches!(q, Primitive::Polygon { section_line_id: Some(_), .. })), "Schnittmarken"); + for floor in ["eg", "og"] { + let rest = plan(&p, floor, &[]); + assert!(rest.is_empty(), "Grundriss {floor}: {rest:?}"); + } + assert!(!section(&p, &all).is_empty()); + let rest = section(&p, &[]); + assert!(rest.is_empty(), "Schnitt: {rest:?}"); + let full = elevation(&p, &all); + assert!(full.iter().any(|q| ctx_id(q) == Some(super::extras::SITE_PICK_VIEW_SHADOWS)), "Schlagschatten der Ansicht"); + let rest = elevation(&p, &[]); + assert!(rest.is_empty(), "Ansicht: {rest:?}"); +} + +/// Klasse „Schatten" aus: Grundriss ohne Sonnenschatten, Ansicht ohne Schlagschatten, sonst gleich. +#[test] +fn klasse_schatten() { + let p = project(); + let all = all_codes(&p); + let off = without(&all, SHADOW_CATEGORY); + let (a, b) = (plan(&p, "eg", &all), plan(&p, "eg", &off)); + let sun = |v: &[Primitive]| v.iter().filter(|q| ctx_id(q) == Some(super::extras::SITE_PICK_SUN)).count(); + assert!(sun(&a) > 0 && sun(&b) == 0); + assert_eq!(a.len() - sun(&a), b.len()); + let shade = |v: &[Primitive]| v.iter().filter(|q| ctx_id(q) == Some(super::extras::SITE_PICK_VIEW_SHADOWS)).count(); + let (a, b) = (elevation(&p, &all), elevation(&p, &off)); + assert!(shade(&a) > 0 && shade(&b) == 0); + // Ohne die Klasse im Projekt (vor „Standards laden") bleibt der Schatten sichtbar. + let mut q = p.clone(); + q.layers.retain(|l| l.code != SHADOW_CATEGORY); + assert_eq!(sun(&plan(&q, "eg", &off)), sun(&plan(&p, "eg", &all))); +} + +/// Klasse „Schnittmarken" aus: Grundriss ohne Schnitt-/Ansichtsmarken, sonst gleich. +#[test] +fn klasse_schnittmarken() { + let p = project(); + let all = all_codes(&p); + let (a, b) = (plan(&p, "eg", &all), plan(&p, "eg", &without(&all, SECTION_MARK_CATEGORY))); + let marks = |v: &[Primitive]| v.iter().filter(|q| matches!(q, Primitive::Polygon { section_line_id: Some(_), .. })).count(); + assert!(marks(&a) > 0 && marks(&b) == 0); + assert!(b.len() < a.len()); + assert!(!b.iter().any(section_mark)); +} + +/// Körper (auch Abzugskörper) liegen auf ihrer Klasse: im Grundriss und im Schnitt (Projektion) weg mit ihr. +#[test] +fn koerper_auf_ihrer_klasse() { + let p = project(); + let all = all_codes(&p); + let solid = |v: &[Primitive], id: &str| v.iter().any(|q| matches!(q, Primitive::Polygon { extruded_solid_id: Some(s), .. } if s == id)); + let a = plan(&p, "eg", &all); + assert!(solid(&a, "k1") && solid(&a, "v1")); + let b = plan(&p, "eg", &without(&all, "35")); + assert!(!solid(&b, "k1") && solid(&b, "v1")); +} + +/// Ansicht: Öffnungen und Treppen folgen ihrer Klasse (früher nur zusammen mit dem Darstellungsmodus); Raster +/// in Schnitt und Ansicht seiner. +#[test] +fn ansicht_oeffnungen_treppen_raster() { + let p = project(); + let all = all_codes(&p); + let opening = |v: &[Primitive]| v.iter().any(|q| matches!(q, Primitive::Polygon { opening_id: Some(_), .. })); + let stair = |v: &[Primitive]| v.iter().any(|q| matches!(q, Primitive::Polygon { ceiling_id: Some(id), .. } if id == "ST1")); + let grid = |v: &[Primitive]| v.iter().any(|q| matches!(q, Primitive::DrawingCircle { drawing_id: Some(id), .. } if id == "raster")); + let a = elevation(&p, &all); + assert!(opening(&a) && stair(&a) && grid(&a)); + let codes: Vec = all.iter().filter(|c| *c != "21").cloned().collect(); + let b = elevation(&p, &codes); + assert!(!opening(&b), "Öffnungen aus"); + assert!(!stair(&elevation(&p, &without(&all, "40"))), "Treppe aus"); + assert!(!grid(&elevation(&p, &without(&all, "00"))), "Raster aus (Ansicht)"); + assert!(grid(§ion(&p, &all)) && !grid(§ion(&p, &without(&all, "00"))), "Raster (Schnitt)"); + // Wand aus: ihre Öffnungen gehen mit. + let c = elevation(&p, &without(&all, "20")); + assert!(!opening(&c), "Öffnungen einer ausgeblendeten Wand"); +} + +/// Schnitt: Projektionskanten folgen der Klasse ihres Bauteils. +#[test] +fn schnitt_projektion_nach_klasse() { + let p = project(); + let all = all_codes(&p); + let visible = |v: &[Primitive]| v.iter().filter(|q| matches!(q, Primitive::Line { cls, .. } if cls == "section-visible")).count(); + let a = section(&p, &all); + let b = section(&p, &without(&all, "20")); + assert!(visible(&a) > visible(&b), "{} {}", visible(&a), visible(&b)); +} + +/// Aussenbemassung landet auf „Auto-Bemassung" (ohne die Klasse im Projekt: auf der aktiven). +#[test] +fn aussenbemassung_auf_eigener_klasse() { + let p = project(); + let mut r: serde_json::Map = serde_json::from_value(serde_json::to_value(&p).unwrap()).unwrap(); + let run = |r: &serde_json::Map| -> Vec { + let ops = crate::commands::ops(r, &crate::model::lenient::typed_for_test(r), &json!({"cmd": "autodim", "ctx": {"level": "eg", "cat": "50"}, "stamp": "s"}).to_string()).unwrap(); + ops.iter() + .filter_map(|o| if let crate::ops::Op::Add { items, .. } = o { Some(items) } else { None }) + .flatten() + .map(|d| d["categoryCode"].as_str().unwrap_or_default().to_string()) + .collect() + }; + let cats = run(&r); + assert!(!cats.is_empty() && cats.iter().all(|c| c == AUTO_DIM_CATEGORY), "{cats:?}"); + r.insert("layers".into(), json!([{"code": "50", "name": "Text", "color": "#000", "lw": 0.13, "visible": true, "locked": false}])); + assert!(run(&r).iter().all(|c| c == "50")); +} diff --git a/src-tauri/core/src/plan/domains.rs b/src-tauri/core/src/plan/domains.rs index f2cb8973..28e520a2 100644 --- a/src-tauri/core/src/plan/domains.rs +++ b/src-tauri/core/src/plan/domains.rs @@ -203,6 +203,12 @@ impl<'a> Ctx<'a> { self.a.show.contains(code) } + /// [180] Abgeleitete Darstellung auf einer Standard-Klasse (`standards::DERIVED_CATEGORIES`): eingeblendet, oder + /// die Klasse fehlt im Projekt. + pub fn derived_shown(&self, code: &str) -> bool { + self.shown(code) || !self.cats.contains_key(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) @@ -1537,7 +1543,9 @@ pub(super) fn columns(c: &Ctx, out: &mut Vec) { fn solids(c: &Ctx, out: &mut Vec) { let range = super::view_range::ViewRange::of(c.p, &c.a.floor); let base = c.p.floor(&c.a.floor).and_then(|f| f.base_elevation).unwrap_or(0.0); - for s in c.p.extruded_solids.as_deref().unwrap_or(&[]).iter().filter(|s| s.level_id == c.a.floor) { + // [180] Körper und Abzugskörper liegen wie jedes Bauteil auf ihrer Klasse (die Aussparung wirkt unabhängig davon). + for s in c.p.extruded_solids.as_deref().unwrap_or(&[]).iter().filter(|s| s.level_id == c.a.floor && c.vis(&s.category_code, &s.id)) { + let greyed = c.greyed(&s.category_code).then_some(true); let subtract = s.operation.as_deref() == Some("subtract"); let zb = base + s.base_offset.unwrap_or(0.0); let zone = if subtract { super::view_range::Zone::Cut } else { range.classify(zb, zb + s.height) }; @@ -1546,9 +1554,9 @@ fn solids(c: &Ctx, out: &mut Vec) { } let out_start = out.len(); if s.operation.as_deref() == Some("subtract") { - out.push(polygon(s.points.clone(), "none", "none", 0.0, no_hatch(), None, None, Pick::Solid(&s.id))); + out.push(polygon(s.points.clone(), "none", "none", 0.0, no_hatch(), greyed, None, Pick::Solid(&s.id))); let n = s.points.len(); - let seg = |a: Vec2, b: Vec2, dash: Option>| line(a, b, "void", SYMBOL_HAIRLINE_MM, Some(dash), EXTRUSION_STROKE, None); + let seg = |a: Vec2, b: Vec2, dash: Option>| line(a, b, "void", SYMBOL_HAIRLINE_MM, Some(dash), EXTRUSION_STROKE, greyed); for i in 0..n { out.push(seg(s.points[i], s.points[(i + 1) % n], Some(vec![2.0, 1.0]))); } @@ -1557,12 +1565,12 @@ fn solids(c: &Ctx, out: &mut Vec) { out.push(seg(s.points[1], s.points[3], None)); } } else { - out.push(polygon(s.points.clone(), "none", EXTRUSION_STROKE, SYMBOL_HAIRLINE_MM, no_hatch(), None, None, Pick::Solid(&s.id))); + out.push(polygon(s.points.clone(), "none", EXTRUSION_STROKE, SYMBOL_HAIRLINE_MM, no_hatch(), greyed, None, Pick::Solid(&s.id))); // [G1] Schnittfläche auf Schnitthöhe (Poché); der Umriss darunter bleibt als Projektion. if zone == super::view_range::Zone::Cut { if let Some(ring) = body_cut_ring(s, zb, range.cut) { let (fill, hatch) = if c.solid_cut() { (HATCH_INK, no_hatch()) } else { (super::section::BODY_FILL, super::section::section_hatch()) }; - out.push(polygon(ring, fill, POCHE_STROKE, WALL_FALLBACK_MM, hatch, None, None, Pick::Solid(&s.id))); + out.push(polygon(ring, fill, POCHE_STROKE, WALL_FALLBACK_MM, hatch, greyed, None, Pick::Solid(&s.id))); } } } @@ -1741,8 +1749,10 @@ pub fn plan_domains_buf(p: &Project, a: &PlanArgs) -> Result, String> { fn extras_of(p: &Project, a: &PlanArgs) -> (Vec<(Primitive, u32)>, Vec) { if a.global { // [66] Baurecht (Parzelle, Baubereich, Verstösse) gehört zur Vermessung: ausgeblendete Kategorie „01" ⇒ ohne. - let site = !(p.flat_categories().iter().any(|c| c.code == super::extras::SITE_CATEGORY) && !a.show.contains(super::extras::SITE_CATEGORY)); - super::extras::site_and_shadow(p, &a.floor, a.sun_when, a.scale, site) + let site = crate::standards::derived_visible(p, super::extras::SITE_CATEGORY, |k| a.show.contains(k)); + // [180] Sonnenschatten auf der Klasse „Schatten". + let sun_when = a.sun_when.filter(|_| crate::standards::derived_visible(p, crate::standards::SHADOW_CATEGORY, |k| a.show.contains(k))); + super::extras::site_and_shadow(p, &a.floor, sun_when, a.scale, site) } else { (Vec::new(), Vec::new()) } @@ -2593,6 +2603,7 @@ mod tests { let mk = |id: &str, off: f64, h: f64| ExtrudedSolid { id: id.into(), level_id: "eg".into(), + category_code: "20".into(), points: vec![Vec2 { x: 0.0, y: 0.0 }, Vec2 { x: 1.0, y: 0.0 }, Vec2 { x: 1.0, y: 1.0 }, Vec2 { x: 0.0, y: 1.0 }], height: h, base_offset: Some(off), @@ -3344,6 +3355,7 @@ mod tests { let mk = |id: &str, off: f64, h: f64, taper: Option, op: Option<&str>| ExtrudedSolid { id: id.into(), level_id: "eg".into(), + category_code: "20".into(), points: vec![Vec2 { x: 20.0, y: 0.0 }, Vec2 { x: 22.0, y: 0.0 }, Vec2 { x: 22.0, y: 2.0 }, Vec2 { x: 20.0, y: 2.0 }], height: h, base_offset: Some(off), diff --git a/src-tauri/core/src/plan/elevation/mod.rs b/src-tauri/core/src/plan/elevation/mod.rs index f3376878..10475ef5 100644 --- a/src-tauri/core/src/plan/elevation/mod.rs +++ b/src-tauri/core/src/plan/elevation/mod.rs @@ -213,6 +213,10 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool, for c in p.ceilings.as_deref().unwrap_or(&[]) { ceil_cat.entry(c.id.as_str()).or_insert(c.category_code.as_str()); } + // [180] Treppen kommen als Platten (Tritte, Läufe) mit der Treppen-Id. + for st in p.stairs.as_deref().unwrap_or(&[]) { + ceil_cat.entry(st.id.as_str()).or_insert(st.category_code.as_str()); + } let mut roof_cat: HashMap<&str, &str> = HashMap::new(); for r in p.roofs.as_deref().unwrap_or(&[]) { roof_cat.entry(r.id.as_str()).or_insert(r.category_code.as_str()); @@ -239,9 +243,9 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool, Role::Mesh => mesh_cat.get(f.id.as_str()).copied(), } }; - if vis.has_vis && vis.has_display { - faces.retain(|f| category(f).is_none_or(|c| vis.visible(c) && vis.render(c))); - } + // [180] Klassen-Sichtbarkeit und Darstellungsmodus wirken je für sich (früher nur beide zusammen: ein Blatt- + // Ausschnitt mit ausgeblendeter Klasse zeigte sie in der Ansicht trotzdem). + faces.retain(|f| category(f).is_none_or(|c| vis.visible(c) && vis.render(c))); let greyed = |f: &Face| vis.has_display && category(f).is_some_and(|c| vis.greyed(c)); // [33] Override-Regeln: ausgeblendete Bauteile entfallen wie ausgeblendete Kategorien (verdecken nichts), // Wände samt ihren Öffnungen. @@ -256,6 +260,17 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool, let mvo = crate::plan::model_view::for_view(p, level.model_view.as_deref(), crate::plan::style::Detail::Mittel, scale); let win = &mvo.window; let mut openings = collect_openings(p, &frame, win); + // [180] Öffnungen nach ihrer Klasse und der ihres Wirts (Wand, Dach): ausgeblendet ⇒ ohne Öffnung. + { + let shown = |c: &str| vis.visible(c) && vis.render(c); + let host_shown = |o: &Opening| { + let wall = (!o.host_wall_id.is_empty()).then(|| wall_cat.get(o.host_wall_id.as_str()).copied()).flatten(); + let roof = o.host_roof_id.as_deref().and_then(|r| roof_cat.get(r).copied()); + wall.is_none_or(shown) && roof.is_none_or(shown) + }; + let all = p.openings.as_deref().unwrap_or(&[]); + openings.retain(|op| all.iter().find(|o| o.id == op.id).is_none_or(|o| shown(&o.category_code) && host_shown(o))); + } // [173] Fensterteilung (Flügel, Sprossen, Kämpfer) nach der Modelldarstellung. if !win.elevation_division { for op in openings.iter_mut().filter(|op| p.openings.as_deref().unwrap_or(&[]).iter().any(|o| o.id == op.id && o.kind != ElementKind::Door)) { @@ -439,6 +454,8 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool, } // [33] Schlagschatten über Regeln (Bauteilart „Schatten“): Ausblenden, Füllung, Linie (Umriss). + // [180] Schlagschatten liegen auf der Klasse „Schatten" (fehlt sie im Projekt, gilt sie als sichtbar). + let shadows = shadows && vis.visible(crate::standards::SHADOW_CATEGORY) && vis.render(crate::standards::SHADOW_CATEGORY); 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 { @@ -721,7 +738,7 @@ pub fn elevation_plan_buf(p: &Project, args: &[f64], text: &str) -> Result Vec2 { /// Achslinien und Blasen für eine Ebene; `bounds` = Ausmass des Schnitts/der Ansicht (x0, y0, x1, y1), /// `scale` = Massstabsnenner. Leer ohne Raster oder ohne Ebene. pub fn grid_prims(p: &Project, level: &LevelSpec, bounds: [f64; 4], scale: f64) -> Vec { + grid_prims_in(p, level, bounds, scale, &Visibility::default()) +} + +/// [180] Wie [`grid_prims`], nur Raster, deren Klasse sichtbar ist (`vis`); gedimmte Klasse ⇒ gedimmt. +pub fn grid_prims_in(p: &Project, level: &LevelSpec, bounds: [f64; 4], scale: f64, vis: &Visibility) -> Vec { let Some(plane) = level.plane() else { return Vec::new() }; let mut out = Vec::new(); for d in &p.drawings2d { let Drawing2DGeom::Grid { bubble_mm, bubbles, .. } = &d.geom else { continue }; + if !(vis.visible(&d.category_code) && vis.render(&d.category_code)) { + continue; + } + let greyed = vis.has_display && vis.greyed(&d.category_code); let Some(spec) = Spec::of(&d.geom) else { continue }; // [137] Achsen, Blasen und Beschriftung tragen die Raster-Id: im Schnitt/in der Ansicht anwählbar. let id = Some(d.id.clone()); @@ -33,6 +42,9 @@ pub fn grid_prims(p: &Project, level: &LevelSpec, bounds: [f64; 4], scale: f64) Primitive::Line { drawing_id, .. } | Primitive::DrawingCircle { drawing_id, .. } | Primitive::DrawingText { drawing_id, .. } => *drawing_id = id.clone(), _ => {} } + if greyed { + q = q.with_greyed(true); + } q })); } diff --git a/src-tauri/core/src/plan/mod.rs b/src-tauri/core/src/plan/mod.rs index 28eadfe5..3b2f0a19 100644 --- a/src-tauri/core/src/plan/mod.rs +++ b/src-tauri/core/src/plan/mod.rs @@ -47,3 +47,5 @@ pub(crate) mod wall_join_tests; mod hatch_dir_tests; #[cfg(test)] mod arc_output_tests; +#[cfg(test)] +mod derived_class_tests; diff --git a/src-tauri/core/src/plan/section/meshes.rs b/src-tauri/core/src/plan/section/meshes.rs index fe5b83b1..026e7766 100644 --- a/src-tauri/core/src/plan/section/meshes.rs +++ b/src-tauri/core/src/plan/section/meshes.rs @@ -68,6 +68,8 @@ pub(super) fn append_body_sections(cuts: &mut Vec, p: &Project, bodies: &[& c.fill = Some(BODY_FILL.into()); c.nse = nse; c.source_id = solids.get(b.index).map(|s| s.id.clone()); + // [180] Klasse des Körpers (Sichtbarkeit, Darstellungsmodus). + c.category = solids.get(b.index).map(|s| s.category_code.clone()); cuts.push(c); } } diff --git a/src-tauri/core/src/plan/section/mod.rs b/src-tauri/core/src/plan/section/mod.rs index bae2d0a2..38fdd7da 100644 --- a/src-tauri/core/src/plan/section/mod.rs +++ b/src-tauri/core/src/plan/section/mod.rs @@ -491,6 +491,35 @@ pub struct Output { pub meshes: Vec, /// [152] Offene Schnittlinien importierter Netze (offene/nicht-mannigfaltige Netze): Netz-Index, Linienzug. pub mesh_lines: Vec<(usize, Vec<[f64; 2]>)>, + /// [180] Klasse der Bauteile hinter den Projektionskanten (`Edge::kind`, `Edge::index`; Netze über `meshes`). + pub edge_cats: HashMap<(Kind, usize), String>, +} + +/// [180] Klassen der Projektions-Besitzer: Wände (Index in `walls_r`), Platten (Decken, Treppen, Stützen; Index in +/// `slabs_r`), Dächer, Körper (Index in `extrudedSolids`). +fn edge_categories(p: &Project, walls: &[Option<&Wall>], slabs: &[bands::SlabOwner]) -> HashMap<(Kind, usize), String> { + let mut m = HashMap::new(); + for (i, w) in walls.iter().enumerate() { + if let Some(w) = w { + m.insert((Kind::Wall, i), w.category_code.clone()); + } + } + for (i, s) in slabs.iter().enumerate() { + let code = match s { + bands::SlabOwner::Ceiling(c, _) => &c.category_code, + bands::SlabOwner::Stair(st) => &st.category_code, + bands::SlabOwner::Column(c) => &c.category_code, + bands::SlabOwner::None => continue, + }; + m.insert((Kind::Slab, i), code.clone()); + } + for (i, r) in p.roofs.as_deref().unwrap_or(&[]).iter().enumerate() { + m.insert((Kind::Roof, i), r.category_code.clone()); + } + for (i, b) in p.extruded_solids.as_deref().unwrap_or(&[]).iter().enumerate() { + m.insert((Kind::Body, i), b.category_code.clone()); + } + m } /// [152] Ein importiertes Netz im Schnitt. @@ -577,6 +606,7 @@ fn compute_plane(p: &Project, level: &LevelSpec, bodies: &[BodyMesh], strip: Opt .collect(); let walls: Vec> = owners.iter().zip(&virt).map(|(o, v)| v.as_ref().or(*o)).collect(); let slabs = slab_owners(p, &slabs_r); + let edge_cats = edge_categories(p, &walls, &slabs); let cuts = attach_cut_styles(cuts, p, &plane, &walls, &slabs)?; let cuts = merge_monolith_cuts(cuts, &slabs_r, &stair_flight_sections(p, plane.base(), plane.u_model())); let base = plane.base(); @@ -603,7 +633,7 @@ fn compute_plane(p: &Project, level: &LevelSpec, bodies: &[BodyMesh], strip: Opt 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[..])); 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 }; + let mut out = Output { cuts, visible, hidden, profiles: Vec::new(), earth: 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); diff --git a/src-tauri/core/src/plan/section/primitives.rs b/src-tauri/core/src/plan/section/primitives.rs index 4518b34a..5d1a3761 100644 --- a/src-tauri/core/src/plan/section/primitives.rs +++ b/src-tauri/core/src/plan/section/primitives.rs @@ -586,7 +586,14 @@ pub fn section_primitives_mv(out: &Output, mono: bool, hidden_lines: bool, vis: (StairPart::Rail, Some(m)) => m.o.stair.section_beyond && m.o.stair.handrail.is_some(), }; // [152] Importierte Netze: Kanten nur, wenn die Kategorie gezeigt wird; Linien nach den Regeln des Netzes. - let mesh_shown = |e: &Edge| stair_shown(e) && (e.kind != Kind::Mesh || out.meshes.get(e.index).and_then(|m| m.category.as_deref()).is_none_or(shown)); + // [180] Projektionskanten der übrigen Bauteile nach deren Klasse. + let mesh_shown = |e: &Edge| { + stair_shown(e) + && match e.kind { + Kind::Mesh => out.meshes.get(e.index).and_then(|m| m.category.as_deref()).is_none_or(shown), + _ => out.edge_cats.get(&(e.kind, e.index)).is_none_or(|c| shown(c)), + } + }; let mesh_style = |e: &Edge, l: &mut Primitive| { if e.kind == Kind::Mesh { if let Some(s) = rules.mesh.get(&e.index) { diff --git a/src-tauri/core/src/plan/section/query.rs b/src-tauri/core/src/plan/section/query.rs index 3155256b..22b5f36a 100644 --- a/src-tauri/core/src/plan/section/query.rs +++ b/src-tauri/core/src/plan/section/query.rs @@ -118,7 +118,7 @@ pub fn section_plan_buf(p: &Project, args: &[f64], text: &str) -> Result .flat_map(|(l, s)| { let off = s.as_ref().map_or(0.0, |s| s.offset); let b = if off == 0.0 { bounds } else { [bounds[0] - off, bounds[1], bounds[2] - off, bounds[3]] }; - unfold::clip_prims(crate::plan::grid_view::grid_prims(p, l, b, scale), s.as_ref()) + unfold::clip_prims(crate::plan::grid_view::grid_prims_in(p, l, b, scale, &vis), s.as_ref()) }) .collect(); if !grid.is_empty() { diff --git a/src-tauri/core/src/plan/section/unfold.rs b/src-tauri/core/src/plan/section/unfold.rs index 5f0f6f1e..6d1d3bf7 100644 --- a/src-tauri/core/src/plan/section/unfold.rs +++ b/src-tauri/core/src/plan/section/unfold.rs @@ -231,6 +231,7 @@ pub(super) fn merge_output(acc: &mut Option, o: Output) { a.profiles.extend(o.profiles); a.earth.extend(o.earth); a.mesh_lines.extend(o.mesh_lines); + a.edge_cats.extend(o.edge_cats); if a.terrain_id.is_none() { a.terrain_id = o.terrain_id; } diff --git a/src-tauri/core/src/selection_info.rs b/src-tauri/core/src/selection_info.rs index 9b5941f2..8cd8ce41 100644 --- a/src-tauri/core/src/selection_info.rs +++ b/src-tauri/core/src/selection_info.rs @@ -1028,7 +1028,8 @@ fn solid_selection(root: &Map, s: &Value) -> J { O::default() .s("kind", "extrudedSolid") .raw("id", s, "id") - .s("categoryCode", "") + // [180] Klasse wie jedes Bauteil (im Kopf der Objekt-Info änderbar). + .s("categoryCode", str_of(field(s, "categoryCode")).unwrap_or("")) .raw("floorId", s, "levelId") .s("color", EXTRUSION_COLOR) .n("weightMm", WALL_FALLBACK_MM) diff --git a/src-tauri/core/src/sheet_viewports.rs b/src-tauri/core/src/sheet_viewports.rs index 544a242e..e94ff3e6 100644 --- a/src-tauri/core/src/sheet_viewports.rs +++ b/src-tauri/core/src/sheet_viewports.rs @@ -252,7 +252,9 @@ fn section_view_buf(p: &Project, level: &DrawingLevel, snap: &ViewSnapshot, scal let mut b = rv.bounds().unwrap_or([0.0, 0.0, 1.0, 1.0]); // Automatische Koten: Ebene > [173] Modelldarstellung (Ausschnitt, sonst Ebene) > an. let mv_id = crate::plan::model_view::selected_id(p, &level.id, args.model_view.as_deref()); - let marks_on = crate::plan::model_view::for_view(p, mv_id, crate::plan::style::Detail::Mittel, scale).level_marks(level.level_marks); + // [180] … und nur mit sichtbarer Klasse „Höhenkoten". + let marks_on = crate::plan::model_view::for_view(p, mv_id, crate::plan::style::Detail::Mittel, scale).level_marks(level.level_marks) + && crate::standards::derived_visible(p, crate::standards::LEVEL_MARK_CATEGORY, |k| args.show.contains(k)); let own_buf = plan_domains_buf(p, &PlanArgs { global: false, ..args }).ok()?; let ov = crate::plan::buf::View::parse(&own_buf)?; let own = ov.prims().unwrap_or_default(); diff --git a/src-tauri/core/src/standards.rs b/src-tauri/core/src/standards.rs index 680691e9..bc2c114f 100644 --- a/src-tauri/core/src/standards.rs +++ b/src-tauri/core/src/standards.rs @@ -276,7 +276,7 @@ pub fn roof_types() -> Vec { pub fn view_templates() -> Vec { vec![ json!({"id": "std-vt-praesentation", "name": "Präsentation", "detail": "mittel", "mono": true, "shadows": true, "hiddenLines": false, - "layerVisibility": {"90": false, "99": false}}), + "layerVisibility": {"90": false, "91": false, "99": false}}), json!({"id": "std-vt-eingabe-100", "name": "Eingabeplan 1:100", "detail": "mittel", "scaleDenominator": 100, "mono": true, "shadows": false, "layerVisibility": {"99": false}}), json!({"id": "std-vt-ausfuehrung-50", "name": "Ausführungsplan 1:50", "detail": "fein", "scaleDenominator": 50, "mono": true, "shadows": false, @@ -347,13 +347,49 @@ pub fn light_category() -> Value { json!({"code": LIGHT_CATEGORY_CODE, "name": "Leuchten", "color": "#1a1a1a", "lw": 0.18, "visible": true, "locked": false}) } +// ── [180] Klassen der abgeleiteten Darstellung ──────────────────────────────── +// +// Alles Sichtbare liegt auf einer Klasse (Vorgabe Maintainer): was nicht zu einem Element gehört (Schatten, +// Schnittmarken, automatische Koten) oder als Element von einem Befehl erzeugt wird (Aussenbemassung), bekommt +// eine Standard-Klasse. Sichtbarkeit über den gewöhnlichen Mechanismus (Klassen-Sichtbarkeit, Darstellungsmodus, +// Ebenen-Kombination). Fehlt die Klasse im Projekt (vor „Standards laden"), bleibt die Darstellung sichtbar +// (wie [66] Baurecht unter „01"), sonst gäbe es keinen Schalter dafür. + +/// Schlagschatten: Sonnenschatten im Grundriss (Schattenstudie), Schlagschatten in der Ansicht. +pub const SHADOW_CATEGORY: &str = "08"; +/// Automatische Aussenbemassung (Befehl `autodim`, Elemente `autodim-…`; je Element änderbar). +pub const AUTO_DIM_CATEGORY: &str = "81"; +/// Automatische Höhenkoten in Schnitt und Ansicht (`levelMarkers`). +pub const LEVEL_MARK_CATEGORY: &str = "82"; +/// Schnitt- und Ansichtsmarken im Grundriss (Schnittführung mit Pfeilen und Beschriftung). +pub const SECTION_MARK_CATEGORY: &str = "91"; + +/// Die Klassen der abgeleiteten Darstellung (Code, Name, Farbe, Strichstärke). +pub const DERIVED_CATEGORIES: [(&str, &str, &str, f64); 4] = [ + (SHADOW_CATEGORY, "Schatten", "#707078", 0.13), + (AUTO_DIM_CATEGORY, "Auto-Bemassung", "#303038", 0.13), + (LEVEL_MARK_CATEGORY, "Höhenkoten", "#1a1a1a", 0.13), + (SECTION_MARK_CATEGORY, "Schnittmarken", "#1a1a1a", 0.18), +]; + +pub fn derived_categories() -> Vec { + DERIVED_CATEGORIES.iter().map(|(code, name, color, lw)| json!({"code": code, "name": name, "color": color, "lw": lw, "visible": true, "locked": false})).collect() +} + +/// [180] Abgeleitete Darstellung der Klasse `code` sichtbar? `shown(code)` (Klasse eingeblendet), oder die Klasse +/// fehlt im Projekt. +pub fn derived_visible(p: &crate::model::Project, code: &str, shown: impl Fn(&str) -> bool) -> bool { + shown(code) || p.layer_category(code).is_none() +} + +/// Gibt es im Kategorie-Baum schon den Code oder den Namen `name` (klein)? +fn has_category(layers: &[Value], code: &str, name: &str) -> bool { + layers.iter().any(|l| l["code"].as_str() == Some(code) || name_key(l).as_deref() == Some(name) || l["children"].as_array().is_some_and(|c| has_category(c, code, name))) +} + /// Gibt es im Kategorie-Baum schon den Code oder den Namen der Leuchten-Kategorie? fn has_light_category(layers: &[Value]) -> bool { - layers.iter().any(|l| { - l["code"].as_str() == Some(LIGHT_CATEGORY_CODE) - || name_key(l).as_deref() == Some("leuchten") - || l["children"].as_array().is_some_and(|c| has_light_category(c)) - }) + has_category(layers, LIGHT_CATEGORY_CODE, "leuchten") } pub fn library() -> Vec<(&'static str, Vec)> { @@ -427,10 +463,18 @@ fn merge_plan(root: &Map) -> (Vec, HashMap } } // Kategorie „Leuchten“ (Kategorien haben keine id: ganze Liste setzen, ein Undo-Schritt). + // [180] Dazu die Klassen der abgeleiteten Darstellung. let layers = root.get("layers").and_then(Value::as_array).cloned().unwrap_or_default(); + let mut all = layers.clone(); if !has_light_category(&layers) { - let mut all = layers; all.push(light_category()); + } + for (c, d) in DERIVED_CATEGORIES.iter().zip(derived_categories()) { + if !has_category(&layers, c.0, &c.1.to_lowercase()) { + all.push(d); + } + } + if all.len() != layers.len() { ops.push(json!({"kind": "setField", "key": "layers", "value": all})); } (ops, ids) @@ -792,11 +836,32 @@ mod tests { let mut own = empty_root(); own.insert("layers".into(), json!([{"code": "20", "name": "Wände", "color": "#000", "lw": 0.35, "visible": true, "locked": false, "children": [{"code": "28", "name": "Leuchten", "color": "#000", "lw": 0.13, "visible": true, "locked": false}]}])); - assert!(!merge_ops(&own).iter().any(|o| o["key"] == "layers")); + let op = merge_ops(&own).into_iter().find(|o| o["key"] == "layers").unwrap(); + assert!(!op["value"].as_array().unwrap().iter().any(|l| l["code"] == "65"), "keine zweite Leuchten-Kategorie"); // Andere Kategorien bleiben, die neue kommt ans Ende. own.insert("layers".into(), json!([{"code": "20", "name": "Wände", "color": "#000", "lw": 0.35, "visible": true, "locked": false}])); let op = merge_ops(&own).into_iter().find(|o| o["key"] == "layers").unwrap(); - assert_eq!(op["value"].as_array().unwrap().iter().map(|l| l["code"].as_str().unwrap()).collect::>(), ["20", "65"]); + assert_eq!(op["value"].as_array().unwrap().iter().map(|l| l["code"].as_str().unwrap()).collect::>(), ["20", "65", "08", "81", "82", "91"]); + } + + /// [180] Klassen der abgeleiteten Darstellung: „Standards laden" legt sie an, einmal; vorhandene (Code oder Name) bleiben. + #[test] + fn klassen_der_abgeleiteten_darstellung() { + let r = apply(&empty_root(), &merge_ops(&empty_root())); + let p: Project = serde_json::from_value(Value::Object(r.clone())).unwrap(); + for (code, name, ..) in DERIVED_CATEGORIES { + assert!(p.layers.iter().any(|l| l.code == code && l.name == name), "{name}"); + } + assert!(merge_ops(&r).is_empty(), "zweites Laden ergänzt nichts"); + let mut own = empty_root(); + own.insert("layers".into(), json!([{"code": "77", "name": "schatten", "color": "#000", "lw": 0.13, "visible": true, "locked": false}])); + let op = merge_ops(&own).into_iter().find(|o| o["key"] == "layers").unwrap(); + let codes: Vec<&str> = op["value"].as_array().unwrap().iter().map(|l| l["code"].as_str().unwrap()).collect(); + assert_eq!(codes, ["77", "65", "81", "82", "91"]); + // Sichtbar, solange die Klasse fehlt; sonst nach der Klassen-Sichtbarkeit. + assert!(derived_visible(&p, SHADOW_CATEGORY, |c| c == SHADOW_CATEGORY)); + assert!(!derived_visible(&p, SHADOW_CATEGORY, |_| false)); + assert!(derived_visible(&Project::default(), SHADOW_CATEGORY, |_| false)); } #[test] diff --git a/src/analysis/kennzahlen.test.ts b/src/analysis/kennzahlen.test.ts index 80c6fb15..dad31c43 100644 --- a/src/analysis/kennzahlen.test.ts +++ b/src/analysis/kennzahlen.test.ts @@ -9,7 +9,7 @@ const sq = (x: number, y: number, s: number) => [ describe("solidVolume", () => { it("Prisma, Kegelstumpf (taper) und Kreis", () => { - const base = { id: "s", type: "extrudedSolid" as const, levelId: "eg", points: sq(0, 0, 2), height: 3 }; + const base = { id: "s", type: "extrudedSolid" as const, categoryCode: "20", levelId: "eg", points: sq(0, 0, 2), height: 3 }; expect(solidVolume(base)).toBeCloseTo(12, 9); expect(solidVolume({ ...base, taper: 1 })).toBeCloseTo(4, 9); // Pyramide = A·h/3 const r = { ...base, circle: { center: { x: 0, y: 0 }, r: 1 } }; @@ -34,8 +34,8 @@ describe("computeKennzahlen", () => { const p: Project = { ...sampleProject, extrudedSolids: [ - { id: "a", type: "extrudedSolid", levelId: sampleProject.drawingLevels[0].id, points: sq(0, 0, 10), height: 3 } as never, - { id: "b", type: "extrudedSolid", levelId: sampleProject.drawingLevels[0].id, points: sq(0, 0, 1), height: 3, operation: "subtract" } as never, + { id: "a", type: "extrudedSolid", categoryCode: "20", levelId: sampleProject.drawingLevels[0].id, points: sq(0, 0, 10), height: 3 } as never, + { id: "b", type: "extrudedSolid", categoryCode: "20", levelId: sampleProject.drawingLevels[0].id, points: sq(0, 0, 1), height: 3, operation: "subtract" } as never, ], }; const k = computeKennzahlen(p); diff --git a/src/cli/main.ts b/src/cli/main.ts index 8b06b27c..e33f2f65 100644 --- a/src/cli/main.ts +++ b/src/cli/main.ts @@ -17,6 +17,7 @@ // Override-Regel ein (auch Standard-Baustein, z. B. --rule "Deckenaufbau weiss") [33]; // das Massstab-Kriterium einer Regel (ab/bis 1:n) gilt nach --scale; // --model-view wählt eine Modelldarstellung (eigene Stufe oder grob/mittel/fein) [173] +// --hide blendet Klassen aus (z. B. --hide "Schatten,Auto-Bemassung") [180] // dossier-cli ifc [--ebkph] [--ebenen] (IFC mit eBKP-H-Hauptgruppen bzw. Modell-Ebenen als Klassifikation) // --schema 4|2x3: IFC4 (Standard) oder IFC2x3 (Coordination View 2.0) // dossier-cli dxf [--binary] [--scale 100] [--dim-unit cm] [--layout]|dwg|ifc|step|obj|stl|glb|gltf|schedule [--openings|--elements|--rooms] [--format json|csv|svg|pdf]|kennzahlen [--sia416] [--ivhb] [--format json|csv|svg|pdf] [--agsf m2] [--gruenflaeche m2] [--agf-basis gf|ngf|nf] [--untergeschosse]|raumprogramm [--import tabelle] [--sheet name|nr] [--mode replace|append] [--tolerance %] [--generate] [--format json|csv|svg|pdf] [--save projekt.obp]|sun [--level EG] [--out datei] @@ -235,6 +236,20 @@ function templateView(project: Project, levelId: string, args: Args, allCodes: S const tpl = templateFor(project, levelId, args); const d = templateDisplay(tpl); const hidden = new Set(d.hiddenCodes); + // [180] --hide : Klassen ausblenden (z. B. --hide "Schatten,Auto-Bemassung"). + for (const w of (args.flags.get("hide") ?? "").split(",").map((x) => x.trim().toLowerCase()).filter(Boolean)) { + const find = (ls: Project["layers"]): string | undefined => { + for (const l of ls) { + if (l.code.toLowerCase() === w || l.name.toLowerCase() === w) return l.code; + const c = l.children ? find(l.children) : undefined; + if (c) return c; + } + return undefined; + }; + const code = find(project.layers); + if (!code) fail(`Klasse nicht gefunden: ${w}`); + hidden.add(code); + } return { tpl, detail: d.detail, diff --git a/src/commands/cmds/solidbool.test.ts b/src/commands/cmds/solidbool.test.ts index c1441f4c..67f91e0a 100644 --- a/src/commands/cmds/solidbool.test.ts +++ b/src/commands/cmds/solidbool.test.ts @@ -13,7 +13,7 @@ function combineSolids(project: typeof sampleProject, a: ExtrudedSolid, b: Extru const box = (id: string, x0: number, y0: number, x1: number, y1: number, h: number): ExtrudedSolid => ({ id, - type: "extrudedSolid", + type: "extrudedSolid", categoryCode: "20", levelId: "eg", points: [{ x: x0, y: y0 }, { x: x1, y: y0 }, { x: x1, y: y1 }, { x: x0, y: y1 }], height: h, diff --git a/src/engine/truckBrep.wasm.test.ts b/src/engine/truckBrep.wasm.test.ts index b1efb29b..83d164d5 100644 --- a/src/engine/truckBrep.wasm.test.ts +++ b/src/engine/truckBrep.wasm.test.ts @@ -46,7 +46,7 @@ const volume = (m: { positions: number[]; indices: number[] }): number => { const build = (spec: unknown, tol = 0.01) => JSON.parse(mod.build_solid_mesh(JSON.stringify({ spec, tol }))); const box = (id: string, x0: number, y0: number, x1: number, y1: number, h: number): ExtrudedSolid => ({ - id, type: "extrudedSolid", levelId: "eg", height: h, + id, type: "extrudedSolid", categoryCode: "20", levelId: "eg", height: h, points: [{ x: x0, y: y0 }, { x: x1, y: y0 }, { x: x1, y: y1 }, { x: x0, y: y1 }], }); diff --git a/src/export/exportIfc.test.ts b/src/export/exportIfc.test.ts index fdae565f..32ab3235 100644 --- a/src/export/exportIfc.test.ts +++ b/src/export/exportIfc.test.ts @@ -110,7 +110,7 @@ function fixtureProject(): Project { const extrudedSolids: ExtrudedSolid[] = [ { id: "E1", - type: "extrudedSolid", + type: "extrudedSolid", categoryCode: "20", levelId: "eg", points: [ { x: 0, y: 0 }, diff --git a/src/export/exportMesh.test.ts b/src/export/exportMesh.test.ts index fb2559b7..2486b9a2 100644 --- a/src/export/exportMesh.test.ts +++ b/src/export/exportMesh.test.ts @@ -81,7 +81,7 @@ function projectWithPolygonExtrusion(pts: { x: number; y: number }[], height = 2 const p = baseProject(); const solid: ExtrudedSolid = { id: "E1", - type: "extrudedSolid", + type: "extrudedSolid", categoryCode: "20", levelId: "eg", points: pts, height, @@ -134,7 +134,7 @@ function fixtureProject(): Project { const extrudedSolids: ExtrudedSolid[] = [ { id: "E1", - type: "extrudedSolid", + type: "extrudedSolid", categoryCode: "20", levelId: "eg", points: [ { x: 0, y: 0 }, diff --git a/src/export/exportSchedule.test.ts b/src/export/exportSchedule.test.ts index a111fb95..cf2efc31 100644 --- a/src/export/exportSchedule.test.ts +++ b/src/export/exportSchedule.test.ts @@ -96,7 +96,7 @@ function fixtureProject(): Project { const extrudedSolids: ExtrudedSolid[] = [ { id: "E1", - type: "extrudedSolid", + type: "extrudedSolid", categoryCode: "20", levelId: "eg", points: [ { x: 0, y: 0 }, diff --git a/src/export/exportStep.test.ts b/src/export/exportStep.test.ts index fd03160a..9ad88c2b 100644 --- a/src/export/exportStep.test.ts +++ b/src/export/exportStep.test.ts @@ -74,7 +74,7 @@ describe("STEP-Export Ende-zu-Ende (truck-WASM)", () => { const p = { ...sampleProject, extrudedSolids: [{ - id: "v", type: "extrudedSolid" as const, levelId: w.floorId, operation: "subtract" as const, height: 0.8, baseOffset: 0.5, + id: "v", type: "extrudedSolid" as const, categoryCode: "20", levelId: w.floorId, operation: "subtract" as const, height: 0.8, baseOffset: 0.5, points: [{ x: mx - 0.3, y: my - 1 }, { x: mx + 0.3, y: my - 1 }, { x: mx + 0.3, y: my + 1 }, { x: mx - 0.3, y: my + 1 }], }], }; diff --git a/src/i18n/de.ts b/src/i18n/de.ts index 9144af5a..69d52564 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -986,6 +986,10 @@ export const de = { "nav.show": "Einblenden", "nav.categoryVisible": "{name} sichtbar", "nav.categorySelect": "{name} als aktive Ebene wählen (Zeichen-Ziel)", + "nav.categoryDerived.08": "Abgeleitete Darstellung: Sonnenschatten im Grundriss, Schlagschatten in der Ansicht", + "nav.categoryDerived.81": "Abgeleitete Darstellung: automatische Aussenbemassung (je Kette änderbar)", + "nav.categoryDerived.82": "Abgeleitete Darstellung: automatische Höhenkoten in Schnitt und Ansicht", + "nav.categoryDerived.91": "Abgeleitete Darstellung: Schnitt- und Ansichtsmarken im Grundriss", "nav.categorySettings": "Ebeneneinstellungen für {name}", "nav.drawingLevelsWindow": "Zeichnungsebenen als eigenes Fenster öffnen", diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 16f1c62d..1584793c 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -981,6 +981,10 @@ export const en: Record = { "nav.show": "Show", "nav.categoryVisible": "{name} visible", "nav.categorySelect": "Make {name} the active layer (drawing target)", + "nav.categoryDerived.08": "Derived display: sun shadows in plans, cast shadows in elevations", + "nav.categoryDerived.81": "Derived display: automatic exterior dimensions (each chain can be reassigned)", + "nav.categoryDerived.82": "Derived display: automatic level marks in sections and elevations", + "nav.categoryDerived.91": "Derived display: section and elevation marks in plans", "nav.categorySettings": "Layer settings for {name}", "nav.drawingLevelsWindow": "Open drawing levels as its own window", diff --git a/src/model/derivedCategories.ts b/src/model/derivedCategories.ts new file mode 100644 index 00000000..3ad64a3e --- /dev/null +++ b/src/model/derivedCategories.ts @@ -0,0 +1,24 @@ +// [180] Klassen der abgeleiteten Darstellung: alles Sichtbare liegt auf einer Klasse, auch was nicht zu einem +// Element gehört (Schatten, Schnittmarken, automatische Koten) oder ein Befehl erzeugt (Aussenbemassung). +// Die Codes stehen im Kern (`src-tauri/core/src/standards.rs`, `DERIVED_CATEGORIES`; „Standards laden" legt die +// Klassen an); hier nur die Codes für die TS-Seite (Gleichheit prüft `derivedCategories.test.ts`). +// Fehlt eine Klasse im Projekt, bleibt die Darstellung sichtbar (wie im Kern `standards::derived_visible`). + +import type { LayerCategory } from "./types"; +import { findCategory } from "./layers"; + +/** Sonnenschatten im Grundriss, Schlagschatten in der Ansicht. */ +export const SHADOW_CATEGORY = "08"; +/** Automatische Aussenbemassung (Befehl `autodim`). */ +export const AUTO_DIM_CATEGORY = "81"; +/** Automatische Höhenkoten in Schnitt und Ansicht. */ +export const LEVEL_MARK_CATEGORY = "82"; +/** Schnitt- und Ansichtsmarken im Grundriss. */ +export const SECTION_MARK_CATEGORY = "91"; + +export const DERIVED_CATEGORY_CODES: readonly string[] = [SHADOW_CATEGORY, AUTO_DIM_CATEGORY, LEVEL_MARK_CATEGORY, SECTION_MARK_CATEGORY]; + +/** Abgeleitete Darstellung der Klasse `code` sichtbar: Klasse eingeblendet (`shown`) oder im Projekt nicht vorhanden. */ +export function derivedVisible(layers: LayerCategory[], code: string, shown: (code: string) => boolean): boolean { + return shown(code) || !findCategory(layers, code); +} diff --git a/src/model/geoRebase.test.ts b/src/model/geoRebase.test.ts index d8911afe..0c663cb7 100644 --- a/src/model/geoRebase.test.ts +++ b/src/model/geoRebase.test.ts @@ -92,7 +92,7 @@ describe("translateProject", () => { it("Extrusion: points + Kreis-Mitte verschieben sich", () => { const solid: ExtrudedSolid = { id: "EX1", - type: "extrudedSolid", + type: "extrudedSolid", categoryCode: "20", levelId: "eg", points: [{ x: 0, y: 0 }, { x: 1, y: 0 }, { x: 1, y: 1 }], height: 1, diff --git a/src/model/richProject.testing.ts b/src/model/richProject.testing.ts index 7f9ed6b6..21616cf8 100644 --- a/src/model/richProject.testing.ts +++ b/src/model/richProject.testing.ts @@ -88,8 +88,8 @@ export function richProject(): Project { { type: "image", categoryCode: "03", id: "c4", name: "Luftbild", src: "data:image/png;base64,AAAA", min: { x: 0, y: 0 }, max: { x: 10, y: 10 }, opacity: 0.7, drape: true, filters: { saturation: 0.5, grayscale: 1 } }, ], extrudedSolids: [ - { id: "x1", type: "extrudedSolid", levelId: lvl, points: [{ x: 0, y: 0 }, { x: 1, y: 0 }, { x: 1, y: 1 }], height: 2, baseOffset: 0.1, operation: "subtract", taper: 0.1, cornerRadius: 0.05, chamfer: 0.02 }, - { id: "x2", type: "extrudedSolid", levelId: lvl, points: [], height: 1, circle: { center: { x: 3, y: 3 }, r: 0.4 }, brep: { spec: { kind: "box", w: 1, nested: { a: [1, 2] } }, origin: { x: 0, y: 0 }, label: "Quader" } }, + { id: "x1", type: "extrudedSolid", categoryCode: "20", levelId: lvl, points: [{ x: 0, y: 0 }, { x: 1, y: 0 }, { x: 1, y: 1 }], height: 2, baseOffset: 0.1, operation: "subtract", taper: 0.1, cornerRadius: 0.05, chamfer: 0.02 }, + { id: "x2", type: "extrudedSolid", categoryCode: "20", levelId: lvl, points: [], height: 1, circle: { center: { x: 3, y: 3 }, r: 0.4 }, brep: { spec: { kind: "box", w: 1, nested: { a: [1, 2] } }, origin: { x: 0, y: 0 }, label: "Quader" } }, ], columns: [ { diff --git a/src/model/sampleProject.ts b/src/model/sampleProject.ts index 384c5aa8..89efa435 100644 --- a/src/model/sampleProject.ts +++ b/src/model/sampleProject.ts @@ -370,6 +370,9 @@ export const sampleProject: Project = { layers: [ { code: "00", name: "Raster", color: "#1a1a1a", lw: 0.13, visible: true, locked: false }, { code: "01", name: "Vermessung", color: "#4a4a4a", lw: 0.18, visible: true, locked: false }, + // [180] Klassen der abgeleiteten Darstellung (wie „Standards laden", Kern `standards.rs`): Schatten, + // Auto-Bemassung, automatische Höhenkoten in Schnitt/Ansicht, Schnitt-/Ansichtsmarken. + { code: "08", name: "Schatten", color: "#707078", lw: 0.13, visible: true, locked: false }, // "05 Kontext" bündelt Bestand/Umgebung (manuell gezeichnet ODER importiert, // s. `contextCategories.ts::CONTEXT_PARENT_CATEGORY`) als Kinder statt als // gleichrangige Top-Level-Einträge (Nutzer-Wunsch 2026-08-31). @@ -409,7 +412,10 @@ export const sampleProject: Project = { { code: "35", name: "Träger", color: "#0a0a0a", lw: 0.25, visible: true, locked: false }, { code: "50", name: "Text", color: "#1a1a1a", lw: 0.13, visible: true, locked: false }, { code: "60", name: "Räume", color: "#4a4a4a", lw: 0.13, visible: true, locked: false }, + { code: "81", name: "Auto-Bemassung", color: "#303038", lw: 0.13, visible: true, locked: false }, + { code: "82", name: "Höhenkoten", color: "#1a1a1a", lw: 0.13, visible: true, locked: false }, { code: "90", name: "Referenzen", color: "#1a1a1a", lw: 0.13, visible: true, locked: false }, + { code: "91", name: "Schnittmarken", color: "#1a1a1a", lw: 0.18, visible: true, locked: false }, { code: "99", name: "Konstruktion", color: "#404040", lw: 0.13, visible: true, locked: false }, ], // [140] Strichstärken folgen dem Massstab (neue Projekte; bestehende behalten ihre Einstellung). diff --git a/src/model/sampleProjectComplex.ts b/src/model/sampleProjectComplex.ts index 60c026e4..d79464c1 100644 --- a/src/model/sampleProjectComplex.ts +++ b/src/model/sampleProjectComplex.ts @@ -482,9 +482,9 @@ const columns: NonNullable = [ const extrudedSolids: NonNullable = [ // Abzugskörper: Durchreiche Küche ↔ Atelier in der EG-Innenwand x = 6. - { id: "void-durchreiche", type: "extrudedSolid", levelId: "eg", points: rect(5.8, 6.6, 6.2, 7.8), height: 0.6, baseOffset: 1.0, operation: "subtract" }, + { id: "void-durchreiche", type: "extrudedSolid", levelId: "eg", categoryCode: "20", points: rect(5.8, 6.6, 6.2, 7.8), height: 0.6, baseOffset: 1.0, operation: "subtract" }, // Freier Körper: runder Brunnentrog im Garten (Kreisprofil, Fase). - { id: "koerper-brunnen", type: "extrudedSolid", levelId: "ug", points: [], circle: { center: P(4.5, -6.5), r: 0.7 }, height: 0.6, baseOffset: -0.1, chamfer: 0.03 }, + { id: "koerper-brunnen", type: "extrudedSolid", levelId: "ug", categoryCode: "20", points: [], circle: { center: P(4.5, -6.5), r: 0.7 }, height: 0.6, baseOffset: -0.1, chamfer: 0.03 }, ]; // ═════════════════════════════════════════════════════════════════════════════ @@ -870,6 +870,7 @@ export function buildComplexSampleProject(): Project { p = addRooms(p); // Aussenbemassung (Massketten je Fassade) in UG, EG, OG. + // [180] Die Ketten landen auf der Klasse „81 Auto-Bemassung" (Befehl `autodim`), nicht auf der aktiven. for (const f of ["ug", "eg", "og"]) p = runCmd(p, f, "autodim", {}, "80").project; return p; } diff --git a/src/model/types.generated.ts b/src/model/types.generated.ts index 1a2b0adc..b001aca0 100644 --- a/src/model/types.generated.ts +++ b/src/model/types.generated.ts @@ -1287,6 +1287,10 @@ export type ExtrudedSolid = { type: "extrudedSolid"; /** Geschoss, dessen `baseElevation` die UK des Körpers bestimmt. */ levelId: string; + /** + * [180] Klasse (Ebene/Kategorie) wie bei jedem Bauteil: Sichtbarkeit in Grundriss, Schnitt und Ansicht. + */ + categoryCode: string; /** * Geschlossenes Profil in der XY-Ebene (Grundriss), ≥3 Punkte. Bei einem * Kreis-Profil (`circle` gesetzt) eine Tessellierung des Kreises (48-Eck) — diff --git a/src/panels/LayersPanel.tsx b/src/panels/LayersPanel.tsx index 72dc8957..5fd2e768 100644 --- a/src/panels/LayersPanel.tsx +++ b/src/panels/LayersPanel.tsx @@ -30,6 +30,7 @@ import type { LayerCategory } from "./host"; import type { DisplayMode } from "./types"; import { DisplayModeSelect } from "./DisplayModeSelect"; import { t } from "../i18n"; +import { DERIVED_CATEGORY_CODES } from "../model/derivedCategories"; /** Inhalt des Panels „Ebenen". */ export function LayersPanel() { @@ -129,7 +130,11 @@ function CategoryRow({ style={style} onClick={() => onSelect(category.code)} onContextMenu={(e) => onContext(category.code, e)} - title={t("nav.categorySelect", { name: category.name })} + title={ + DERIVED_CATEGORY_CODES.includes(category.code) + ? `${t("nav.categorySelect", { name: category.name })}\n${t(`nav.categoryDerived.${category.code}`)}` + : t("nav.categorySelect", { name: category.name }) + } >