Merge branch 'worktree-agent-a70a8e4a2bbd76737' into claude/practical-noether-1hb2s1
# Conflicts: # TODO.md
This commit is contained in:
32 files changed
+1695
-347
No files matched your search
@@ -3564,6 +3564,59 @@ Format · [90] Versionsvergleich · [91] Assistent · [92] Speckle.
|
||||
Öffnungen 35/46 (76 %) → 40/46 (87 %) (alle 5 Schiebe-/Hebeschiebetüren), Drehtüren mit Anschlag/Aufschlag 15/15,
|
||||
Stützen 1/1 (UG; Carport-Pfosten 12 cm unter 15 cm), Wände unverändert 45/57 (Achsen 96 %). Geprüft: cargo test Kern,
|
||||
WASM `--no-opt`, tsc, vitest, CLI + Chromium-Bild EG vorher/nachher; nur Linux-Container, Knopf nicht in Tauri geklickt.
|
||||
- ◐ **[155] Treppensymbol im Grundriss bereinigt.** (7.11., Befund Musterhaus komplex EG 1:50, Treppenhaus: unter
|
||||
gestrichelten Tritten lag deckungsgleich die volle Kante des Tritt-Vielecks, Wange voll und gestrichelt übereinander,
|
||||
Plattenraster durch die Treppe, Bruchlinie als zwei Querstriche neben der Trittkante; Wendel: Trittkanten als Sehnen auf
|
||||
dem Aussenbogen und 12-Eck des Auges über dem Innenbogen; OG ohne Spur der ankommenden Treppe.) `plan/stair_symbol.rs`
|
||||
neu aufgebaut: keine Tritt-/Podest-Vielecke mehr (nur eine unsichtbare Pick-Fläche = Grundfläche), jede Kante genau
|
||||
einmal (Aussenlinie vor Trittkanten vor Podestkanten, deckungsgleiche Stücke entfallen); das erste Element über der
|
||||
Schnitthöhe (Tritt oder Podest) trägt die **Bruchlinie** quer über den Lauf mit Zickzack in der Mitte (Wendel radial auf
|
||||
der Trittmitte, Podest einen halben Auftritt hinter der Antrittskante); Wange, Tritt-/Podestkanten und Handlauf ([151])
|
||||
sind davor ausgezogen, dahinter gestrichelt — dieselbe geometrische Teilung für alle (Handlauf vorher nach Gehhöhe;
|
||||
`stair_rail::plan_pieces` → `plan_path`). Wendel: Trittkanten radial, Innen-/Aussenbogen an der Bruchlinie geteilt
|
||||
(Bogen-Kodierung mit Strich-Flag, 10 Zahlen). **Linienhierarchie** relativ zur Kategorie (Treppen 0.18 @1:100): Tritte,
|
||||
Podest, Lauflinie, Pfeil 0.1, Umriss/Wange und Bruchlinie 0.13 (`TREAD_FACTOR`/`OUTLINE_FACTOR`); Pfeilflügel als ein
|
||||
Zug über die Spitze, Lauflinie endet in der Spitze. **Belag:** Treppen des Geschosses sparen das Bodenbelag-Muster aus
|
||||
(`stair_symbol::footprint`, `surface_pattern::clip_outside_poly`). **Eigene Decke über der Schnittebene deckt nicht
|
||||
mehr** (Füllung/Schraffur nur noch über Regeln): vorher verdeckte sie den Bodenbelag überall ausser im Treppenloch —
|
||||
der Belag erscheint jetzt in allen Räumen von EG/OG (Musterhaus komplex: Parkett/Platten), wie bisher schon im DG.
|
||||
**Treppenloch oben:** Treppen tieferer Geschosse, die auf dem Geschoss ankommen, erscheinen im Loch der Decke, auf der
|
||||
das Geschoss steht (ausgezogen, auf das Loch beschnitten, ohne Bruchlinie, mit Handlauf), dazu die **Absturzsicherung**
|
||||
(`stair-guard`, 0.1 mm, 4 cm auf der Decke, ab 1:50/fein doppelt) an den freien Lochrändern — nicht unter Wänden, nicht
|
||||
an der Austrittskante (15 cm Toleranz). Tests: `keine_deckungsgleichen_linien` (alle Formen, 8 Schnitthöhen, mit/ohne
|
||||
Handlauf, sichtbare Vieleck-Kanten mitgezählt), `vor_der_bruchlinie_voll_dahinter_gestrichelt`, `bruch_auf_dem_podest`,
|
||||
`strichstaerken_tritte_fein_umriss_mittel`, `pfeil_schliesst_an_der_spitze`, `wendel_radiale_trittkanten_und_geteilte_boegen`,
|
||||
`beschnitten_auf_das_loch`, `belag_ausgespart_unter_treppe`, `ankommende_treppe_im_deckenloch_mit_absturzsicherung`,
|
||||
`eigene_decke_ueber_schnitt_deckt_nicht`. Goldens neu (Grundrisse Muster EG, komplex UG–DG, CLI EG). Geprüft: cargo test
|
||||
Kern, WASM (`--no-opt`), tsc, vitest, CLI-SVG Musterhaus komplex EG/OG 1:50/1:100, UG-Wendel und Formen-Testprojekt
|
||||
(U, U mit Mittellauf, gerade mit Podest, L, gerade, Wendel) vorher/nachher in Chromium. **Offen:** Raumstempel weichen
|
||||
den neuen Linien aus (OG 1:100: „O.05 Treppenhaus“ eine Stufe kleiner); Lauflinie bleibt über der Bruchlinie ausgezogen;
|
||||
Absturzsicherung nur im Grundriss (kein Geländer-Bauteil in 3D/IFC am Deckenloch); Ende eines ganz freien Lochrings
|
||||
ohne Gehrung; dichtes Belagsmuster im 1:100 (Musterhaus: Parkett 60×10) ggf. Ausdünnung prüfen; nur Linux, nicht in der
|
||||
Tauri-App/Metal angesehen. · M
|
||||
- ◐ **[156] Bodenbelag-Muster im Grundriss massstabsgerecht.** (7.11., Folge aus [155]: seit die eigene Decke nicht
|
||||
mehr deckt, lag im 1:100 überall dichtes Parkett-/Plattenraster.) Neu `plan/floor_finish.rs`: Belagsmuster
|
||||
automatisch nur ab 1:50 bzw. Detail „fein" (ausdrücklich „grob" nie); 1:100 und gröber ohne. Feld **„Bodenbelag
|
||||
zeigen"** an Ebene und Ansichtsvorlage (`floorFinish`: `off`/`wet`/`all`, Rust-Modell `FloorFinishDisplay`,
|
||||
`gen:types`; Vorlage → Ebene über `LEVEL_KEYS`, CLI `--template`; UI Ressourcen › Ansichtsvorlagen): „aus" nie,
|
||||
„Nassräume" gröber als 1:50 nur Plattenbeläge (Muster „Raster" oder Name Platte/Fliese/Keramik …) beschnitten auf
|
||||
Räume mit Namen Bad/WC/Dusche/Nasszelle/Toilette …, „alle" in jedem Massstab. **Regeln** [33]: neue Bauteilart
|
||||
`floor_finish` (nur Regeln, die sie ausdrücklich nennen, wie Schatten/Gelände): `hide` blendet aus, `hide: false`
|
||||
erzwingt auch im 1:100, Farbe/Stärke/Linientyp. **Strich:** Tusche-grau #8c8c8c, 0.02–0.05 mm (Muster-Stärke
|
||||
geklemmt, Vorgabe 0.035; Regel-Stärke ebenso), Teilung auf dem Papier nicht enger als 1.5 mm (sonst jede 2./4./8.
|
||||
Linie, Verbands-Stossfugen entfallen, noch enger kein Muster). **Aussparungen:** Treppen (schon [155]),
|
||||
Raumstempel-Rechteck (+1 mm Luft; Belag darum nach den Räumen gerechnet, `domains_after`), Blöcke der 2D-Zeichnungen
|
||||
(Möbel/Sanitär, konvexe Hülle, `drawings::block_footprints`) und Körper auf dem Boden (Einbauten, ohne
|
||||
Abzugskörper). Bildschirm = Druck (kein Unterschied nach `forPrint`/`compact`, getestet). Tests:
|
||||
`belag_nur_ab_1_50_oder_fein`, `belag_nassraeume_im_1_100`, `belag_mindestteilung_und_feiner_strich`,
|
||||
`belag_spart_stempel_und_moebel_aus`, `belag_regeln`, `darstellung_je_massstab_und_einstellung`, vitest
|
||||
Ansichtsvorlage → Ebene. Goldens neu (komplex Grundrisse EG/OG/DG 1:100 ohne Belag, 1:50 feiner/ausgespart; CLI-Golden
|
||||
unverändert). Geprüft: cargo test Kern, WASM (`--no-opt`), tsc, vitest, CLI-SVG Musterhaus komplex EG 1:100/1:50
|
||||
und 1:100 mit „Nassräume" in Chromium. **Offen:** Nassraum-Erkennung nur nach Name (kein Nutzungs-/Belagsfeld am
|
||||
Raum; Belag hängt an der Decke, nicht am Raum — Bad mit Parkett-Decke zeigt im Nassraum-Modus nichts); Möbel nur als
|
||||
Blöcke/Körper (geschlossene 2D-Formen der Kategorie „Möbel" sparen nicht aus); Deckenspiegel-Untersicht unverändert
|
||||
(0.1 mm, alte Ausdünnung); Level-Feld nur über Ansichtsvorlage einstellbar (kein eigenes Feld im Ebenen-Panel); nur
|
||||
Linux, nicht in der Tauri-App/Metal angesehen. · S
|
||||
- ◐ **[68] Baugrube / Geländebearbeitung.** (30.10.) Kontext-Objekt `excavation` (Rust-Modell, `ContextObject`):
|
||||
Sohle (`outline`, `bottom` m ±0.00), Böschung `slope` (Standard 45°, je Kante `edgeSlopes`), Schüttung `fillSlope`
|
||||
(33.7°), Bermen `bermWidth`/`bermHeight`. Neues Gelände = clamp(t, b − d·tan β, b + H(d)) mit d = Abstand zum
|
||||
|
||||
@@ -1852,6 +1852,10 @@ pub struct DrawingLevel {
|
||||
#[serde(rename = "cutHatch", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub cut_hatch: Option<bool>,
|
||||
/// [156] Bodenbelag-Muster im Grundriss: fehlt = automatisch (ab 1:50 bzw. Detail „fein" alle, gröber keine).
|
||||
#[serde(rename = "floorFinish", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub floor_finish: Option<FloorFinishDisplay>,
|
||||
/// Grundriss-Unterlage (nur Schnitt/Ansicht): ID eines Geschosses, dessen
|
||||
/// Grundriss AUSGERICHTET unter dem Schnitt/der Ansicht gezeigt wird (Schnitt-
|
||||
/// linie waagrecht, Blickrichtung nach oben, s. Kern `plan/underlay.rs`).
|
||||
@@ -1951,6 +1955,10 @@ pub struct ViewTemplate {
|
||||
#[serde(rename = "cutHatch", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub cut_hatch: Option<bool>,
|
||||
/// [156] Bodenbelag-Muster im Grundriss (s. `DrawingLevel::floor_finish`).
|
||||
#[serde(rename = "floorFinish", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub floor_finish: Option<FloorFinishDisplay>,
|
||||
/// Strichstärken mit dem Massstab skalieren.
|
||||
#[serde(rename = "scaleLineWeights", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
@@ -2882,6 +2890,22 @@ pub enum DetailLevel {
|
||||
Unknown,
|
||||
}
|
||||
|
||||
/// [156] Bodenbelag-Muster im Grundriss (Ansichtsvorlage/Ebene): „aus" nie, „Nassräume" ab 1:50/„fein"
|
||||
/// alle und gröber nur Plattenbeläge in Nassräumen (Bad/WC/Dusche), „alle" in jedem Massstab.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize, TS)]
|
||||
pub enum FloorFinishDisplay {
|
||||
#[default]
|
||||
#[serde(rename = "off")]
|
||||
Off,
|
||||
#[serde(rename = "wet")]
|
||||
Wet,
|
||||
#[serde(rename = "all")]
|
||||
All,
|
||||
#[serde(other)]
|
||||
#[ts(skip)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
/// Optionale Farb-/Strichstärke-Übersteuerung einer Linien-Kategorie im Grundriss.
|
||||
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize, TS)]
|
||||
#[serde(default)]
|
||||
|
||||
@@ -343,31 +343,87 @@ pub(super) fn view_hatch_override(p: &Project, o: Option<&overrides::LayerAction
|
||||
|
||||
/// Bodenbeläge ([100]): Ansichtsmuster der obersten Schicht der Decke, auf der das Geschoss steht (OK
|
||||
/// Decke zwischen 0.3 m unter dem Geschossboden und der Schnitthöhe) — von oben gesehen, unter Wänden
|
||||
/// und Räumen gezeichnet.
|
||||
fn floor_finishes(c: &Ctx, out: &mut Vec<Primitive>) {
|
||||
/// und Räumen gezeichnet. [156] Massstabsgerecht (`floor_finish`): automatisch erst ab 1:50/„fein",
|
||||
/// Einstellung der Ebene (`floorFinish`), Regeln der Bauteilart „floor_finish"; spart Treppen, Möbel/
|
||||
/// Einbauten und die Raumstempel `rooms` (schon gesetzt) aus.
|
||||
fn floor_finishes(c: &Ctx, rooms: &[Primitive], out: &mut Vec<Primitive>) {
|
||||
use super::floor_finish as ff;
|
||||
let p = c.p;
|
||||
let base = p.floor(&c.a.floor).and_then(|f| f.base_elevation).unwrap_or(0.0);
|
||||
let cut = super::extras::cut_z(p, &c.a.floor);
|
||||
for ce in p.ceilings.as_deref().unwrap_or(&[]).iter().filter(|x| c.vis(&x.category_code, &x.id)) {
|
||||
let top = p.ceiling_vertical_extent(ce).1;
|
||||
if !(top >= base - 0.3 && top <= cut) {
|
||||
continue;
|
||||
}
|
||||
let setting = p.floor(&c.a.floor).and_then(|l| l.floor_finish);
|
||||
let mode = ff::show(setting, c.a.detail, c.a.scale);
|
||||
let ceilings: Vec<&Ceiling> = {
|
||||
let base = p.floor(&c.a.floor).and_then(|f| f.base_elevation).unwrap_or(0.0);
|
||||
let cut = super::extras::cut_z(p, &c.a.floor);
|
||||
p.ceilings
|
||||
.as_deref()
|
||||
.unwrap_or(&[])
|
||||
.iter()
|
||||
.filter(|x| c.vis(&x.category_code, &x.id))
|
||||
.filter(|ce| {
|
||||
let top = p.ceiling_vertical_extent(ce).1;
|
||||
top >= base - 0.3 && top <= cut
|
||||
})
|
||||
.collect()
|
||||
};
|
||||
if ceilings.is_empty() {
|
||||
return;
|
||||
}
|
||||
// Aussparungen und Nassräume erst rechnen, wenn ein Belag gezeichnet wird.
|
||||
let mut excl: Option<Vec<Vec<[f64; 2]>>> = None;
|
||||
let mut wet: Option<Vec<Vec<[f64; 2]>>> = None;
|
||||
for ce in ceilings {
|
||||
// [33] Schicht-Override mit eigener Schraffur bzw. ohne Muster: kein Belagsmuster.
|
||||
if view_hatch_override(p, ceiling_view_override(c, ce, true).as_ref(), no_hatch()).1 {
|
||||
continue;
|
||||
}
|
||||
let Some((segs, w, ink)) = crate::surface_pattern3d::floor_finish_segments(p, ce, c.a.scale) else { continue };
|
||||
let Some((segs, w, ink, comp)) = crate::surface_pattern3d::floor_finish_segments(p, ce, c.a.scale) else { continue };
|
||||
// [156] Regeln der Bauteilart „floor_finish": ausblenden, erzwingen (`hide: false`), Farbe/Stärke.
|
||||
let ov = c.overrides(Some("floor_finish"), &ce.category_code, Some(&comp.name));
|
||||
let mode = match ov.hide {
|
||||
Some(true) => ff::Show::Off,
|
||||
Some(false) => ff::Show::All,
|
||||
None => mode,
|
||||
};
|
||||
let segs = match mode {
|
||||
ff::Show::Off => continue,
|
||||
ff::Show::All => segs,
|
||||
ff::Show::Wet => {
|
||||
if !ff::is_tile(comp) {
|
||||
continue;
|
||||
}
|
||||
ff::clip_inside_any(&segs, wet.get_or_insert_with(|| ff::wet_rooms(c)))
|
||||
}
|
||||
};
|
||||
if segs.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let excl = excl.get_or_insert_with(|| {
|
||||
// [155] Treppen des Geschosses stehen auf dem Belag: ihre Grundfläche spart ihn aus.
|
||||
let mut v: Vec<Vec<[f64; 2]>> = p
|
||||
.stairs
|
||||
.as_deref()
|
||||
.unwrap_or(&[])
|
||||
.iter()
|
||||
.filter(|s| s.floor_id == c.a.floor && c.vis(&s.category_code, &s.id))
|
||||
.filter_map(|s| crate::stair::decode_params(&s.encode()))
|
||||
.flat_map(|sp| super::stair_symbol::footprint(&sp))
|
||||
.collect();
|
||||
v.extend(ff::exclusions(c, rooms));
|
||||
v
|
||||
});
|
||||
let segs = ff::clip_outside_all(segs, excl);
|
||||
let w = ov.lineweight.map_or(w, |x| ff::weight(Some(x)));
|
||||
let ink = ov.color.unwrap_or(ink);
|
||||
let dash = overrides::linetype_dash(p, ov.linetype_id.as_deref());
|
||||
let greyed = Some(c.greyed(&ce.category_code));
|
||||
for (a, b) in segs {
|
||||
out.push(line(pv(a), pv(b), "floor-finish-pattern", w, None, &ink, greyed));
|
||||
out.push(line(pv(a), pv(b), "floor-finish-pattern", w, dash.clone(), &ink, greyed));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn ceilings(c: &Ctx, out: &mut Vec<Primitive>, bounds: &mut Bounds) -> Result<(), String> {
|
||||
let p = c.p;
|
||||
floor_finishes(c, out);
|
||||
let range = super::view_range::ViewRange::of(p, &c.a.floor);
|
||||
// Ansichtsbereich ([36]): Decken anderer Geschosse „über Schnitt“ (bis Oberkante, z. B. Galerie
|
||||
// darüber) bzw. „unter Schnitt“ (bis „darunter sichtbar bis“) kommen dazu.
|
||||
@@ -411,11 +467,15 @@ fn ceilings(c: &Ctx, out: &mut Vec<Primitive>, bounds: &mut Bounds) -> Result<()
|
||||
};
|
||||
let stroke = color.unwrap_or(POCHE_STROKE);
|
||||
let view_hatch_id = resolve_hatch_id(ce.hatch_id.as_deref(), ce.hatch_source, category, comp.and_then(|k| k.view_hatch_id.as_deref()));
|
||||
let hatch = match (c.a.detail != Detail::Grob, comp, view_hatch_id.filter(|s| !s.is_empty())) {
|
||||
// [155] Eigene Decke über der Schnittebene: nur der strichpunktierte Umriss, die Fläche deckt nicht
|
||||
// (sonst verschwänden Bodenbelag und Treppen darunter ausser im Deckenloch); Regeln wirken weiter.
|
||||
let overhead = ce.floor_id == c.a.floor && zone == super::view_range::Zone::Above;
|
||||
let hatch = match (c.a.detail != Detail::Grob && !overhead, comp, view_hatch_id.filter(|s| !s.is_empty())) {
|
||||
(true, Some(k), Some(id)) => resolve_hatch_or_none(p, id, None, resolve_foreground(k, ce.foreground.as_deref(), category, ce.foreground_source)),
|
||||
_ => no_hatch(),
|
||||
};
|
||||
let fill = match comp {
|
||||
_ if overhead => "none".to_string(),
|
||||
Some(k) => resolve_background(k, ce.background.as_deref(), category, ce.background_source).unwrap_or(poche_fill(hatch.pattern)).to_string(),
|
||||
None => "none".to_string(),
|
||||
};
|
||||
@@ -1170,6 +1230,12 @@ fn domains_after(c: &Ctx, out: &mut DomainPrims, bounds: &mut Bounds) {
|
||||
}
|
||||
let obstacles = stamp_obstacles_with(out, drawn);
|
||||
rooms(c, &mut out.rooms, bounds, &obstacles);
|
||||
// [156] Bodenbelag nach den Raumstempeln (spart sie aus), zuunterst in der Gruppe der Decken.
|
||||
let mut finish = Vec::new();
|
||||
floor_finishes(c, &out.rooms, &mut finish);
|
||||
if !finish.is_empty() {
|
||||
out.ceilings.splice(0..0, finish);
|
||||
}
|
||||
}
|
||||
|
||||
/// Reihenfolge der Gruppen im Plan-Puffer der Abfrage `planDomains`: Schatten und Baurecht
|
||||
@@ -1994,6 +2060,256 @@ mod tests {
|
||||
assert_eq!(count("eg"), 0);
|
||||
}
|
||||
|
||||
/// [156] Beispiel mit Belagsmuster auf C1 (Boden des OG) und einem Raum im OG.
|
||||
fn belag_projekt(kind: SurfacePatternKind, spacing: f64, height: f64) -> Project {
|
||||
let mut p = sample();
|
||||
let ce = p.ceilings.as_ref().unwrap()[0].clone();
|
||||
let top = crate::model3d::ceiling_type_ref(&p, &ce).unwrap().2[0].component_id.clone();
|
||||
let c = p.components.iter_mut().find(|c| c.id == top).unwrap();
|
||||
c.surface_pattern = Some(SurfacePattern { kind, spacing, height: Some(height), ..Default::default() });
|
||||
p
|
||||
}
|
||||
|
||||
/// [156] Belagslinien des Grundrisses `floor` (Detail 0/1/2, Massstab, weitere Argumente).
|
||||
fn belag(p: &Project, floor: &str, detail: f64, scale: f64, extra: serde_json::Value) -> Vec<(Vec2, Vec2, f64, String)> {
|
||||
let mut t = serde_json::json!({ "floor": floor, "show": ["30", "40", "50", "60", "20"], "grey": [], "scale": scale });
|
||||
if let (Some(o), Some(e)) = (t.as_object_mut(), extra.as_object()) {
|
||||
o.extend(e.clone());
|
||||
}
|
||||
let r = plan_domains(p, &PlanArgs::parse(detail, &t.to_string()).unwrap()).unwrap();
|
||||
r.ceilings
|
||||
.iter()
|
||||
.filter_map(|q| match q {
|
||||
Primitive::Line { a, b, cls, weight_mm, color, .. } if cls == "floor-finish-pattern" => Some((*a, *b, *weight_mm, color.clone().unwrap_or_default())),
|
||||
_ => None,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn set_finish(p: &mut Project, floor: &str, v: Option<FloorFinishDisplay>) {
|
||||
p.drawing_levels.iter_mut().find(|l| l.id == floor).unwrap().floor_finish = v;
|
||||
}
|
||||
|
||||
/// [156] Belagsmuster automatisch nur ab 1:50 bzw. Detail „fein"; 1:100 ohne, „alle" zeigt es auch dort.
|
||||
#[test]
|
||||
fn belag_nur_ab_1_50_oder_fein() {
|
||||
let mut p = belag_projekt(SurfacePatternKind::Grid, 0.3, 0.3);
|
||||
let none = serde_json::json!({});
|
||||
assert!(belag(&p, "og", 1.0, 50.0, none.clone()).len() > 10);
|
||||
assert!(belag(&p, "og", 1.0, 100.0, none.clone()).is_empty());
|
||||
assert!(belag(&p, "og", 2.0, 100.0, none.clone()).len() > 10, "fein auch im 1:100");
|
||||
assert!(belag(&p, "og", 0.0, 50.0, none.clone()).is_empty(), "ausdrücklich grob");
|
||||
set_finish(&mut p, "og", Some(FloorFinishDisplay::All));
|
||||
assert!(belag(&p, "og", 1.0, 100.0, none.clone()).len() > 10);
|
||||
set_finish(&mut p, "og", Some(FloorFinishDisplay::Off));
|
||||
assert!(belag(&p, "og", 1.0, 50.0, none.clone()).is_empty());
|
||||
// Bildschirm wie Druck (forPrint, kompakte Unterlage).
|
||||
set_finish(&mut p, "og", None);
|
||||
let screen = belag(&p, "og", 1.0, 50.0, serde_json::json!({ "compact": true }));
|
||||
let print = belag(&p, "og", 1.0, 50.0, serde_json::json!({ "forPrint": true }));
|
||||
assert_eq!(screen.len(), print.len());
|
||||
assert!(!screen.is_empty());
|
||||
}
|
||||
|
||||
/// [156] „Nassräume": im 1:100 nur Plattenbeläge, nur in Bad/WC/Dusche; Parkett nicht.
|
||||
#[test]
|
||||
fn belag_nassraeume_im_1_100() {
|
||||
let mut p = belag_projekt(SurfacePatternKind::Grid, 0.3, 0.3);
|
||||
let mut bad = p.rooms.as_ref().unwrap()[0].clone();
|
||||
bad.id = "R-bad".into();
|
||||
bad.floor_id = "og".into();
|
||||
bad.name = "Bad".into();
|
||||
bad.stamp_anchor = Some(Vec2 { x: 4.4, y: 3.6 });
|
||||
bad.boundary = vec![Vec2 { x: 3.0, y: 2.0 }, Vec2 { x: 4.8, y: 2.0 }, Vec2 { x: 4.8, y: 3.8 }, Vec2 { x: 3.0, y: 3.8 }];
|
||||
let mut wohnen = bad.clone();
|
||||
wohnen.id = "R-wohnen".into();
|
||||
wohnen.name = "Wohnen".into();
|
||||
wohnen.stamp_anchor = Some(Vec2 { x: 1.0, y: 1.0 });
|
||||
wohnen.boundary = vec![Vec2 { x: 0.2, y: 0.2 }, Vec2 { x: 2.8, y: 0.2 }, Vec2 { x: 2.8, y: 3.8 }, Vec2 { x: 0.2, y: 3.8 }];
|
||||
p.rooms.as_mut().unwrap().extend([bad.clone(), wohnen]);
|
||||
set_finish(&mut p, "og", Some(FloorFinishDisplay::Wet));
|
||||
let wet = belag(&p, "og", 1.0, 100.0, serde_json::json!({}));
|
||||
assert!(wet.len() >= 4, "{}", wet.len());
|
||||
let ring: Vec<[f64; 2]> = bad.boundary.iter().map(|v| [v.x, v.y]).collect();
|
||||
for (a, b, ..) in &wet {
|
||||
let m = [(a.x + b.x) / 2.0, (a.y + b.y) / 2.0];
|
||||
assert!(crate::surface_pattern::point_in(m, &ring), "Belag ausserhalb des Bads: {a:?}–{b:?}");
|
||||
}
|
||||
// 1:50: alle Räume.
|
||||
assert!(belag(&p, "og", 1.0, 50.0, serde_json::json!({})).len() > wet.len());
|
||||
// Parkett (Verband, kein Plattenname) im Nassraum-Modus: kein Belag im 1:100.
|
||||
let mut q = belag_projekt(SurfacePatternKind::RunningBond, 0.6, 0.1);
|
||||
let ce = q.ceilings.as_ref().unwrap()[0].clone();
|
||||
let top = crate::model3d::ceiling_type_ref(&q, &ce).unwrap().2[0].component_id.clone();
|
||||
let comp = q.components.iter_mut().find(|c| c.id == top).unwrap();
|
||||
comp.name = "Parkett".into();
|
||||
assert!(!super::super::floor_finish::is_tile(comp), "{}", comp.id);
|
||||
q.rooms = p.rooms.clone();
|
||||
set_finish(&mut q, "og", Some(FloorFinishDisplay::Wet));
|
||||
assert!(belag(&q, "og", 1.0, 100.0, serde_json::json!({})).is_empty());
|
||||
assert!(!belag(&q, "og", 1.0, 50.0, serde_json::json!({})).is_empty());
|
||||
}
|
||||
|
||||
/// [156] Teilung auf dem Papier nicht enger als 1.5 mm; Strich fein (0.02–0.05 mm) in Tusche-Grau.
|
||||
#[test]
|
||||
fn belag_mindestteilung_und_feiner_strich() {
|
||||
let p = belag_projekt(SurfacePatternKind::Lines, 0.05, 0.05);
|
||||
let gaps = |scale: f64| {
|
||||
let mut xs: Vec<f64> = belag(&p, "og", 1.0, scale, serde_json::json!({})).iter().filter(|(a, b, ..)| (a.x - b.x).abs() < 1e-9).map(|(a, ..)| a.x).collect();
|
||||
xs.sort_by(f64::total_cmp);
|
||||
xs.dedup_by(|a, b| (*a - *b).abs() < 1e-6);
|
||||
assert!(xs.len() > 3, "{scale}: {xs:?}");
|
||||
xs.windows(2).map(|w| w[1] - w[0]).fold(f64::INFINITY, f64::min)
|
||||
};
|
||||
// 1:20: 5 cm = 2.5 mm auf dem Papier, volle Teilung.
|
||||
assert!((gaps(20.0) - 0.05).abs() < 1e-6);
|
||||
// 1:50: 5 cm = 1 mm → jede 2. Linie (2 mm).
|
||||
let g = gaps(50.0);
|
||||
assert!(g * 1000.0 / 50.0 >= super::super::floor_finish::MIN_PAPER_MM - 1e-9, "{g}");
|
||||
for (_, _, w, color) in belag(&p, "og", 1.0, 50.0, serde_json::json!({})) {
|
||||
assert!((0.02..=0.05).contains(&w), "{w}");
|
||||
assert_eq!(color, super::super::floor_finish::INK);
|
||||
}
|
||||
}
|
||||
|
||||
/// [156] Belag spart Raumstempel und Möbel/Einbauten (Blöcke, Körper) aus.
|
||||
#[test]
|
||||
fn belag_spart_stempel_und_moebel_aus() {
|
||||
let mut p = belag_projekt(SurfacePatternKind::Grid, 0.1, 0.1);
|
||||
let mut r = p.rooms.as_ref().unwrap()[0].clone();
|
||||
r.floor_id = "og".into();
|
||||
r.id = "R-og".into();
|
||||
p.rooms.as_mut().unwrap().push(r);
|
||||
p.block_defs = Some(vec![serde_json::from_value(serde_json::json!({ "id": "tisch", "name": "Tisch", "geom2d": [
|
||||
{ "shape": "rect", "min": {"x": -0.4, "y": -0.4}, "max": {"x": 0.4, "y": 0.4} } ] })).unwrap()]);
|
||||
p.drawings2d.push(serde_json::from_value(serde_json::json!({ "id": "m1", "type": "drawing2d", "levelId": "og", "categoryCode": "20",
|
||||
"geom": {"shape": "block", "blockDefId": "tisch", "at": {"x": 1.0, "y": 1.0}, "rotation": 0} })).unwrap());
|
||||
p.extruded_solids = Some(vec![serde_json::from_value(serde_json::json!({ "id": "kueche", "type": "extrudedSolid", "levelId": "og",
|
||||
"points": [{"x": 3.6, "y": 0.2}, {"x": 4.8, "y": 0.2}, {"x": 4.8, "y": 0.8}, {"x": 3.6, "y": 0.8}], "height": 0.9 })).unwrap()]);
|
||||
let t = serde_json::json!({ "floor": "og", "show": ["30", "60", "20"], "grey": [], "scale": 50 }).to_string();
|
||||
let d = plan_domains(&p, &PlanArgs::parse(1.0, &t).unwrap()).unwrap();
|
||||
let stamp = d.rooms.iter().find_map(|q| match q { Primitive::Text { at, doc, extra_lines, base_pt, .. } => Some((*at, stamp_size_m(doc, extra_lines, *base_pt, 50.0))), _ => None }).unwrap();
|
||||
let (at, (w, h)) = stamp;
|
||||
let inside = |m: [f64; 2], x0: f64, y0: f64, x1: f64, y1: f64| m[0] > x0 + 1e-6 && m[0] < x1 - 1e-6 && m[1] > y0 + 1e-6 && m[1] < y1 - 1e-6;
|
||||
let lines = belag(&p, "og", 1.0, 50.0, serde_json::json!({}));
|
||||
assert!(lines.len() > 20);
|
||||
for (a, b, ..) in &lines {
|
||||
for k in 1..10 {
|
||||
let t = k as f64 / 10.0;
|
||||
let m = [a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t];
|
||||
assert!(!inside(m, at.x - w / 2.0, at.y - h / 2.0, at.x + w / 2.0, at.y + h / 2.0), "Belag im Stempel {m:?}");
|
||||
assert!(!inside(m, 0.6, 0.6, 1.4, 1.4), "Belag unter dem Möbel {m:?}");
|
||||
assert!(!inside(m, 3.6, 0.2, 4.8, 0.8), "Belag unter dem Einbau {m:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [156] Override-Regeln der Bauteilart „floor_finish": ausblenden, erzwingen, färben.
|
||||
#[test]
|
||||
fn belag_regeln() {
|
||||
let mut p = belag_projekt(SurfacePatternKind::Grid, 0.3, 0.3);
|
||||
let rule = |actions: serde_json::Value| -> OverrideRule {
|
||||
serde_json::from_value(serde_json::json!({"id": "b", "name": "b", "enabled": true, "condition": {"type": "element_kind", "operator": "equals", "value": "floor_finish"}, "actions": actions})).unwrap()
|
||||
};
|
||||
p.override_rules = Some(vec![rule(serde_json::json!({"hide": true}))]);
|
||||
assert!(belag(&p, "og", 1.0, 50.0, serde_json::json!({})).is_empty());
|
||||
p.override_rules = Some(vec![rule(serde_json::json!({"hide": false, "color": "#336699", "lineweight": 0.5}))]);
|
||||
let l = belag(&p, "og", 1.0, 100.0, serde_json::json!({}));
|
||||
assert!(l.len() > 10);
|
||||
assert!(l.iter().all(|(_, _, w, c)| c == "#336699" && (*w - 0.05).abs() < 1e-12));
|
||||
// Eine allgemeine Regel (Ebene) färbt den Belag nicht.
|
||||
p.override_rules = Some(vec![serde_json::from_value(serde_json::json!({"id": "x", "name": "x", "enabled": true, "condition": {"type": "layer_name", "operator": "not_equals", "value": "zzz"}, "actions": {"color": "#ff0000"}})).unwrap()]);
|
||||
assert!(belag(&p, "og", 1.0, 50.0, serde_json::json!({})).iter().all(|(.., c)| c == super::super::floor_finish::INK));
|
||||
}
|
||||
|
||||
/// [155] Die eigene Decke über der Schnittebene deckt nicht (Bodenbelag und Treppen bleiben sichtbar).
|
||||
#[test]
|
||||
fn eigene_decke_ueber_schnitt_deckt_nicht() {
|
||||
let p = sample();
|
||||
let poly = |floor: &str| {
|
||||
let t = serde_json::json!({ "floor": floor, "show": ["30"], "grey": [], "scale": 50 }).to_string();
|
||||
let r = plan_domains(&p, &PlanArgs::parse(1.0, &t).unwrap()).unwrap();
|
||||
let v = serde_json::to_value(&r.ceilings).unwrap();
|
||||
v.as_array().unwrap().iter().find(|q| q["ceilingId"] == "C1" && q["kind"] == "polygon").map(|q| q["fill"].as_str().unwrap_or("").to_string())
|
||||
};
|
||||
assert_eq!(poly("eg").as_deref(), Some("none"));
|
||||
}
|
||||
|
||||
/// [155] Treppen sparen den Bodenbelag aus: kein Musterstück schneidet die Treppen-Grundfläche.
|
||||
#[test]
|
||||
fn belag_ausgespart_unter_treppe() {
|
||||
let mut p = sample();
|
||||
let ce = p.ceilings.as_ref().unwrap()[0].clone();
|
||||
let top = crate::model3d::ceiling_type_ref(&p, &ce).unwrap().2[0].component_id.clone();
|
||||
let c = p.components.iter_mut().find(|c| c.id == top).unwrap();
|
||||
c.surface_pattern = Some(SurfacePattern { kind: SurfacePatternKind::Grid, spacing: 0.3, height: Some(0.3), ..Default::default() });
|
||||
// Treppe im OG (steht auf C1)
|
||||
let mut st = p.stairs.as_ref().unwrap()[0].clone();
|
||||
st.id = "ST2".into();
|
||||
st.floor_id = "og".into();
|
||||
p.stairs.as_mut().unwrap().push(st.clone());
|
||||
let t = serde_json::json!({ "floor": "og", "show": ["30", "40"], "grey": [], "scale": 50 }).to_string();
|
||||
let r = plan_domains(&p, &PlanArgs::parse(1.0, &t).unwrap()).unwrap();
|
||||
let fp = super::super::stair_symbol::footprint(&crate::stair::decode_params(&st.encode()).unwrap()).remove(0);
|
||||
let mut n = 0;
|
||||
for q in &r.ceilings {
|
||||
if let Primitive::Line { a, b, cls, .. } = q {
|
||||
if cls != "floor-finish-pattern" {
|
||||
continue;
|
||||
}
|
||||
n += 1;
|
||||
for k in 1..10 {
|
||||
let t = k as f64 / 10.0;
|
||||
let m = [a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t];
|
||||
let edge = (0..fp.len()).any(|i| {
|
||||
let (u, w) = (fp[i], fp[(i + 1) % fp.len()]);
|
||||
let d = [w[0] - u[0], w[1] - u[1]];
|
||||
let s = (((m[0] - u[0]) * d[0] + (m[1] - u[1]) * d[1]) / (d[0] * d[0] + d[1] * d[1])).clamp(0.0, 1.0);
|
||||
(m[0] - u[0] - d[0] * s).hypot(m[1] - u[1] - d[1] * s) < 1e-6
|
||||
});
|
||||
assert!(!crate::surface_pattern::point_in(m, &fp) || edge, "Belag in der Treppe: {a:?}–{b:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
assert!(n > 10, "Belag ausserhalb bleibt");
|
||||
}
|
||||
|
||||
/// [155] Treppe aus dem Geschoss darunter im Deckenloch: ausgezogen, auf das Loch beschnitten, mit
|
||||
/// Absturzsicherung an den freien Lochrändern, nicht an der Austrittskante.
|
||||
#[test]
|
||||
fn ankommende_treppe_im_deckenloch_mit_absturzsicherung() {
|
||||
let mut p = sample();
|
||||
// ST1: x 3.2 … 4.2, y 0.4 → 3.6 (Austritt bei y = 3.6); Loch in C1 darüber
|
||||
let hole = vec![Vec2 { x: 3.2, y: 1.6 }, Vec2 { x: 4.2, y: 1.6 }, Vec2 { x: 4.2, y: 3.6 }, Vec2 { x: 3.2, y: 3.6 }];
|
||||
p.ceilings.as_mut().unwrap()[0].openings = Some(vec![hole]);
|
||||
let run = |p: &Project| {
|
||||
let t = serde_json::json!({ "floor": "og", "show": ["30", "40"], "grey": [], "scale": 50 }).to_string();
|
||||
plan_domains(p, &PlanArgs::parse(1.0, &t).unwrap()).unwrap().stairs
|
||||
};
|
||||
let st = run(&p);
|
||||
let lines: Vec<(String, Vec2, Vec2, bool)> = st
|
||||
.iter()
|
||||
.filter_map(|q| match q {
|
||||
Primitive::Line { a, b, cls, dash, stair_id, .. } if stair_id.as_deref() == Some("ST1") => Some((cls.clone(), *a, *b, dash.as_ref().is_some_and(|d| d.is_some()))),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
let sym: Vec<_> = lines.iter().filter(|l| l.0 != "stair-guard").collect();
|
||||
assert!(sym.iter().any(|l| l.0 == "stair-tread"), "Tritte im Loch sichtbar");
|
||||
assert!(sym.iter().all(|l| !l.3), "von oben: alles ausgezogen");
|
||||
assert!(sym.iter().all(|l| l.1.y >= 1.6 - 1e-9 && l.2.y >= 1.6 - 1e-9), "auf das Loch beschnitten");
|
||||
assert!(sym.iter().all(|l| l.0 != "stair-break"));
|
||||
let guard: Vec<_> = lines.iter().filter(|l| l.0 == "stair-guard").collect();
|
||||
assert!(!guard.is_empty(), "Absturzsicherung");
|
||||
// nicht an der Austrittskante (y = 3.6), aber an der Lochkante y = 1.6 (ausserhalb des Lochs)
|
||||
assert!(guard.iter().all(|l| !((l.1.y - 3.6).abs() < 0.1 && (l.2.y - 3.6).abs() < 0.1 && (l.1.x - l.2.x).abs() > 0.2)), "{guard:?}");
|
||||
assert!(guard.iter().any(|l| l.1.y < 1.6 && l.2.y < 1.6 && (l.1.x - l.2.x).abs() > 0.5));
|
||||
// ohne Loch: nichts von ST1 im OG
|
||||
let mut q = p.clone();
|
||||
q.ceilings.as_mut().unwrap()[0].openings = None;
|
||||
assert!(run(&q).iter().all(|x| !matches!(x, Primitive::Line { stair_id, .. } if stair_id.as_deref() == Some("ST1"))));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn puffer_gruppen_wie_domaenen() {
|
||||
let p = sample();
|
||||
|
||||
@@ -1440,6 +1440,33 @@ fn prims_where(c: &Ctx, pred: impl Fn(&Drawing2DGeom) -> bool) -> Vec<Primitive>
|
||||
out.prims
|
||||
}
|
||||
|
||||
/// [156] Grundflächen der gezeichneten Blöcke (Möbel, Sanitär-/Einbau-Symbole) des Geschosses als konvexe
|
||||
/// Hülle ihrer Striche: der Bodenbelag spart sie aus.
|
||||
pub fn block_footprints(c: &Ctx) -> Vec<Vec<[f64; 2]>> {
|
||||
let mut memo = Memo::default();
|
||||
let mut res = Vec::new();
|
||||
for d in c.p.drawings2d.iter().filter(|d| matches!(d.geom, Drawing2DGeom::Block { .. }) && on_floor(c, d)) {
|
||||
let m = memo.get(c, d);
|
||||
if !m.shown {
|
||||
continue;
|
||||
}
|
||||
let mut out = Out::default();
|
||||
let mut sink = Sink::new(Target::Vec(&mut out), Keep::All);
|
||||
if emit(c, d, Attrs::with(d, &m.ov, m.cat), &d.geom, m.greyed, c.a.scale, &mut sink, 0).is_err() {
|
||||
continue;
|
||||
}
|
||||
let mut o = super::stamp_place::Obstacles::default();
|
||||
for q in &out.prims {
|
||||
o.add_prim(q);
|
||||
}
|
||||
let hull = super::floor_finish::convex_hull(o.points());
|
||||
if hull.len() >= 3 {
|
||||
res.push(hull);
|
||||
}
|
||||
}
|
||||
res
|
||||
}
|
||||
|
||||
/// Mittlere Grösse eines Stücks der 2D-Zeichnungen (Elemente) und Obergrenze.
|
||||
const CHUNK_MEAN: u64 = 256;
|
||||
const CHUNK_MAX: usize = 2048;
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
//! [156] Bodenbelag-Muster im Grundriss massstabsgerecht: Parkett, Platten … erst ab 1:50 bzw. Detail
|
||||
//! „fein"; im 1:100 und gröber keine Belagsmuster — ausser die Ebene/Ansichtsvorlage verlangt es
|
||||
//! (`DrawingLevel.floorFinish`: „aus", „Nassräume" = gröber nur Plattenbeläge in Bad/WC/Dusche, „alle").
|
||||
//! Override-Regeln mit Bauteilart „floor_finish" blenden aus (`hide`), erzwingen (`hide: false`) oder
|
||||
//! färben/verstärken. Sichtbares Muster: feine Tusche-graue Linie (0.02–0.05 mm), Teilung auf dem Papier
|
||||
//! nicht dichter als [`MIN_PAPER_MM`] (sonst gröber, s. `surface_pattern::thin_factor`), ausgespart unter
|
||||
//! Treppen, Möbeln/Einbauten (Blöcke, Körper) und Raumstempeln. Bildschirm und Druck gleich (kein
|
||||
//! Unterschied nach `forPrint`/`compact`).
|
||||
|
||||
use super::domains::Ctx;
|
||||
use super::style::Detail;
|
||||
use super::prim::Primitive;
|
||||
use crate::model::{Component, FloorFinishDisplay, Room};
|
||||
|
||||
type P = [f64; 2];
|
||||
|
||||
/// Massstab (1:N), bis zu dem Belagsmuster automatisch gezeichnet werden.
|
||||
pub const FINE_FROM: f64 = 50.0;
|
||||
/// Kleinste Musterteilung auf dem Papier (mm); enger wird ausgedünnt (jede 2./4./8. Linie) oder entfällt.
|
||||
pub const MIN_PAPER_MM: f64 = 1.5;
|
||||
/// Strichstärke des Belagsmusters (Papier-mm): Spanne und Vorgabe.
|
||||
pub const WEIGHT_MIN_MM: f64 = 0.02;
|
||||
pub const WEIGHT_MAX_MM: f64 = 0.05;
|
||||
pub const WEIGHT_MM: f64 = 0.035;
|
||||
/// Tusche-Grau des Belagsmusters (wie die Ansichtsschraffur, [140]).
|
||||
pub const INK: &str = "#8c8c8c";
|
||||
/// Luft um den Raumstempel (Papier-mm), in der kein Belag liegt.
|
||||
const STAMP_MARGIN_MM: f64 = 1.0;
|
||||
|
||||
/// Welche Beläge ein Grundriss zeigt.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum Show {
|
||||
Off,
|
||||
/// Nur Plattenbeläge in Nassräumen.
|
||||
Wet,
|
||||
All,
|
||||
}
|
||||
|
||||
/// Feiner Plan: ab 1:50 (Detail nicht ausdrücklich „grob") oder Detail „fein".
|
||||
pub fn fine(detail: Detail, scale: f64) -> bool {
|
||||
detail == Detail::Fein || (detail != Detail::Grob && scale.is_finite() && scale > 0.0 && scale <= FINE_FROM + 1e-9)
|
||||
}
|
||||
|
||||
/// Belags-Darstellung für die Einstellung der Ebene `setting`, Detail und Massstab.
|
||||
pub fn show(setting: Option<FloorFinishDisplay>, detail: Detail, scale: f64) -> Show {
|
||||
let fine = fine(detail, scale);
|
||||
match setting {
|
||||
Some(FloorFinishDisplay::Off) => Show::Off,
|
||||
Some(FloorFinishDisplay::All) => Show::All,
|
||||
Some(FloorFinishDisplay::Wet) if !fine => Show::Wet,
|
||||
_ if fine => Show::All,
|
||||
_ => Show::Off,
|
||||
}
|
||||
}
|
||||
|
||||
fn has_any(text: &str, words: &[&str]) -> bool {
|
||||
let t = text.to_lowercase();
|
||||
words.iter().any(|w| t.contains(w))
|
||||
}
|
||||
|
||||
/// Nassraum nach Name (auch Stempel-Name): Bad, WC, Dusche, Nasszelle, Toilette, Sanitär …
|
||||
pub fn is_wet_room(r: &Room) -> bool {
|
||||
const WET: [&str; 12] = ["bad", "wc", "dusche", "nasszelle", "toilette", "sanitär", "sanitaer", "waschraum", "bath", "shower", "toilet", "lavabo"];
|
||||
let names = [Some(r.name.as_str()), r.stamp.as_ref().map(|s| s.name.as_str()), r.stamp.as_ref().and_then(|s| s.name_line2.as_deref())];
|
||||
names.into_iter().flatten().any(|n| has_any(n, &WET))
|
||||
}
|
||||
|
||||
/// Plattenbelag: Muster „Raster" oder Baustoff-/Bauteilname mit Platten, Fliesen, Keramik …
|
||||
pub fn is_tile(comp: &Component) -> bool {
|
||||
const TILE: [&str; 6] = ["platte", "fliese", "keramik", "kachel", "feinstein", "tile"];
|
||||
comp.surface_pattern.as_ref().is_some_and(|s| s.kind == crate::model::SurfacePatternKind::Grid) || has_any(&comp.name, &TILE) || has_any(&comp.id, &TILE)
|
||||
}
|
||||
|
||||
/// Strichstärke aus dem Muster (oder einer Regel), auf die Spanne der feinen Tusche gebracht.
|
||||
pub fn weight(w: Option<f64>) -> f64 {
|
||||
w.filter(|w| w.is_finite() && *w > 0.0).map_or(WEIGHT_MM, |w| w.clamp(WEIGHT_MIN_MM, WEIGHT_MAX_MM))
|
||||
}
|
||||
|
||||
/// Massstab für `surface_pattern::segments`, der dessen Ausdünnung (ab `MIN_PAPER_MM` dort) auf
|
||||
/// [`MIN_PAPER_MM`] hebt.
|
||||
pub fn thinning_scale(scale: f64) -> f64 {
|
||||
let s = if scale.is_finite() && scale > 0.0 { scale } else { 100.0 };
|
||||
s * MIN_PAPER_MM / crate::surface_pattern::MIN_PAPER_MM
|
||||
}
|
||||
|
||||
/// Umrisse der Nassräume des Geschosses.
|
||||
pub fn wet_rooms(c: &Ctx) -> Vec<Vec<P>> {
|
||||
c.p.rooms.as_deref().unwrap_or(&[]).iter().filter(|r| r.floor_id == c.a.floor && r.boundary.len() >= 3 && is_wet_room(r)).map(|r| r.boundary.iter().map(|v| [v.x, v.y]).collect()).collect()
|
||||
}
|
||||
|
||||
/// Aussparungen: Raumstempel (Rechteck mit Luft) aus den schon gesetzten Raum-Primitiven, Möbel/Symbole
|
||||
/// (Blöcke der 2D-Zeichnungen, konvexe Hülle) und Körper des Geschosses (Einbauten, ohne Abzugskörper).
|
||||
pub fn exclusions(c: &Ctx, rooms: &[Primitive]) -> Vec<Vec<P>> {
|
||||
let mut out = Vec::new();
|
||||
let margin = STAMP_MARGIN_MM * c.a.scale / 1000.0;
|
||||
for q in rooms {
|
||||
if let Primitive::Text { at, doc, extra_lines, base_pt, room_id: Some(_), .. } = q {
|
||||
let (w, h) = super::domains::stamp_size_m(doc, extra_lines, *base_pt, c.a.scale);
|
||||
let (hw, hh) = (w / 2.0 + margin, h / 2.0 + margin);
|
||||
if hw.is_finite() && hh.is_finite() && hw > 0.0 && hh > 0.0 {
|
||||
out.push(vec![[at.x - hw, at.y - hh], [at.x + hw, at.y - hh], [at.x + hw, at.y + hh], [at.x - hw, at.y + hh]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
out.extend(super::drawings::block_footprints(c));
|
||||
for s in c.p.extruded_solids.as_deref().unwrap_or(&[]) {
|
||||
// Nur Körper, die auf dem Boden stehen (Küchenblock, Einbauschrank), nicht Träger darüber.
|
||||
let on_floor = s.base_offset.unwrap_or(0.0).abs() <= 0.05 && s.height > 0.0;
|
||||
if s.level_id == c.a.floor && on_floor && s.operation.as_deref() != Some("subtract") && s.site_projection != Some(true) && !c.rule_hidden(&s.id) {
|
||||
let ring: Vec<P> = match &s.circle {
|
||||
Some(k) if s.points.len() < 3 => (0..32).map(|i| {
|
||||
let a = i as f64 * std::f64::consts::TAU / 32.0;
|
||||
[k.center.x + k.r * crate::jsnum::cos(a), k.center.y + k.r * crate::jsnum::sin(a)]
|
||||
}).collect(),
|
||||
_ => s.points.iter().map(|v| [v.x, v.y]).collect(),
|
||||
};
|
||||
if ring.len() >= 3 && ring.iter().all(|q| q[0].is_finite() && q[1].is_finite()) {
|
||||
out.push(ring);
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Konvexe Hülle (Monotone Chain), gegen den Uhrzeigersinn, ohne doppelte Punkte.
|
||||
pub fn convex_hull(mut pts: Vec<P>) -> Vec<P> {
|
||||
pts.retain(|q| q[0].is_finite() && q[1].is_finite());
|
||||
pts.sort_by(|a, b| a[0].total_cmp(&b[0]).then(a[1].total_cmp(&b[1])));
|
||||
pts.dedup_by(|a, b| (a[0] - b[0]).abs() < 1e-12 && (a[1] - b[1]).abs() < 1e-12);
|
||||
if pts.len() < 3 {
|
||||
return pts;
|
||||
}
|
||||
let cross = |o: P, a: P, b: P| (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
|
||||
let mut lower: Vec<P> = Vec::new();
|
||||
for &q in &pts {
|
||||
while lower.len() >= 2 && cross(lower[lower.len() - 2], lower[lower.len() - 1], q) <= 0.0 {
|
||||
lower.pop();
|
||||
}
|
||||
lower.push(q);
|
||||
}
|
||||
let mut upper: Vec<P> = Vec::new();
|
||||
for &q in pts.iter().rev() {
|
||||
while upper.len() >= 2 && cross(upper[upper.len() - 2], upper[upper.len() - 1], q) <= 0.0 {
|
||||
upper.pop();
|
||||
}
|
||||
upper.push(q);
|
||||
}
|
||||
lower.pop();
|
||||
upper.pop();
|
||||
lower.extend(upper);
|
||||
lower
|
||||
}
|
||||
|
||||
/// Stücke ausserhalb aller `polys`.
|
||||
pub fn clip_outside_all(mut segs: Vec<(P, P)>, polys: &[Vec<P>]) -> Vec<(P, P)> {
|
||||
for poly in polys {
|
||||
let mut rest = Vec::with_capacity(segs.len());
|
||||
for (a, b) in segs {
|
||||
crate::surface_pattern::clip_outside_poly(a, b, poly, &mut rest);
|
||||
}
|
||||
segs = rest;
|
||||
}
|
||||
segs
|
||||
}
|
||||
|
||||
/// Stücke innerhalb eines der `polys`.
|
||||
pub fn clip_inside_any(segs: &[(P, P)], polys: &[Vec<P>]) -> Vec<(P, P)> {
|
||||
let mut out = Vec::new();
|
||||
for poly in polys.iter().filter(|q| q.len() >= 3) {
|
||||
for &(a, b) in segs {
|
||||
crate::surface_pattern::clip_to_poly(a, b, poly, &mut out);
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn darstellung_je_massstab_und_einstellung() {
|
||||
use FloorFinishDisplay as F;
|
||||
assert_eq!(show(None, Detail::Mittel, 50.0), Show::All);
|
||||
assert_eq!(show(None, Detail::Mittel, 100.0), Show::Off);
|
||||
assert_eq!(show(None, Detail::Fein, 100.0), Show::All);
|
||||
assert_eq!(show(None, Detail::Grob, 50.0), Show::Off);
|
||||
assert_eq!(show(Some(F::Wet), Detail::Mittel, 100.0), Show::Wet);
|
||||
assert_eq!(show(Some(F::Wet), Detail::Mittel, 50.0), Show::All);
|
||||
assert_eq!(show(Some(F::Off), Detail::Fein, 20.0), Show::Off);
|
||||
assert_eq!(show(Some(F::All), Detail::Grob, 200.0), Show::All);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn strichstaerke_feine_tusche() {
|
||||
assert_eq!(weight(None), WEIGHT_MM);
|
||||
assert_eq!(weight(Some(0.25)), WEIGHT_MAX_MM);
|
||||
assert_eq!(weight(Some(0.005)), WEIGHT_MIN_MM);
|
||||
assert_eq!(weight(Some(f64::NAN)), WEIGHT_MM);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn huelle_konvex() {
|
||||
let h = convex_hull(vec![[0.0, 0.0], [1.0, 0.0], [0.5, 0.2], [1.0, 1.0], [0.0, 1.0], [0.5, 0.5]]);
|
||||
assert_eq!(h.len(), 4);
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ pub mod ceiling_plan;
|
||||
pub mod line_ends;
|
||||
pub mod line_pattern;
|
||||
pub mod stamp_place;
|
||||
pub mod floor_finish;
|
||||
pub mod trees;
|
||||
pub mod mesh_plan;
|
||||
pub(crate) mod wall_columns;
|
||||
|
||||
@@ -63,7 +63,8 @@ pub struct Subject<'a> {
|
||||
/// Element-/Typ-Name (Wandtyp, Raum, Öffnungs-Label …).
|
||||
pub object_name: Option<&'a str>,
|
||||
/// [33] Bauteilart: "wall", "slab", "ground_slab", "roof", "stair", "column", "opening", "room", dazu
|
||||
/// [`SPECIAL_KINDS`] "shadow" (Schlagschatten der Ansicht) und "terrain" (Gelände/Höhenlinien).
|
||||
/// [`SPECIAL_KINDS`] "shadow" (Schlagschatten der Ansicht), "terrain" (Gelände/Höhenlinien) und "floor_finish"
|
||||
/// (Bodenbelag-Muster im Grundriss, [156]).
|
||||
pub element_kind: Option<&'a str>,
|
||||
/// [33] Funktion der Schicht ([`function_key`]).
|
||||
pub layer_function: Option<&'a str>,
|
||||
@@ -101,7 +102,7 @@ impl Actions {
|
||||
/// [33] Bauteilarten ohne eigenes Element im Modell (Schlagschatten der Ansicht, Gelände/Höhenlinien): Sie
|
||||
/// folgen nur Regeln, die die Bauteilart ausdrücklich nennen (gleich/enthält/beginnt mit) — sonst würden
|
||||
/// allgemeine Regeln („Ebene ≠ …“, „Bauteilart ≠ Fenster/Tür“) sie plötzlich mitfärben.
|
||||
pub const SPECIAL_KINDS: [&str; 2] = ["shadow", "terrain"];
|
||||
pub const SPECIAL_KINDS: [&str; 3] = ["shadow", "terrain", "floor_finish"];
|
||||
|
||||
/// [33] Wirkt die Regel auf diese Bauteilart? Für [`SPECIAL_KINDS`] nur mit positiver Bauteilart-Bedingung.
|
||||
fn kind_ok(rule: &OverrideRule, s: &Subject) -> bool {
|
||||
|
||||
@@ -1,28 +1,34 @@
|
||||
//! Treppen-Symbol im Grundriss ([K3a]): Tritte, Lauflinie, Pfeil, Podest, SIA-Bruchlinie und
|
||||
//! Aussenlinie als flache Primitivliste. Port von `src/plan/generatePlan/stairs.ts`; die Geometrie
|
||||
//! kommt aus `kernel2d` (`stair_geometry`, `stair_cut`, `stair_outline`), Farbe, Pick-ID und
|
||||
//! Graustufen setzt der Aufrufer (`plan/stairs.rs`, [K3d]).
|
||||
//! kommt aus `kernel2d` (`stair_geometry`, `stair_outline`), Farbe, Pick-ID und Graustufen setzt der
|
||||
//! Aufrufer (`plan/stairs.rs`, [K3d]).
|
||||
//!
|
||||
//! Eingabe: Treppen-Parameter (22 Zahlen, s. `stair.rs`), Gesamt-Steighöhe, Schnitthöhe über der
|
||||
//! Treppen-UK, Strichstärke `lw_mm` (Papier-mm), `filled_arrow` (0/1).
|
||||
//!
|
||||
//! Ausgabe `[n, Eintrag × n]`, Reihenfolge = Zeichenreihenfolge:
|
||||
//! ```text
|
||||
//! 1 polygon [1, strokeMm, gefüllt (0 = nur Umriss, 1 = Füllung in Strichfarbe), nPts, x, y …]
|
||||
//! 1 polygon [1, strokeMm, gefüllt (0 = nur Umriss, 1 = Füllung in Strichfarbe), nPts, x, y …] (strokeMm 0 = unsichtbare Pick-Fläche)
|
||||
//! 2 line [2, cls, weightMm, gestrichelt (0|1), ax, ay, bx, by]
|
||||
//! 3 arc [3, weightMm, cx, cy, fromX, fromY, toX, toY, r] (cls immer stair-outline)
|
||||
//! 3 arc [3, weightMm, gestrichelt (0|1), cx, cy, fromX, fromY, toX, toY, r] (cls immer stair-outline)
|
||||
//! cls 0 stair-outline · 1 stair-tread · 2 stair-break · 3 stair-run · 4 stair-arrow · 5 stair-handrail
|
||||
//! ```
|
||||
//! Gestrichelte Linien tragen das Strichmuster `DASH` (verdeckt, Papier-mm, [153]).
|
||||
//!
|
||||
//! [155] Jede Kante genau einmal: Aussenlinie (Wange) vor Trittkanten vor Podestkanten, deckungsgleiche
|
||||
//! Stücke entfallen (keine Tritt-Vielecke mehr unter den Linien). Das erste Element (Tritt oder Podest)
|
||||
//! über der Schnitthöhe trägt die Bruchlinie (quer, Zickzack in der Mitte); Wange, Kanten und Handlauf
|
||||
//! sind davor ausgezogen, dahinter gestrichelt. Strichstärken relativ zur Kategorie: Tritte, Podest,
|
||||
//! Lauflinie, Pfeil × [`TREAD_FACTOR`], Umriss und Bruchlinie × [`OUTLINE_FACTOR`] (Tusche 0.1 / 0.13 @1:100).
|
||||
//!
|
||||
//! [151] Handlauf (`railing` 0 keiner, 1 links, 2 rechts, 3 beide): Achse aus [`crate::stair_rail`] (wie im
|
||||
//! 3D), unter der Bruchhöhe ausgezogen, darüber gestrichelt; `double` (1:50/fein) zeichnet die beiden
|
||||
//! 3D), vor der Bruchlinie ausgezogen, dahinter gestrichelt; `double` (1:50/fein) zeichnet die beiden
|
||||
//! Rohrkanten statt der Achse. Strichstärke [`HANDRAIL_MM`] (Tusche 0.1 mm).
|
||||
|
||||
use crate::jsnum;
|
||||
use crate::stair::decode_params;
|
||||
use kernel2d::{stair_cut, stair_geometry, stair_outline, Vec2};
|
||||
use std::collections::HashSet;
|
||||
use crate::stair_rail::P;
|
||||
use kernel2d::{stair_geometry, stair_outline, StairGeometry, StairParams, Vec2};
|
||||
|
||||
pub const DASH: [f64; 2] = super::line_pattern::HIDDEN;
|
||||
|
||||
@@ -34,93 +40,413 @@ const CLS_ARROW: f64 = 4.0;
|
||||
const CLS_HANDRAIL: f64 = 5.0;
|
||||
/// Strichstärke des Handlaufs (Papier-mm).
|
||||
pub const HANDRAIL_MM: f64 = 0.1;
|
||||
|
||||
#[derive(Default)]
|
||||
struct Out {
|
||||
buf: Vec<f64>,
|
||||
n: usize,
|
||||
}
|
||||
|
||||
impl Out {
|
||||
fn polygon(&mut self, pts: &[Vec2], stroke_mm: f64, filled: bool) {
|
||||
self.n += 1;
|
||||
self.buf.extend([1.0, stroke_mm, if filled { 1.0 } else { 0.0 }, pts.len() as f64]);
|
||||
for p in pts {
|
||||
self.buf.extend([p.x, p.y]);
|
||||
}
|
||||
}
|
||||
fn line(&mut self, cls: f64, a: Vec2, b: Vec2, weight_mm: f64, dashed: bool) {
|
||||
self.n += 1;
|
||||
self.buf.extend([2.0, cls, weight_mm, if dashed { 1.0 } else { 0.0 }, a.x, a.y, b.x, b.y]);
|
||||
}
|
||||
fn arc(&mut self, weight_mm: f64, c: Vec2, from: Vec2, to: Vec2, r: f64) {
|
||||
self.n += 1;
|
||||
self.buf.extend([3.0, weight_mm, c.x, c.y, from.x, from.y, to.x, to.y, r]);
|
||||
}
|
||||
}
|
||||
/// [155] Linienhierarchie relativ zur Kategorie-Stärke (Standard Treppen 0.18 @1:100): Tritte, Podestkanten,
|
||||
/// Lauflinie und Pfeil 0.1, Umriss/Wange und Bruchlinie 0.13.
|
||||
pub const TREAD_FACTOR: f64 = 0.1 / 0.18;
|
||||
pub const OUTLINE_FACTOR: f64 = 0.13 / 0.18;
|
||||
/// Toleranz für „deckungsgleich" (Meter).
|
||||
const EPS: f64 = 1e-6;
|
||||
|
||||
/// Ecken des Säulenkreises im Grundriss.
|
||||
const COLUMN_SEGMENTS: usize = 48;
|
||||
/// Bogenauflösung der Wendel-Grundfläche (Pick, Belag) und beschnittener Bögen (Radiant je Stück).
|
||||
const ARC_STEP: f64 = std::f64::consts::PI / 90.0;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
enum Item {
|
||||
Polygon { pts: Vec<Vec2>, stroke_mm: f64, filled: bool },
|
||||
Line { cls: f64, a: Vec2, b: Vec2, w: f64, dashed: bool },
|
||||
Arc { w: f64, c: Vec2, r: f64, a0: f64, a1: f64, dashed: bool },
|
||||
}
|
||||
|
||||
fn v(p: P) -> Vec2 {
|
||||
Vec2::new(p[0], p[1])
|
||||
}
|
||||
fn p2(a: Vec2) -> P {
|
||||
[a.x, a.y]
|
||||
}
|
||||
fn sub(a: Vec2, b: Vec2) -> Vec2 {
|
||||
Vec2::new(a.x - b.x, a.y - b.y)
|
||||
}
|
||||
fn add(a: Vec2, b: Vec2) -> Vec2 {
|
||||
Vec2::new(a.x + b.x, a.y + b.y)
|
||||
}
|
||||
fn mul(a: Vec2, s: f64) -> Vec2 {
|
||||
Vec2::new(a.x * s, a.y * s)
|
||||
}
|
||||
fn mid(a: Vec2, b: Vec2) -> Vec2 {
|
||||
Vec2::new((a.x + b.x) / 2.0, (a.y + b.y) / 2.0)
|
||||
}
|
||||
fn cross(a: Vec2, b: Vec2) -> f64 {
|
||||
a.x * b.y - a.y * b.x
|
||||
}
|
||||
fn dot(a: Vec2, b: Vec2) -> f64 {
|
||||
a.x * b.x + a.y * b.y
|
||||
}
|
||||
fn len(a: Vec2) -> f64 {
|
||||
crate::jsmath::hypot2(a.x, a.y)
|
||||
}
|
||||
fn lerp(a: Vec2, b: Vec2, t: f64) -> Vec2 {
|
||||
Vec2::new(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t)
|
||||
}
|
||||
|
||||
/// Abstand Punkt–Strecke.
|
||||
fn dist_seg(m: Vec2, a: Vec2, b: Vec2) -> f64 {
|
||||
let d = sub(b, a);
|
||||
let l2 = dot(d, d);
|
||||
let t = if l2 > 0.0 { (dot(sub(m, a), d) / l2).clamp(0.0, 1.0) } else { 0.0 };
|
||||
len(sub(m, lerp(a, b, t)))
|
||||
}
|
||||
|
||||
fn dist_poly(m: Vec2, poly: &[Vec2]) -> f64 {
|
||||
(0..poly.len()).map(|i| dist_seg(m, poly[i], poly[(i + 1) % poly.len()])).fold(f64::INFINITY, f64::min)
|
||||
}
|
||||
|
||||
/// Schnittparameter t der Strecke a–b mit der Strecke c–d (beide Parameter in [0, 1]).
|
||||
fn seg_hit(a: Vec2, b: Vec2, c: Vec2, d: Vec2) -> Option<f64> {
|
||||
let (r, s) = (sub(b, a), sub(d, c));
|
||||
let den = cross(r, s);
|
||||
if den.abs() < 1e-15 {
|
||||
return None;
|
||||
}
|
||||
let t = cross(sub(c, a), s) / den;
|
||||
let u = cross(sub(c, a), r) / den;
|
||||
((-1e-9..=1.0 + 1e-9).contains(&t) && (-1e-9..=1.0 + 1e-9).contains(&u)).then_some(t.clamp(0.0, 1.0))
|
||||
}
|
||||
|
||||
/// Ein Element der Treppe im Grundriss: Tritt oder Podest mit Oberkante über der Treppen-UK.
|
||||
struct El {
|
||||
poly: Vec<Vec2>,
|
||||
top: f64,
|
||||
}
|
||||
|
||||
/// [155] Bruch: erstes Element über der Schnitthöhe, quer geteilt durch die Bruchlinie `a`–`b`; `up` zeigt
|
||||
/// auf die obere (gestrichelte) Seite, `depth` = Platz längs für das Zickzack.
|
||||
struct Break {
|
||||
el: usize,
|
||||
a: Vec2,
|
||||
b: Vec2,
|
||||
up: Vec2,
|
||||
depth: f64,
|
||||
}
|
||||
|
||||
/// Treppe als Elemente mit Schnitt-Zuordnung: unter der Schnitthöhe ausgezogen, darüber gestrichelt,
|
||||
/// das erste Element darüber durch die Bruchlinie geteilt.
|
||||
struct Layout {
|
||||
els: Vec<El>,
|
||||
cut: f64,
|
||||
brk: Option<Break>,
|
||||
}
|
||||
|
||||
impl Layout {
|
||||
fn new(p: &StairParams, geo: &StairGeometry, cut: f64, spiral_center: Option<Vec2>) -> Layout {
|
||||
let mut els: Vec<El> = geo.treads.iter().filter(|t| t.pts.len() >= 4).map(|t| El { poly: t.pts.clone(), top: t.top_rise }).collect();
|
||||
let n_treads = els.len();
|
||||
let spiral = p.shape == "spiral";
|
||||
if !spiral {
|
||||
for (poly, top) in crate::stair_rail::landings_of(geo) {
|
||||
els.push(El { poly: poly.into_iter().map(v).collect(), top });
|
||||
}
|
||||
}
|
||||
let first = (0..els.len()).filter(|&i| els[i].top > cut + 1e-6).min_by(|&i, &j| els[i].top.total_cmp(&els[j].top));
|
||||
let brk = first.and_then(|i| {
|
||||
if i < n_treads {
|
||||
let q = &els[i].poly;
|
||||
// Gerade Läufe: Ecken 0 links vorn, 1 links hinten, 2 rechts hinten, 3 rechts vorn;
|
||||
// Wendel: 0 innen / 1 aussen am Anfang, 3 innen / 2 aussen am Ende.
|
||||
let (front, back) = if spiral { (mid(q[0], q[1]), mid(q[3], q[2])) } else { (mid(q[0], q[3]), mid(q[1], q[2])) };
|
||||
let (a, b) = match (spiral, spiral_center) {
|
||||
(true, Some(c)) => {
|
||||
// radial auf der Winkelmitte des Tritts
|
||||
let ang = |x: Vec2| jsnum::atan2(x.y - c.y, x.x - c.x);
|
||||
let (t0, t1) = (ang(q[0]), ang(q[3]));
|
||||
let mut dt = t1 - t0;
|
||||
while dt > std::f64::consts::PI {
|
||||
dt -= std::f64::consts::TAU;
|
||||
}
|
||||
while dt < -std::f64::consts::PI {
|
||||
dt += std::f64::consts::TAU;
|
||||
}
|
||||
let tm = t0 + dt / 2.0;
|
||||
let (ri, ro) = (len(sub(q[0], c)), len(sub(q[1], c)));
|
||||
let at = |r: f64| Vec2::new(c.x + r * jsnum::cos(tm), c.y + r * jsnum::sin(tm));
|
||||
(at(ri), at(ro))
|
||||
}
|
||||
_ => (mid(q[0], q[1]), mid(q[3], q[2])),
|
||||
};
|
||||
let d = sub(back, front);
|
||||
let l = len(d);
|
||||
(l > 1e-9).then(|| Break { el: i, a, b, up: mul(d, 1.0 / l), depth: l / 2.0 })
|
||||
} else {
|
||||
// Podest über der Schnitthöhe: Bruch parallel zum Austritt des Laufs davor, einen halben
|
||||
// Auftritt aufs Podest.
|
||||
let prev = (0..n_treads).filter(|&k| els[k].top <= els[i].top).max_by(|&x, &y| els[x].top.total_cmp(&els[y].top))?;
|
||||
let q = &els[prev].poly;
|
||||
let d = sub(mid(q[1], q[2]), mid(q[0], q[3]));
|
||||
let l = len(d);
|
||||
if !(l > 1e-9) {
|
||||
return None;
|
||||
}
|
||||
let up = mul(d, 1.0 / l);
|
||||
let depth = geo.tread_depth.min(l) / 2.0;
|
||||
let off = mul(up, depth);
|
||||
Some(Break { el: i, a: add(q[1], off), b: add(q[2], off), up, depth })
|
||||
}
|
||||
});
|
||||
Layout { els, cut, brk }
|
||||
}
|
||||
|
||||
/// Element, auf dessen Fläche oder Rand `m` liegt (sonst das nächste).
|
||||
fn element_at(&self, m: Vec2) -> Option<usize> {
|
||||
let mut best: Option<(usize, f64)> = None;
|
||||
for (i, e) in self.els.iter().enumerate() {
|
||||
let d = if kernel2d::point_in_polygon(m, &e.poly) { 0.0 } else { dist_poly(m, &e.poly) };
|
||||
if best.map_or(true, |(_, bd)| d < bd - 1e-12) {
|
||||
best = Some((i, d));
|
||||
}
|
||||
}
|
||||
best.map(|b| b.0)
|
||||
}
|
||||
|
||||
/// Gestrichelt (über der Schnitthöhe) an der Stelle `m`.
|
||||
fn dashed_at(&self, m: Vec2) -> bool {
|
||||
let Some(i) = self.element_at(m) else { return false };
|
||||
match &self.brk {
|
||||
Some(b) if b.el == i => dot(sub(m, b.a), b.up) > 0.0,
|
||||
_ => self.els[i].top > self.cut + 1e-6,
|
||||
}
|
||||
}
|
||||
|
||||
/// Strecke a–b an der Bruchlinie (und den Parametern `extra`) teilen, je Stück nach `dashed_at`
|
||||
/// einordnen; gleiche Nachbarn zusammengefasst.
|
||||
fn split(&self, a: Vec2, b: Vec2, extra: &[f64]) -> Vec<(Vec2, Vec2, bool)> {
|
||||
let mut ts = vec![0.0, 1.0];
|
||||
ts.extend_from_slice(extra);
|
||||
if let Some(br) = &self.brk {
|
||||
if let Some(t) = seg_hit(a, b, br.a, br.b) {
|
||||
ts.push(t);
|
||||
}
|
||||
}
|
||||
ts.sort_by(|x, y| x.total_cmp(y));
|
||||
ts.dedup_by(|x, y| (*x - *y).abs() < 1e-9);
|
||||
let mut out: Vec<(Vec2, Vec2, bool)> = Vec::new();
|
||||
for w in ts.windows(2) {
|
||||
let (p, q) = (lerp(a, b, w[0]), lerp(a, b, w[1]));
|
||||
if len(sub(q, p)) < EPS {
|
||||
continue;
|
||||
}
|
||||
let d = self.dashed_at(mid(p, q));
|
||||
match out.last_mut() {
|
||||
Some(last) if last.2 == d => last.1 = q,
|
||||
_ => out.push((p, q, d)),
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
}
|
||||
|
||||
/// Schon gezeichnete Kanten: neue Kanten nur, wo keine deckungsgleiche (auf derselben Geraden) liegt.
|
||||
#[derive(Default)]
|
||||
struct Drawn(Vec<(Vec2, Vec2)>);
|
||||
|
||||
impl Drawn {
|
||||
fn free(&self, a: Vec2, b: Vec2) -> Vec<(Vec2, Vec2)> {
|
||||
let d = sub(b, a);
|
||||
let l = len(d);
|
||||
if !(l > EPS) {
|
||||
return Vec::new();
|
||||
}
|
||||
let u = mul(d, 1.0 / l);
|
||||
let mut cover: Vec<(f64, f64)> = self
|
||||
.0
|
||||
.iter()
|
||||
.filter(|(c, e)| cross(u, sub(*c, a)).abs() < EPS && cross(u, sub(*e, a)).abs() < EPS)
|
||||
.map(|(c, e)| {
|
||||
let (t0, t1) = (dot(sub(*c, a), u) / l, dot(sub(*e, a), u) / l);
|
||||
(t0.min(t1), t0.max(t1))
|
||||
})
|
||||
.filter(|(t0, t1)| *t1 > 1e-9 && *t0 < 1.0 - 1e-9)
|
||||
.collect();
|
||||
cover.sort_by(|x, y| x.0.total_cmp(&y.0));
|
||||
let mut out = Vec::new();
|
||||
let mut t = 0.0;
|
||||
for (t0, t1) in cover {
|
||||
if t0 > t {
|
||||
out.push((t, t0.min(1.0)));
|
||||
}
|
||||
t = f64::max(t, t1);
|
||||
}
|
||||
if t < 1.0 {
|
||||
out.push((t, 1.0));
|
||||
}
|
||||
out.into_iter().filter(|(t0, t1)| (t1 - t0) * l > EPS).map(|(t0, t1)| (lerp(a, b, t0), lerp(a, b, t1))).collect()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct Out {
|
||||
items: Vec<Item>,
|
||||
drawn: Drawn,
|
||||
}
|
||||
|
||||
impl Out {
|
||||
fn line(&mut self, cls: f64, a: Vec2, b: Vec2, w: f64, dashed: bool) {
|
||||
self.items.push(Item::Line { cls, a, b, w, dashed });
|
||||
}
|
||||
/// Kante nur, wo noch keine deckungsgleiche liegt (Umriss vor Trittkanten vor Podestkanten).
|
||||
fn edge(&mut self, cls: f64, a: Vec2, b: Vec2, w: f64, dashed: bool) {
|
||||
for (p, q) in self.drawn.free(a, b) {
|
||||
self.drawn.0.push((p, q));
|
||||
self.line(cls, p, q, w, dashed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [155] Grundfläche der Treppe (Pick, Belags-Aussparung): Aussenlinie bzw. Wendel-Ringstück.
|
||||
pub fn footprint(p: &StairParams) -> Vec<Vec<P>> {
|
||||
let outline = stair_outline(p);
|
||||
if let Some(poly) = outline.polygon.filter(|q| q.len() >= 3) {
|
||||
return vec![poly.iter().map(|q| p2(*q)).collect()];
|
||||
}
|
||||
let Some(s) = outline.spiral else { return Vec::new() };
|
||||
let ((c, r_in, a0, a1), (_, r_out, _, _)) = (s.arcs[0], s.arcs[1]);
|
||||
let n = (((a1 - a0).abs() / ARC_STEP).ceil() as usize).clamp(2, 720);
|
||||
let at = |r: f64, t: f64| [c.x + r * jsnum::cos(t), c.y + r * jsnum::sin(t)];
|
||||
let mut ring: Vec<P> = (0..=n).map(|k| at(r_out, a0 + (a1 - a0) * k as f64 / n as f64)).collect();
|
||||
ring.extend((0..=n).rev().map(|k| at(r_in, a0 + (a1 - a0) * k as f64 / n as f64)));
|
||||
if ring.iter().all(|q| q[0].is_finite() && q[1].is_finite()) {
|
||||
vec![ring]
|
||||
} else {
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn plan_stair(params: &[f64], total_rise: f64, cut_rise: f64, lw_mm: f64, filled_arrow: bool, column_r: f64, railing: u8, double: bool) -> Vec<f64> {
|
||||
plan_stair_clipped(params, total_rise, cut_rise, lw_mm, filled_arrow, column_r, railing, double, &[])
|
||||
}
|
||||
|
||||
/// Wie [`plan_stair`]; `clip` nicht leer: nur die Teile innerhalb dieser Ringe (Treppe des unteren
|
||||
/// Geschosses durch das Deckenloch gesehen, [155]), ohne Pick-Fläche und Säule.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn plan_stair_clipped(params: &[f64], total_rise: f64, cut_rise: f64, lw_mm: f64, filled_arrow: bool, column_r: f64, railing: u8, double: bool, clip: &[Vec<P>]) -> Vec<f64> {
|
||||
let Some(p) = decode_params(params) else { return Vec::new() };
|
||||
if !(total_rise.is_finite() && cut_rise.is_finite() && lw_mm.is_finite()) {
|
||||
return Vec::new();
|
||||
}
|
||||
let geo = stair_geometry(&p, total_rise);
|
||||
let cut = stair_cut(&geo, cut_rise);
|
||||
let below: HashSet<i64> = cut.below_indices.iter().copied().collect();
|
||||
let outline = stair_outline(&p);
|
||||
let spiral = p.shape == "spiral";
|
||||
let center = outline.spiral.as_ref().map(|s| s.arcs[0].0);
|
||||
let lay = Layout::new(&p, &geo, cut_rise, center);
|
||||
let (w_tread, w_outline) = (lw_mm * TREAD_FACTOR, lw_mm * OUTLINE_FACTOR);
|
||||
let mut o = Out::default();
|
||||
|
||||
for tr in &geo.treads {
|
||||
let is_below = below.contains(&tr.index);
|
||||
o.polygon(&tr.pts, lw_mm * 0.7, false);
|
||||
if tr.pts.len() >= 3 {
|
||||
o.line(CLS_TREAD, tr.pts[1], tr.pts[2], lw_mm * if is_below { 1.0 } else { 0.6 }, !is_below);
|
||||
// Pick-Fläche (unsichtbar): Treppe auch zwischen den Linien anwählbar.
|
||||
if clip.is_empty() {
|
||||
for ring in footprint(&p) {
|
||||
o.items.push(Item::Polygon { pts: ring.into_iter().map(v).collect(), stroke_mm: 0.0, filled: false });
|
||||
}
|
||||
}
|
||||
for l in geo.landing.iter().chain(geo.landing2.iter()) {
|
||||
if l.len() >= 3 {
|
||||
o.polygon(l, lw_mm * 0.7, false);
|
||||
}
|
||||
}
|
||||
if let Some(lines) = &cut.break_line {
|
||||
for (a, b) in lines {
|
||||
o.line(CLS_BREAK, *a, *b, lw_mm, false);
|
||||
}
|
||||
}
|
||||
for w in geo.run_line.windows(2) {
|
||||
o.line(CLS_RUN, w[0], w[1], lw_mm, false);
|
||||
}
|
||||
let (h1, tip, h2) = geo.arrow.head;
|
||||
if filled_arrow {
|
||||
o.polygon(&[h1, tip, h2], lw_mm, true);
|
||||
} else {
|
||||
o.line(CLS_ARROW, h1, tip, lw_mm, false);
|
||||
o.line(CLS_ARROW, h2, tip, lw_mm, false);
|
||||
}
|
||||
|
||||
let outline = stair_outline(&p);
|
||||
if let Some(poly) = &outline.polygon {
|
||||
if poly.len() >= 3 {
|
||||
o.polygon(poly, lw_mm, false);
|
||||
// 1. Aussenlinie (Wange), an den Elementgrenzen und der Bruchlinie geteilt.
|
||||
if let Some(poly) = outline.polygon.as_ref().filter(|q| q.len() >= 3) {
|
||||
let corners: Vec<Vec2> = lay.els.iter().flat_map(|e| e.poly.iter().copied()).collect();
|
||||
for i in 0..poly.len() {
|
||||
let (a, b) = (poly[i], poly[(i + 1) % poly.len()]);
|
||||
let d = sub(b, a);
|
||||
let l2 = dot(d, d);
|
||||
if !(l2 > EPS * EPS) {
|
||||
continue;
|
||||
}
|
||||
let ts: Vec<f64> = corners.iter().filter(|q| dist_seg(**q, a, b) < EPS).map(|q| dot(sub(*q, a), d) / l2).filter(|t| *t > 1e-9 && *t < 1.0 - 1e-9).collect();
|
||||
for (p0, p1, dashed) in lay.split(a, b, &ts) {
|
||||
o.edge(CLS_OUTLINE, p0, p1, w_outline, dashed);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(s) = &outline.spiral {
|
||||
for (a, b) in &s.lines {
|
||||
o.line(CLS_OUTLINE, *a, *b, lw_mm, false);
|
||||
// Bögen am Winkel der Bruchlinie geteilt.
|
||||
let all_above = lay.els.iter().all(|e| e.top > cut_rise + 1e-6);
|
||||
let t_break = lay.brk.as_ref().zip(center).map(|(b, c)| jsnum::atan2(b.a.y - c.y, b.a.x - c.x));
|
||||
for (c, r, a0, a1) in s.arcs {
|
||||
let (lo, hi) = (a0.min(a1), a0.max(a1));
|
||||
let pieces = match t_break {
|
||||
Some(tb) => {
|
||||
let mut t = tb;
|
||||
while t < lo - 1e-12 {
|
||||
t += std::f64::consts::TAU;
|
||||
}
|
||||
while t > hi + 1e-12 {
|
||||
t -= std::f64::consts::TAU;
|
||||
}
|
||||
if t > lo && t < hi {
|
||||
vec![(a0, t, false), (t, a1, true)]
|
||||
} else {
|
||||
vec![(a0, a1, all_above)]
|
||||
}
|
||||
}
|
||||
None => vec![(a0, a1, all_above)],
|
||||
};
|
||||
for (t0, t1, dashed) in pieces {
|
||||
o.items.push(Item::Arc { w: w_outline, c, r, a0: t0, a1: t1, dashed });
|
||||
}
|
||||
}
|
||||
for (c, r, a0, a1) in &s.arcs {
|
||||
let from = Vec2::new(c.x + r * jsnum::cos(*a0), c.y + r * jsnum::sin(*a0));
|
||||
let to = Vec2::new(c.x + r * jsnum::cos(*a1), c.y + r * jsnum::sin(*a1));
|
||||
o.arc(lw_mm, *c, from, to, *r);
|
||||
for (a, b) in s.lines {
|
||||
for (p0, p1, dashed) in lay.split(a, b, &[]) {
|
||||
o.edge(CLS_OUTLINE, p0, p1, w_outline, dashed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Trittkanten (Vorderkante = Austritt des Tritts davor): ausgezogen bis zur Schnitthöhe.
|
||||
for t in geo.treads.iter().filter(|t| t.pts.len() >= 4) {
|
||||
let q = &t.pts;
|
||||
let (front, back) = if spiral { ((q[0], q[1]), (q[3], q[2])) } else { ((q[3], q[0]), (q[1], q[2])) };
|
||||
o.edge(CLS_TREAD, front.0, front.1, w_tread, t.base_rise > cut_rise + 1e-6);
|
||||
o.edge(CLS_TREAD, back.0, back.1, w_tread, t.top_rise > cut_rise + 1e-6);
|
||||
}
|
||||
// 3. Podestkanten, soweit nicht schon Umriss oder Trittkante.
|
||||
for e in lay.els.iter().skip(geo.treads.len()) {
|
||||
for i in 0..e.poly.len() {
|
||||
let (a, b) = (e.poly[i], e.poly[(i + 1) % e.poly.len()]);
|
||||
for (p0, p1, dashed) in lay.split(a, b, &[]) {
|
||||
o.edge(CLS_TREAD, p0, p1, w_tread, dashed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Bruchlinie quer über den Lauf, Zickzack in der Mitte.
|
||||
if let Some(b) = &lay.brk {
|
||||
let d = sub(b.b, b.a);
|
||||
let w = len(d);
|
||||
if w > 1e-6 {
|
||||
let c = mul(d, 1.0 / w);
|
||||
let m = mid(b.a, b.b);
|
||||
let z = 0.08_f64.min(w * 0.15);
|
||||
let h = 0.06_f64.min(b.depth * 0.8);
|
||||
let pts = [b.a, sub(m, mul(c, z)), add(sub(m, mul(c, z / 3.0)), mul(b.up, h)), sub(add(m, mul(c, z / 3.0)), mul(b.up, h)), add(m, mul(c, z)), b.b];
|
||||
for k in 0..pts.len() - 1 {
|
||||
o.line(CLS_BREAK, pts[k], pts[k + 1], w_outline, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Lauflinie und Pfeil (Flügel als ein Zug über die Spitze: die Ecke schliesst spitz).
|
||||
for w in geo.run_line.windows(2) {
|
||||
o.line(CLS_RUN, w[0], w[1], w_tread, false);
|
||||
}
|
||||
let (h1, tip, h2) = geo.arrow.head;
|
||||
if filled_arrow {
|
||||
o.items.push(Item::Polygon { pts: vec![h1, tip, h2], stroke_mm: w_tread, filled: true });
|
||||
} else {
|
||||
o.line(CLS_ARROW, h1, tip, w_tread, false);
|
||||
o.line(CLS_ARROW, tip, h2, w_tread, false);
|
||||
}
|
||||
|
||||
// Mittelsäule (Spindel) der Wendel: reicht über die ganze Steighöhe, also geschnitten, sobald die
|
||||
// Schnittebene innerhalb der Treppe liegt.
|
||||
if let (true, Some(c)) = (p.shape == "spiral" && column_r.is_finite() && column_r > 0.0, p.center) {
|
||||
if let (true, Some(c)) = (clip.is_empty() && spiral && column_r.is_finite() && column_r > 0.0, center.or(p.center)) {
|
||||
let r = column_r.min(5.0);
|
||||
let pts: Vec<Vec2> = (0..COLUMN_SEGMENTS)
|
||||
.map(|k| {
|
||||
@@ -129,33 +455,94 @@ pub fn plan_stair(params: &[f64], total_rise: f64, cut_rise: f64, lw_mm: f64, fi
|
||||
})
|
||||
.collect();
|
||||
let cut = cut_rise > 0.0 && cut_rise < total_rise;
|
||||
o.polygon(&pts, lw_mm, cut);
|
||||
o.items.push(Item::Polygon { pts, stroke_mm: lw_mm, filled: cut });
|
||||
}
|
||||
|
||||
// [151] Handlauf: über der Bruchhöhe (Mitte des ersten geschnittenen Tritts) gestrichelt.
|
||||
let z_break = cut.above_indices.first().and_then(|i| geo.treads.iter().find(|t| t.index == *i)).map(|t| (t.base_rise + t.top_rise) / 2.0);
|
||||
// [151] Handlauf: über der Bruchlinie gestrichelt (dieselbe Teilung wie Tritte und Wange).
|
||||
let r = crate::stair_rail::RAIL_THICK / 2.0;
|
||||
for rail in crate::stair_rail::rails(&p, &geo, railing) {
|
||||
for (pts, dashed) in crate::stair_rail::plan_pieces(&rail, z_break) {
|
||||
let lines: Vec<Vec<[f64; 2]>> = if double {
|
||||
vec![crate::stair_rail::offset_polyline(&pts, r), crate::stair_rail::offset_polyline(&pts, -r)]
|
||||
} else {
|
||||
vec![pts]
|
||||
};
|
||||
let path = crate::stair_rail::plan_path(&rail);
|
||||
let mut pieces: Vec<(Vec<P>, bool)> = Vec::new();
|
||||
for w in path.windows(2) {
|
||||
for (a, b, dashed) in lay.split(v(w[0]), v(w[1]), &[]) {
|
||||
match pieces.last_mut() {
|
||||
Some((pts, d)) if *d == dashed && pts.last().is_some_and(|l| len(sub(v(*l), a)) < EPS) => pts.push(p2(b)),
|
||||
_ => pieces.push((vec![p2(a), p2(b)], dashed)),
|
||||
}
|
||||
}
|
||||
}
|
||||
for (pts, dashed) in pieces {
|
||||
let lines: Vec<Vec<P>> = if double { vec![crate::stair_rail::offset_polyline(&pts, r), crate::stair_rail::offset_polyline(&pts, -r)] } else { vec![pts] };
|
||||
for l in lines {
|
||||
for w in l.windows(2) {
|
||||
o.line(CLS_HANDRAIL, Vec2::new(w[0][0], w[0][1]), Vec2::new(w[1][0], w[1][1]), HANDRAIL_MM, dashed);
|
||||
o.line(CLS_HANDRAIL, v(w[0]), v(w[1]), HANDRAIL_MM, dashed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mut out = Vec::with_capacity(o.buf.len() + 1);
|
||||
out.push(o.n as f64);
|
||||
out.extend(o.buf);
|
||||
let items = if clip.is_empty() { o.items } else { clip_items(o.items, clip) };
|
||||
encode(&items)
|
||||
}
|
||||
|
||||
/// Linien und Bögen auf die Ringe `clip` beschnitten (Bögen als Sehnenzug); Flächen nur ganz innen.
|
||||
fn clip_items(items: Vec<Item>, clip: &[Vec<P>]) -> Vec<Item> {
|
||||
let inside = |q: Vec2| clip.iter().any(|r| crate::surface_pattern::point_in(p2(q), r));
|
||||
let clip_line = |out: &mut Vec<Item>, cls: f64, a: Vec2, b: Vec2, w: f64, dashed: bool| {
|
||||
let mut segs = Vec::new();
|
||||
for r in clip {
|
||||
crate::surface_pattern::clip_to_poly(p2(a), p2(b), r, &mut segs);
|
||||
}
|
||||
for (p, q) in segs {
|
||||
out.push(Item::Line { cls, a: v(p), b: v(q), w, dashed });
|
||||
}
|
||||
};
|
||||
let mut out = Vec::new();
|
||||
for it in items {
|
||||
match it {
|
||||
Item::Line { cls, a, b, w, dashed } => clip_line(&mut out, cls, a, b, w, dashed),
|
||||
Item::Arc { w, c, r, a0, a1, dashed } => {
|
||||
let n = (((a1 - a0).abs() / ARC_STEP).ceil() as usize).clamp(1, 720);
|
||||
let at = |k: usize| {
|
||||
let t = a0 + (a1 - a0) * k as f64 / n as f64;
|
||||
Vec2::new(c.x + r * jsnum::cos(t), c.y + r * jsnum::sin(t))
|
||||
};
|
||||
for k in 0..n {
|
||||
clip_line(&mut out, CLS_OUTLINE, at(k), at(k + 1), w, dashed);
|
||||
}
|
||||
}
|
||||
Item::Polygon { pts, stroke_mm, filled } => {
|
||||
if stroke_mm > 0.0 && pts.iter().all(|q| inside(*q)) {
|
||||
out.push(Item::Polygon { pts, stroke_mm, filled });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Kodierung s. Modulkopf.
|
||||
fn encode(items: &[Item]) -> Vec<f64> {
|
||||
let mut buf = vec![items.len() as f64];
|
||||
for it in items {
|
||||
match it {
|
||||
Item::Polygon { pts, stroke_mm, filled } => {
|
||||
buf.extend([1.0, *stroke_mm, if *filled { 1.0 } else { 0.0 }, pts.len() as f64]);
|
||||
for q in pts {
|
||||
buf.extend([q.x, q.y]);
|
||||
}
|
||||
}
|
||||
Item::Line { cls, a, b, w, dashed } => buf.extend([2.0, *cls, *w, if *dashed { 1.0 } else { 0.0 }, a.x, a.y, b.x, b.y]),
|
||||
Item::Arc { w, c, r, a0, a1, dashed } => {
|
||||
let from = Vec2::new(c.x + r * jsnum::cos(*a0), c.y + r * jsnum::sin(*a0));
|
||||
let to = Vec2::new(c.x + r * jsnum::cos(*a1), c.y + r * jsnum::sin(*a1));
|
||||
buf.extend([3.0, *w, if *dashed { 1.0 } else { 0.0 }, c.x, c.y, from.x, from.y, to.x, to.y, *r]);
|
||||
}
|
||||
}
|
||||
}
|
||||
buf
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -176,7 +563,7 @@ mod tests {
|
||||
i += match buf[i] as i64 {
|
||||
1 => 4 + 2 * buf[i + 3] as usize,
|
||||
2 => 8,
|
||||
3 => 9,
|
||||
3 => 10,
|
||||
_ => panic!("unbekannter Tag"),
|
||||
};
|
||||
}
|
||||
@@ -188,11 +575,208 @@ mod tests {
|
||||
fn gerade_treppe_hat_tritte_lauflinie_pfeil_und_aussenlinie() {
|
||||
let b = plan_stair(&straight(), 2.8, 1.0, 0.25, false, 0.0, 0, false);
|
||||
let t = tags(&b);
|
||||
// 16 Tritte × (Polygon + Kante) + 2 Bruchstriche + Lauflinie + 2 Pfeilflügel + Aussenlinie
|
||||
assert_eq!(t.iter().filter(|x| **x == 1.0).count(), 16 + 1);
|
||||
assert!(t.iter().filter(|x| **x == 2.0).count() >= 16 + 2 + 2);
|
||||
// erster Tritt liegt unter der Schnittebene: durchgezogen, volle Stärke
|
||||
assert_eq!(&b[1 + 4 + 8 + 1..][..3], &[1.0, 0.25, 0.0]);
|
||||
// [155] nur die unsichtbare Pick-Fläche als Polygon, keine Tritt-Vielecke
|
||||
assert_eq!(t.iter().filter(|x| **x == 1.0).count(), 1);
|
||||
assert_eq!(&b[1..4], &[1.0, 0.0, 0.0]);
|
||||
let l = lines(&b);
|
||||
let n = |cls: f64| l.iter().filter(|x| x.0 == cls).count();
|
||||
// 15 Kanten zwischen 16 Tritten (Antritt und Austritt sind Umriss); Umriss: Antritt, Austritt,
|
||||
// zwei Wangen je ausgezogen + gestrichelt; Bruchlinie mit Zickzack (5 Striche); Lauflinie; 2 Pfeilflügel
|
||||
assert_eq!(n(CLS_TREAD), 15);
|
||||
assert_eq!(n(CLS_OUTLINE), 6);
|
||||
assert_eq!(n(CLS_BREAK), 5);
|
||||
assert_eq!((n(CLS_RUN), n(CLS_ARROW)), (1, 2));
|
||||
}
|
||||
|
||||
/// Alle Linien (cls, gestrichelt, a, b, Stärke).
|
||||
fn lines_w(buf: &[f64]) -> Vec<(f64, bool, [f64; 2], [f64; 2], f64)> {
|
||||
let n = buf[0] as usize;
|
||||
let mut i = 1;
|
||||
let mut out = Vec::new();
|
||||
for _ in 0..n {
|
||||
match buf[i] as i64 {
|
||||
1 => i += 4 + 2 * buf[i + 3] as usize,
|
||||
2 => {
|
||||
out.push((buf[i + 1], buf[i + 3] != 0.0, [buf[i + 4], buf[i + 5]], [buf[i + 6], buf[i + 7]], buf[i + 2]));
|
||||
i += 8;
|
||||
}
|
||||
_ => i += 10,
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Bögen (gestrichelt, Radius).
|
||||
fn arcs(buf: &[f64]) -> Vec<(bool, f64)> {
|
||||
let n = buf[0] as usize;
|
||||
let mut i = 1;
|
||||
let mut out = Vec::new();
|
||||
for _ in 0..n {
|
||||
match buf[i] as i64 {
|
||||
1 => i += 4 + 2 * buf[i + 3] as usize,
|
||||
2 => i += 8,
|
||||
_ => {
|
||||
out.push((buf[i + 2] != 0.0, buf[i + 9]));
|
||||
i += 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Überlappungslänge zweier Strecken auf derselben Geraden (0 = nicht deckungsgleich).
|
||||
fn overlap(a: ([f64; 2], [f64; 2]), b: ([f64; 2], [f64; 2])) -> f64 {
|
||||
let d = [a.1[0] - a.0[0], a.1[1] - a.0[1]];
|
||||
let l = d[0].hypot(d[1]);
|
||||
if l < 1e-12 {
|
||||
return 0.0;
|
||||
}
|
||||
let u = [d[0] / l, d[1] / l];
|
||||
let off = |q: [f64; 2]| (q[0] - a.0[0]) * u[1] - (q[1] - a.0[1]) * u[0];
|
||||
if off(b.0).abs() > 1e-7 || off(b.1).abs() > 1e-7 {
|
||||
return 0.0;
|
||||
}
|
||||
let t = |q: [f64; 2]| (q[0] - a.0[0]) * u[0] + (q[1] - a.0[1]) * u[1];
|
||||
let (b0, b1) = (t(b.0).min(t(b.1)), t(b.0).max(t(b.1)));
|
||||
(b1.min(l) - b0.max(0.0)).max(0.0)
|
||||
}
|
||||
|
||||
/// [155] Keine Linie liegt deckungsgleich auf einer anderen (auch nicht voll unter gestrichelt) — alle
|
||||
/// Formen, Schnitthöhen unter, in und über der Treppe, mit und ohne Handlauf.
|
||||
#[test]
|
||||
fn keine_deckungsgleichen_linien() {
|
||||
for (name, p) in forms() {
|
||||
for cut in [-0.5, 0.3, 1.0, 1.45, 1.6, 2.0, 2.5, 3.5] {
|
||||
for railing in [0, 3] {
|
||||
let b = plan_stair(&p, 2.8, cut, 0.25, false, 0.0, railing, true);
|
||||
let mut l = lines_w(&b);
|
||||
// sichtbare Vieleck-Kanten zählen mit (früher lagen Tritt-Vielecke unter den Trittkanten)
|
||||
let n = b[0] as usize;
|
||||
let mut i = 1;
|
||||
for _ in 0..n {
|
||||
match b[i] as i64 {
|
||||
1 => {
|
||||
let k = b[i + 3] as usize;
|
||||
let q: Vec<[f64; 2]> = (0..k).map(|j| [b[i + 4 + 2 * j], b[i + 5 + 2 * j]]).collect();
|
||||
if b[i + 1] > 0.0 {
|
||||
for j in 0..k {
|
||||
l.push((-1.0, false, q[j], q[(j + 1) % k], b[i + 1]));
|
||||
}
|
||||
}
|
||||
i += 4 + 2 * k;
|
||||
}
|
||||
2 => i += 8,
|
||||
_ => i += 10,
|
||||
}
|
||||
}
|
||||
for i in 0..l.len() {
|
||||
for j in i + 1..l.len() {
|
||||
let ov = overlap((l[i].2, l[i].3), (l[j].2, l[j].3));
|
||||
assert!(ov < 1e-6, "{name} Schnitt {cut}: {:?} deckt {:?} ({ov})", l[i], l[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [155] Vor der Bruchlinie ausgezogen, dahinter gestrichelt (Wange, Trittkanten, Handlauf); die
|
||||
/// Bruchlinie liegt in der Mitte des ersten Tritts über der Schnitthöhe, mit Zickzack.
|
||||
#[test]
|
||||
fn vor_der_bruchlinie_voll_dahinter_gestrichelt() {
|
||||
let x_break = 5.5 * 3.0 / 16.0;
|
||||
let b = plan_stair(&straight(), 2.8, 1.0, 0.25, false, 0.0, 3, false);
|
||||
for (cls, dashed, a, e, _) in lines_w(&b) {
|
||||
if cls == CLS_RUN || cls == CLS_ARROW || cls == CLS_BREAK {
|
||||
assert!(!dashed);
|
||||
continue;
|
||||
}
|
||||
let m = (a[0] + e[0]) / 2.0;
|
||||
assert_eq!(dashed, m > x_break, "cls {cls}: {a:?}–{e:?}");
|
||||
}
|
||||
let brk: Vec<_> = lines_w(&b).into_iter().filter(|l| l.0 == CLS_BREAK).collect();
|
||||
assert!((brk[0].2[0] - x_break).abs() < 1e-9 && (brk[4].3[0] - x_break).abs() < 1e-9);
|
||||
assert!(brk.iter().any(|l| (l.2[0] - x_break).abs() > 0.01), "Zickzack");
|
||||
// Schnitt über der Treppe: alles ausgezogen, keine Bruchlinie
|
||||
let all = lines_w(&plan_stair(&straight(), 2.8, 3.5, 0.25, false, 0.0, 3, false));
|
||||
assert!(all.iter().all(|l| !l.1) && all.iter().all(|l| l.0 != CLS_BREAK));
|
||||
}
|
||||
|
||||
/// [155] Podest über der Schnitthöhe als erstes Element: Bruchlinie auf dem Podest, Lauf 1 ganz ausgezogen.
|
||||
#[test]
|
||||
fn bruch_auf_dem_podest() {
|
||||
let l = forms().into_iter().find(|f| f.0 == "L").unwrap().1;
|
||||
// L: 16 Steigungen à 0.175, Lauf 1 hat 10 (Podest = 11. Steigung, OK 1.925)
|
||||
let geo = stair_geometry(&decode_params(&l).unwrap(), 2.8);
|
||||
let gap = geo.treads.windows(2).position(|w| w[1].index != w[0].index + 1).unwrap();
|
||||
let run1_top = geo.treads[gap].top_rise;
|
||||
let cut = run1_top + 0.05;
|
||||
let b = plan_stair(&l, 2.8, cut, 0.25, false, 0.0, 0, false);
|
||||
let ls = lines_w(&b);
|
||||
let brk: Vec<_> = ls.iter().filter(|x| x.0 == CLS_BREAK).collect();
|
||||
assert_eq!(brk.len(), 5);
|
||||
let land = geo.landing.as_ref().unwrap();
|
||||
let inside = |q: [f64; 2]| kernel2d::point_in_polygon(Vec2::new(q[0], q[1]), land) || dist_poly(Vec2::new(q[0], q[1]), land) < 1e-9;
|
||||
assert!(brk.iter().all(|x| inside(x.2) && inside(x.3)), "Bruchlinie auf dem Podest");
|
||||
// alle Trittkanten von Lauf 1 ausgezogen
|
||||
let n1 = geo.treads.iter().filter(|t| t.top_rise <= cut).count();
|
||||
assert!(n1 > 0);
|
||||
for t in geo.treads.iter().filter(|t| t.top_rise <= cut) {
|
||||
let back = ([t.pts[1].x, t.pts[1].y], [t.pts[2].x, t.pts[2].y]);
|
||||
assert!(ls.iter().filter(|x| overlap((x.2, x.3), back) > 1e-6).all(|x| !x.1));
|
||||
}
|
||||
}
|
||||
|
||||
/// [155] Linienhierarchie: Tritte/Lauflinie/Pfeil 0.1, Umriss und Bruchlinie 0.13 bei Kategorie 0.18.
|
||||
#[test]
|
||||
fn strichstaerken_tritte_fein_umriss_mittel() {
|
||||
for (name, p) in forms() {
|
||||
for (cls, _, _, _, w) in lines_w(&plan_stair(&p, 2.8, 1.0, 0.18, false, 0.0, 1, false)) {
|
||||
let want = match cls {
|
||||
c if c == CLS_TREAD || c == CLS_RUN || c == CLS_ARROW || c == CLS_HANDRAIL => 0.1,
|
||||
_ => 0.13,
|
||||
};
|
||||
assert!((w - want).abs() < 1e-12, "{name} cls {cls}: {w}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [155] Pfeilflügel als ein Zug über die Spitze; die Lauflinie endet in der Spitze.
|
||||
#[test]
|
||||
fn pfeil_schliesst_an_der_spitze() {
|
||||
let l = lines_w(&plan_stair(&straight(), 2.8, 1.0, 0.25, false, 0.0, 0, false));
|
||||
let a: Vec<_> = l.iter().filter(|x| x.0 == CLS_ARROW).collect();
|
||||
let run = l.iter().find(|x| x.0 == CLS_RUN).unwrap();
|
||||
assert_eq!(a[0].3, a[1].2);
|
||||
assert_eq!(run.3, a[0].3);
|
||||
}
|
||||
|
||||
/// [155] Wendel: Trittkanten radial (keine Sehnen auf dem Aussenbogen), Bögen an der Bruchlinie geteilt.
|
||||
#[test]
|
||||
fn wendel_radiale_trittkanten_und_geteilte_boegen() {
|
||||
let p = vec![2.0, 0.0, 0.0, 1.0, 0.0, 3.0, NAN, NAN, 0.0, 0.0, 1.5, 270.0, 1.0, 14.0, NAN, 0.0];
|
||||
let b = plan_stair(&p, 2.8, 1.0, 0.25, false, 0.0, 0, false);
|
||||
let r = |q: [f64; 2]| q[0].hypot(q[1]);
|
||||
for (_, _, a, e, _) in lines_w(&b).into_iter().filter(|x| x.0 == CLS_TREAD) {
|
||||
assert!((r(a) - 1.0).abs() < 1e-9 && (r(e) - 2.0).abs() < 1e-9, "{a:?} {e:?}");
|
||||
}
|
||||
let ar = arcs(&b);
|
||||
assert_eq!(ar.len(), 4);
|
||||
for rad in [1.0, 2.0] {
|
||||
let at: Vec<bool> = ar.iter().filter(|x| (x.1 - rad).abs() < 1e-9).map(|x| x.0).collect();
|
||||
assert_eq!(at, vec![false, true]);
|
||||
}
|
||||
}
|
||||
|
||||
/// [155] Treppe durch das Deckenloch: nur Teile im Loch, ohne Pick-Fläche.
|
||||
#[test]
|
||||
fn beschnitten_auf_das_loch() {
|
||||
let hole = vec![vec![[1.5, -1.0], [4.0, -1.0], [4.0, 1.0], [1.5, 1.0]]];
|
||||
let b = plan_stair_clipped(&straight(), 2.8, 3.8, 0.25, false, 0.0, 3, false, &hole);
|
||||
let t = tags(&b);
|
||||
assert!(t.iter().all(|x| *x == 2.0));
|
||||
let l = lines_w(&b);
|
||||
assert!(!l.is_empty() && l.iter().all(|x| x.2[0] >= 1.5 - 1e-9 && x.3[0] >= 1.5 - 1e-9 && !x.1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -206,7 +790,7 @@ mod tests {
|
||||
fn wendel_liefert_boegen() {
|
||||
let p = vec![2.0, 0.0, 0.0, 1.0, 0.0, 3.0, NAN, NAN, 0.0, 0.0, 1.5, 270.0, 1.0, 14.0, NAN, 0.0];
|
||||
let t = tags(&plan_stair(&p, 2.8, 1.0, 0.25, false, 0.0, 0, false));
|
||||
assert_eq!(t.iter().filter(|x| **x == 3.0).count(), 2);
|
||||
assert_eq!(t.iter().filter(|x| **x == 3.0).count(), 4, "Innen- und Aussenbogen je vor und hinter der Bruchlinie");
|
||||
}
|
||||
|
||||
/// Letztes Polygon im Puffer: (gefüllt, Punkte).
|
||||
@@ -222,7 +806,7 @@ mod tests {
|
||||
i += 4 + 2 * k;
|
||||
}
|
||||
2 => i += 8,
|
||||
_ => i += 9,
|
||||
_ => i += 10,
|
||||
}
|
||||
}
|
||||
last
|
||||
@@ -259,7 +843,7 @@ mod tests {
|
||||
out.push((buf[i + 1], buf[i + 3] != 0.0, [buf[i + 4], buf[i + 5]], [buf[i + 6], buf[i + 7]]));
|
||||
i += 8;
|
||||
}
|
||||
_ => i += 9,
|
||||
_ => i += 10,
|
||||
}
|
||||
}
|
||||
out
|
||||
@@ -312,7 +896,7 @@ mod tests {
|
||||
}
|
||||
i += 8;
|
||||
}
|
||||
_ => i += 9,
|
||||
_ => i += 10,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! Treppen im Grundriss auf dem Dokument ([K3d]): Filter, Override-Regeln, Stil und Pick-ID um
|
||||
//! das Treppen-Symbol aus `plan_stairs.rs` — Rust-Gegenstück zu `generatePlan/stairs.ts` und der
|
||||
//! das Treppen-Symbol aus `stair_symbol.rs` — Rust-Gegenstück zu `generatePlan/stairs.ts` und der
|
||||
//! Treppen-Schleife in `generatePlan.ts`.
|
||||
|
||||
use super::domains::{Bounds, Ctx};
|
||||
@@ -8,10 +8,15 @@ use super::style::*;
|
||||
use crate::js_fmt::js_number;
|
||||
use crate::model::*;
|
||||
|
||||
/// Linienklassen der Kern-Kodierung (`plan_stairs.rs`).
|
||||
const LINE_CLS: [&str; 6] = ["stair-outline", "stair-tread", "stair-break", "stair-run", "stair-arrow", "stair-handrail"];
|
||||
/// Linienklassen der Kern-Kodierung (`stair_symbol.rs`); 6 = Absturzsicherung am Treppenloch ([155]).
|
||||
const LINE_CLS: [&str; 7] = ["stair-outline", "stair-tread", "stair-break", "stair-run", "stair-arrow", "stair-handrail", "stair-guard"];
|
||||
/// Strichmuster der verdeckten Tritte.
|
||||
const TREAD_DASH: [f64; 2] = super::line_pattern::HIDDEN;
|
||||
/// [155] Achse der Absturzsicherung: so weit vom Lochrand auf die Decke gerückt wie der Handlauf von der
|
||||
/// Treppenkante (Rohr ganz auf der Decke).
|
||||
const GUARD_INSET: f64 = crate::stair_rail::RAIL_INSET;
|
||||
/// [155] Lochrand am Austritt: bis zu diesem Abstand von der Austrittskante keine Absturzsicherung.
|
||||
const ARRIVAL_TOL: f64 = 0.15;
|
||||
|
||||
/// `stairLabel` (für `object_name`).
|
||||
pub fn stair_label(s: &Stair) -> String {
|
||||
@@ -29,11 +34,105 @@ fn v2(x: f64, y: f64) -> Vec2 {
|
||||
Vec2 { x, y }
|
||||
}
|
||||
|
||||
/// Geländer-Code des Treppentyps (0 keins, 1 links, 2 rechts, 3 beide).
|
||||
fn railing_code(p: &Project, s: &Stair) -> u8 {
|
||||
match p.stair_type(s).and_then(|t| t.railing) {
|
||||
Some(StairTypeRailing::Links) => 1,
|
||||
Some(StairTypeRailing::Rechts) => 2,
|
||||
Some(StairTypeRailing::Beide) => 3,
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
|
||||
fn stair_line(a: Vec2, b: Vec2, cls: &str, weight_mm: f64, dash: Option<Option<Vec<f64>>>, stroke: &str, greyed: Option<bool>, id: &str) -> Primitive {
|
||||
Primitive::Line {
|
||||
a,
|
||||
b,
|
||||
cls: cls.into(),
|
||||
weight_mm,
|
||||
dash,
|
||||
zigzag: None,
|
||||
motif: None,
|
||||
color: Some(stroke.to_string()),
|
||||
drawing_id: None,
|
||||
opening_id: None,
|
||||
stair_id: Some(id.to_string()),
|
||||
greyed,
|
||||
opacity: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Symbol-Puffer (`stair_symbol.rs`) als Primitive.
|
||||
fn emit(out: &mut Vec<Primitive>, f: &[f64], stroke: &str, greyed: Option<bool>, id: &str) {
|
||||
if f.is_empty() {
|
||||
return;
|
||||
}
|
||||
let n = f[0] as usize;
|
||||
let mut i = 1;
|
||||
for _ in 0..n {
|
||||
match f[i] as i64 {
|
||||
1 => {
|
||||
let count = f[i + 3] as usize;
|
||||
let pts = (0..count).map(|j| v2(f[i + 4 + 2 * j], f[i + 5 + 2 * j])).collect();
|
||||
// Strichstärke 0: unsichtbare Pick-Fläche.
|
||||
let visible = f[i + 1] > 0.0;
|
||||
out.push(Primitive::Polygon {
|
||||
pts,
|
||||
fill: if f[i + 2] != 0.0 { stroke.to_string() } else { "none".into() },
|
||||
stroke: if visible { stroke.to_string() } else { "none".into() },
|
||||
stroke_width_mm: f[i + 1],
|
||||
hatch: no_hatch(),
|
||||
greyed,
|
||||
opacity: None,
|
||||
no_stroke_edges: None,
|
||||
wall_id: None,
|
||||
drawing_id: None,
|
||||
ceiling_id: None,
|
||||
opening_id: None,
|
||||
stair_id: Some(id.to_string()),
|
||||
room_id: None,
|
||||
extruded_solid_id: None,
|
||||
context_object_id: None,
|
||||
column_id: None,
|
||||
roof_id: None,
|
||||
section_line_id: None,
|
||||
});
|
||||
i += 4 + 2 * count;
|
||||
}
|
||||
2 => {
|
||||
let cls = LINE_CLS.get(f[i + 1] as usize).copied().unwrap_or("");
|
||||
let dash = (cls == "stair-tread" || cls == "stair-handrail" || cls == "stair-outline").then(|| (f[i + 3] != 0.0).then(|| TREAD_DASH.to_vec()));
|
||||
out.push(stair_line(v2(f[i + 4], f[i + 5]), v2(f[i + 6], f[i + 7]), cls, f[i + 2], dash, stroke, greyed, id));
|
||||
i += 8;
|
||||
}
|
||||
_ => {
|
||||
out.push(Primitive::Arc {
|
||||
center: v2(f[i + 3], f[i + 4]),
|
||||
from: v2(f[i + 5], f[i + 6]),
|
||||
to: v2(f[i + 7], f[i + 8]),
|
||||
r: f[i + 9],
|
||||
cls: "stair-outline".into(),
|
||||
weight_mm: f[i + 1],
|
||||
dash: (f[i + 2] != 0.0).then(|| Some(TREAD_DASH.to_vec())),
|
||||
color: None,
|
||||
opening_id: None,
|
||||
stair_id: Some(id.to_string()),
|
||||
greyed,
|
||||
opacity: None,
|
||||
});
|
||||
i += 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Treppen des Geschosses in Zeichenreihenfolge; Tritte und Podest ins Ausmass.
|
||||
pub fn plan_stairs(c: &Ctx, out: &mut Vec<Primitive>, bounds: &mut Bounds) {
|
||||
let p = c.p;
|
||||
let cut_height = p.floor(&c.a.floor).and_then(|f| f.cut_height).unwrap_or(1.0);
|
||||
let range = super::view_range::ViewRange::of(p, &c.a.floor);
|
||||
// [151] Handlauf-Doppellinie ab 1:50 bzw. Detailstufe fein.
|
||||
let double = c.a.scale <= 50.0 || c.a.detail == Detail::Fein;
|
||||
for s in p.stairs.as_deref().unwrap_or(&[]).iter().filter(|s| s.floor_id == c.a.floor && c.vis(&s.category_code, &s.id)) {
|
||||
let greyed = Some(c.greyed(&s.category_code));
|
||||
let ov = c.overrides(Some("stair"), &s.category_code, Some(&stair_label(s)));
|
||||
@@ -57,91 +156,125 @@ pub fn plan_stairs(c: &Ctx, out: &mut Vec<Primitive>, bounds: &mut Bounds) {
|
||||
bounds.acc(q.x, q.y);
|
||||
}
|
||||
}
|
||||
// [151] Handlauf nach Geländer des Treppentyps; Doppellinie ab 1:50 bzw. Detailstufe fein.
|
||||
let railing = match p.stair_type(s).and_then(|t| t.railing) {
|
||||
Some(StairTypeRailing::Links) => 1,
|
||||
Some(StairTypeRailing::Rechts) => 2,
|
||||
Some(StairTypeRailing::Beide) => 3,
|
||||
_ => 0,
|
||||
};
|
||||
let double = c.a.scale <= 50.0 || c.a.detail == Detail::Fein;
|
||||
let f = crate::plan::stair_symbol::plan_stair(¶ms, zt - zb, cut_height, lw, s.arrow_style == Some(StairArrowStyle::Filled), s.center_column.unwrap_or(0.0), railing, double);
|
||||
if f.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let n = f[0] as usize;
|
||||
let mut i = 1;
|
||||
for _ in 0..n {
|
||||
match f[i] as i64 {
|
||||
1 => {
|
||||
let count = f[i + 3] as usize;
|
||||
let pts = (0..count).map(|j| v2(f[i + 4 + 2 * j], f[i + 5 + 2 * j])).collect();
|
||||
out.push(Primitive::Polygon {
|
||||
pts,
|
||||
fill: if f[i + 2] != 0.0 { stroke.clone() } else { "none".into() },
|
||||
stroke: stroke.clone(),
|
||||
stroke_width_mm: f[i + 1],
|
||||
hatch: no_hatch(),
|
||||
greyed,
|
||||
opacity: None,
|
||||
no_stroke_edges: None,
|
||||
wall_id: None,
|
||||
drawing_id: None,
|
||||
ceiling_id: None,
|
||||
opening_id: None,
|
||||
stair_id: Some(s.id.clone()),
|
||||
room_id: None,
|
||||
extruded_solid_id: None,
|
||||
context_object_id: None,
|
||||
column_id: None,
|
||||
roof_id: None,
|
||||
section_line_id: None,
|
||||
});
|
||||
i += 4 + 2 * count;
|
||||
}
|
||||
2 => {
|
||||
let cls = LINE_CLS.get(f[i + 1] as usize).copied().unwrap_or("");
|
||||
let dash = (cls == "stair-tread" || cls == "stair-handrail").then(|| (f[i + 3] != 0.0).then(|| TREAD_DASH.to_vec()));
|
||||
out.push(Primitive::Line {
|
||||
a: v2(f[i + 4], f[i + 5]),
|
||||
b: v2(f[i + 6], f[i + 7]),
|
||||
cls: cls.into(),
|
||||
weight_mm: f[i + 2],
|
||||
dash,
|
||||
zigzag: None,
|
||||
motif: None,
|
||||
color: Some(stroke.clone()),
|
||||
drawing_id: None,
|
||||
opening_id: None,
|
||||
stair_id: Some(s.id.clone()),
|
||||
greyed,
|
||||
opacity: None,
|
||||
});
|
||||
i += 8;
|
||||
}
|
||||
_ => {
|
||||
out.push(Primitive::Arc {
|
||||
center: v2(f[i + 2], f[i + 3]),
|
||||
from: v2(f[i + 4], f[i + 5]),
|
||||
to: v2(f[i + 6], f[i + 7]),
|
||||
r: f[i + 8],
|
||||
cls: "stair-outline".into(),
|
||||
weight_mm: f[i + 1],
|
||||
dash: None,
|
||||
color: None,
|
||||
opening_id: None,
|
||||
stair_id: Some(s.id.clone()),
|
||||
greyed,
|
||||
opacity: None,
|
||||
});
|
||||
i += 9;
|
||||
}
|
||||
}
|
||||
}
|
||||
let f = crate::plan::stair_symbol::plan_stair(¶ms, zt - zb, cut_height, lw, s.arrow_style == Some(StairArrowStyle::Filled), s.center_column.unwrap_or(0.0), railing_code(p, s), double);
|
||||
emit(out, &f, &stroke, greyed, &s.id);
|
||||
if let Some(d) = range.restyle_dash(zone) {
|
||||
super::view_range::restyle(out, out_start, d);
|
||||
}
|
||||
}
|
||||
arriving(c, out, double);
|
||||
}
|
||||
|
||||
/// [155] Treppen tieferer Geschosse, die auf diesem Geschoss ankommen: durch das Loch der Decke, auf der
|
||||
/// das Geschoss steht, von oben gesehen (ausgezogen, auf das Loch beschnitten), dazu die Absturzsicherung
|
||||
/// an den freien Lochrändern (nicht unter Wänden, nicht am Austritt der Treppe).
|
||||
fn arriving(c: &Ctx, out: &mut Vec<Primitive>, double: bool) {
|
||||
use crate::stair_rail::P;
|
||||
let p = c.p;
|
||||
let Some(floor) = p.floor(&c.a.floor) else { return };
|
||||
let base = floor.base_elevation.unwrap_or(0.0);
|
||||
// Löcher der Decken unter dem Geschossboden (Oberkante wie bei den Bodenbelägen).
|
||||
let holes: Vec<Vec<P>> = p
|
||||
.ceilings
|
||||
.as_deref()
|
||||
.unwrap_or(&[])
|
||||
.iter()
|
||||
.filter(|ce| {
|
||||
let top = p.ceiling_vertical_extent(ce).1;
|
||||
top >= base - 0.3 && top <= base + 0.05
|
||||
})
|
||||
.flat_map(|ce| crate::opening_shape::ceiling_hole_rings(p, ce))
|
||||
.map(|h| h.iter().map(|q| [q.x, q.y]).collect::<Vec<P>>())
|
||||
.filter(|h| h.len() >= 3 && h.iter().all(|q| q[0].is_finite() && q[1].is_finite()))
|
||||
.collect();
|
||||
if holes.is_empty() {
|
||||
return;
|
||||
}
|
||||
let mut fps: Option<Vec<super::wall_poche::WallFootprint>> = None;
|
||||
for s in p.stairs.as_deref().unwrap_or(&[]).iter().filter(|s| s.floor_id != c.a.floor && c.vis(&s.category_code, &s.id)) {
|
||||
let (zb, zt) = p.stair_vertical_extent(s);
|
||||
if !((zt - base).abs() <= 0.05 && zb < base - 1e-6 && (zt - zb).is_finite()) {
|
||||
continue;
|
||||
}
|
||||
let params = s.encode();
|
||||
let Some(sp) = crate::stair::decode_params(¶ms) else { continue };
|
||||
let geo = kernel2d::stair_geometry(&sp, zt - zb);
|
||||
let centroid = |t: &kernel2d::TreadRect| {
|
||||
let n = t.pts.len().max(1) as f64;
|
||||
[t.pts.iter().map(|q| q.x).sum::<f64>() / n, t.pts.iter().map(|q| q.y).sum::<f64>() / n]
|
||||
};
|
||||
let own: Vec<Vec<P>> = holes.iter().filter(|h| geo.treads.iter().any(|t| crate::surface_pattern::point_in(centroid(t), h))).cloned().collect();
|
||||
if own.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let greyed = Some(c.greyed(&s.category_code));
|
||||
let ov = c.overrides(Some("stair"), &s.category_code, Some(&stair_label(s)));
|
||||
let lw = ov.lineweight.unwrap_or_else(|| c.cat(&s.category_code).map_or(WALL_FALLBACK_MM, |k| k.lw));
|
||||
let stroke = ov.color.as_deref().or(s.color.as_deref()).unwrap_or(POCHE_STROKE).to_string();
|
||||
// ganz unter der Schnittebene: alles ausgezogen, keine Bruchlinie
|
||||
let f = crate::plan::stair_symbol::plan_stair_clipped(¶ms, zt - zb, zt - zb + 1.0, lw, s.arrow_style == Some(StairArrowStyle::Filled), 0.0, railing_code(p, s), double, &own);
|
||||
emit(out, &f, &stroke, greyed, &s.id);
|
||||
// Austrittskante: Hinterkante des obersten Tritts.
|
||||
let Some(last) = geo.treads.iter().filter(|t| t.pts.len() >= 4).max_by(|a, b| a.top_rise.total_cmp(&b.top_rise)) else { continue };
|
||||
let arrival = if sp.shape == "spiral" { (last.pts[3], last.pts[2]) } else { (last.pts[1], last.pts[2]) };
|
||||
let fps = fps.get_or_insert_with(|| super::domains::wall_footprints(c));
|
||||
for ring in &own {
|
||||
for pts in guard_chains(ring, fps, ([arrival.0.x, arrival.0.y], [arrival.1.x, arrival.1.y])) {
|
||||
let area: f64 = (0..ring.len()).map(|i| ring[i][0] * ring[(i + 1) % ring.len()][1] - ring[(i + 1) % ring.len()][0] * ring[i][1]).sum();
|
||||
// nach aussen (auf die Decke): rechts der Ringrichtung bei Gegenuhrzeigersinn
|
||||
let d = if area > 0.0 { -GUARD_INSET } else { GUARD_INSET };
|
||||
let axis = crate::stair_rail::offset_polyline(&pts, d);
|
||||
let r = crate::stair_rail::RAIL_THICK / 2.0;
|
||||
let lines = if double { vec![crate::stair_rail::offset_polyline(&axis, r), crate::stair_rail::offset_polyline(&axis, -r)] } else { vec![axis] };
|
||||
for l in lines {
|
||||
for w in l.windows(2) {
|
||||
out.push(stair_line(v2(w[0][0], w[0][1]), v2(w[1][0], w[1][1]), LINE_CLS[6], crate::plan::stair_symbol::HANDRAIL_MM, None, &stroke, greyed, &s.id));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [155] Freie Lochränder als Züge in Ringrichtung: ohne Stücke unter Wänden und ohne die Austrittskante.
|
||||
fn guard_chains(ring: &[[f64; 2]], fps: &[super::wall_poche::WallFootprint], arrival: ([f64; 2], [f64; 2])) -> Vec<Vec<[f64; 2]>> {
|
||||
let near = |a: [f64; 2], b: [f64; 2]| (a[0] - b[0]).abs() < 1e-7 && (a[1] - b[1]).abs() < 1e-7;
|
||||
let mut pieces: Vec<[[f64; 2]; 2]> = Vec::new();
|
||||
for [a, b] in super::wall_poche::ceiling_outline_lines(ring, &[], fps) {
|
||||
// Teil, der an der Austrittskante liegt (beide Enden der Kante nahe der Geraden a–b), entfällt.
|
||||
let d = [b[0] - a[0], b[1] - a[1]];
|
||||
let l = d[0].hypot(d[1]);
|
||||
if !(l > 1e-9) {
|
||||
continue;
|
||||
}
|
||||
let u = [d[0] / l, d[1] / l];
|
||||
let off = |q: [f64; 2]| ((q[0] - a[0]) * u[1] - (q[1] - a[1]) * u[0]).abs();
|
||||
let t = |q: [f64; 2]| ((q[0] - a[0]) * u[0] + (q[1] - a[1]) * u[1]) / l;
|
||||
let mut keep = vec![(0.0, 1.0)];
|
||||
if off(arrival.0) < ARRIVAL_TOL && off(arrival.1) < ARRIVAL_TOL {
|
||||
let pad = ARRIVAL_TOL / l;
|
||||
let (t0, t1) = (t(arrival.0).min(t(arrival.1)) - pad, t(arrival.0).max(t(arrival.1)) + pad);
|
||||
keep = [(0.0, t0.min(1.0)), (t1.max(0.0), 1.0)].into_iter().filter(|(x, y)| (y - x) * l > 1e-6).collect();
|
||||
}
|
||||
for (t0, t1) in keep {
|
||||
pieces.push([[a[0] + d[0] * t0, a[1] + d[1] * t0], [a[0] + d[0] * t1, a[1] + d[1] * t1]]);
|
||||
}
|
||||
}
|
||||
// aneinanderhängende Stücke zu Zügen
|
||||
let mut chains: Vec<Vec<[f64; 2]>> = Vec::new();
|
||||
for [a, b] in pieces {
|
||||
match chains.last_mut() {
|
||||
Some(ch) if ch.last().is_some_and(|q| near(*q, a)) => ch.push(b),
|
||||
_ => chains.push(vec![a, b]),
|
||||
}
|
||||
}
|
||||
// letzter Zug schliesst an den ersten an
|
||||
if chains.len() >= 2 && near(*chains.last().unwrap().last().unwrap(), chains[0][0]) {
|
||||
let mut last = chains.pop().unwrap();
|
||||
last.extend(chains[0].iter().skip(1).copied());
|
||||
chains[0] = last;
|
||||
}
|
||||
chains
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -38,6 +38,11 @@ fn finite(p: &P) -> bool {
|
||||
}
|
||||
|
||||
impl Obstacles {
|
||||
/// [156] Alle Punkte der Strecken und Flächen (für eine Hülle).
|
||||
pub fn points(&self) -> Vec<P> {
|
||||
self.segs.iter().flat_map(|s| s.iter().copied()).chain(self.areas.iter().flatten().copied()).collect()
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.segs.is_empty() && self.areas.is_empty()
|
||||
}
|
||||
|
||||
@@ -460,55 +460,26 @@ fn flight_rails(geo: &StairGeometry, railing: u8) -> Vec<Rail> {
|
||||
out
|
||||
}
|
||||
|
||||
/// Grundriss-Stücke eines Handlaufs: zusammenhängende Polygonzüge mit `true` = über der Schnitthöhe
|
||||
/// (gestrichelt). Grenze ist die Gehhöhe `z_break` (Mitte des ersten geschnittenen Tritts, wie die
|
||||
/// Bruchlinie); `None` = ganz unter dem Schnitt. Gerade Folgepunkte werden zusammengefasst.
|
||||
pub fn plan_pieces(rail: &Rail, z_break: Option<f64>) -> Vec<(Vec<P>, bool)> {
|
||||
let above = |z_walk: f64| z_break.is_some_and(|b| z_walk > b + 1e-9);
|
||||
let mut out: Vec<(Vec<P>, bool)> = Vec::new();
|
||||
let path = &rail.path;
|
||||
// Teilstrecke (p → q, Gehhöhe in der Mitte) anhängen; Stilwechsel beginnt ein neues Stück.
|
||||
let mut add = |p: P, q: P, z_mid: f64| {
|
||||
if near(p, q) {
|
||||
return;
|
||||
/// Grundriss-Achse eines Handlaufs als Polygonzug (ohne doppelte und ohne gerade Zwischenpunkte). Die
|
||||
/// Teilung in ausgezogen/gestrichelt an der Bruchlinie macht `plan/stair_symbol.rs` ([155]).
|
||||
pub fn plan_path(rail: &Rail) -> Vec<P> {
|
||||
let mut v: Vec<P> = Vec::with_capacity(rail.path.len());
|
||||
for q in &rail.path {
|
||||
let p = [q[0], q[1]];
|
||||
if v.last().is_some_and(|l| near(*l, p)) {
|
||||
continue;
|
||||
}
|
||||
let up = above(z_mid);
|
||||
match out.last_mut() {
|
||||
Some((pts, u)) if *u == up && pts.last().is_some_and(|l| near(*l, p)) => pts.push(q),
|
||||
_ => out.push((vec![p, q], up)),
|
||||
}
|
||||
};
|
||||
for w in path.windows(2) {
|
||||
let (a, q) = (w[0], w[1]);
|
||||
let (za, zq) = (a[2] - RAIL_HEIGHT, q[2] - RAIL_HEIGHT);
|
||||
let (pa, pq) = ([a[0], a[1]], [q[0], q[1]]);
|
||||
match z_break {
|
||||
Some(b) if (za - b) * (zq - b) < 0.0 => {
|
||||
let t = (b - za) / (zq - za);
|
||||
let m = [a[0] + (q[0] - a[0]) * t, a[1] + (q[1] - a[1]) * t];
|
||||
add(pa, m, (za + b) / 2.0);
|
||||
add(m, pq, (b + zq) / 2.0);
|
||||
if v.len() >= 2 {
|
||||
let (a, b) = (v[v.len() - 2], v[v.len() - 1]);
|
||||
let cr = (b[0] - a[0]) * (p[1] - b[1]) - (b[1] - a[1]) * (p[0] - b[0]);
|
||||
let dot = (b[0] - a[0]) * (p[0] - b[0]) + (b[1] - a[1]) * (p[1] - b[1]);
|
||||
if cr.abs() < 1e-9 && dot > 0.0 {
|
||||
v.pop();
|
||||
}
|
||||
_ => add(pa, pq, (za + zq) / 2.0),
|
||||
}
|
||||
v.push(p);
|
||||
}
|
||||
// Gerade Zwischenpunkte zusammenfassen.
|
||||
for (pts, _) in out.iter_mut() {
|
||||
let mut v: Vec<P> = Vec::with_capacity(pts.len());
|
||||
for &p in pts.iter() {
|
||||
if v.len() >= 2 {
|
||||
let (a, b) = (v[v.len() - 2], v[v.len() - 1]);
|
||||
let cr = (b[0] - a[0]) * (p[1] - b[1]) - (b[1] - a[1]) * (p[0] - b[0]);
|
||||
let dot = (b[0] - a[0]) * (p[0] - b[0]) + (b[1] - a[1]) * (p[1] - b[1]);
|
||||
if cr.abs() < 1e-9 && dot > 0.0 {
|
||||
v.pop();
|
||||
}
|
||||
}
|
||||
v.push(p);
|
||||
}
|
||||
*pts = v;
|
||||
}
|
||||
out
|
||||
v
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -652,28 +623,20 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grundriss_stuecke_an_der_bruchhoehe() {
|
||||
fn grundriss_achse_zusammengefasst() {
|
||||
let mut p = params("straight");
|
||||
p.run_length = 3.0;
|
||||
p.step_count = 10;
|
||||
let geo = stair_geometry(&p, 2.8);
|
||||
let rail = &rails(&p, &geo, 1)[0];
|
||||
// ganz unter dem Schnitt: ein Stück, durchgezogen
|
||||
let all = plan_pieces(rail, None);
|
||||
assert_eq!(all.len(), 1);
|
||||
assert!(!all[0].1 && all[0].0.len() == 2);
|
||||
// Bruch bei Gehhöhe 1.12 (x = 1.2 auf der Linie 0 → 2.8 über 3 m): unten durchgezogen, oben gestrichelt
|
||||
let parts = plan_pieces(rail, Some(1.12));
|
||||
assert_eq!(parts.len(), 2);
|
||||
assert!(!parts[0].1 && parts[1].1);
|
||||
assert!((parts[0].0[1][0] - 1.2).abs() < 1e-9 && (parts[1].0[0][0] - 1.2).abs() < 1e-9);
|
||||
// gerade Treppe: eine Strecke (Zwischenpunkte der Pfosten/Tritte zusammengefasst)
|
||||
assert_eq!(plan_path(rail).len(), 2);
|
||||
// U mit Kropf: Zwischenpunkte auf Geraden zusammengefasst (Ecken bleiben)
|
||||
let u = params("U");
|
||||
let geo = stair_geometry(&u, 2.89);
|
||||
for rail in rails(&u, &geo, 3) {
|
||||
let pieces = plan_pieces(&rail, None);
|
||||
assert_eq!(pieces.len(), 1);
|
||||
assert!(pieces[0].0.len() <= 6, "{:?}", pieces[0].0);
|
||||
let path = plan_path(&rail);
|
||||
assert!(path.len() >= 3 && path.len() <= 6, "{path:?}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,19 @@ pub(crate) fn point_in(pt: P, poly: &[P]) -> bool {
|
||||
|
||||
/// Teilstücke der Strecke a–b innerhalb des Polygons (gerade-ungerade-Regel).
|
||||
pub fn clip_to_poly(a: P, b: P, poly: &[P], out: &mut Vec<(P, P)>) {
|
||||
clip_poly(a, b, poly, true, out);
|
||||
}
|
||||
|
||||
/// [155] Teilstücke der Strecke a–b ausserhalb des Polygons (Gegenstück zu [`clip_to_poly`]).
|
||||
pub fn clip_outside_poly(a: P, b: P, poly: &[P], out: &mut Vec<(P, P)>) {
|
||||
if poly.len() < 3 {
|
||||
out.push((a, b));
|
||||
return;
|
||||
}
|
||||
clip_poly(a, b, poly, false, out);
|
||||
}
|
||||
|
||||
fn clip_poly(a: P, b: P, poly: &[P], keep_inside: bool, out: &mut Vec<(P, P)>) {
|
||||
let n = poly.len();
|
||||
if n < 3 {
|
||||
return;
|
||||
@@ -115,7 +128,7 @@ pub fn clip_to_poly(a: P, b: P, poly: &[P], out: &mut Vec<(P, P)>) {
|
||||
if w[1] - w[0] < 1e-12 {
|
||||
continue;
|
||||
}
|
||||
if point_in(at((w[0] + w[1]) / 2.0), poly) {
|
||||
if point_in(at((w[0] + w[1]) / 2.0), poly) == keep_inside {
|
||||
run = Some(match run {
|
||||
Some((s, e)) if (e - w[0]).abs() < 1e-12 => (s, w[1]),
|
||||
Some((s, e)) => {
|
||||
|
||||
@@ -65,15 +65,16 @@ fn lod_segments(f: impl Fn(f64) -> Vec<(P, P)>) -> Vec<(P, P, u8)> {
|
||||
}
|
||||
|
||||
/// Bodenbelag im Grundriss: Muster der obersten Deckenschicht auf dem Deckenumriss (ohne Aussparungen),
|
||||
/// in Plan-Koordinaten; Ausrichtung am Plan (x), Ursprung am ersten Umrisspunkt.
|
||||
pub fn floor_finish_segments(p: &Project, ce: &Ceiling, scale: f64) -> Option<(Vec<(P, P)>, f64, String)> {
|
||||
/// in Plan-Koordinaten; Ausrichtung am Plan (x), Ursprung am ersten Umrisspunkt. [156] Teilung auf dem
|
||||
/// Papier nicht enger als `plan::floor_finish::MIN_PAPER_MM`, Strich als feine Tusche (0.02–0.05 mm, grau).
|
||||
/// Dazu das Bauteil der Belagsschicht (Name für Regeln, Plattenbelag?).
|
||||
pub fn floor_finish_segments<'a>(p: &'a Project, ce: &Ceiling, scale: f64) -> Option<(Vec<(P, P)>, f64, String, &'a Component)> {
|
||||
let layers = crate::model3d::ceiling_type_ref(p, ce).map(|t| t.2)?;
|
||||
let (pat, comp, spec) = spec_for(layers.first().and_then(|l| p.component(&l.component_id)), 0.0)?;
|
||||
let (outer, holes) = ceiling_rings(ce)?;
|
||||
let segs = sp::segments(&ring_with_holes(&outer, &holes), &spec, outer[0], scale);
|
||||
let w = pat.weight_mm.filter(|w| w.is_finite() && *w > 0.0).unwrap_or(0.1);
|
||||
let ink = pat.color.as_deref().or(comp.foreground.as_deref()).filter(|c| !c.trim().is_empty()).unwrap_or(INK).to_string();
|
||||
Some((segs, w, ink))
|
||||
let segs = sp::segments(&ring_with_holes(&outer, &holes), &spec, outer[0], crate::plan::floor_finish::thinning_scale(scale));
|
||||
let w = crate::plan::floor_finish::weight(pat.weight_mm);
|
||||
Some((segs, w, crate::plan::floor_finish::INK.to_string(), comp))
|
||||
}
|
||||
|
||||
/// Deckenuntersicht im Deckenspiegel ([100]): Muster der untersten Deckenschicht auf dem Deckenumriss
|
||||
@@ -394,7 +395,7 @@ mod tests {
|
||||
let top = crate::model3d::ceiling_type_ref(&p, &ce).unwrap().2[0].component_id.clone();
|
||||
assert!(floor_finish_segments(&p, &ce, 50.0).is_none());
|
||||
with_pattern(&mut p, &top, 0.12);
|
||||
let (segs, w, _) = floor_finish_segments(&p, &ce, 50.0).unwrap();
|
||||
let (segs, w, _, _) = floor_finish_segments(&p, &ce, 50.0).unwrap();
|
||||
assert!(segs.len() > 20, "{}", segs.len());
|
||||
assert!(w > 0.0);
|
||||
// 3D: Oberseite der Decke auf OK Decke.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-0.6725 0 6.345 5.345" width="63.45mm" height="53.45mm">
|
||||
<rect x="-0.6725" y="0" width="6.345" height="5.345" fill="#ffffff"/>
|
||||
<g stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="4">
|
||||
<polygon points="0,4.6725 5,4.6725 5,0.6725 0,0.6725" fill="#f0f0f0" stroke="none" stroke-width="0"/>
|
||||
<polygon points="0,4.6725 5,4.6725 5,0.6725 0,0.6725" fill="none" stroke="none" stroke-width="0"/>
|
||||
<polygon points="0.1725,4.5 4.8275,4.5 4.8275,0.845 0.1725,0.845" fill="#6b728000" stroke="#6b7280" stroke-width="0.002"/>
|
||||
<text x="0.98291" y="2.31972" font-family="Inter, sans-serif" text-anchor="start"><tspan font-size="0.3528" fill="#111111">Wohnen</tspan></text>
|
||||
<text x="2.5" y="2.77833" font-family="Inter, sans-serif" text-anchor="middle"><tspan font-size="0.28222" fill="#111111">17.01 m²</tspan></text>
|
||||
@@ -19,42 +19,26 @@
|
||||
<polygon points="2.475,4.5 2.475,0.845 2.325,0.845 2.325,4.5" fill="#0f0f0f" stroke="none"/>
|
||||
<line x1="2.475" y1="4.5" x2="2.475" y2="0.845" stroke="#1a1a1a" stroke-width="0.025"/>
|
||||
<line x1="2.325" y1="0.845" x2="2.325" y2="4.5" stroke="#1a1a1a" stroke-width="0.025"/>
|
||||
<polygon points="3.2,4.2725 3.2,4.05917 4.2,4.05917 4.2,4.2725" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="4.05917" x2="4.2" y2="4.05917" stroke="#1a1a1a" stroke-width="0.018"/>
|
||||
<polygon points="3.2,4.05917 3.2,3.84583 4.2,3.84583 4.2,4.05917" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="3.84583" x2="4.2" y2="3.84583" stroke="#1a1a1a" stroke-width="0.018"/>
|
||||
<polygon points="3.2,3.84583 3.2,3.6325 4.2,3.6325 4.2,3.84583" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="3.6325" x2="4.2" y2="3.6325" stroke="#1a1a1a" stroke-width="0.018"/>
|
||||
<polygon points="3.2,3.6325 3.2,3.41917 4.2,3.41917 4.2,3.6325" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="3.41917" x2="4.2" y2="3.41917" stroke="#1a1a1a" stroke-width="0.018"/>
|
||||
<polygon points="3.2,3.41917 3.2,3.20583 4.2,3.20583 4.2,3.41917" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="3.20583" x2="4.2" y2="3.20583" stroke="#1a1a1a" stroke-width="0.018"/>
|
||||
<polygon points="3.2,3.20583 3.2,2.9925 4.2,2.9925 4.2,3.20583" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="2.9925" x2="4.2" y2="2.9925" stroke="#1a1a1a" stroke-width="0.0108" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<polygon points="3.2,2.9925 3.2,2.77917 4.2,2.77917 4.2,2.9925" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="2.77917" x2="4.2" y2="2.77917" stroke="#1a1a1a" stroke-width="0.0108" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<polygon points="3.2,2.77917 3.2,2.56583 4.2,2.56583 4.2,2.77917" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="2.56583" x2="4.2" y2="2.56583" stroke="#1a1a1a" stroke-width="0.0108" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<polygon points="3.2,2.56583 3.2,2.3525 4.2,2.3525 4.2,2.56583" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="2.3525" x2="4.2" y2="2.3525" stroke="#1a1a1a" stroke-width="0.0108" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<polygon points="3.2,2.3525 3.2,2.13917 4.2,2.13917 4.2,2.3525" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="2.13917" x2="4.2" y2="2.13917" stroke="#1a1a1a" stroke-width="0.0108" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<polygon points="3.2,2.13917 3.2,1.92583 4.2,1.92583 4.2,2.13917" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="1.92583" x2="4.2" y2="1.92583" stroke="#1a1a1a" stroke-width="0.0108" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<polygon points="3.2,1.92583 3.2,1.7125 4.2,1.7125 4.2,1.92583" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="1.7125" x2="4.2" y2="1.7125" stroke="#1a1a1a" stroke-width="0.0108" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<polygon points="3.2,1.7125 3.2,1.49917 4.2,1.49917 4.2,1.7125" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="1.49917" x2="4.2" y2="1.49917" stroke="#1a1a1a" stroke-width="0.0108" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<polygon points="3.2,1.49917 3.2,1.28583 4.2,1.28583 4.2,1.49917" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="1.28583" x2="4.2" y2="1.28583" stroke="#1a1a1a" stroke-width="0.0108" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<polygon points="3.2,1.28583 3.2,1.0725 4.2,1.0725 4.2,1.28583" fill="none" stroke="#1a1a1a" stroke-width="0.0126"/>
|
||||
<line x1="3.2" y1="1.0725" x2="4.2" y2="1.0725" stroke="#1a1a1a" stroke-width="0.0108" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<line x1="3.2" y1="3.03917" x2="4.2" y2="3.03917" stroke="#1a1a1a" stroke-width="0.018"/>
|
||||
<line x1="3.2" y1="3.15917" x2="4.2" y2="3.15917" stroke="#1a1a1a" stroke-width="0.018"/>
|
||||
<line x1="3.7" y1="4.16583" x2="3.7" y2="1.1045" stroke="#1a1a1a" stroke-width="0.018"/>
|
||||
<line x1="3.579" y1="1.3245" x2="3.7" y2="1.1045" stroke="#1a1a1a" stroke-width="0.018"/>
|
||||
<line x1="3.821" y1="1.3245" x2="3.7" y2="1.1045" stroke="#1a1a1a" stroke-width="0.018"/>
|
||||
<polygon points="3.2,4.2725 4.2,4.2725 4.2,1.0725 3.2,1.0725" fill="none" stroke="#1a1a1a" stroke-width="0.018"/>
|
||||
<polygon points="3.2,4.2725 4.2,4.2725 4.2,1.0725 3.2,1.0725" fill="none" stroke="none" stroke-width="0"/>
|
||||
<polyline points="4.2,3.09917 4.2,1.0725 3.2,1.0725 3.2,3.09917" fill="none" stroke="#1a1a1a" stroke-width="0.013" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.12333"/>
|
||||
<line x1="3.2" y1="4.05917" x2="4.2" y2="4.05917" stroke="#1a1a1a" stroke-width="0.01"/>
|
||||
<line x1="3.2" y1="3.84583" x2="4.2" y2="3.84583" stroke="#1a1a1a" stroke-width="0.01"/>
|
||||
<line x1="3.2" y1="3.6325" x2="4.2" y2="3.6325" stroke="#1a1a1a" stroke-width="0.01"/>
|
||||
<line x1="3.2" y1="3.41917" x2="4.2" y2="3.41917" stroke="#1a1a1a" stroke-width="0.01"/>
|
||||
<line x1="3.2" y1="3.20583" x2="4.2" y2="3.20583" stroke="#1a1a1a" stroke-width="0.01"/>
|
||||
<line x1="3.2" y1="2.9925" x2="4.2" y2="2.9925" stroke="#1a1a1a" stroke-width="0.01" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<line x1="3.2" y1="2.77917" x2="4.2" y2="2.77917" stroke="#1a1a1a" stroke-width="0.01" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<line x1="3.2" y1="2.56583" x2="4.2" y2="2.56583" stroke="#1a1a1a" stroke-width="0.01" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<line x1="3.2" y1="2.3525" x2="4.2" y2="2.3525" stroke="#1a1a1a" stroke-width="0.01" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<line x1="3.2" y1="2.13917" x2="4.2" y2="2.13917" stroke="#1a1a1a" stroke-width="0.01" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<line x1="3.2" y1="1.92583" x2="4.2" y2="1.92583" stroke="#1a1a1a" stroke-width="0.01" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<line x1="3.2" y1="1.7125" x2="4.2" y2="1.7125" stroke="#1a1a1a" stroke-width="0.01" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<line x1="3.2" y1="1.49917" x2="4.2" y2="1.49917" stroke="#1a1a1a" stroke-width="0.01" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<line x1="3.2" y1="1.28583" x2="4.2" y2="1.28583" stroke="#1a1a1a" stroke-width="0.01" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<polygon points="3.78,3.09917 3.72667,3.15917 3.67333,3.03917 3.62,3.09917 3.2,3.09917 3.2,4.2725 4.2,4.2725 4.2,3.09917" fill="none" stroke="#1a1a1a" stroke-width="0.013"/>
|
||||
<line x1="3.7" y1="4.16583" x2="3.7" y2="1.1045" stroke="#1a1a1a" stroke-width="0.01"/>
|
||||
<line x1="3.579" y1="1.3245" x2="3.7" y2="1.1045" stroke="#1a1a1a" stroke-width="0.01"/>
|
||||
<line x1="3.7" y1="1.1045" x2="3.821" y2="1.3245" stroke="#1a1a1a" stroke-width="0.01"/>
|
||||
<line x1="-1" y1="2.6725" x2="6" y2="2.6725" stroke="#1f242c" stroke-width="0.018" stroke-dasharray="0.6 0.15 0.04 0.15" stroke-dashoffset="0.09"/>
|
||||
<polyline points="-1,2.9725 -1,2.3725 -1,1.7725" fill="none" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<line x1="-1" y1="1.7725" x2="-0.85" y2="2.0125" stroke="#1f242c" stroke-width="0.025"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 6.6 KiB |
+1
-1
@@ -204,7 +204,7 @@ function findLevel(project: Project, kinds: string[], name: string | undefined)
|
||||
}
|
||||
|
||||
/** Ansichts-Felder einer Vorlage, die am Geschoss/Schnitt/Ansicht stehen (wie `state/viewTemplates.ts`). */
|
||||
const TEMPLATE_LEVEL_KEYS = ["cutHeight", "viewTop", "viewBottom", "viewDepth", "shadows", "hiddenLines", "sketch", "cutHatch"] as const;
|
||||
const TEMPLATE_LEVEL_KEYS = ["cutHeight", "viewTop", "viewBottom", "viewDepth", "shadows", "hiddenLines", "sketch", "cutHatch", "floorFinish"] as const;
|
||||
|
||||
/**
|
||||
* [33]/[34] `--template <Name|id>`: Ansichtsvorlage auf die Ebene anwenden (Override-Regeln nach
|
||||
|
||||
@@ -1162,6 +1162,10 @@ export const de = {
|
||||
"resources.viewTemplates.shadows": "Schatten",
|
||||
"resources.viewTemplates.hiddenLines": "Verdeckte Kanten",
|
||||
"resources.viewTemplates.cutHatch": "Schnittflächen 1:100 schraffiert (statt schwarz)",
|
||||
"resources.viewTemplates.floorFinish": "Bodenbelag zeigen (ohne: ab 1:50 bzw. „fein“)",
|
||||
"resources.viewTemplates.floorFinish.off": "aus",
|
||||
"resources.viewTemplates.floorFinish.wet": "Nassräume (Platten, gröber als 1:50)",
|
||||
"resources.viewTemplates.floorFinish.all": "alle",
|
||||
"resources.viewTemplates.rules": "Override-Regeln festlegen",
|
||||
"resources.viewTemplates.rulesHint": "Eingeschaltete Regeln gelten in Ansichten/Ausschnitten mit dieser Vorlage, alle übrigen sind dort aus.",
|
||||
"resources.viewTemplates.ruleBlock": "Baustein übernehmen",
|
||||
@@ -1255,6 +1259,7 @@ export const de = {
|
||||
"resources.overrides.val.element_kind.shadow": "Schatten",
|
||||
"resources.overrides.val.element_kind.terrain": "Gelände",
|
||||
"resources.overrides.val.element_kind.mesh": "Importiertes Netz",
|
||||
"resources.overrides.val.element_kind.floor_finish": "Bodenbelag (Muster im Grundriss)",
|
||||
"resources.overrides.action.hide": "Ausblenden",
|
||||
"resources.overrides.value.material": "Name, Kennung oder std-c-…",
|
||||
"resources.overrides.and": "und",
|
||||
|
||||
@@ -1156,6 +1156,10 @@ export const en: Record<TranslationKey, string> = {
|
||||
"resources.viewTemplates.shadows": "Shadows",
|
||||
"resources.viewTemplates.hiddenLines": "Hidden lines",
|
||||
"resources.viewTemplates.cutHatch": "Hatched cut areas at 1:100 (instead of solid black)",
|
||||
"resources.viewTemplates.floorFinish": "Show floor finish (unset: from 1:50 or “fine”)",
|
||||
"resources.viewTemplates.floorFinish.off": "off",
|
||||
"resources.viewTemplates.floorFinish.wet": "Wet rooms (tiles, coarser than 1:50)",
|
||||
"resources.viewTemplates.floorFinish.all": "all",
|
||||
"resources.viewTemplates.rules": "Set override rules",
|
||||
"resources.viewTemplates.rulesHint": "Checked rules apply in views and snapshots using this template, all others are off there.",
|
||||
"resources.viewTemplates.ruleBlock": "Add building block",
|
||||
@@ -1249,6 +1253,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"resources.overrides.val.element_kind.shadow": "Shadow",
|
||||
"resources.overrides.val.element_kind.terrain": "Terrain",
|
||||
"resources.overrides.val.element_kind.mesh": "Imported mesh",
|
||||
"resources.overrides.val.element_kind.floor_finish": "Floor finish (plan pattern)",
|
||||
"resources.overrides.action.hide": "Hide",
|
||||
"resources.overrides.value.material": "Name, id or std-c-…",
|
||||
"resources.overrides.and": "and",
|
||||
|
||||
@@ -1123,6 +1123,10 @@ export type DrawingLevel = {
|
||||
* schwarze Fläche (Poché). Fehlt/aus: ab 1:100 schwarz, 1:50 und Detail „fein" schraffiert.
|
||||
*/
|
||||
cutHatch?: boolean;
|
||||
/**
|
||||
* [156] Bodenbelag-Muster im Grundriss: fehlt = automatisch (ab 1:50 bzw. Detail „fein" alle, gröber keine).
|
||||
*/
|
||||
floorFinish?: FloorFinishDisplay;
|
||||
/**
|
||||
* Grundriss-Unterlage (nur Schnitt/Ansicht): ID eines Geschosses, dessen
|
||||
* Grundriss AUSGERICHTET unter dem Schnitt/der Ansicht gezeigt wird (Schnitt-
|
||||
@@ -1287,6 +1291,12 @@ export type ExtrudedSolid = {
|
||||
brep?: { spec: Record<string, unknown>; origin: Vec2; label?: string };
|
||||
};
|
||||
|
||||
/**
|
||||
* [156] Bodenbelag-Muster im Grundriss (Ansichtsvorlage/Ebene): „aus" nie, „Nassräume" ab 1:50/„fein"
|
||||
* alle und gröber nur Plattenbeläge in Nassräumen (Bad/WC/Dusche), „alle" in jedem Massstab.
|
||||
*/
|
||||
export type FloorFinishDisplay = "off" | "wet" | "all";
|
||||
|
||||
/**
|
||||
* Ein Türtyp (Türstil) — wiederverwendbares Preset für {@link Opening} mit
|
||||
* `kind: "door"`. Bündelt Bauart, Blattausführung und Standardmaße. Werte am
|
||||
@@ -3482,6 +3492,8 @@ export type ViewTemplate = {
|
||||
sketch?: boolean;
|
||||
/** [140] Schnittflächen ab 1:100 schraffiert statt schwarz (s. `DrawingLevel::cut_hatch`). */
|
||||
cutHatch?: boolean;
|
||||
/** [156] Bodenbelag-Muster im Grundriss (s. `DrawingLevel::floor_finish`). */
|
||||
floorFinish?: FloorFinishDisplay;
|
||||
/** Strichstärken mit dem Massstab skalieren. */
|
||||
scaleLineWeights?: boolean;
|
||||
/** Schnitthöhe über OKFF ([36]). */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
viewBox -4.243 0 23.243 18.205
|
||||
bytes 298010
|
||||
bytes 23064
|
||||
circle 14
|
||||
g 1
|
||||
line 3222
|
||||
line 91
|
||||
polygon 22
|
||||
polyline 70
|
||||
polyline 20
|
||||
rect 1
|
||||
svg 1
|
||||
text 36
|
||||
tspan 12
|
||||
hash 735e870f40a3c586
|
||||
hash 476f813f443d315d
|
||||
@@ -1,12 +1,12 @@
|
||||
viewBox -4.243 0 23.243 18.205
|
||||
bytes 308573
|
||||
bytes 307254
|
||||
circle 14
|
||||
g 1
|
||||
line 3223
|
||||
line 3202
|
||||
polygon 76
|
||||
polyline 75
|
||||
polyline 78
|
||||
rect 1
|
||||
svg 1
|
||||
text 36
|
||||
tspan 12
|
||||
hash ab8f9617d6f7d16b
|
||||
hash 24e2377802dd7bbc
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -41.5 0 95 63.6
|
||||
bytes 83229
|
||||
bytes 77791
|
||||
circle 16
|
||||
g 1
|
||||
line 269
|
||||
line 158
|
||||
path 18
|
||||
polygon 106
|
||||
polyline 120
|
||||
polygon 91
|
||||
polyline 124
|
||||
rect 1
|
||||
svg 1
|
||||
text 118
|
||||
tspan 26
|
||||
hash 9e9501052d5dfb39
|
||||
hash 152d5241c7868827
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -41.5 0 95 63.6
|
||||
bytes 112023
|
||||
bytes 128960
|
||||
circle 16
|
||||
g 1
|
||||
line 294
|
||||
line 403
|
||||
path 39
|
||||
polygon 268
|
||||
polyline 137
|
||||
polygon 253
|
||||
polyline 145
|
||||
rect 1
|
||||
svg 1
|
||||
text 121
|
||||
tspan 32
|
||||
hash 3a31318c028477f0
|
||||
hash d4d84942c135622a
|
||||
@@ -1,12 +1,12 @@
|
||||
viewBox -4.243 0 25.297 23.11
|
||||
bytes 340824
|
||||
bytes 49755
|
||||
circle 14
|
||||
g 1
|
||||
line 3307
|
||||
polygon 67
|
||||
polyline 156
|
||||
line 128
|
||||
polygon 52
|
||||
polyline 111
|
||||
rect 1
|
||||
svg 1
|
||||
text 91
|
||||
tspan 23
|
||||
hash bacb8f3cc9970a80
|
||||
text 90
|
||||
tspan 22
|
||||
hash f34a5df35938ec79
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -4.243 0 25.297 23.11
|
||||
bytes 371899
|
||||
bytes 361442
|
||||
circle 14
|
||||
g 1
|
||||
line 3334
|
||||
line 3227
|
||||
path 21
|
||||
polygon 228
|
||||
polyline 171
|
||||
polygon 213
|
||||
polyline 180
|
||||
rect 1
|
||||
svg 1
|
||||
text 91
|
||||
tspan 24
|
||||
hash eccc034e26cbd3c2
|
||||
hash 4d3f45b22f1bbcc7
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -10.004 0 31.058 26.958
|
||||
bytes 48741
|
||||
bytes 51629
|
||||
circle 14
|
||||
g 1
|
||||
line 110
|
||||
path 2
|
||||
polygon 60
|
||||
line 115
|
||||
path 4
|
||||
polygon 44
|
||||
polyline 81
|
||||
rect 1
|
||||
svg 1
|
||||
text 75
|
||||
tspan 20
|
||||
hash a9f5556e41861d67
|
||||
hash c69c51600b89e05d
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -10.004 0 31.058 26.958
|
||||
bytes 59010
|
||||
bytes 61927
|
||||
circle 14
|
||||
g 1
|
||||
line 115
|
||||
path 13
|
||||
polygon 105
|
||||
line 120
|
||||
path 15
|
||||
polygon 89
|
||||
polyline 87
|
||||
rect 1
|
||||
svg 1
|
||||
text 75
|
||||
tspan 20
|
||||
hash e38a3134bcc0c0d4
|
||||
hash 313f8c57cbd6ef78
|
||||
@@ -1,11 +1,11 @@
|
||||
viewBox -0.672 0 6.345 5.345
|
||||
bytes 8216
|
||||
bytes 6549
|
||||
g 1
|
||||
line 32
|
||||
polygon 30
|
||||
polyline 4
|
||||
line 29
|
||||
polygon 16
|
||||
polyline 5
|
||||
rect 1
|
||||
svg 1
|
||||
text 7
|
||||
tspan 3
|
||||
hash 261fa3c016628c74
|
||||
hash 9dad2d2e8cad8951
|
||||
@@ -1,11 +1,11 @@
|
||||
viewBox -0.672 0 6.345 5.345
|
||||
bytes 11919
|
||||
bytes 10294
|
||||
g 1
|
||||
line 33
|
||||
polygon 62
|
||||
polyline 8
|
||||
line 30
|
||||
polygon 48
|
||||
polyline 9
|
||||
rect 1
|
||||
svg 1
|
||||
text 7
|
||||
tspan 3
|
||||
hash 81055535667e58fc
|
||||
hash e23122bd0fdcd298
|
||||
@@ -35,6 +35,11 @@ function withTemplate(p: Project): Project {
|
||||
}
|
||||
|
||||
describe("viewTemplates", () => {
|
||||
it("[156] setzt „Bodenbelag zeigen“ am Geschoss", () => {
|
||||
const p = applyOps(base(), addTemplateOps({ id: "tb", name: "Nass", floorFinish: "wet" }));
|
||||
const q = applyOps(p, applyToLevelOps(p, "tb", "eg", false));
|
||||
expect(q.drawingLevels.find((l) => l.id === "eg")?.floorFinish).toBe("wet");
|
||||
});
|
||||
it("erfasst Geschoss- und Anzeigewerte", () => {
|
||||
const p = base();
|
||||
const t = captureTemplate("t", "V", p.drawingLevels.find((l) => l.id === "eg"), ui);
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface ViewTemplateUi {
|
||||
}
|
||||
|
||||
/** Geschoss-Felder, die eine Vorlage setzt (fehlt das Vorlagen-Feld, bleibt die Ansicht unberührt). */
|
||||
const LEVEL_KEYS = ["cutHeight", "viewTop", "viewBottom", "viewDepth", "shadows", "hiddenLines", "sketch", "cutHatch"] as const;
|
||||
const LEVEL_KEYS = ["cutHeight", "viewTop", "viewBottom", "viewDepth", "shadows", "hiddenLines", "sketch", "cutHatch", "floorFinish"] as const;
|
||||
|
||||
/** Teilobjekt für das Geschoss aus den gesetzten Feldern der Vorlage. */
|
||||
export function levelPatch(t: ViewTemplate): Partial<DrawingLevel> {
|
||||
|
||||
@@ -28,7 +28,7 @@ const OVERRIDE_TYPE_OPTIONS: { value: OverrideConditionType; labelKey: string }[
|
||||
|
||||
/** [33] Feste Werte je Kriterium (Auswahl statt Freitext); Beschriftung `resources.overrides.val.<typ>.<wert>`. */
|
||||
const ENUM_VALUES: Partial<Record<OverrideConditionType, readonly string[]>> = {
|
||||
element_kind: ["wall", "slab", "ground_slab", "roof", "stair", "column", "opening", "room", "shadow", "terrain", "mesh"],
|
||||
element_kind: ["wall", "slab", "ground_slab", "roof", "stair", "column", "opening", "room", "shadow", "terrain", "mesh", "floor_finish"],
|
||||
layer_function: ["structure", "insulation", "screed", "finish", "plaster", "substructure", "membrane", "cladding", "air"],
|
||||
layer_position: ["above", "structure", "below"],
|
||||
view_kind: ["plan", "section", "elevation"],
|
||||
|
||||
@@ -157,6 +157,15 @@ function TemplateDetail({
|
||||
{bool("scaleLineWeights", t("resources.viewTemplates.scaleLineWeights"))}
|
||||
{bool("sketch", t("resources.viewTemplates.sketch"))}
|
||||
{bool("cutHatch", t("resources.viewTemplates.cutHatch"))}
|
||||
<Optional label={t("resources.viewTemplates.floorFinish")} on={tpl.floorFinish !== undefined} onToggle={(on) => patch({ floorFinish: on ? "off" : null })}>
|
||||
<select className="res-input" aria-label={t("resources.viewTemplates.floorFinish")} value={tpl.floorFinish ?? "off"} onChange={(e) => patch({ floorFinish: e.target.value })}>
|
||||
{(["off", "wet", "all"] as const).map((v) => (
|
||||
<option key={v} value={v}>
|
||||
{t(`resources.viewTemplates.floorFinish.${v}`)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Optional>
|
||||
<RulesSection tpl={tpl} project={project} h={h} />
|
||||
<div className="res-hint">{t("resources.viewTemplates.rangeHint")}</div>
|
||||
{num("cutHeight", t("resources.viewTemplates.cutHeight"), 1.0)}
|
||||
|
||||
Reference in new issue
Block a user