diff --git a/crates/engine/src/cmd/layout/export.rs b/crates/engine/src/cmd/layout/export.rs index 2fb140a179..50de17e82f 100644 --- a/crates/engine/src/cmd/layout/export.rs +++ b/crates/engine/src/cmd/layout/export.rs @@ -83,6 +83,11 @@ pub fn layout_png(s: &mut Session, li: usize, dpi: f64, region: Option<[f64; 4]> if let Some(r) = region { gaps.retain(|g, _| layout.element(g.frame).is_some_and(|e| rustgis_render::layout::meets(e, r, 0.0))); } + let mut profiles: ProfileNotes = + rustgis_render::layout::profiles_not_drawn(&layout, &s.project.maps).into_iter().map(|n| (n, 1)).collect(); + if let Some(r) = region { + profiles.retain(|n, _| layout.element(n.element).is_some_and(|e| rustgis_render::layout::meets(e, r, 0.0))); + } let ((img, mut unfitted), mut charts) = rustgis_render::layout::drawn_charts(|| { rustgis_render::layout::unfitted_legends(|| { crate::cmd::share::saying_shadows(s, "The layout", |s| match region { @@ -106,6 +111,9 @@ pub fn layout_png(s: &mut Session, li: usize, dpi: f64, region: Option<[f64; 4]> if let Some(note) = rustgis_render::layout::sections_notice(&gaps, 1) { s.warn(note); } + for note in rustgis_render::layout::profiles_notice(&profiles, 1) { + s.warn(note); + } img.encode_png().map_err(|e| e.to_string()) } @@ -152,6 +160,9 @@ pub(in crate::cmd) fn chart_notice_lines_in<'a>( /// The section lines an export doesn't draw, each with the pages it is missing from. type SectionGaps = BTreeMap; +/// What an export's profiles say ([`rustgis_render::layout::profiles_not_drawn`]), each with the +/// pages it is said on. +type ProfileNotes = BTreeMap; /// What `view_map` draws when it is given a `layout`: the layout's frames' maps and their tiles, /// as exporting it reads them, rather than the active map's. `None` without a `layout`. @@ -211,6 +222,7 @@ pub(in crate::cmd::layout) fn layout_bytes_inner( let (mut left_out, mut by_corners): (Vec<(usize, u32, String, &'static str)>, Vec<(usize, u32, String)>) = (Vec::new(), Vec::new()); let mut clipped = BTreeMap::new(); let mut gaps = SectionGaps::new(); + let mut profiles = ProfileNotes::new(); let render_pages = || -> Result<(Vec, Option>), String> { let mut out = Vec::new(); let mut png = None; @@ -236,6 +248,9 @@ pub(in crate::cmd::layout) fn layout_bytes_inner( for gap in rustgis_render::layout::sections_not_drawn(layout, &s.project.maps) { *gaps.entry(gap).or_default() += 1; } + for note in rustgis_render::layout::profiles_not_drawn(layout, &s.project.maps) { + *profiles.entry(note).or_default() += 1; + } // Each page is kept as vectors (its pictures compressed) as soon as it's drawn, within // a memory budget. if pdf { @@ -303,6 +318,9 @@ pub(in crate::cmd::layout) fn layout_bytes_inner( if let Some(note) = rustgis_render::layout::sections_notice(&gaps, pages.len()) { s.warn(note); } + for note in rustgis_render::layout::profiles_notice(&profiles, pages.len()) { + s.warn(note); + } say_unfitted_legends(s, &unfitted); for note in chart_notice_lines(&saved, &charts) { s.warn(note); @@ -535,6 +553,7 @@ pub(in crate::cmd::layout) fn layout_svg(s: &mut Session, li: usize, dpi: f64) - let clipped = rustgis_render::layout::clipped_text(layout, &s.project.maps, dpi, &info); let note = rustgis_render::layout::clipped_text_notice(layout, &clipped); let gaps = rustgis_render::layout::sections_not_drawn(layout, &s.project.maps).into_iter().map(|g| (g, 1)).collect(); + let profiles: ProfileNotes = rustgis_render::layout::profiles_not_drawn(layout, &s.project.maps).into_iter().map(|n| (n, 1)).collect(); let ((drawn, unfitted), charts) = rustgis_render::layout::drawn_charts(|| { rustgis_render::layout::unfitted_legends(|| rustgis_render::svg::layout_svg(layout, &mut s.project.maps, dpi, &info)) }); @@ -543,6 +562,9 @@ pub(in crate::cmd::layout) fn layout_svg(s: &mut Session, li: usize, dpi: f64) - for note in [note, rustgis_render::layout::sections_notice(&gaps, 1)].into_iter().flatten() { s.warn(note); } + for note in rustgis_render::layout::profiles_notice(&profiles, 1) { + s.warn(note); + } say_unfitted_legends(s, &unfitted); for note in chart_notes { s.warn(note); diff --git a/crates/engine/src/cmd/report.rs b/crates/engine/src/cmd/report.rs index f0e7c4ab43..28c650bfbc 100644 --- a/crates/engine/src/cmd/report.rs +++ b/crates/engine/src/cmd/report.rs @@ -1280,6 +1280,30 @@ fn say_sections_not_drawn(s: &mut Session, pages: &[rustgis_render::report::Page if let Some(note) = rustgis_render::layout::sections_notice(&gaps, 1) { s.warn(format!("The report: {note}")); } + say_profiles_not_drawn(s, pages, n); +} + +/// Says what the profiles (#2863 part 2) of the layouts of the first `n` of `pages` say, as +/// [`say_sections_not_drawn`] says their section lines: one notice of a kind, each profile named +/// with its layout. +fn say_profiles_not_drawn(s: &mut Session, pages: &[rustgis_render::report::Page], n: usize) { + let mut seen = Vec::new(); + let mut notes = std::collections::BTreeMap::new(); + for page in pages.iter().take(n) { + let rustgis_render::report::Page::Layout(li) = page else { continue }; + if seen.contains(li) { + continue; + } + seen.push(*li); + let Some(layout) = s.project.layouts.get(*li) else { continue }; + for mut note in rustgis_render::layout::profiles_not_drawn(layout, &s.project.maps) { + note.layout.clone_from(&layout.name); + notes.insert(note, 1); + } + } + for note in rustgis_render::layout::profiles_notice(¬es, 1) { + s.warn(format!("The report: {note}")); + } } /// Runs `f`, and returns its result with the legends it drew under a fit still cut and the charts diff --git a/crates/engine/src/tests/layout_profiles.rs b/crates/engine/src/tests/layout_profiles.rs index 52321fa9c9..4955fa910c 100644 --- a/crates/engine/src/tests/layout_profiles.rs +++ b/crates/engine/src/tests/layout_profiles.rs @@ -3,6 +3,7 @@ use crate::{Session, sample}; use rustgis_data::raster::{ColorHint, Crs, GeoTransform, Raster}; +use rustgis_data::{Dataset, Field, FieldType, Geometry, GeometryType, Value as Data}; use rustgis_geom::Coord; use rustgis_map::layout::{ElementKind, Profile, ProfileSide}; use serde_json::json; @@ -16,6 +17,21 @@ fn put_profile(s: &mut Session, frame: u32, side: ProfileSide) -> u32 { l.add("Profile", p.rect(at), ElementKind::Profile(p)) } +/// A layout with a frame of the sample's map round (10, 50), a raster "DEM" of one degree's hundred +/// metres of latitude over it, and the frame's id. +fn with_dem() -> (Session, u32) { + let mut s = Session::new(sample::world_project()); + let (n, cell) = (400usize, 0.05); + let data = (0..n * n).map(|i| ((60.0 - ((i / n) as f64 + 0.5) * cell) * 100.0) as f32).collect(); + let gt = GeoTransform { origin_x: 0.0, origin_y: 60.0, pixel_width: cell, pixel_height: -cell }; + let r = Raster::new("dem", n as u32, n as u32, vec![data], gt, Crs::LonLat, None, ColorHint::Gray, "Float32").unwrap(); + s.map_mut().add_raster("DEM", rustgis_map::RasterLayer::from_path(r, "dem.tif")); + s.run("layout.new", &json!({"page": "a4", "template": "map"})).unwrap(); + let frame = s.project.layouts[0].first_frame().unwrap(); + s.run("layout.update", &json!({"element": frame, "center": [10, 50], "scale": 1e7})).unwrap(); + (s, frame) +} + /// A profile's copy stays beside its frame, over the original, and says it took no offset. #[test] fn a_profiles_copy_keeps_beside_its_frame_and_says_so() { @@ -50,6 +66,56 @@ fn a_box_given_to_a_profile_is_said_not_kept() { assert!(s.notices_since(mark).is_empty(), "the frame takes its profile along"); } +fn said(s: &Session, mark: u64) -> Vec { + s.notices_since(mark).iter().map(|n| n.text.clone()).collect() +} + +/// A profile its page can't draw says so when the page is drawn: beside a tilted frame, one notice +/// naming it and why, from a PNG, a PDF and the picture `view_map` draws alike, and from a report +/// with its layout named. +#[test] +fn a_profile_not_drawn_is_said() { + let (mut s, frame) = with_dem(); + s.run("layout.addElement", &json!({"kind": "section", "at": [10, 50], "direction": "vertical"})).unwrap(); + s.run("layout.update", &json!({"element": frame, "pitch": 40})).unwrap(); + let id = put_profile(&mut s, frame, ProfileSide::Right); + let notes = vec![format!( + "1 profile(s) not drawn: 'Profile' ({id}): its frame is tilted or on the globe, where a line straight on the page isn't a section of the ground" + )]; + let drawn: Vec<(&str, Box)> = vec![ + ("png", Box::new(|s| drop(crate::cmd::layout::layout_bytes(s, 0, false, 48.0, false).unwrap()))), + ("pdf", Box::new(|s| drop(crate::cmd::layout::layout_bytes(s, 0, true, 48.0, true).unwrap()))), + ("view", Box::new(|s| drop(crate::cmd::layout::layout_png(s, 0, 48.0, None).unwrap()))), + ]; + let profile_notes = |s: &Session, mark: u64| said(s, mark).into_iter().filter(|n| n.contains("profile(s)")).collect::>(); + for (how, export) in &drawn { + let mark = s.notice_mark(); + export(&mut s); + assert_eq!(profile_notes(&s, mark), notes, "{how}"); + } + let layout = s.project.layouts[0].name.clone(); + let mut shops = Dataset::new("Shops", GeometryType::Point, vec![Field::new("n", FieldType::Double)]); + shops.push(Some(Geometry::Point(Coord::new(10.0, 50.0))), vec![Data::Float(1.0)]); + s.map_mut().add_dataset(shops); + s.run("report.new", &json!({"layer": "Shops", "name": "R"})).unwrap(); + s.run("report.existingTemplate", &json!({"report": "R", "layout": layout, "end": true})).unwrap(); + let dir = std::env::temp_dir().join(format!("rustgis-2863c-{}-{:?}", std::process::id(), std::thread::current().id())); + std::fs::create_dir_all(&dir).unwrap(); + let mark = s.notice_mark(); + let exported = s.run("report.export", &json!({"report": "R", "path": dir.join("r.pdf"), "dpi": 36})); + std::fs::remove_dir_all(&dir).ok(); + exported.unwrap(); + let why = "its frame is tilted or on the globe, where a line straight on the page isn't a section of the ground"; + assert_eq!(profile_notes(&s, mark), [format!("The report: 1 profile(s) not drawn: 'Profile' ({id}) in layout '{layout}': {why}")]); + // Flat again, it is drawn, and nothing is said. + s.run("layout.update", &json!({"element": frame, "pitch": 0})).unwrap(); + for (how, export) in &drawn { + let mark = s.notice_mark(); + export(&mut s); + assert!(profile_notes(&s, mark).is_empty(), "{how}: {:?}", said(&s, mark)); + } +} + /// The Mantiqueira of #2863: a vertical section line of a UTM 23S frame through the Pedra da Mina, /// whose profile `profile.create` gave again within 0.11 m over 1,600 samples of the Copernicus DEM. /// On a relief of that frame, the profile's samples and `profile.create`'s between the line's ends, diff --git a/crates/render/src/layout.rs b/crates/render/src/layout.rs index b65a276948..d601456bc1 100644 --- a/crates/render/src/layout.rs +++ b/crates/render/src/layout.rs @@ -696,7 +696,7 @@ fn draw_page( None => placeholder(&mut pm, r, "Chart", ppp), } } - // What it reads is worked out from 2b (`profile_samples`); it is said in 2c and drawn in 2d (#2863). + // Its curve comes in its own step (#2863 part 2d); what it reads is said meanwhile. ElementKind::Profile(_) => placeholder(&mut pm, r, "Profile", ppp), ElementKind::Rectangle { fill, outline, width, radius, dash } => { // Square corners filled as before, so an existing layout draws to the same pixels. diff --git a/crates/render/src/layout/profile.rs b/crates/render/src/layout/profile.rs index 881efcc9e0..77bd203953 100644 --- a/crates/render/src/layout/profile.rs +++ b/crates/render/src/layout/profile.rs @@ -1,5 +1,6 @@ //! A raster's profile beside its map frame (#2863 part 2): its samples along a section line, read -//! at each one's point of the page line through the frame's projection. +//! at each one's point of the page line through the frame's projection, and what keeps one from +//! being drawn. use rustgis_map::layout::{MAX_PROFILE_SAMPLES, Profile}; @@ -120,6 +121,106 @@ pub fn profile_samples(layout: &Layout, maps: &[Map], p: &Profile) -> Result<(Pr Ok((out, section.clone())) } +/// A profile its layout doesn't draw, or draws from fewer samples than its raster's cells along +/// its section line, or with gaps where the line has no data ([`profile_samples`]). +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +pub struct ProfileNote { + /// The layout it is in, named where several are said together (a report's); empty otherwise. + pub layout: String, + pub element: u32, + pub name: String, + /// Why it isn't drawn; `None` for one drawn. + pub why: Option, + /// Drawn, the cells along its section line when they are more than its samples; 0 otherwise. + pub cells: usize, + /// Drawn, its samples without a value (off its raster or over no data), and all of them. + pub blank: (usize, usize), +} + +/// What `layout`'s visible profiles say as the page is now: those not drawn, and why, those read +/// at fewer samples than their raster's cells along the line, and those drawn with gaps. +pub fn profiles_not_drawn(layout: &Layout, maps: &[Map]) -> Vec { + let profiles = layout.elements.iter().filter(|e| e.visible).filter_map(|e| match &e.kind { + ElementKind::Profile(p) => Some((e, p)), + _ => None, + }); + profiles + .filter_map(|(e, p)| { + let (why, cells, blank) = match profile_samples(layout, maps, p) { + Err(why) => (Some(why), 0, (0, 0)), + Ok((s, _)) => { + let blank = (s.values.iter().filter(|v| v.is_none()).count(), s.values.len()); + if s.cells.is_none() && blank.0 == 0 { + return None; + } + (None, s.cells.unwrap_or(0), blank) + } + }; + Some(ProfileNote { layout: String::new(), element: e.id, name: e.name.clone(), why, cells, blank }) + }) + .collect() +} + +/// What an export of `pages` pages says of its profiles ([`profiles_not_drawn`]), each with the +/// pages it is on: one notice for those not drawn, each named with its reason, one for those read +/// at fewer samples than cells, and one for those drawn with gaps, each with the pages it is on +/// over several; the profiles counted, the first ten named. +pub fn profiles_notice(notes: &BTreeMap, pages: usize) -> Vec { + let on = |n: usize| if pages > 1 { format!(" on {n} of {pages} pages") } else { String::new() }; + let list = |items: Vec| { + let more = items.len().saturating_sub(10); + let mut named = items.into_iter().take(10).collect::>().join("; "); + if more > 0 { + named.push_str(&format!("; and {more} more")); + } + named + }; + // A profile can be missing for one reason on some pages and another on others: one profile still. + let mut missing: BTreeMap<(&str, u32, &str), Vec> = BTreeMap::new(); + // The most a page says of each, and the pages saying it. + let mut thinned: BTreeMap<(&str, u32, &str), (usize, usize)> = BTreeMap::new(); + let mut gaps: BTreeMap<(&str, u32, &str), ((usize, usize), usize)> = BTreeMap::new(); + for (n, count) in notes { + let key = (n.layout.as_str(), n.element, n.name.as_str()); + match &n.why { + Some(why) => missing.entry(key).or_default().push(format!("{}: {why}", on(*count))), + None => { + if n.cells > 0 { + let (most, on) = thinned.entry(key).or_default(); + (*most, *on) = ((*most).max(n.cells), *on + count); + } + if n.blank.0 > 0 { + let (most, on) = gaps.entry(key).or_default(); + (*most, *on) = ((*most).max(n.blank), *on + count); + } + } + } + } + let named = |(layout, id, name): (&str, u32, &str)| { + if layout.is_empty() { format!("'{name}' ({id})") } else { format!("'{name}' ({id}) in layout '{layout}'") } + }; + let mut out = Vec::new(); + if !missing.is_empty() { + let count = missing.len(); + let items = missing.into_iter().map(|(key, why)| format!("{}{}", named(key), why.join(","))).collect(); + out.push(format!("{count} profile(s) not drawn: {}", list(items))); + } + if !thinned.is_empty() { + let count = thinned.len(); + let items = thinned.into_iter().map(|(key, (cells, n))| format!("{}, across {cells} cells{}", named(key), on(n))).collect(); + out.push(format!( + "{count} profile(s) read at {MAX_PROFILE_SAMPLES} samples, fewer than their raster's cells along the line: {}", + list(items) + )); + } + if !gaps.is_empty() { + let count = gaps.len(); + let items = gaps.into_iter().map(|(key, ((blank, all), n))| format!("{}, {blank} of {all} samples{}", named(key), on(n))).collect(); + out.push(format!("{count} profile(s) drawn with gaps, where the line has no data: {}", list(items))); + } + out +} + #[cfg(test)] #[path = "profile_tests.rs"] mod tests; diff --git a/crates/render/src/layout/profile_tests.rs b/crates/render/src/layout/profile_tests.rs index 0fff37af5d..4cec885aaa 100644 --- a/crates/render/src/layout/profile_tests.rs +++ b/crates/render/src/layout/profile_tests.rs @@ -133,6 +133,45 @@ fn the_page_line_is_not_a_straight_line_of_longitude_and_latitude() { assert!(s.values.iter().flatten().all(|v| (v - along).abs() < 0.05)); } +/// What keeps a profile from being drawn is said, one notice with each profile and why: a tilted +/// frame, a section line running the other way, a band the raster hasn't, a raster read in place, a +/// section line that isn't there, and no data along the line. A drawable one says nothing. +#[test] +fn a_profile_not_drawn_says_why() { + let notes = |l: &Layout, maps: &[Map]| { + let n = profiles_not_drawn(l, maps); + profiles_notice(&n.into_iter().map(|n| (n, 1)).collect(), 1) + }; + let maps = vec![utm_map(dem(|_, n| n))]; + let (l, _) = page(SectionLine::Horizontal(CENTER), ProfileSide::Bottom, (0.0, 0.0)); + assert!(notes(&l, &maps).is_empty(), "{:?}", notes(&l, &maps)); + let (tilted, _) = page(SectionLine::Horizontal(CENTER), ProfileSide::Bottom, (0.0, 40.0)); + let said = notes(&tilted, &maps); + assert!(said.len() == 1 && said[0].starts_with("1 profile(s) not drawn: 'Profile' (2): its frame is tilted"), "{said:?}"); + let (across, _) = page(SectionLine::Horizontal(CENTER), ProfileSide::Right, (0.0, 0.0)); + assert!(notes(&across, &maps)[0].contains("a horizontal section line's profile goes under or over its frame, not right")); + let change = |f: &dyn Fn(&mut Profile)| { + let (mut l, id) = page(SectionLine::Horizontal(CENTER), ProfileSide::Bottom, (0.0, 0.0)); + if let Some(ElementKind::Profile(p)) = l.element_mut(id).map(|e| &mut e.kind) { + f(p); + } + notes(&l, &maps).join(" | ") + }; + assert!(change(&|p| p.band = 2).contains("its layer 'DEM' has no band 2 (it has 1)")); + assert!(change(&|p| p.section = "B".into()).contains("its frame has no section line 'B'")); + assert!(change(&|p| p.layer = "Other".into()).contains("the frame's map has no raster layer 'Other'")); + let mut in_place = utm_map(dem(|_, n| n)); + if let Some(r) = in_place.layers.first_mut().and_then(|l| l.raster.as_mut()) { + r.in_place = true; + } + assert!(notes(&l, &[in_place]).join("").contains("is read in place, a part at a time, not held whole")); + let empty = vec![utm_map(dem(|_, _| f64::NAN))]; + assert!(notes(&l, &empty).join("").contains("has no data along section line 'A'")); + // Drawn, it draws its placeholder otherwise. + let mut maps = maps; + assert!(render(&tilted, &mut maps, 96.0, &PageInfo::default()).is_ok()); +} + /// A gap of no data along the line leaves a gap in the samples, which breaks the curve: two runs, /// each drawn. #[test] @@ -196,3 +235,39 @@ fn a_line_across_the_antimeridian_counts_the_cells_it_crosses() { assert!(s.cells.is_none() && (5..=20).contains(&s.values.len()), "{} samples, {:?} cells", s.values.len(), s.cells); assert!(s.values.iter().all(|v| v.is_some_and(|v| (v - 1.0).abs() < 1e-9)), "{:?}", s.values); } + +/// A profile drawn with gaps, where its line runs off its raster or over no data, says so, with how +/// many of its samples have no value: a broken curve is not left unexplained (#2863). +#[test] +fn a_profile_with_gaps_says_how_many_samples_have_no_value() { + let mid = Crs::from_epsg(31983).unwrap().transformer().unwrap().from_lonlat(CENTER).unwrap().x; + let gap = vec![utm_map(dem(move |e, _| if (e - mid).abs() < 2_000.0 { f64::NAN } else { 100.0 }))]; + let (l, id) = page(SectionLine::Horizontal(CENTER), ProfileSide::Bottom, (0.0, 0.0)); + let said = |maps: &[Map]| profiles_notice(&profiles_not_drawn(&l, maps).into_iter().map(|n| (n, 1)).collect(), 1); + let (s, _) = profile_samples(&l, &gap, profile_of(&l, id)).unwrap(); + let blank = s.values.iter().filter(|v| v.is_none()).count(); + assert!(blank > 100, "{blank} of {}", s.values.len()); + let want = format!("1 profile(s) drawn with gaps, where the line has no data: 'Profile' ({id}), {blank} of {} samples", s.values.len()); + assert_eq!(said(&gap), vec![want]); + // A line read whole says nothing. + assert!(said(&[utm_map(dem(|_, _| 100.0))]).is_empty()); +} + +/// Over several pages, a profile read thinned or with gaps says on how many of them, as one not +/// drawn does; on one page it says nothing of pages (#2863). +#[test] +fn a_thinned_or_gapped_profile_says_on_how_many_pages() { + let note = |cells, blank| ProfileNote { layout: String::new(), element: 2, name: "Profile".into(), why: None, cells, blank }; + let notes: BTreeMap = [(note(12_000, (0, 10_000)), 2), (note(0, (133, 1242)), 1)].into_iter().collect(); + assert_eq!( + profiles_notice(¬es, 3), + [ + format!( + "1 profile(s) read at {MAX_PROFILE_SAMPLES} samples, fewer than their raster's cells along the line: 'Profile' (2), across 12000 cells on 2 of 3 pages" + ), + "1 profile(s) drawn with gaps, where the line has no data: 'Profile' (2), 133 of 1242 samples on 1 of 3 pages".to_string(), + ] + ); + let one: BTreeMap = [(note(0, (133, 1242)), 1)].into_iter().collect(); + assert_eq!(profiles_notice(&one, 1), ["1 profile(s) drawn with gaps, where the line has no data: 'Profile' (2), 133 of 1242 samples"]); +} diff --git a/crates/ui-egui/src/layoutview.rs b/crates/ui-egui/src/layoutview.rs index fa0c974c9c..10d197daaa 100644 --- a/crates/ui-egui/src/layoutview.rs +++ b/crates/ui-egui/src/layoutview.rs @@ -119,6 +119,9 @@ pub struct LayoutView { text_warning: Option, /// The last notice of the section lines the page's frames don't draw. section_warning: Option, + /// The last notices of the profiles the page doesn't draw, or draws from fewer samples than + /// cells or with gaps (#2863). + profile_warning: Vec, /// The texts of the layout drawn (by its index) cut off on its page, with their lines left /// out of their box, as the Format pane tells them (#2346). text_losses: Option<(usize, Vec)>, @@ -212,6 +215,7 @@ pub(crate) fn follow_project(app: &mut RustGisApp) { app.layout.viewed = None; app.layout.text_warning = None; app.layout.section_warning = None; + app.layout.profile_warning.clear(); app.layout.text_losses = None; app.layout.views.clear(); } @@ -289,6 +293,7 @@ impl LayoutView { } self.text_warning = None; self.section_warning = None; + self.profile_warning.clear(); self.text_losses = None; if let Some(old) = self.viewed.replace(name.to_string()) { self.views.insert(old, (self.zoom, self.pan)); @@ -430,6 +435,17 @@ pub fn show(app: &mut RustGisApp, ui: &mut Ui) { } app.layout.section_warning = note; } + let notes = rustgis_engine::render::layout::profiles_not_drawn(&layout, &app.session.project.maps); + let said = rustgis_engine::render::layout::profiles_notice(¬es.into_iter().map(|n| (n, 1)).collect(), 1); + if said != app.layout.profile_warning { + // (An export of this page may have just said the same; it isn't said twice.) + for note in said.iter().filter(|n| !app.layout.profile_warning.contains(n)) { + if app.session.notices.last().is_none_or(|last| last.text != *note) { + app.session.warn(note.clone()); + } + } + app.layout.profile_warning = said; + } // The Format pane is drawn before the page: a count that changed shows on the next // frame, without waiting for an input event. let losses = Some((li, losses));