[140] Merge: Plandarstellung Teil 3 – Tusche als Standard, Schichten im Schnitt, Blasen, grob: Türbogen/Fenster 2 Striche, Raumstempel
This commit is contained in:
32 files changed
+546
-132
No files matched your search
@@ -2752,11 +2752,32 @@ Format · [90] Versionsvergleich · [91] Assistent · [92] Speckle.
|
||||
`duenne_schichten_je_massstab_zusammengefasst`, `achsraster_unterbrochen_im_gebaeude`, `senkrechte_achsen_mit_blase`
|
||||
(Stummel), `raumstempel_je_massstab` (1:500, Tinte, eigene Stempel), `mittel_ab_1_200_automatisch_grob`,
|
||||
`hoehenlinien_ausgeduennt_wo_zu_eng`, WGSL-Validierung. Goldens neu (Strichstärken, Farben, Schichten, Achsen).
|
||||
Offen: Schnitt fasst dünne Decken-/Dachschichten (Parkett, Putz) noch nicht zusammen; Ansicht zeigt im Modus
|
||||
„Farbig" weiter Materialfarben (Ziegelrot, Fassade) — für Tusche-Ansicht braucht es einen eigenen Modus oder einen
|
||||
brauchbaren „Schwarz-Weiss"-Modus; Achsblasen in 1:500 gross (Papiermass fest); in 1:200 („grob") keine
|
||||
Türaufschläge; enge Räume (Bad/Réduit) Stempel überlappen; Stifte (`penSets`) nicht angepasst. Nur Linux/CLI-SVG +
|
||||
Chromium geprüft, nicht in der Tauri-App (Bildschirm-Deckung nur per WGSL-Validierung geprüft, nicht angesehen). · M
|
||||
(6.11., Teil 3) **Tusche als Standard:** Darstellung „Schwarz-Weiss" ist jetzt Standard der App (`viewSlice`
|
||||
`planColorMode: "mono"`) und der CLI (`--color` = „Farbig"); „Farbig" bleibt wählbar. Schwarz-Weiss repariert
|
||||
(`extras::Post`, `is_neutral`): Grautöne bleiben (Schatten, Gelände, Höhenlinien, Treppe), nur bunte Farben werden
|
||||
Tinte bzw. Papier; Umriss „none" bleibt „none" (vorher bekam jede Wandschicht eine Kontur, der SVG-Kantenlauf-Pfad
|
||||
übersprang dann die Schraffur — `svg.rs` zeichnet sie jetzt auch dort); Luftbilder bleiben; kompakte
|
||||
Linien-Unterlage auch in Schwarz-Weiss (`drawingLines` Schalter-Bit 2). Ansicht in Tusche: Flächen weiss, keine
|
||||
Materialfarben, Ansichtsschraffur grau (#8c8c8c), Glas hellgrau, Schatten neutral hell. **Schnitt:** dünne
|
||||
Schichten (< 0.25 mm Papier, Dicke ≈ Fläche/halber Umfang) gehen ab 1:75 in der Nachbarschicht desselben Bauteils
|
||||
auf (längste gemeinsame Kante, Gleichstand → dickere; vereinigt, keine Fuge; `section::merge_thin_cuts`, Wände,
|
||||
Decken, Dächer), 1:50 alle Schichten. **Achsblasen** 5 mm (Standard statt 8, Beispiel ohne eigene 6 mm), ab 1:200
|
||||
×0.8 (4 mm), Text mit. **Detail grob** (auch automatisch ab 1:200, Vorgabe Maintainer): Türen mit Blatt und
|
||||
Aufschlag-Bogen, erst ab 1:500 ohne Bogen (Öffnungs-Code −1); Fenster nur zwei Striche quer durch die Öffnung in
|
||||
den Wandfluchten (kein Rahmen/Glas/Bank/Anschlag). **Raumstempel** passen sich an (Schätzung 0.55 × Schrifthöhe
|
||||
je Zeichen, 1.25 je Zeile, gegen die Raum-Bounding-Box): erst ohne Nutzungszeile, dann ohne Fläche, dann 2 mm
|
||||
Schrift, zuletzt Name gekürzt („Trep."). Tests: `mono_behaelt_grau_und_ohne_umriss`,
|
||||
`tusche_ansicht_ohne_materialfarben`, `duenne_schnittschichten_je_massstab_zusammengefasst`,
|
||||
`blase_papiergroesse_je_massstab`, `tuer_grob_hat_pick_blatt_bogen_und_zwei_sturzlinien`,
|
||||
`fenster_grob_zwei_striche_in_der_wandflucht`, `raumstempel_passt_in_engen_raum`; TS-Tests (Luftbild, Unterlage,
|
||||
Detailgrad-Übersteuerung, Fenster grob) angepasst. Goldens neu (Grundrisse: Blasen, Stempelzeilen; Schnitte:
|
||||
zusammengefasste Schichten; CLI-Schnitt in Tusche). Geprüft: cargo test Kern, vitest, tsc, CLI-SVG (EG
|
||||
1:100/200/500, Schnitt A-A 1:100/1:50, Ansicht Süd) in Chromium angesehen.
|
||||
Offen: Layout-Viewports (`sheet_viewports.rs`, `viewportPlan.ts`) und Präsentationsblatt zeichnen weiter „Farbig"
|
||||
(Ansicht mit Ziegelrot auf dem Blatt); Ansichtsvorlage „Präsentation" setzt `mono: false`; dünne
|
||||
Trittschalldämmung (2–3 cm) bleibt in 1:100 als dichter Zickzack-Balken; Stempel-Breite nur geschätzt (keine
|
||||
Schriftmetrik), L-förmige Räume über die Bounding-Box; Stifte (`penSets`) nicht angepasst; Fenster grob ohne
|
||||
Brüstungs-/Sturzlinie. Nur Linux/CLI-SVG + Chromium geprüft, nicht in der Tauri-App (Bildschirm nicht angesehen). · M
|
||||
Höhenlinien). Offen: dünne Schichten (Putz, Parkett) laufen in 1:100 zu einem Balken zusammen (Detailgrad sollte
|
||||
sie zusammenfassen); Achsen laufen in Ansicht/Grundriss durch das Gebäude; Raumstempel farbig statt schwarz im
|
||||
Druck ohne Schwarz-Weiss; Schatten im EG-Grundriss überdeckt Bemassung; eigene Stempel (`Room.stamp`) behalten in
|
||||
|
||||
@@ -11,8 +11,11 @@ pub type P = (f64, f64);
|
||||
|
||||
/// Überstand der Achsen über die äusserste Querachse (Meter).
|
||||
pub const DEFAULT_EXTEND: f64 = 1.5;
|
||||
/// Blasen-Durchmesser (Papier-mm).
|
||||
pub const DEFAULT_BUBBLE_MM: f64 = 8.0;
|
||||
/// Blasen-Durchmesser (Papier-mm, bei 1:100; [140] 5 statt 8 mm).
|
||||
pub const DEFAULT_BUBBLE_MM: f64 = 5.0;
|
||||
/// [140] Ab 1:200 schrumpft die Blase samt Text auf 4/5 (5 → 4 mm): der Plan ist dort kleiner, eine
|
||||
/// feste Papiergrösse wirkte in 1:500 übergross.
|
||||
pub const SMALL_SCALE_BUBBLE: f64 = 0.8;
|
||||
|
||||
/// Verlauf einer Achse: Strecke oder Kreisbogen (gegen den Uhrzeigersinn von `a0` nach `a1`).
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
@@ -301,7 +304,8 @@ pub fn visible_on(d: &Drawing2D, level: &str) -> bool {
|
||||
|
||||
/// Bildmass der Blase (Durchmesser, Modell-Meter) aus Papier-mm und Massstab.
|
||||
pub fn bubble_diameter(mm: Option<f64>, scale: f64) -> f64 {
|
||||
mm.filter(|v| v.is_finite() && *v > 0.0).unwrap_or(DEFAULT_BUBBLE_MM) * scale / 1000.0
|
||||
let k = if scale >= 200.0 { SMALL_SCALE_BUBBLE } else { 1.0 };
|
||||
mm.filter(|v| v.is_finite() && *v > 0.0).unwrap_or(DEFAULT_BUBBLE_MM) * k * scale / 1000.0
|
||||
}
|
||||
|
||||
/// Senkrechte Achsen eines Schnitts/einer Ansicht: Raster-Achsen (nur Strecken) als (Beschriftung,
|
||||
@@ -347,6 +351,15 @@ pub fn polyline(ax: &Axis) -> Vec<P> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
/// [140] Achsblase: 5 mm Papier bei 1:100 (und 1:50), 4 mm ab 1:200; eigene Grösse ebenso verkleinert.
|
||||
#[test]
|
||||
fn blase_papiergroesse_je_massstab() {
|
||||
let paper = |mm: Option<f64>, n: f64| super::bubble_diameter(mm, n) * 1000.0 / n;
|
||||
assert!((paper(None, 100.0) - 5.0).abs() < 1e-9 && (paper(None, 50.0) - 5.0).abs() < 1e-9);
|
||||
assert!((paper(None, 200.0) - 4.0).abs() < 1e-9 && (paper(None, 500.0) - 4.0).abs() < 1e-9);
|
||||
assert!((paper(Some(6.0), 500.0) - 4.8).abs() < 1e-9);
|
||||
}
|
||||
|
||||
use super::*;
|
||||
use crate::model::Vec2;
|
||||
|
||||
|
||||
@@ -612,6 +612,49 @@ fn with_alpha(color: &str, alpha: &str) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// [140] Kleinste Stempelschrift (2 mm Papier) für enge Räume.
|
||||
const ROOM_STAMP_MIN_PT: f64 = 2.0 / PT_MM;
|
||||
const PT_MM: f64 = 0.3528;
|
||||
/// Geschätzte Zeichenbreite und Zeilenhöhe je Schrifthöhe (Sans, Ziffern/Kleinbuchstaben).
|
||||
const STAMP_CHAR_W: f64 = 0.55;
|
||||
const STAMP_LINE_H: f64 = 1.25;
|
||||
|
||||
/// [140] Raumstempel einpassen: passt der geschätzte Stempel (Zeichen × Zeilen bei `pt`) nicht in den
|
||||
/// Raum (`room_w` × `room_h`, Meter, Bounding-Box mit 5 % Rand), entfallen erst die Nutzungszeile, dann die
|
||||
/// Flächenzeile (Zusatzzeilen von hinten), danach sinkt die Schrift auf 2 mm Papier. `name_chars` = Zeichen
|
||||
/// je Namenszeile. Ergebnis: verbleibende Zusatzzeilen, Schriftgrösse (pt) und — passt selbst der Name in 2 mm
|
||||
/// nicht in die Breite — die Zeichenzahl, auf die er gekürzt wird (`Some(n)`, n ≥ 2, mit Punkt).
|
||||
fn fit_room_stamp(name_chars: &[usize], mut extra: Vec<StampLine>, pt: f64, scale: f64, room_w: f64, room_h: f64) -> (Vec<StampLine>, f64, Option<usize>) {
|
||||
let fits = |extra: &[StampLine], pt: f64| {
|
||||
let h = pt * PT_MM * scale / 1000.0;
|
||||
let chars = name_chars.iter().copied().chain(extra.iter().map(|l| l.text.chars().count())).max().unwrap_or(0) as f64;
|
||||
let rows = (name_chars.len() + extra.len()) as f64;
|
||||
chars * STAMP_CHAR_W * h <= room_w * 0.95 && rows * STAMP_LINE_H * h <= room_h * 0.95
|
||||
};
|
||||
if !(scale > 0.0) || !(room_w > 0.0) || !(room_h > 0.0) {
|
||||
return (extra, pt, None);
|
||||
}
|
||||
while !fits(&extra, pt) && !extra.is_empty() {
|
||||
extra.pop();
|
||||
}
|
||||
if fits(&extra, pt) || pt <= ROOM_STAMP_MIN_PT {
|
||||
return (extra, pt, None);
|
||||
}
|
||||
let pt = ROOM_STAMP_MIN_PT;
|
||||
let h = pt * PT_MM * scale / 1000.0;
|
||||
let max_chars = (room_w * 0.95 / (STAMP_CHAR_W * h)).floor() as usize;
|
||||
let longest = name_chars.iter().copied().max().unwrap_or(0);
|
||||
(extra, pt, (longest > max_chars).then_some(max_chars.max(2)))
|
||||
}
|
||||
|
||||
/// Namenszeilen auf `n` Zeichen kürzen (n − 1 Zeichen und Punkt), Leerzeichen am Schnitt weg.
|
||||
fn abbreviate(text: &str, n: usize) -> String {
|
||||
text.split('\n')
|
||||
.map(|l| if l.chars().count() <= n { l.to_string() } else { format!("{}.", l.chars().take(n.saturating_sub(1).max(1)).collect::<String>().trim_end()) })
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
}
|
||||
|
||||
fn rooms(c: &Ctx, out: &mut Vec<Primitive>, bounds: &mut Bounds) {
|
||||
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 q in &room.boundary {
|
||||
@@ -649,7 +692,16 @@ fn rooms(c: &Ctx, out: &mut Vec<Primitive>, bounds: &mut Bounds) {
|
||||
(room.stamp_doc.clone().unwrap_or_else(|| doc_from_text(&room.name)), lines)
|
||||
}
|
||||
};
|
||||
out.push(Primitive::Text { at, doc, extra_lines, base_pt: if small { ROOM_STAMP_SMALL_PT } else { ROOM_STAMP_PT }, color: text_color.into(), room_id: Some(room.id.clone()), greyed, opacity: None });
|
||||
let (x0, x1) = room.boundary.iter().fold((f64::INFINITY, f64::NEG_INFINITY), |a, q| (a.0.min(q.x), a.1.max(q.x)));
|
||||
let (y0, y1) = room.boundary.iter().fold((f64::INFINITY, f64::NEG_INFINITY), |a, q| (a.0.min(q.y), a.1.max(q.y)));
|
||||
let name_chars: Vec<usize> = crate::text_layout::plain_text(&doc).split('\n').map(|l| l.chars().count()).collect();
|
||||
let (extra_lines, base_pt, cut) = fit_room_stamp(&name_chars, extra_lines, if small { ROOM_STAMP_SMALL_PT } else { ROOM_STAMP_PT }, c.a.scale, x1 - x0, y1 - y0);
|
||||
// Passt der Name selbst in 2 mm nicht: gekürzt (z. B. „Treppenh."), ohne Auszeichnungen.
|
||||
let doc = match cut {
|
||||
Some(n) => doc_from_text(&abbreviate(&crate::text_layout::plain_text(&doc), n)),
|
||||
None => doc,
|
||||
};
|
||||
out.push(Primitive::Text { at, doc, extra_lines, base_pt, color: text_color.into(), room_id: Some(room.id.clone()), greyed, opacity: None });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1055,6 +1107,27 @@ mod tests {
|
||||
assert_eq!((lines(100.0), lines(200.0), lines(500.0)), (3, 1, 0));
|
||||
}
|
||||
|
||||
/// [140] Enger Raum: erst ohne Nutzungszeile, dann ohne Fläche, dann 2 mm Schrift; grosser Raum unverändert.
|
||||
#[test]
|
||||
fn raumstempel_passt_in_engen_raum() {
|
||||
let extra = || vec![StampLine { text: "4.6 m²".into(), align: Align::Center }, StampLine { text: "NNF · Nebennutzfläche".into(), align: Align::Center }];
|
||||
let name = [8usize]; // „E.04 Bad"
|
||||
let (e, pt, cut) = fit_room_stamp(&name, extra(), ROOM_STAMP_PT, 100.0, 6.0, 4.0);
|
||||
assert_eq!((e.len(), pt, cut), (2, ROOM_STAMP_PT, None));
|
||||
let (e, pt, _) = fit_room_stamp(&name, extra(), ROOM_STAMP_PT, 100.0, 1.8, 2.4);
|
||||
assert_eq!((e.len(), pt), (1, ROOM_STAMP_PT), "ohne Nutzung");
|
||||
let (e, pt, _) = fit_room_stamp(&name, extra(), ROOM_STAMP_PT, 100.0, 1.8, 0.8);
|
||||
assert_eq!((e.len(), pt), (0, ROOM_STAMP_PT), "nur der Name");
|
||||
let (e, pt, cut) = fit_room_stamp(&name, extra(), ROOM_STAMP_PT, 100.0, 1.2, 0.8);
|
||||
assert_eq!((e.len(), cut), (0, None));
|
||||
assert!((pt * PT_MM - 2.0).abs() < 1e-9, "2 mm Papier");
|
||||
// 1:500, „Treppenhaus" in 3 m: auch 2 mm (1 m Schrift) zu breit → gekürzt.
|
||||
let (_, _, cut) = fit_room_stamp(&[11], vec![], ROOM_STAMP_SMALL_PT, 500.0, 3.0, 4.0);
|
||||
assert_eq!(cut, Some(5));
|
||||
assert_eq!(abbreviate("Treppenhaus", 5), "Trep.");
|
||||
assert_eq!(abbreviate("Bad", 5), "Bad");
|
||||
}
|
||||
|
||||
/// [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() {
|
||||
|
||||
@@ -1777,13 +1777,13 @@ mod tests {
|
||||
let texts: Vec<String> = prims.iter().filter_map(|q| if let Primitive::DrawingText { text, .. } = q { Some(text.clone()) } else { None }).collect();
|
||||
assert_eq!(lines, 4);
|
||||
assert_eq!(circles.len(), 8);
|
||||
// 8 mm Durchmesser bei 1:100 = 0.8 m → Radius 0.4.
|
||||
assert!(circles.iter().all(|r| (r - 0.4).abs() < 1e-9), "{circles:?}");
|
||||
// [140] 5 mm Durchmesser bei 1:100 = 0.5 m → Radius 0.25.
|
||||
assert!(circles.iter().all(|r| (r - 0.25).abs() < 1e-9), "{circles:?}");
|
||||
assert_eq!(texts.len(), 8);
|
||||
assert!(["1", "2", "A", "B"].iter().all(|t| texts.iter().any(|x| x == t)));
|
||||
// Halber Massstab → halbe Blase.
|
||||
let half: Vec<f64> = render(&p, grid(false), 50.0).iter().filter_map(|q| if let Primitive::DrawingCircle { r, .. } = q { Some(*r) } else { None }).collect();
|
||||
assert!((half[0] - 0.2).abs() < 1e-9);
|
||||
assert!((half[0] - 0.125).abs() < 1e-9);
|
||||
// Radial: 2 Strahlen (Linien) und 2 Ringe (Bögen, Ring A mit Radius 0 entfällt als Vollkreis-Punkt).
|
||||
let prims = render(&p, grid(true), 100.0);
|
||||
assert_eq!(prims.iter().filter(|q| matches!(q, Primitive::Line { .. })).count(), 2);
|
||||
|
||||
@@ -21,7 +21,10 @@ const SILHOUETTE_MM: f64 = 0.18;
|
||||
/// [140] Abstand (m), bis zu dem eine Kante als Teil der Silhouette gilt.
|
||||
const SILHOUETTE_TOL: f64 = 2e-3;
|
||||
const FRAME_MM: f64 = 0.13;
|
||||
const GLASS_FILL_MONO: &str = "#c4c8cd";
|
||||
/// [140] Tusche (Schwarz-Weiss, Standard): Glas hellgrau, Schatten neutral grau und hell.
|
||||
const GLASS_FILL_MONO: &str = "#dcdcdc";
|
||||
const SHADOW_FILL_MONO: &str = "#c4c4c4";
|
||||
const OPENING_SHADOW_FILL_MONO: &str = "#d2d2d2";
|
||||
/// [140] Glas hellgrau statt blau (Farbe nur, wo der Nutzer sie setzt).
|
||||
const GLASS_FILL_COLOR: &str = "#d3d8dd";
|
||||
const SHADOW_FILL: &str = "#8f959e";
|
||||
@@ -1433,7 +1436,7 @@ pub fn elevation_primitives(p: &Project, level: &LevelSpec, shadows: bool, mono:
|
||||
})
|
||||
.collect();
|
||||
i += 2 * count;
|
||||
let mut prim = polygon(pts, SHADOW_FILL, "none", 0.0, no_hatch());
|
||||
let mut prim = polygon(pts, if mono { SHADOW_FILL_MONO } else { SHADOW_FILL }, "none", 0.0, no_hatch());
|
||||
// [137] Klick auf den Schlagschatten wählt die Schatten-Einstellung der Ansicht (keine Element-Id).
|
||||
if let Primitive::Polygon { context_object_id, .. } = &mut prim {
|
||||
*context_object_id = Some(crate::plan::extras::SITE_PICK_VIEW_SHADOWS.into());
|
||||
@@ -1497,7 +1500,7 @@ pub fn elevation_primitives(p: &Project, level: &LevelSpec, shadows: bool, mono:
|
||||
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), OPENING_SHADOW_FILL, "none", 0.0, no_hatch()));
|
||||
push(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 {
|
||||
@@ -1623,6 +1626,8 @@ fn pattern_style(sp: &SurfacePattern, comp: &Component) -> (f64, String) {
|
||||
}
|
||||
|
||||
const PATTERN_INK: &str = "#3a3f47";
|
||||
/// [140] Ansichtsschraffur in Tusche: feines Grau (Materialstruktur tritt hinter die Kanten zurück).
|
||||
const MONO_PATTERN_INK: &str = "#8c8c8c";
|
||||
|
||||
/// Linie der Ansichtsschraffur: Endpunkte, Verdeckungstiefe, Maler-Tiefe, Stil-Index.
|
||||
type PatternLine = (Pt, Pt, f64, f64, usize);
|
||||
@@ -1740,7 +1745,7 @@ fn surface_patterns(p: &Project, faces: &mut [Face], frame: &[f64; 9], scale: f6
|
||||
}
|
||||
if mono {
|
||||
for s in &mut styles {
|
||||
s.1 = PATTERN_INK.into();
|
||||
s.1 = MONO_PATTERN_INK.into();
|
||||
}
|
||||
}
|
||||
(lines, styles)
|
||||
@@ -1975,6 +1980,43 @@ mod tests {
|
||||
assert_eq!(render(&p, 2000.0).matches("elevation-surface-pattern").count(), 0, "grob: weggelassen");
|
||||
}
|
||||
|
||||
/// [140] Tusche-Ansicht (Schwarz-Weiss, Standard): keine Materialfarben, Flächen weiss, Glas hellgrau,
|
||||
/// Schatten und Ansichtsschraffur in neutralem Grau (Schatten bleiben).
|
||||
#[test]
|
||||
fn tusche_ansicht_ohne_materialfarben() {
|
||||
let mut p = sample();
|
||||
let outer = p.wall_types.iter().find(|t| t.id == "aw").unwrap().layers[0].component_id.clone();
|
||||
let c = p.components.iter_mut().find(|c| c.id == outer).unwrap();
|
||||
c.elevation_color = Some("#c0603a".into());
|
||||
c.surface_pattern = Some(SurfacePattern { kind: SurfacePatternKind::Lines, spacing: 0.1, color: Some("#a0522d".into()), ..Default::default() });
|
||||
let l = p.drawing_levels.iter().find(|l| l.id == "ansicht-sued").unwrap();
|
||||
let level = LevelSpec::from_json(&serde_json::to_value(l).unwrap());
|
||||
let (prims, _) = elevation_primitives(&p, &level, true, true, &Visibility::default(), 50.0).unwrap().unwrap();
|
||||
let neutral = |c: &str| c == "none" || crate::plan::extras::is_neutral(c);
|
||||
let mut shadow = false;
|
||||
let mut pattern = false;
|
||||
for q in &prims {
|
||||
match q {
|
||||
Primitive::Polygon { fill, stroke, context_object_id, .. } => {
|
||||
assert!(neutral(fill) && neutral(stroke), "bunt: {fill} {stroke}");
|
||||
shadow |= context_object_id.as_deref() == Some(crate::plan::extras::SITE_PICK_VIEW_SHADOWS);
|
||||
}
|
||||
Primitive::Line { cls, color, .. } => {
|
||||
let c = color.as_deref().unwrap_or("#000");
|
||||
assert!(neutral(c), "bunte Linie {cls}: {c}");
|
||||
if cls == "elevation-surface-pattern" {
|
||||
pattern = true;
|
||||
assert_eq!(c, MONO_PATTERN_INK, "Muster grau, nicht schwarz");
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
assert!(shadow && pattern);
|
||||
let json = serde_json::to_string(&prims).unwrap();
|
||||
assert!(json.contains(GLASS_FILL_MONO) && !json.contains("#c0603a"));
|
||||
}
|
||||
|
||||
/// [G3] Formöffnung: Rahmen als Umriss (viele Ecken), Glas eingerückt; [103] Dachfenster auf der
|
||||
/// Südfläche sichtbar.
|
||||
#[test]
|
||||
|
||||
@@ -416,7 +416,11 @@ impl Post {
|
||||
|
||||
fn hatch(&self, h: &mut HatchRender) {
|
||||
if self.mono && h.pattern != HatchPattern::None {
|
||||
h.color = (if h.pattern == HatchPattern::Solid { HATCH_INK } else { MONO_INK }).into();
|
||||
if h.pattern == HatchPattern::Solid {
|
||||
h.color = HATCH_INK.into();
|
||||
} else if !is_neutral(&h.color) {
|
||||
h.color = MONO_INK.into();
|
||||
}
|
||||
}
|
||||
if self.lw != 1.0 {
|
||||
h.line_weight = scale_weight(h.line_weight, self.lw);
|
||||
@@ -430,9 +434,16 @@ impl Post {
|
||||
if self.mono {
|
||||
let solid = hatch.pattern == HatchPattern::Solid;
|
||||
if *fill != "none" {
|
||||
*fill = (if solid { HATCH_INK } else { "#ffffff" }).into();
|
||||
if solid {
|
||||
*fill = HATCH_INK.into();
|
||||
} else if !is_neutral(fill) {
|
||||
*fill = "#ffffff".into();
|
||||
}
|
||||
}
|
||||
// [140] „none" bleibt (Wandschichten ohne Umriss: sonst Kontur statt Schraffur).
|
||||
if *stroke != "none" && !is_neutral(stroke) {
|
||||
*stroke = MONO_INK.into();
|
||||
}
|
||||
*stroke = MONO_INK.into();
|
||||
}
|
||||
self.hatch(hatch);
|
||||
if self.lw != 1.0 {
|
||||
@@ -445,7 +456,7 @@ impl Post {
|
||||
}
|
||||
}
|
||||
Primitive::Line { weight_mm, color, .. } => {
|
||||
if self.mono {
|
||||
if self.mono && !color.as_deref().is_some_and(is_neutral) {
|
||||
*color = Some(MONO_INK.into());
|
||||
}
|
||||
if self.lw != 1.0 {
|
||||
@@ -463,10 +474,24 @@ impl Post {
|
||||
|
||||
/// Farbe und Stärke einer Linie.
|
||||
pub fn line<'a>(&self, color: Option<&'a str>, w: f64) -> (Option<&'a str>, f64) {
|
||||
(if self.mono { Some(MONO_INK) } else { color }, scale_weight(w, self.lw))
|
||||
(if self.mono && !color.is_some_and(is_neutral) { Some(MONO_INK) } else { color }, scale_weight(w, self.lw))
|
||||
}
|
||||
}
|
||||
|
||||
/// [140] Unbunte Farbe (Grau/Schwarz/Weiss, `#rgb`/`#rrggbb`/`#rrggbbaa`): bleibt in Schwarz-Weiss erhalten
|
||||
/// (Schatten, Gelände-Grau, Treppen-Grau); bunte Farben werden Tinte bzw. Papier.
|
||||
pub fn is_neutral(c: &str) -> bool {
|
||||
let h = c.trim().trim_start_matches('#');
|
||||
let ch = |i: usize, n: usize| u8::from_str_radix(h.get(i..i + n)?, 16).ok().map(|v| if n == 1 { v * 17 } else { v });
|
||||
let rgb = match h.len() {
|
||||
3 | 4 => (ch(0, 1), ch(1, 1), ch(2, 1)),
|
||||
6 | 8 => (ch(0, 2), ch(2, 2), ch(4, 2)),
|
||||
_ => return false,
|
||||
};
|
||||
let (Some(r), Some(g), Some(b)) = rgb else { return false };
|
||||
r.max(g).max(b) - r.min(g).min(b) <= 20
|
||||
}
|
||||
|
||||
/// [32] Strichstärken nach Massstab auf Schnitt-/Ansichts-Primitive (wie im Grundriss über [`post_for`]):
|
||||
/// Faktor [`line_weight_factor`] auf Linien, Umrisse und Schraffurlinien; ohne Projekt-Option nichts.
|
||||
pub fn scale_line_weights(p: &Project, scale: f64, prims: &mut [Primitive]) {
|
||||
@@ -785,4 +810,42 @@ mod tests {
|
||||
}
|
||||
assert_eq!(post.line(None, 0.25), (Some(MONO_INK), 0.25));
|
||||
}
|
||||
|
||||
/// [140] Schwarz-Weiss als Tusche-Standard: Wandschichten ohne Umriss bleiben ohne Umriss (sonst verdrängt
|
||||
/// die Kontur die Schraffur), Grautöne (Schatten, Gelände, Treppe) bleiben, bunte Farben werden Tinte/Papier.
|
||||
#[test]
|
||||
fn mono_behaelt_grau_und_ohne_umriss() {
|
||||
let post = Post { mono: true, lw: 1.0, sketch: 0.0 };
|
||||
let mut p = flat_polygon(vec![], "#3c3c3c", 0.0);
|
||||
if let Primitive::Polygon { stroke, hatch, .. } = &mut p {
|
||||
*stroke = "none".into();
|
||||
*hatch = HatchRender { pattern: HatchPattern::Diagonal, color: "#808080".into(), ..no_hatch() };
|
||||
}
|
||||
post.apply(&mut p);
|
||||
match &p {
|
||||
Primitive::Polygon { fill, stroke, hatch, .. } => {
|
||||
assert_eq!(fill, "#3c3c3c");
|
||||
assert_eq!(stroke, "none");
|
||||
assert_eq!(hatch.color, "#808080");
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
let mut q = flat_polygon(vec![], "#e8dcc0", 0.0);
|
||||
if let Primitive::Polygon { stroke, hatch, .. } = &mut q {
|
||||
*stroke = "#b06030".into();
|
||||
*hatch = HatchRender { pattern: HatchPattern::Diagonal, color: "#c04020".into(), ..no_hatch() };
|
||||
}
|
||||
post.apply(&mut q);
|
||||
match &q {
|
||||
Primitive::Polygon { fill, stroke, hatch, .. } => {
|
||||
assert_eq!(fill, "#ffffff");
|
||||
assert_eq!(stroke, MONO_INK);
|
||||
assert_eq!(hatch.color, MONO_INK);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
assert_eq!(post.line(Some("#8a8a8a"), 0.13), (Some("#8a8a8a"), 0.13));
|
||||
assert_eq!(post.line(Some("#a05a2c"), 0.13), (Some(MONO_INK), 0.13));
|
||||
assert!(is_neutral("#fff") && is_neutral("#1a1a1aff") && !is_neutral("#ff0000") && !is_neutral("rot"));
|
||||
}
|
||||
}
|
||||
@@ -85,8 +85,11 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
|
||||
let (sx, sy, ex, ey, total, ref_off) = (r.num()?, r.num()?, r.num()?, r.num()?, r.num()?, r.num()?);
|
||||
let (position, width) = (r.num()?, r.num()?);
|
||||
let is_door = r.num()? != 0.0;
|
||||
let detail = match r.num()? as i64 {
|
||||
0 => Detail::Grob,
|
||||
// [140] Code −1 = Übersicht (grob ab 1:500): Türen ohne Aufschlag-Bogen.
|
||||
let detail_code = r.num()? as i64;
|
||||
let overview = detail_code < 0;
|
||||
let detail = match detail_code {
|
||||
i64::MIN..=0 => Detail::Grob,
|
||||
1 => Detail::Mittel,
|
||||
_ => Detail::Fein,
|
||||
};
|
||||
@@ -185,7 +188,7 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
|
||||
};
|
||||
for leaf in leaves(&door) {
|
||||
o.line(C_LEAF, hair, 0.0, 0.0, leaf.hinge, leaf.open_end);
|
||||
if detail != Detail::Grob {
|
||||
if !overview {
|
||||
o.arc(hair, leaf.hinge, leaf.closed_end, leaf.open_end, leaf.radius);
|
||||
}
|
||||
}
|
||||
@@ -194,7 +197,7 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
|
||||
let other = DoorParams { swing_right: !door.swing_right, ..door };
|
||||
for leaf in leaves(&other) {
|
||||
o.line(C_LEAF, hair, 0.0, 3.0, leaf.hinge, leaf.open_end);
|
||||
if detail != Detail::Grob {
|
||||
if !overview {
|
||||
// Bögen laufen gegen den Uhrzeigersinn von `from` nach `to`: kurzen Bogen wählen.
|
||||
let (a, b) = (sub(leaf.closed_end, leaf.hinge), sub(leaf.open_end, leaf.hinge));
|
||||
let (from, to) = if a.x * b.y - a.y * b.x >= 0.0 { (leaf.closed_end, leaf.open_end) } else { (leaf.open_end, leaf.closed_end) };
|
||||
@@ -257,14 +260,16 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
|
||||
}
|
||||
None => (ref_off - total / 2.0, ref_off + total / 2.0),
|
||||
};
|
||||
if has_type {
|
||||
if has_type && detail != Detail::Grob {
|
||||
let zone = if win_inset_side == 1.0 { (f_hi, ref_off + total / 2.0) } else { (ref_off - total / 2.0, f_lo) };
|
||||
rebate_nibs(&mut o, &w, position, width, rebate, Some(zone));
|
||||
}
|
||||
if detail == Detail::Grob {
|
||||
let idx = sym.glass_lines.len() / 2;
|
||||
if let Some(g) = sym.glass_lines.get(idx).or_else(|| sym.glass_lines.first()) {
|
||||
o.line(C_GLASS, sash_w, 4.0, 0.0, g.0, g.1);
|
||||
// [140] Grob: zwei Striche quer durch die Öffnung in den Wandfluchten (kein Rahmen, Glas, Bank).
|
||||
if let Some((js, je)) = opening_jambs(&w, position, width) {
|
||||
for off in [ref_off - total / 2.0, ref_off + total / 2.0] {
|
||||
o.line(C_WINDOW_FRAME, frame_hair, 2.0, 0.0, add(js, scale(wn, off)), add(je, scale(wn, off)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
o.polygon(1.0, frame_view_w, 3.0, &sym.frame);
|
||||
@@ -586,9 +591,13 @@ mod tests {
|
||||
t
|
||||
}
|
||||
|
||||
/// [140] Grob (auch automatisch ab 1:200): Tür mit Blatt UND Aufschlag-Bogen; Übersicht (1:500, Code −1)
|
||||
/// nur das Blatt.
|
||||
#[test]
|
||||
fn tuer_grob_hat_pick_blatt_und_zwei_sturzlinien() {
|
||||
fn tuer_grob_hat_pick_blatt_bogen_und_zwei_sturzlinien() {
|
||||
let t = tags(&plan_opening(&input(true, 0.0, false, &[])));
|
||||
assert_eq!(t, vec![1.0, 2.0, 3.0, 2.0, 2.0]);
|
||||
let t = tags(&plan_opening(&input(true, -1.0, false, &[])));
|
||||
assert_eq!(t, vec![1.0, 2.0, 2.0, 2.0]);
|
||||
}
|
||||
|
||||
@@ -599,10 +608,24 @@ mod tests {
|
||||
assert_eq!(t.len(), 1 + 1 + 1 + 2 + 2);
|
||||
}
|
||||
|
||||
/// [140] Fenster grob: nur zwei Striche quer durch die Öffnung in den Wandfluchten (kein Rahmen, kein Glas,
|
||||
/// keine Bank, kein Anschlag) — auch mit Fenstertyp, Anschlag und Bank.
|
||||
#[test]
|
||||
fn fenster_grob_hat_eine_glaslinie() {
|
||||
let t = tags(&plan_opening(&input(false, 0.0, false, &[])));
|
||||
assert_eq!(t, vec![1.0, 2.0]);
|
||||
fn fenster_grob_zwei_striche_in_der_wandflucht() {
|
||||
let sashes = [[0.0, 1.0, NAN, NAN, 1.0], [0.0, 1.0, NAN, NAN, 1.0]];
|
||||
for (has_type, sa) in [(false, &[][..]), (true, &sashes[..])] {
|
||||
let mut b = input(false, 0.0, has_type, sa);
|
||||
b[DETAILS] = 0.04; // Anschlag
|
||||
b[DETAILS + 1] = 3.0; // Bank beidseitig
|
||||
let f = plan_opening(&b);
|
||||
assert_eq!(tags(&f), vec![1.0, 2.0, 2.0], "Lücke + zwei Striche");
|
||||
let mut ys: Vec<f64> = lines(&f).iter().map(|l| {
|
||||
assert!((l.3 - l.5).abs() < 1e-9 && (l.2 - 1.0).abs() < 1e-9 && (l.4 - 1.9).abs() < 1e-9, "quer durch die Öffnung: {l:?}");
|
||||
l.3
|
||||
}).collect();
|
||||
ys.sort_by(f64::total_cmp);
|
||||
assert!((ys[0] + 0.15).abs() < 1e-9 && (ys[1] - 0.15).abs() < 1e-9, "Wandfluchten: {ys:?}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -751,9 +774,13 @@ mod tests {
|
||||
assert_eq!(count_cls(&f, C_GLASS), 2);
|
||||
b[KIND] = 3.0;
|
||||
assert_eq!(arcs(&plan_opening(&b)), 2);
|
||||
// Grob: keine Bögen, aber beide Blätter.
|
||||
// Grob: Bögen und beide Blätter; Übersicht (1:500): keine Bögen.
|
||||
b[9] = 0.0;
|
||||
let f = plan_opening(&b);
|
||||
assert_eq!(arcs(&f), 2);
|
||||
assert_eq!(count_cls(&f, C_LEAF), 2);
|
||||
b[9] = -1.0;
|
||||
let f = plan_opening(&b);
|
||||
assert_eq!(arcs(&f), 0);
|
||||
assert_eq!(count_cls(&f, C_LEAF), 2);
|
||||
}
|
||||
|
||||
@@ -2265,8 +2265,119 @@ impl Acc {
|
||||
}
|
||||
}
|
||||
|
||||
/// [140] Ab diesem Massstab (1:75 und kleiner) gehen dünne geschnittene Schichten in der Nachbarschicht auf
|
||||
/// (Detail „mittel" ab 1:100 wie die Wände im Grundriss, `walls::thin_layer_targets`); 1:50 zeigt alle.
|
||||
const THIN_MERGE_FROM: f64 = 75.0;
|
||||
|
||||
fn ring_len(r: &[[f64; 2]]) -> f64 {
|
||||
(0..r.len()).map(|i| { let (a, b) = (r[i], r[(i + 1) % r.len()]); hypot2(b[0] - a[0], b[1] - a[1]) }).sum()
|
||||
}
|
||||
|
||||
fn ring_area(r: &[[f64; 2]]) -> f64 {
|
||||
let mut a = 0.0;
|
||||
for i in 0..r.len() {
|
||||
let (p, q) = (r[i], r[(i + 1) % r.len()]);
|
||||
a += p[0] * q[1] - q[0] * p[1];
|
||||
}
|
||||
(a / 2.0).abs()
|
||||
}
|
||||
|
||||
fn ring_bbox(r: &[[f64; 2]]) -> [f64; 4] {
|
||||
r.iter().fold([f64::INFINITY, f64::INFINITY, f64::NEG_INFINITY, f64::NEG_INFINITY], |b, q| [b[0].min(q[0]), b[1].min(q[1]), b[2].max(q[0]), b[3].max(q[1])])
|
||||
}
|
||||
|
||||
/// [140] Dünne Schnitt-Schichten (Putz, Parkett, Trittschall, Folien) bei 1:`scale` zusammenfassen: eine Schicht
|
||||
/// unter [`walls::THIN_LAYER_PAPER_MM`] Papierdicke (Dicke ≈ Fläche / halber Umfang) übernimmt Füllung und
|
||||
/// Schraffur der dickeren Nachbarschicht desselben Bauteils, mit der sie die längste Kante teilt, und wird mit
|
||||
/// ihr zu einer Fläche vereinigt (keine Fuge dazwischen). Unter 1:75 (oder `scale` 0) unverändert.
|
||||
pub fn merge_thin_cuts(cuts: &[Cut], scale: f64) -> Vec<Cut> {
|
||||
if !(scale >= THIN_MERGE_FROM) || !scale.is_finite() {
|
||||
return cuts.to_vec();
|
||||
}
|
||||
let n = cuts.len();
|
||||
let mergeable = |c: &Cut| matches!(c.kind, Kind::Wall | Kind::Slab | Kind::Roof) && c.stair_id.is_none() && c.pts.len() >= 3;
|
||||
let thick: Vec<f64> = cuts.iter().map(|c| { let half = ring_len(&c.pts) / 2.0; if half > 0.0 { ring_area(&c.pts) / half } else { 0.0 } }).collect();
|
||||
let thin: Vec<bool> = (0..n).map(|i| mergeable(&cuts[i]) && thick[i] > 0.0 && thick[i] * 1000.0 / scale < super::walls::THIN_LAYER_PAPER_MM).collect();
|
||||
if !thin.iter().any(|t| *t) {
|
||||
return cuts.to_vec();
|
||||
}
|
||||
let bbox: Vec<[f64; 4]> = cuts.iter().map(|c| ring_bbox(&c.pts)).collect();
|
||||
let same_part = |a: &Cut, b: &Cut| a.kind == b.kind && a.index == b.index && a.source_id == b.source_id;
|
||||
let touch = |i: usize, j: usize| {
|
||||
let (a, b) = (bbox[i], bbox[j]);
|
||||
a[0] <= b[2] + 1e-4 && b[0] <= a[2] + 1e-4 && a[1] <= b[3] + 1e-4 && b[1] <= a[3] + 1e-4
|
||||
};
|
||||
// Gemeinsame Kantenlänge zweier Flächen über die Vereinigung (0, wenn sie nicht zu einer Fläche verschmelzen).
|
||||
let shared = |i: usize, j: usize| -> f64 {
|
||||
let u = crate::polygon_bool::union(&[vec![cuts[i].pts.clone()], vec![cuts[j].pts.clone()]]);
|
||||
if u.len() != 1 || u[0].len() != 1 {
|
||||
return 0.0;
|
||||
}
|
||||
(ring_len(&cuts[i].pts) + ring_len(&cuts[j].pts) - ring_len(&u[0][0])) / 2.0
|
||||
};
|
||||
// Ziel je Fläche; dünne Ketten (dünn an dünn an dick) in wenigen Durchgängen.
|
||||
let mut target: Vec<Option<usize>> = (0..n).map(|i| (!thin[i]).then_some(i)).collect();
|
||||
for _ in 0..3 {
|
||||
let mut changed = false;
|
||||
let open: Vec<usize> = (0..n).filter(|&i| thin[i] && target[i].is_none()).collect();
|
||||
for i in open {
|
||||
let best = (0..n)
|
||||
.filter(|&j| j != i && target[j].is_some() && mergeable(&cuts[j]) && same_part(&cuts[i], &cuts[j]) && touch(i, j))
|
||||
.map(|j| (j, shared(i, j)))
|
||||
.filter(|(_, l)| *l > 1e-4)
|
||||
// Längste gemeinsame Kante; bei gleicher Länge die dickere Schicht (wie `thin_layer_targets`).
|
||||
.max_by(|a, b| {
|
||||
if (a.1 - b.1).abs() <= 1e-3 * a.1.max(b.1) {
|
||||
thick[a.0].total_cmp(&thick[b.0])
|
||||
} else {
|
||||
a.1.total_cmp(&b.1)
|
||||
}
|
||||
});
|
||||
if let Some((j, _)) = best {
|
||||
target[i] = target[j];
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if !changed {
|
||||
break;
|
||||
}
|
||||
}
|
||||
let mut groups: Vec<Vec<usize>> = vec![Vec::new(); n];
|
||||
for i in 0..n {
|
||||
groups[target[i].unwrap_or(i)].push(i);
|
||||
}
|
||||
let mut out = Vec::with_capacity(n);
|
||||
for (t, g) in groups.into_iter().enumerate() {
|
||||
match g.len() {
|
||||
0 => {}
|
||||
1 => out.push(cuts[g[0]].clone()),
|
||||
_ => {
|
||||
let polys: Vec<crate::flat::Polygon> = g.iter().map(|&i| vec![cuts[i].pts.clone()]).collect();
|
||||
let u = crate::polygon_bool::union(&polys);
|
||||
if u.iter().all(|poly| poly.len() == 1) {
|
||||
for poly in u {
|
||||
out.push(Cut { pts: poly.into_iter().next().unwrap_or_default(), nse: None, ..cuts[t].clone() });
|
||||
}
|
||||
} else {
|
||||
// Löcher: Flächen einzeln lassen, nur den Stil der Zielschicht übernehmen.
|
||||
for &i in &g {
|
||||
out.push(Cut { fill: cuts[t].fill.clone(), hatch: cuts[t].hatch.clone(), ..cuts[i].clone() });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// `generateSectionPlan`: Primitive (u → x, Höhe → y) und Ausmass.
|
||||
pub fn section_primitives(out: &Output, mono: bool, hidden_lines: bool, vis: &Visibility) -> (Vec<Primitive>, [f64; 4]) {
|
||||
section_primitives_at(out, mono, hidden_lines, vis, 0.0)
|
||||
}
|
||||
|
||||
/// [`section_primitives`] beim Massstab 1:`scale` (dünne Schichten zusammengefasst, [`merge_thin_cuts`]).
|
||||
pub fn section_primitives_at(out: &Output, mono: bool, hidden_lines: bool, vis: &Visibility, scale: f64) -> (Vec<Primitive>, [f64; 4]) {
|
||||
let merged = merge_thin_cuts(&out.cuts, scale);
|
||||
let mut prims = Vec::new();
|
||||
let mut acc = Acc::new();
|
||||
let shown = |code: &str| vis.visible(code) && vis.render(code);
|
||||
@@ -2283,7 +2394,7 @@ pub fn section_primitives(out: &Output, mono: bool, hidden_lines: bool, vis: &Vi
|
||||
prims.push(q);
|
||||
}
|
||||
}
|
||||
for cp in &out.cuts {
|
||||
for cp in &merged {
|
||||
if cp.pts.len() < 3 {
|
||||
continue;
|
||||
}
|
||||
@@ -2820,7 +2931,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 (mut prims, bounds) = section_primitives(&out, mono, hidden, &vis);
|
||||
let (mut prims, bounds) = section_primitives_at(&out, mono, hidden, &vis, scale);
|
||||
w.post = super::extras::sketch_post(Some(level.sketch), scale);
|
||||
// Strichstärken nach Massstab ([32]) wie im Grundriss.
|
||||
super::extras::scale_line_weights(p, scale, &mut prims);
|
||||
@@ -2994,6 +3105,38 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// [140] Dünne Schichten (Parkett, Putz) im Schnitt ab 1:100 in der Nachbarschicht, 1:50 alle; der
|
||||
/// Umriss der Fläche bleibt gleich (nur die Fuge entfällt).
|
||||
#[test]
|
||||
fn duenne_schnittschichten_je_massstab_zusammengefasst() {
|
||||
let rect = |v0: f64, v1: f64| vec![[0.0, v1], [5.0, v1], [5.0, v0], [0.0, v0]];
|
||||
let mk = |v0: f64, v1: f64, fill: &str| {
|
||||
let mut c = Cut::new(Kind::Slab, 0, rect(v0, v1));
|
||||
c.fill = Some(fill.into());
|
||||
c.source_id = Some("D1".into());
|
||||
c
|
||||
};
|
||||
// Parkett 1 cm, Unterlagsboden 8 cm, Trittschall 2 cm, Beton 22 cm, Putz 1 cm
|
||||
let cuts = vec![mk(0.32, 0.33, "#a"), mk(0.24, 0.32, "#b"), mk(0.22, 0.24, "#c"), mk(0.0, 0.22, "#d"), mk(-0.01, 0.0, "#e")];
|
||||
assert_eq!(merge_thin_cuts(&cuts, 50.0).len(), 5, "1:50: alle Schichten");
|
||||
let m = merge_thin_cuts(&cuts, 100.0);
|
||||
assert_eq!(m.len(), 2, "{:?}", m.iter().map(|c| (c.fill.clone(), ring_bbox(&c.pts))).collect::<Vec<_>>());
|
||||
let total: f64 = m.iter().map(|c| ring_area(&c.pts)).sum();
|
||||
assert!((total - 5.0 * 0.34).abs() < 1e-4, "{total}");
|
||||
let b = m.iter().find(|c| c.fill.as_deref() == Some("#b")).unwrap();
|
||||
let bb = ring_bbox(&b.pts);
|
||||
assert!((bb[1] - 0.24).abs() < 1e-5 && (bb[3] - 0.33).abs() < 1e-5, "Parkett geht im Unterlagsboden auf: {bb:?}");
|
||||
let d = m.iter().find(|c| c.fill.as_deref() == Some("#d")).unwrap();
|
||||
let bd = ring_bbox(&d.pts);
|
||||
assert!((bd[1] + 0.01).abs() < 1e-5 && (bd[3] - 0.24).abs() < 1e-5, "Putz und Trittschall im Beton: {bd:?}");
|
||||
// Trittschall 2 cm = 0.2 mm bei 1:100 → dünn, gleich lange Kanten: zur dickeren Nachbarschicht (Beton).
|
||||
assert!(m.iter().all(|c| c.fill.as_deref() != Some("#c")));
|
||||
// Anderes Bauteil verschmilzt nicht.
|
||||
let mut other = cuts.clone();
|
||||
other[0].source_id = Some("D2".into());
|
||||
assert!(merge_thin_cuts(&other, 100.0).iter().any(|c| c.fill.as_deref() == Some("#a")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn beispiel_schnitt_mit_pick_ids() {
|
||||
let p = sample();
|
||||
|
||||
@@ -187,13 +187,14 @@ pub fn plan_svg(parts: &mut [Part], o: &SvgOptions) -> Option<String> {
|
||||
out.push(String::new());
|
||||
stitch.add(attrs.clone(), run, out.len() - 1);
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
out.push(format!(
|
||||
"<polygon points=\"{pl}\" fill=\"{fill}\" stroke=\"{stroke}\" stroke-width=\"{}\"{}/>",
|
||||
num(f[2] * mm_to_m),
|
||||
op(greyed, opacity(4))
|
||||
));
|
||||
}
|
||||
out.push(format!(
|
||||
"<polygon points=\"{pl}\" fill=\"{fill}\" stroke=\"{stroke}\" stroke-width=\"{}\"{}/>",
|
||||
num(f[2] * mm_to_m),
|
||||
op(greyed, opacity(4))
|
||||
));
|
||||
// [140] Schraffur auch bei Kantenläufen (Wandschichten mit offenen Kanten).
|
||||
if o.hatch && f[3] >= 0.0 {
|
||||
let (_, h, color) = hatches.get(whole(f[3])?)?.clone();
|
||||
if h.pattern != Pattern::None && h.pattern != Pattern::Solid && h.kind != hatch::HatchKind::Image {
|
||||
|
||||
@@ -388,6 +388,8 @@ fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, colo
|
||||
];
|
||||
let b01 = |b: bool| if b { 1.0 } else { 0.0 };
|
||||
let detail_code = match detail {
|
||||
// [140] Übersicht (1:500 und kleiner): Türen ohne Aufschlag-Bogen.
|
||||
Detail::Grob if c.a.scale >= super::domains::OVERVIEW_FROM => -1.0,
|
||||
Detail::Grob => 0.0,
|
||||
Detail::Mittel => 1.0,
|
||||
Detail::Fein => 2.0,
|
||||
|
||||
@@ -241,14 +241,16 @@ pub fn run_bin(p: &Project, name: &str, args: &[f64], text: &str) -> Result<Vec<
|
||||
let a = domains::PlanArgs::parse(args[0], text)?;
|
||||
Ok(drawings::underlay_groups(&domains::Ctx::new(p, &a)).iter().flat_map(|v| v.to_le_bytes()).collect())
|
||||
}
|
||||
// Linien der Zeichnungen `[Massstab, gedimmt, Index…]` (Index in `drawings2d`), mit Override-Regeln.
|
||||
// Linien der Zeichnungen `[Massstab, Schalter, Index…]` (Index in `drawings2d`), mit Override-Regeln;
|
||||
// Schalter: Bit 1 = gedimmt, Bit 2 = Schwarz-Weiss ([140]).
|
||||
("drawingLines", n) if n >= 2 => {
|
||||
let mut a = domains::PlanArgs::parse(1.0, "{}")?;
|
||||
a.scale = args[0];
|
||||
let c = domains::Ctx::new(p, &a);
|
||||
let flags = if args[1].is_finite() && args[1] >= 0.0 { args[1] as u32 } else { 0 };
|
||||
// Strichstärken nach Massstab wie im übrigen Plan.
|
||||
let post = Some(crate::plan::extras::Post { mono: false, lw: crate::plan::extras::line_weight_factor(p, args[0]), sketch: 0.0 }).filter(crate::plan::extras::Post::active);
|
||||
buf_with(post, |sink| drawings::underlay_lines(&c, &args[2..], args[1] != 0.0, sink))
|
||||
let post = Some(crate::plan::extras::Post { mono: flags & 2 != 0, lw: crate::plan::extras::line_weight_factor(p, args[0]), sketch: 0.0 }).filter(crate::plan::extras::Post::active);
|
||||
buf_with(post, |sink| drawings::underlay_lines(&c, &args[2..], flags & 1 != 0, sink))
|
||||
}
|
||||
// Primitive einer Zeichnung (JSON in `text`, ohne Override-Regeln) beim Massstab `args[0]`.
|
||||
("drawingPrims", 1) => {
|
||||
|
||||
@@ -2,24 +2,14 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0.1 0 6.8 7.58564" width="68mm" height="75.85641mm">
|
||||
<rect x="0.1" y="0" width="6.8" height="7.58564" fill="#ffffff"/>
|
||||
<g stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="4">
|
||||
<polygon points="5.8275,4.78564 5.8425,4.78564 5.8425,7.08564 5.8275,7.08564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="5.8425,4.78564 5.9925,4.78564 5.9925,7.08564 5.8425,7.08564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="5.8275,4.78564 5.8275,7.08564 5.9925,7.08564 5.9925,4.78564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="5.8425,1.88564 5.9925,1.88564 5.9925,4.58564 5.8425,4.58564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="6,4.48564 6.1525,4.48564 6.1525,7.08564 6,7.08564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="5.9925,4.78564 6,4.78564 6,7.08564 5.9925,7.08564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="5.9925,4.54564 6,4.54564 6,4.58564 5.9925,4.58564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="6.1525,1.88564 6.1725,1.88564 6.1725,7.08564 6.1525,7.08564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="0.8275,1.88564 0.8475,1.88564 0.8475,7.08564 0.8275,7.08564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="0.8475,4.48564 1,4.48564 1,7.08564 0.8475,7.08564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="1,4.78564 1.0075,4.78564 1.0075,7.08564 1,7.08564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="1,4.54564 1.0075,4.54564 1.0075,4.58564 1,4.58564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="1.0075,4.78564 1.1575,4.78564 1.1575,7.08564 1.0075,7.08564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="5.9925,4.78564 5.9925,7.08564 6.1725,7.08564 6.1725,1.88564 6.1525,1.88564 6.1525,4.48564 6,4.48564 6,4.54564 5.9925,4.54564 5.9925,4.58564 6,4.58564 6,4.78564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="0.8275,1.88564 0.8275,7.08564 1.0075,7.08564 1.0075,4.78564 1,4.78564 1,4.58564 1.0075,4.58564 1.0075,4.54564 1,4.54564 1,4.48564 0.8475,4.48564 0.8475,1.88564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="1.0075,4.78564 1.0075,7.08564 1.1725,7.08564 1.1725,4.78564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="1.0075,1.88564 1.1575,1.88564 1.1575,4.58564 1.0075,4.58564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="1.1575,4.78564 1.1725,4.78564 1.1725,7.08564 1.1575,7.08564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="3.325,4.78564 3.34,4.78564 3.34,7.08564 3.325,7.08564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="3.34,4.78564 3.46,4.78564 3.46,7.08564 3.34,7.08564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="3.325,4.78564 3.325,7.08564 3.475,7.08564 3.475,4.78564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="3.34,4.48564 3.46,4.48564 3.46,4.58564 3.34,4.58564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="3.46,4.78564 3.475,4.78564 3.475,7.08564 3.46,7.08564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="5.8275,1.88564 5.8425,1.88564 5.8425,4.48564 5.8275,4.48564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="5.9925,1.88564 6.1525,1.88564 6.1525,4.48564 5.9925,4.48564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="0.8475,1.88564 1.0075,1.88564 1.0075,4.48564 0.8475,4.48564" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
@@ -34,7 +24,18 @@
|
||||
<polygon points="0.6,0.5 6.4,0.5 6.4,0.73094 0.6,0.73094" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="4.2,5.69897 4.2,5.99364 5.2,5.99364 5.2,5.69897" fill="#f0f0f0" stroke="#1f242c" stroke-width="0.013"/>
|
||||
<polygon points="0.6,0.5 0.6,0.73094 6.4,0.73094 6.4,0.5" fill="none" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<polygon points="0.8275,1.88564 0.8275,7.08564 1.1725,7.08564 1.1725,4.78564 3.325,4.78564 3.325,7.08564 3.475,7.08564 3.475,4.78564 5.8275,4.78564 5.8275,7.08564 6.1725,7.08564 6.1725,1.88564 5.8275,1.88564 5.8275,4.48564 1.1725,4.48564 1.1725,1.88564" fill="none" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<line x1="1.0075" y1="7.08564" x2="1.0075" y2="7.08564" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<polyline points="1.0075,7.08564 1.1725,7.08564 1.1725,4.78564 3.325,4.78564 3.325,7.08564 3.475,7.08564 3.475,4.78564 5.8275,4.78564 5.8275,7.08564 5.9925,7.08564" fill="none" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<line x1="5.9925" y1="7.08564" x2="5.9925" y2="7.08564" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<polyline points="5.9925,7.08564 6.1725,7.08564 6.1725,1.88564 5.8275,1.88564 5.8275,4.48564 1.1725,4.48564 1.1725,1.88564 0.8275,1.88564 0.8275,7.08564 1.0075,7.08564" fill="none" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<line x1="1" y1="4.54564" x2="1" y2="4.54564" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<line x1="1" y1="4.54564" x2="1.0075" y2="4.54564" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<line x1="1.0075" y1="4.54564" x2="1.0075" y2="4.54564" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<line x1="1.0075" y1="4.54564" x2="1" y2="4.54564" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<line x1="5.9925" y1="4.54564" x2="5.9925" y2="4.54564" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<line x1="5.9925" y1="4.54564" x2="6" y2="4.54564" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<line x1="6" y1="4.54564" x2="6" y2="4.54564" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<line x1="6" y1="4.54564" x2="5.9925" y2="4.54564" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<polygon points="4.2,5.69897 4.2,5.99364 5.2,5.99364 5.2,5.69897" fill="none" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<polyline points="5.8275,7.08564 5.4,7.08564 4,7.08564 3.475,7.08564" fill="none" stroke="#2b3039" stroke-width="0.018"/>
|
||||
<line x1="3.325" y1="7.08564" x2="1.1725" y2="7.08564" stroke="#2b3039" stroke-width="0.018"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
+12
-6
@@ -5,10 +5,11 @@
|
||||
// dossier-cli <projekt.obp> info
|
||||
// dossier-cli <projekt.obp> validate
|
||||
// dossier-cli <projekt.obp> migrate [--out neu.obp]
|
||||
// dossier-cli <projekt.obp> plan [--level EG] [--ceiling] [--scale 100] [--sketch] [--hatch] [--format svg|json] [--out eg.svg]
|
||||
// dossier-cli <projekt.obp> plan [--level EG] [--ceiling] [--scale 100] [--sketch] [--hatch] [--color] [--format svg|json] [--out eg.svg]
|
||||
// json = render2d-Szene (planToRenderScene)
|
||||
// dossier-cli <projekt.obp> section <Name> [--sketch] [--hatch] [--out schnitt.svg] (--format json: render2d-Szene)
|
||||
// dossier-cli <projekt.obp> elevation <Name> [--sketch] [--hatch] [--out ansicht.svg] (--sketch: Skizzenstil [67])
|
||||
// dossier-cli <projekt.obp> section <Name> [--sketch] [--hatch] [--color] [--out schnitt.svg] (--format json: render2d-Szene)
|
||||
// dossier-cli <projekt.obp> elevation <Name> [--sketch] [--hatch] [--color] [--out ansicht.svg] (--sketch: Skizzenstil [67])
|
||||
// --color: Darstellung „Farbig" statt Tusche (Standard, [140])
|
||||
// dossier-cli <projekt.obp> 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 <projekt.obp> dxf [--binary] [--scale 100] [--dim-unit cm] [--layout]|dwg|ifc|step|obj|stl|glb|gltf|schedule [--openings|--elements] [--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]
|
||||
@@ -446,6 +447,11 @@ async function importAny(path: string, args: Args): Promise<Project> {
|
||||
return fail(`Eingabeformat nicht unterstützt: .${ext} (obp, dxf, dwg, ifc, pdf, obj, stl, gltf, glb, ply)`);
|
||||
}
|
||||
|
||||
/** [140] Darstellung wie der App-Standard „Tusche" (Schwarz-Weiss); `--color` = „Farbig". */
|
||||
function inkArg(args: Args): boolean {
|
||||
return !(args.flags.has("color") && args.flags.get("color") !== "false");
|
||||
}
|
||||
|
||||
/** `convert <eingabe> <ausgabe>`: Eingabe nach Endung lesen, Ausgabe nach Endung schreiben, dann `--cmd` ausführen. */
|
||||
async function convert(input: string | undefined, output: string | undefined, args: Args): Promise<number> {
|
||||
if (!input || !output) {
|
||||
@@ -606,7 +612,7 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
if (!own) planProject = { ...project, drawingLevels: [...project.drawingLevels, lvl] };
|
||||
}
|
||||
// Massstab geht in die Plan-Erzeugung ein (Bemassung in Papier-mm, Strichstärken nach Massstab).
|
||||
const plan = generatePlan(withSketch(planProject, lvl.id, args), lvl.id, allCodes, undefined, "mittel", false, false, true, scale);
|
||||
const plan = generatePlan(withSketch(planProject, lvl.id, args), lvl.id, allCodes, undefined, "mittel", false, inkArg(args), true, scale);
|
||||
if (args.flags.get("format") === "json") {
|
||||
out(args, JSON.stringify(planToRenderScene(plan, scale)), `${lvl.name}.scene.json`);
|
||||
return 0;
|
||||
@@ -628,9 +634,9 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
const o = await computeSection(sp, lvl);
|
||||
if (!o) fail("keine gültige Schnittlinie");
|
||||
// Wie die App: verdeckte Kanten nach der Ebene, geschnittene Fenster/Türen.
|
||||
plan = generateSectionPlan(o, false, { visibleCodes: allCodes, hiddenLines: lvl.hiddenLines, openings: true, scaleDenominator: scale });
|
||||
plan = generateSectionPlan(o, inkArg(args), { visibleCodes: allCodes, hiddenLines: lvl.hiddenLines, openings: true, scaleDenominator: scale });
|
||||
} else {
|
||||
plan = generateElevationPlan(sp, lvl, { scaleDenominator: scale });
|
||||
plan = generateElevationPlan(sp, lvl, { scaleDenominator: scale, mono: inkArg(args) });
|
||||
if (!plan) fail("keine gültige Ansichtslinie");
|
||||
}
|
||||
if (args.flags.get("format") === "json") {
|
||||
|
||||
@@ -545,7 +545,7 @@ function annotations(): Drawing2D[] {
|
||||
shape: "grid", origin: P(0, 0), angle: 0,
|
||||
a: [{ label: "1", pos: 0 }, { label: "2", pos: 6 }, { label: "3", pos: 10 }, { label: "4", pos: 15 }],
|
||||
b: [{ label: "A", pos: 0 }, { label: "B", pos: 5 }, { label: "C", pos: 10 }],
|
||||
extend: 2.5, bubbles: "both", bubbleMm: 6, levels: ["ug", "eg", "og", "dg"], show3d: true,
|
||||
extend: 2.5, bubbles: "both", levels: ["ug", "eg", "og", "dg"], show3d: true,
|
||||
}, { lineStyleId: "std-ls-strichpunkt" });
|
||||
|
||||
// Assoziative Bemassung: Innenmasse an Wandflächen (Schichtgrenze 0/letzte) und Öffnungsleibungen.
|
||||
|
||||
@@ -523,7 +523,7 @@ export function AttributesPanel() {
|
||||
</span>
|
||||
<span className="attr-key">{t("attr.grid.bubbleMm")}</span>
|
||||
<span className="attr-val">
|
||||
<input className="attr-num" style={{ width: 72 }} type="number" step={0.5} min={2} value={geom.bubbleMm ?? 8}
|
||||
<input className="attr-num" style={{ width: 72 }} type="number" step={0.5} min={2} value={geom.bubbleMm ?? 5}
|
||||
onChange={(e) => { const v = Number(e.target.value); if (Number.isFinite(v) && v >= 2) host.onSetGridProps(drawing.id, { bubbleMm: v }); }} />
|
||||
</span>
|
||||
<span className="attr-key">{t("attr.grid.show3d")}</span>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
viewBox -4.2 0 37.045 17.778
|
||||
bytes 265283
|
||||
viewBox -4.2 0 37.045 17.678
|
||||
bytes 265288
|
||||
circle 4
|
||||
g 1
|
||||
line 615
|
||||
@@ -8,4 +8,4 @@ polyline 68
|
||||
rect 1
|
||||
svg 1
|
||||
text 4
|
||||
hash 18d42b37d5c973f7
|
||||
hash bc4a285700382759
|
||||
@@ -1,5 +1,5 @@
|
||||
viewBox -4 0 23 18
|
||||
bytes 317361
|
||||
bytes 317431
|
||||
circle 14
|
||||
g 1
|
||||
line 3227
|
||||
@@ -8,4 +8,4 @@ polyline 73
|
||||
rect 1
|
||||
svg 1
|
||||
text 36
|
||||
hash b639c8605f1c4c9d
|
||||
hash 008b41292083538c
|
||||
@@ -1,5 +1,5 @@
|
||||
viewBox -4 0 23 18
|
||||
bytes 323049
|
||||
bytes 323091
|
||||
circle 14
|
||||
g 1
|
||||
line 3240
|
||||
@@ -8,4 +8,4 @@ polyline 84
|
||||
rect 1
|
||||
svg 1
|
||||
text 36
|
||||
hash 67469479cfe01b3d
|
||||
hash 92ee43948feacb35
|
||||
@@ -1,5 +1,5 @@
|
||||
viewBox -41.5 0 95 63.6
|
||||
bytes 113333
|
||||
bytes 112696
|
||||
circle 16
|
||||
g 1
|
||||
line 338
|
||||
@@ -8,5 +8,5 @@ polygon 266
|
||||
polyline 126
|
||||
rect 1
|
||||
svg 1
|
||||
text 121
|
||||
hash 1cac5c48dbd17ac3
|
||||
text 115
|
||||
hash 9f8c7f5a07987cc3
|
||||
@@ -1,5 +1,5 @@
|
||||
viewBox -41.5 0 95 63.6
|
||||
bytes 118162
|
||||
bytes 117868
|
||||
circle 16
|
||||
g 1
|
||||
line 349
|
||||
@@ -8,5 +8,5 @@ polygon 266
|
||||
polyline 151
|
||||
rect 1
|
||||
svg 1
|
||||
text 121
|
||||
hash 7c1dabfc3b60dd70
|
||||
text 118
|
||||
hash 8dff669ded19d82b
|
||||
@@ -1,5 +1,5 @@
|
||||
viewBox -4.055 0 25.109 23.11
|
||||
bytes 366491
|
||||
bytes 366321
|
||||
circle 14
|
||||
g 1
|
||||
line 3333
|
||||
@@ -8,5 +8,5 @@ polygon 227
|
||||
polyline 169
|
||||
rect 1
|
||||
svg 1
|
||||
text 91
|
||||
hash 48bd54ad5e8b1c20
|
||||
text 89
|
||||
hash 3e20e7dadb42197b
|
||||
@@ -1,5 +1,5 @@
|
||||
viewBox -4.055 0 25.109 23.11
|
||||
bytes 374934
|
||||
bytes 374960
|
||||
circle 14
|
||||
g 1
|
||||
line 3350
|
||||
@@ -9,4 +9,4 @@ polyline 195
|
||||
rect 1
|
||||
svg 1
|
||||
text 91
|
||||
hash 7bd001e733642672
|
||||
hash 6e48062b617631c7
|
||||
@@ -1,5 +1,5 @@
|
||||
viewBox -10.004 0 31.058 26.958
|
||||
bytes 61153
|
||||
bytes 61113
|
||||
circle 14
|
||||
g 1
|
||||
line 171
|
||||
@@ -8,5 +8,5 @@ polygon 105
|
||||
polyline 77
|
||||
rect 1
|
||||
svg 1
|
||||
text 75
|
||||
hash d31704c307ac309d
|
||||
text 74
|
||||
hash c64f09735f82df1e
|
||||
@@ -1,5 +1,5 @@
|
||||
viewBox -10.004 0 31.058 26.958
|
||||
bytes 62007
|
||||
bytes 62033
|
||||
circle 14
|
||||
g 1
|
||||
line 173
|
||||
@@ -9,4 +9,4 @@ polyline 80
|
||||
rect 1
|
||||
svg 1
|
||||
text 75
|
||||
hash eba7b491c822b768
|
||||
hash 47cb320915d63e7a
|
||||
@@ -1,11 +1,11 @@
|
||||
viewBox 4.457 0 21.343 17.778
|
||||
bytes 41694
|
||||
viewBox 4.457 0 21.343 17.678
|
||||
bytes 36282
|
||||
circle 3
|
||||
g 1
|
||||
line 96
|
||||
polygon 186
|
||||
polyline 13
|
||||
line 105
|
||||
polygon 136
|
||||
polyline 14
|
||||
rect 1
|
||||
svg 1
|
||||
text 3
|
||||
hash 471491b0c51f190a
|
||||
hash ff9a1be90fae7d83
|
||||
@@ -1,9 +1,9 @@
|
||||
viewBox 0.1 0 6.8 7.586
|
||||
bytes 6668
|
||||
bytes 6662
|
||||
g 1
|
||||
line 21
|
||||
polygon 34
|
||||
polyline 4
|
||||
line 31
|
||||
polygon 23
|
||||
polyline 6
|
||||
rect 1
|
||||
svg 1
|
||||
hash 8ce8b71fc217069c
|
||||
hash 68fbe08143832562
|
||||
@@ -224,7 +224,7 @@ describe("generatePlan — Luftbild (ContextImage)", () => {
|
||||
expect(plan.backgroundImages![0].filters).toBeUndefined();
|
||||
});
|
||||
|
||||
it("im Mono-Modus wird das Luftbild ausgeblendet (reiner S/W-Plan)", () => {
|
||||
it("[140] auch im Schwarz-Weiss-Modus (Tusche-Standard) bleibt das Luftbild", () => {
|
||||
const p = projectWith([
|
||||
{
|
||||
id: "IMG1",
|
||||
@@ -236,7 +236,7 @@ describe("generatePlan — Luftbild (ContextImage)", () => {
|
||||
},
|
||||
]);
|
||||
const plan = generatePlan(p, "eg", visible, undefined, "mittel", false, true);
|
||||
expect(plan.backgroundImages).toHaveLength(0);
|
||||
expect(plan.backgroundImages).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -171,13 +171,23 @@ describe("generatePlan — Opening.detailLevel (Per-Element-Übersteuerung der A
|
||||
(pr) => pr.kind === "arc",
|
||||
).length;
|
||||
|
||||
/** Anschlagstriche der Tür (cls "door-frame", nur Detailgrad fein). */
|
||||
const doorRevealCount = (opening: Opening, viewDetail: "grob" | "mittel" | "fein") =>
|
||||
generatePlan(projectWithOpening(opening), "eg", visible, undefined, viewDetail).primitives.filter(
|
||||
(pr) => pr.kind === "line" && pr.cls === "door-frame",
|
||||
).length;
|
||||
|
||||
it("ohne detailLevel gilt weiterhin die Ansichts-Detailstufe (rückwärtskompatibel)", () => {
|
||||
expect(doorArcCount(baseDoor, "grob")).toBe(0); // grob: kein Schwenkbogen
|
||||
expect(doorArcCount(baseDoor, "mittel")).toBe(1); // mittel+: Schwenkbogen
|
||||
// [140] grob (auch automatisch ab 1:200) mit Schwenkbogen, erst 1:500 ohne.
|
||||
expect(doorArcCount(baseDoor, "grob")).toBe(1);
|
||||
expect(doorArcCount(baseDoor, "mittel")).toBe(1);
|
||||
expect(generatePlan(projectWithOpening(baseDoor), "eg", visible, undefined, "grob", false, false, true, 500).primitives.filter((pr) => pr.kind === "arc").length).toBe(0);
|
||||
expect(doorRevealCount(baseDoor, "fein")).toBe(2);
|
||||
expect(doorRevealCount(baseDoor, "mittel")).toBe(0);
|
||||
});
|
||||
|
||||
it("detailLevel='grob' unterdrückt den Schwenkbogen, AUCH wenn die Ansicht 'fein' zeigt", () => {
|
||||
expect(doorArcCount({ ...baseDoor, detailLevel: "grob" }, "fein")).toBe(0);
|
||||
it("detailLevel='grob' zeichnet grob (ohne Anschlagstriche), AUCH wenn die Ansicht 'fein' zeigt", () => {
|
||||
expect(doorRevealCount({ ...baseDoor, detailLevel: "grob" }, "fein")).toBe(0);
|
||||
});
|
||||
|
||||
it("detailLevel='fein' zeigt den Schwenkbogen, AUCH wenn die Ansicht 'grob' zeigt", () => {
|
||||
@@ -199,6 +209,6 @@ describe("generatePlan — Opening.detailLevel (Per-Element-Übersteuerung der A
|
||||
const doorPlain: Opening = { ...baseDoor, id: "T2", position: 3.0 };
|
||||
const p: Project = { ...projectWithOpening(doorFein), walls: [wall], openings: [doorFein, doorPlain] };
|
||||
const plan = generatePlan(p, "eg", visible, undefined, "grob");
|
||||
expect(plan.primitives.filter((pr) => pr.kind === "arc").length).toBe(1);
|
||||
expect(plan.primitives.filter((pr) => pr.kind === "line" && pr.cls === "door-frame").length).toBe(2);
|
||||
});
|
||||
});
|
||||
@@ -243,11 +243,11 @@ export function generatePlan(
|
||||
/**
|
||||
* Kompakte Linien-Unterlage statt dauerhafter 'line'-Primitive (s.
|
||||
* {@link UnderlayGroup}) — NUR für die interaktive GPU-Ansicht. Aus bei
|
||||
* Export/mono (reiner Schwarz-Weiss-Plan ohne Unterlage).
|
||||
* Export/Druck.
|
||||
*/
|
||||
compactUnderlay = false,
|
||||
): Plan {
|
||||
const compact = compactUnderlay && !mono && !forPrint;
|
||||
const compact = compactUnderlay && !forPrint;
|
||||
// Blatt-Ebene eines Layouts (Papier 1:1): ohne projektglobale Zutaten (Kontext, Luftbilder,
|
||||
// Schnittlinien, Schatten, Baurecht) — die gehören zum Modell, nicht aufs Papier.
|
||||
if (project.drawingLevels.some((l) => l.id === floorId && l.layoutId)) includeGlobal = false;
|
||||
@@ -275,12 +275,12 @@ export function generatePlan(
|
||||
// Kompakte Linien-Unterlage (s. {@link UnderlayGroup}): die Linien einfacher Zeichnungen fehlen
|
||||
// im Puffer und entstehen erst bei Bedarf, PRO KATEGORIE gruppiert — das Ein-/Ausblenden einer
|
||||
// Ebene entfernt dann nur deren Gruppe, die Chunks aller anderen Ebenen bleiben gültig.
|
||||
const underlay = compact ? underlayGroups(project, dom, scaleDenominator) : [];
|
||||
const underlay = compact ? underlayGroups(project, dom, scaleDenominator, mono) : [];
|
||||
|
||||
// Georeferenzierte Luftbilder als Hintergrund-Ebenen (nur interaktive Ansicht,
|
||||
// nicht Teil der Vektor-Primitive) — im Mono-Modus ausgeblendet (reiner S/W-Plan).
|
||||
// nicht Teil der Vektor-Primitive) — auch in Schwarz-Weiss, dem Standard ([140]).
|
||||
// Projektglobal (nicht je Geschoss), s. `includeGlobal` oben.
|
||||
const backgroundImages: PlanImage[] = !includeGlobal || mono
|
||||
const backgroundImages: PlanImage[] = !includeGlobal
|
||||
? []
|
||||
: (project.context ?? [])
|
||||
.filter((o): o is Extract<ContextObject, { type: "image" }> => o.type === "image")
|
||||
@@ -599,7 +599,7 @@ function readPlanMulti(
|
||||
* Domäne der 2D-Zeichnungen): je (gedimmt, Ebene) die Zeichnungen, deren Linien der Plan-Puffer
|
||||
* nicht enthält. `build` holt die Linien einer Teilmenge bei Bedarf (`drawingLines`).
|
||||
*/
|
||||
function underlayGroups(project: Project, dom: DomainPrims, scaleDenominator: number): UnderlayGroup[] {
|
||||
function underlayGroups(project: Project, dom: DomainPrims, scaleDenominator: number, mono: boolean): UnderlayGroup[] {
|
||||
const bytes = documentFor(project).queryBin("drawingUnderlay", [1], dom.args);
|
||||
if (bytes.byteLength % 8 !== 0) throw new Error("drawingUnderlay: unerwartete Antwort");
|
||||
const f = new Float64Array(bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength));
|
||||
@@ -614,7 +614,7 @@ function underlayGroups(project: Project, dom: DomainPrims, scaleDenominator: nu
|
||||
return index.get(d);
|
||||
};
|
||||
// Alles, wovon `build` abhängt: ändert sich eine davon, werden die GPU-Chunks neu erzeugt.
|
||||
const ctx = [project.lineStyles, project.hatches, layersStyleSig(project.layers), scaleDenominator, project.overrideRules, project.scaleLineWeights];
|
||||
const ctx = [project.lineStyles, project.hatches, layersStyleSig(project.layers), scaleDenominator, project.overrideRules, project.scaleLineWeights, mono];
|
||||
const out: UnderlayGroup[] = [];
|
||||
let k = 1;
|
||||
for (let g = 0; g < f[0]; g++) {
|
||||
@@ -624,7 +624,8 @@ function underlayGroups(project: Project, dom: DomainPrims, scaleDenominator: nu
|
||||
for (let i = 0; i < n; i++) drawings[i] = all[f[k + 2 + i]];
|
||||
k += 2 + n;
|
||||
const buildBuf = (list: Drawing2D[]): DecodedPlanBuf => {
|
||||
const args = [scaleDenominator, catGreyed ? 1 : 0];
|
||||
// Schalter: Bit 1 = gedimmt, Bit 2 = Schwarz-Weiss ([140]).
|
||||
const args = [scaleDenominator, (catGreyed ? 1 : 0) + (mono ? 2 : 0)];
|
||||
for (const d of list) {
|
||||
const i = indexOf(d);
|
||||
if (i !== undefined) args.push(i);
|
||||
|
||||
@@ -80,9 +80,16 @@ describe("kompakte Linien-Unterlage", () => {
|
||||
expect(compact.primitives.some((q) => q.kind === "polygon" && (q as any).drawingId === "filled")).toBe(true);
|
||||
});
|
||||
|
||||
it("mono und Export (forPrint) bleiben beim normalen Pfad", () => {
|
||||
it("Export (forPrint) bleibt beim normalen Pfad; Schwarz-Weiss ([140] Standard) nutzt die Unterlage in Tinte", () => {
|
||||
const p = project(drawings);
|
||||
expect(generatePlan(p, "L1", visible, undefined, "mittel", false, true, true, 100, false, true).underlay).toBeUndefined();
|
||||
const mono = generatePlan(p, "L1", visible, undefined, "mittel", false, true, true, 100, false, true);
|
||||
expect(mono.underlay).toBeDefined();
|
||||
const lines = mono.underlay!.flatMap((g) => g.build(g.drawings));
|
||||
expect(lines.length).toBeGreaterThan(0);
|
||||
// Kategorie „Rot" (61) wird Tinte.
|
||||
expect(JSON.stringify(lines)).not.toContain("#ff0000");
|
||||
const color = generatePlan(p, "L1", visible, undefined, "mittel", false, false, true, 100, false, true);
|
||||
expect(JSON.stringify(color.underlay!.flatMap((g) => g.build(g.drawings)))).toContain("#ff0000");
|
||||
expect(generatePlan(p, "L1", visible, undefined, "mittel", false, false, true, 100, true, true).underlay).toBeUndefined();
|
||||
});
|
||||
|
||||
|
||||
@@ -201,17 +201,18 @@ describe("generatePlan — Verglasung glazingPanes (Item 2)", () => {
|
||||
expect(glassLineCount(p1, "fein")).toBe(0);
|
||||
});
|
||||
|
||||
it("ohne typeId bleibt die alte Detailgrad-Regel (grob/mittel=1, fein=2) unverändert — Regression", () => {
|
||||
it("ohne typeId: mittel=1, fein=2 Glaslinien; grob keine ([140]: zwei Striche in der Wandflucht)", () => {
|
||||
const p = project({ ...baseWindow });
|
||||
expect(glassLineCount(p, "grob")).toBe(1);
|
||||
expect(glassLineCount(p, "grob")).toBe(0);
|
||||
expect(glassLineCount(p, "mittel")).toBe(1);
|
||||
expect(glassLineCount(p, "fein")).toBe(2);
|
||||
});
|
||||
|
||||
it("glazingPanes wirkt bei 'grob' NICHT (bleibt bei 1 Glaslinie)", () => {
|
||||
it("glazingPanes wirkt bei 'grob' NICHT (keine Glaslinie, nur die zwei Striche)", () => {
|
||||
const wt: WindowType = { ...baseWindowType, glazingPanes: 3 };
|
||||
const p = project({ ...baseWindow, typeId: "wt1" }, [wt]);
|
||||
expect(glassLineCount(p, "grob")).toBe(1);
|
||||
expect(glassLineCount(p, "grob")).toBe(0);
|
||||
expect(linesOfClass(p, "window-frame", "grob").length).toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -432,14 +433,15 @@ describe("generatePlan — Linien-Übersteuerung je Kategorie (Opening.frameLine
|
||||
}
|
||||
});
|
||||
|
||||
it("sashLine wirkt auch bei 'grob' (1:100) auf die einzige dort sichtbare Glaslinie", () => {
|
||||
it("frameLine wirkt bei 'grob' (1:100) auf die zwei Striche in der Wandflucht ([140])", () => {
|
||||
const p = project(
|
||||
{ ...baseWindow, typeId: "wt1", sashLine: { color: "#00ff00", weight: 0.3 } },
|
||||
{ ...baseWindow, typeId: "wt1", frameLine: { color: "#00ff00", weight: 0.3 } },
|
||||
[twoSashType],
|
||||
);
|
||||
const g = linesOfClass(p, "window-glass", "grob");
|
||||
expect(g.length).toBe(1);
|
||||
expect(g[0].kind === "line" && g[0].color).toBe("#00ff00");
|
||||
expect(linesOfClass(p, "window-glass", "grob").length).toBe(0);
|
||||
const g = linesOfClass(p, "window-frame", "grob");
|
||||
expect(g.length).toBe(2);
|
||||
expect(g.every((q) => q.kind === "line" && q.color === "#00ff00")).toBe(true);
|
||||
expect(g[0].kind === "line" && g[0].weightMm).toBeCloseTo(0.3, 6);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,8 +41,8 @@ export interface ViewSlice {
|
||||
// nicht im Projekt) und der Abstand je Geschoss in Metern.
|
||||
explode3d: boolean;
|
||||
explode3dGap: number;
|
||||
// Farb-Modus des Grundrisses: "color" = Kategorie-/Element-Farben (heute),
|
||||
// "mono" = reiner Schwarz-Weiss-Plan (Tinte, keine Farb-/Schraffurfarben).
|
||||
// Farb-Modus von Grundriss/Schnitt/Ansicht: "mono" = Tusche (Standard, [140]: Schwarz/Grau, bunte
|
||||
// Farben werden Tinte bzw. Papier, Grautöne wie Schatten bleiben), "color" = „Farbig" (Materialfarben).
|
||||
planColorMode: "color" | "mono";
|
||||
// Wand-Achslinien im Grundriss.
|
||||
referenceLines: boolean;
|
||||
@@ -97,7 +97,7 @@ export function createViewSlice(api: StoreApi<ViewSlice>): ViewSlice {
|
||||
grid3dVisible: true,
|
||||
explode3d: false,
|
||||
explode3dGap: 3,
|
||||
planColorMode: "color",
|
||||
planColorMode: "mono",
|
||||
referenceLines: false,
|
||||
lineMode: "display",
|
||||
scaleDenominator: 100,
|
||||
|
||||
Reference in new issue
Block a user