[207] Situation: Gewässer als Schraffur (auch in Tusche), Kataster-Umrisse von der Fläche getragen, neue Klassen in Ausschnitten, Zahlen-Layer beim zweiten Import wiederverwendet
- Gewässer: feine waagrechte Parallelschraffur (1.2 mm Papierabstand) auf hellblauer Fläche; in Tusche bleibt die Schraffur - gefüllte Kataster-Ringe (Gebäude, Gewässer) ohne Zeichnungslinien darüber, die Fläche trägt den feinen Umriss (Schwarzplan schwarz) - Import: neu angelegte Klassen (z. B. 17) in allen Ausschnitten eingeblendet; Beispiel-Ausschnitte „Situation 1:500" mit 17 - Abgleich über „Code Bezeichnung": vorhandene Kategorie „4711 …" wird für Layer „4711" wiederverwendet
This commit is contained in:
10 files changed
+173
-5
No files matched your search
@@ -1913,6 +1913,11 @@ pub fn plan_drawings(c: &Ctx, sink: &mut Sink, bounds: &mut Bounds) -> Result<()
|
||||
if !m.shown {
|
||||
continue;
|
||||
}
|
||||
if super::situation::drawing_is_filled(c, d) {
|
||||
// [207] Die gefüllte Fläche (situation.rs) trägt den Umriss.
|
||||
acc_bounds(&d.geom, bounds);
|
||||
continue;
|
||||
}
|
||||
sink.keep = if c.a.compact && compact_eligible(d) { Keep::NoLines } else { Keep::All };
|
||||
emit(c, d, Attrs::with(d, &m.ov, m.cat), &d.geom, m.greyed, c.a.scale, sink, 0)?;
|
||||
acc_bounds(&d.geom, bounds);
|
||||
@@ -2134,6 +2139,10 @@ pub fn plan_drawings_chunked(c: &Ctx, stamps: &[u64], cache: &mut super::cache::
|
||||
if !m.shown {
|
||||
continue;
|
||||
}
|
||||
if super::situation::drawing_is_filled(c, d) {
|
||||
acc_bounds(&d.geom, bounds);
|
||||
continue;
|
||||
}
|
||||
let keep = if c.a.compact && compact_eligible(d) { Keep::NoLines } else { Keep::All };
|
||||
seq.push((i, stamp, m.greyed as u8 | ((keep as u8) << 1)));
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
use super::domains::{Bounds, Ctx};
|
||||
use super::drawings::mm_to_model;
|
||||
use super::prim::Primitive;
|
||||
use super::prim::{HatchRender, Primitive};
|
||||
use super::style::no_hatch;
|
||||
use crate::flat::{Polygon, Ring};
|
||||
use crate::model::*;
|
||||
@@ -35,6 +35,9 @@ const GREY: (&str, &str) = ("#b8b8b8", "#7c7c7c");
|
||||
/// Gewässer aus dem Kataster: hellblau gefüllt.
|
||||
const WATER: (&str, &str) = ("#cfe3f1", "#7fa8c7");
|
||||
const OUTLINE_MM: f64 = 0.1;
|
||||
/// Linienabstand und Strichstärke der Wasser-Schraffur (Papier-mm).
|
||||
const WATER_HATCH_MM: f64 = 1.2;
|
||||
const WATER_HATCH_LINE_MM: f64 = 0.05;
|
||||
/// Eine Dreiecksfläche unter 1 cm² trägt nichts zur Aufsicht bei (senkrechte Wände, Splitter).
|
||||
const MIN_TRI_AREA: f64 = 1e-4;
|
||||
|
||||
@@ -235,10 +238,32 @@ pub fn cadastre_prims(c: &Ctx, s: &Opts, out: &mut Vec<Primitive>) {
|
||||
}
|
||||
}
|
||||
for (code, rings) in fills(is_water_class) {
|
||||
let from = out.len();
|
||||
fill_polygons(&crate::polygon_bool::nest_even_odd(&rings), WATER, None, c.greyed(&code), out);
|
||||
for q in &mut out[from..] {
|
||||
if let Primitive::Polygon { hatch, .. } = q {
|
||||
*hatch = Box::new(water_hatch(c.a.scale));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Wasser als feine waagrechte Parallelschraffur (Plangrafik-Brauch für Gewässer): bleibt in Tusche erhalten, wo die
|
||||
/// hellblaue Fläche weiss wird (`extras::Post`: bunte Fläche → Papier, bunte Schraffur → Tinte). Abstand auf dem
|
||||
/// Papier fest ([`WATER_HATCH_MM`]), unabhängig vom Massstab; Musterabstand = 8 · scale / 90 m.
|
||||
fn water_hatch(plan_scale: f64) -> HatchRender {
|
||||
let scale = mm_to_model(WATER_HATCH_MM, plan_scale) * 90.0 / 8.0;
|
||||
HatchRender { pattern: HatchPattern::Diagonal, scale, angle: 90.0, color: WATER.1.into(), line_weight: WATER_HATCH_LINE_MM, ..no_hatch() }
|
||||
}
|
||||
|
||||
/// Wird diese Zeichnung im Situationsplan als gefüllte Fläche gezeigt (Kataster-Gebäude, Gewässer)? Dann trägt die
|
||||
/// Fläche den Umriss selbst (wie die Kontextnetze: fein, in der Farbe der Fläche, im Schwarzplan schwarz) und die
|
||||
/// Linien der Zeichnung entfallen — sonst läge der Klassen-Umriss (grau, 0.18 mm) über der Füllung.
|
||||
pub fn drawing_is_filled(c: &Ctx, d: &Drawing2D) -> bool {
|
||||
matches!(d.geom, Drawing2DGeom::Polyline { closed: true, .. } | Drawing2DGeom::Rect { .. })
|
||||
&& opts(c).is_some_and(|s| (colors(s.context).is_some() && is_building_class(c, &d.category_code)) || is_water_class(c, &d.category_code))
|
||||
}
|
||||
|
||||
fn acc_polys(polys: &[Polygon], bounds: &mut Bounds) {
|
||||
for q in polys.iter().filter_map(|p| p.first()).flatten() {
|
||||
bounds.acc(q[0], q[1]);
|
||||
|
||||
@@ -204,3 +204,42 @@ fn kataster_schwarzplan_und_klassen() {
|
||||
let normal = plan(&p, &all, "mittel");
|
||||
assert!(fills(&normal, "#b8b8b8").is_empty() && fills(&normal, "#cfe3f1").is_empty());
|
||||
}
|
||||
|
||||
/// [207] Gewässer: hellblau mit feiner Parallelschraffur; in Tusche bleibt die Schraffur (Fläche weiss, Linien Tinte),
|
||||
/// sonst wäre das Wasser auf dem Papier unsichtbar.
|
||||
#[test]
|
||||
fn kataster_gewaesser_mit_schraffur_auch_in_tusche() {
|
||||
use crate::plan::extras::Post;
|
||||
let p = cadastre_project();
|
||||
let ps = plan(&p, &codes(&p), "std-mv-situation-wbw");
|
||||
let water = fills(&ps, "#cfe3f1");
|
||||
let Primitive::Polygon { hatch, .. } = water[0] else { unreachable!() };
|
||||
assert_eq!(hatch.pattern, HatchPattern::Diagonal);
|
||||
assert_eq!(hatch.angle, 90.0, "waagrechte Linien (Musterwinkel 0 = senkrecht)");
|
||||
assert!(hatch.line_weight <= 0.1, "fein: {}", hatch.line_weight);
|
||||
// Abstand 1.2 mm auf dem Papier bei 1:500: 8 · scale / 90 m = 0.6 m.
|
||||
assert!((8.0 * hatch.scale / 90.0 - 0.6).abs() < 1e-9, "Abstand {}", 8.0 * hatch.scale / 90.0);
|
||||
let mut q = water[0].clone();
|
||||
Post { mono: true, lw: 1.0, sketch: 0.0 }.apply(&mut q);
|
||||
let Primitive::Polygon { fill, hatch, .. } = &q else { unreachable!() };
|
||||
assert_eq!(fill, "#ffffff");
|
||||
assert_eq!(hatch.pattern, HatchPattern::Diagonal);
|
||||
assert_eq!(hatch.color, crate::plan::style::MONO_INK, "Schraffur in Tusche");
|
||||
// Gebäude behalten keine Schraffur.
|
||||
assert!(fills(&ps, "#b8b8b8").iter().all(|q| matches!(q, Primitive::Polygon { hatch, .. } if hatch.pattern == HatchPattern::None)));
|
||||
}
|
||||
|
||||
/// [207] Gefüllte Kataster-Flächen tragen ihren Umriss selbst (wie die Kontextnetze): die Zeichnungs-Linien der
|
||||
/// Ringe liegen nicht noch einmal darüber. Im gewöhnlichen Grundriss bleiben sie.
|
||||
#[test]
|
||||
fn kataster_umrisse_nicht_doppelt() {
|
||||
let p = cadastre_project();
|
||||
let all = codes(&p);
|
||||
let kat_lines = |ps: &[Primitive]| ps.iter().filter(|q| matches!(q, Primitive::Line { drawing_id: Some(id), .. } if id.starts_with("k-"))).count();
|
||||
assert_eq!(kat_lines(&plan(&p, &all, "std-mv-situation-wbw")), 0);
|
||||
assert_eq!(kat_lines(&plan(&p, &all, "std-mv-schwarzplan")), 0);
|
||||
assert!(kat_lines(&plan(&p, &all, "mittel")) > 0, "gewöhnlicher Grundriss zeichnet sie");
|
||||
// Schwarzplan: Umriss der gefüllten Gebäude schwarz wie die Füllung.
|
||||
let sp = plan(&p, &all, "std-mv-schwarzplan");
|
||||
assert!(sp.iter().filter(|q| matches!(q, Primitive::Polygon { fill, .. } if fill == "#000000")).all(|q| matches!(q, Primitive::Polygon { stroke, .. } if stroke == "#000000")));
|
||||
}
|
||||
Reference in new issue
Block a user