From e34372bf0d42fb559613c8efe8dfb61cc66a5ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Gregorio=20Rinc=C3=B3n?= Date: Sat, 28 Nov 2026 12:22:04 -0500 Subject: [PATCH 1/4] feat(ui): the Publication Layout Wizard can leave out the graticule --- .../ui-egui/src/publicationwizard/elements.rs | 37 ++++++++- .../ui-egui/src/publicationwizard/review.rs | 5 +- .../ui-egui/src/publicationwizard/sources.rs | 75 ++++++++++++++++++- docs/user-guide/layouts.md | 7 +- 4 files changed, 117 insertions(+), 7 deletions(-) diff --git a/crates/ui-egui/src/publicationwizard/elements.rs b/crates/ui-egui/src/publicationwizard/elements.rs index 67ccc831ee..571f9bcadb 100644 --- a/crates/ui-egui/src/publicationwizard/elements.rs +++ b/crates/ui-egui/src/publicationwizard/elements.rs @@ -50,6 +50,8 @@ pub struct Elements { pub scale_bar: bool, /// Whether the map outside the extent may be veiled for the legend's room. pub veil: bool, + /// Whether the map frame has a graticule. + pub graticule: bool, /// A decimal comma rather than a point. pub comma: bool, pub north_style: ArrowStyle, @@ -74,6 +76,7 @@ impl Default for Elements { colorbar: true, scale_bar: true, veil: true, + graticule: true, comma: false, north_style: ArrowStyle::default(), scale_units: ScaleUnits::default(), @@ -256,6 +259,7 @@ impl Draft { ("contextInLegend", (e.context && self.usable(Control::Context, s)).then(|| true.into())), ("colorbar", (!e.colorbar && self.usable(Control::Colorbar, s)).then(|| "none".into())), ("scaleBar", scale_bar), + ("grid", (!e.graticule).then(|| "none".into())), ("veil", (!e.veil && self.usable(Control::Veil, s)).then(|| false.into())), ("decimal", e.comma.then(|| ",".into())), ] { @@ -370,6 +374,7 @@ pub(super) fn elements_value(s: &Session, d: &Draft) -> String { push_if(e.context && d.usable(Control::Context, s), tl!("Context layers listed")); push_if(d.draws_colorbar(s), tl!("Colorbar")); push_if(d.draws_scale_bar(s), &scale); + push_if(!e.graticule, tl!("No graticule")); push_if(!e.veil && d.usable(Control::Veil, s), tl!("No veil")); push_if(true, if e.comma { tl!("Decimal comma") } else { tl!("Decimal point") }); on.join("\n") @@ -440,6 +445,7 @@ pub(super) fn elements_step(ui: &mut egui::Ui, s: &Session, d: &mut Draft) { tl!(v.label()) }); }); + ui.checkbox(&mut d.elements.graticule, tl!("Graticule")); let usable = d.usable(Control::Veil, s); let why = if d.column() { tl!("In this style the map isn't veiled.") } else { tl!("There is no legend or colorbar to make room for.") }; tick(ui, usable, &mut d.elements.veil, tl!("Veil the map outside the extent if the legend needs room"), why); @@ -549,7 +555,8 @@ mod tests { type Wizard = egui_kittest::Harness<'static, RustGisApp>; /// The keys the step may send. - const KEYS: [&str; 9] = ["locator", "northArrow", "legend", "legendBox", "contextInLegend", "colorbar", "scaleBar", "veil", "decimal"]; + const KEYS: [&str; 10] = + ["grid", "locator", "northArrow", "legend", "legendBox", "contextInLegend", "colorbar", "scaleBar", "veil", "decimal"]; /// What the step adds to the command's parameters, by key. fn added(s: &Session, d: &Draft) -> Value { @@ -618,7 +625,8 @@ mod tests { let mut app = app(); raster(&mut app); type Set = fn(&mut Elements); - let cases: [(Set, Value); 12] = [ + let cases: [(Set, Value); 13] = [ + (|e| e.graticule = false, json!({"grid": "none"})), (|e| e.locator = LocatorChoice::Globe, json!({"locator": "globe"})), (|e| e.locator = LocatorChoice::Inset, json!({"locator": "inset"})), (|e| e.locator = LocatorChoice::None, json!({"locator": "none"})), @@ -1238,6 +1246,31 @@ mod tests { assert!(h.query_by_label(want).is_some()); } + /// The graticule's box is on, and unticked it sends no grid, on a whole globe too. + #[test] + fn the_graticule_box_sets_the_answer() { + for prepare in [(|_| {}) as fn(&mut RustGisApp), globe] { + let mut h = step_of(prepare); + assert!(!off(&h, "Graticule")); + click_box(&mut h, "Graticule"); + assert!(!draft(&h).elements.graticule); + assert_eq!(draft(&h).sent(&h.state().session)["grid"], "none"); + click_box(&mut h, "Graticule"); + assert!(draft(&h).sent(&h.state().session).get("grid").is_none()); + } + } + + /// The review says a graticule left out, and nothing for the default. + #[test] + fn the_review_says_there_is_no_graticule() { + let mut h = step_of(|app| app.dialogs.publication.as_mut().unwrap().step = Step::Review); + assert!(h.query_by_label_contains("No graticule").is_none()); + h.state_mut().dialogs.publication.as_mut().unwrap().elements.graticule = false; + h.run_steps(4); + let want = "Locator: Default (globe)\nNorth arrow: Auto (none from 20°)\nLegend\nScale bar\nNo graticule\nDecimal point"; + assert!(h.query_by_label(want).is_some()); + } + /// Create makes the layout the step asked for; Undo takes it away. #[test] fn create_leaves_out_what_the_step_left_out() { diff --git a/crates/ui-egui/src/publicationwizard/review.rs b/crates/ui-egui/src/publicationwizard/review.rs index 474f2e5d0f..333c232baa 100644 --- a/crates/ui-egui/src/publicationwizard/review.rs +++ b/crates/ui-egui/src/publicationwizard/review.rs @@ -66,7 +66,10 @@ fn reference_value(d: &Draft) -> String { match d.left_out(Field::Reference) { Some(_) if typed.is_empty() => tl!("(none)").to_string(), Some(_) => tl!("(none; the lines typed aren't used)").to_string(), - None if typed.is_empty() => tl!("The default: projection, datum and graticule, filled in on the sheet").to_string(), + None if typed.is_empty() && d.elements.graticule => { + tl!("The default: projection, datum and graticule, filled in on the sheet").to_string() + } + None if typed.is_empty() => tl!("The default: projection and datum, filled in on the sheet").to_string(), None => typed, } } diff --git a/crates/ui-egui/src/publicationwizard/sources.rs b/crates/ui-egui/src/publicationwizard/sources.rs index a5849955bf..0d3ba340ce 100644 --- a/crates/ui-egui/src/publicationwizard/sources.rs +++ b/crates/ui-egui/src/publicationwizard/sources.rs @@ -19,9 +19,21 @@ pub(super) fn reference_step(ui: &mut egui::Ui, d: &mut Draft) { limit_note(ui, d, &[Field::Reference]); } +/// The default reference's second line without a graticule, as `layout.publication` writes it. +const DATUM_ALONE: &str = "Datum: {datum}"; + +impl Draft { + /// The lines `layout.publication` writes when no reference is typed. + pub(super) fn default_reference(&self) -> [&'static str; 2] { + let [projection, datum_and_grid] = PUBLICATION_DEFAULT_REFERENCE; + [projection, if self.elements.graticule { datum_and_grid } else { DATUM_ALONE }] + } +} + /// The reference's box and the tick that leaves it out, as two rows of a step's grid. fn reference_rows(ui: &mut egui::Ui, d: &mut Draft) { - list(ui, d, tl!("Reference"), Field::Reference, &PUBLICATION_DEFAULT_REFERENCE.join("\n"), 2); + let hint = d.default_reference().join("\n"); + list(ui, d, tl!("Reference"), Field::Reference, &hint, 2); ui.label(""); // Wrapped to the column: a long label would widen the narrowed window. let width = field_width(ui); @@ -495,6 +507,67 @@ mod tests { } } + /// Without a graticule the review's default names the projection and datum alone, on a sheet + /// and on a figure; lines typed and no reference read as with one. + #[test] + fn without_a_graticule_the_default_reference_names_none() { + let with = "The default: projection, datum and graticule, filled in on the sheet"; + let without = "The default: projection and datum, filled in on the sheet"; + for size in ["a4", "figure-1col"] { + let mut h = at(Step::Review, |d| (d.size, d.elements.graticule) = (size.into(), false)); + assert!(h.query_by_label(without).is_some() && h.query_by_label(with).is_none(), "{size}"); + h.state_mut().dialogs.publication.as_mut().unwrap().reference = "UTM 23S".into(); + h.run_steps(4); + assert!(h.query_by_label("UTM 23S").is_some() && h.query_by_label(without).is_none(), "{size}"); + assert_eq!(wizard(&h).params()["reference"], json!(["UTM 23S"]), "{size}"); + let d = h.state_mut().dialogs.publication.as_mut().unwrap(); + (d.reference, d.no_reference) = (String::new(), true); + h.run_steps(4); + assert!(h.query_by_label(without).is_none(), "{size}: left out"); + } + } + + /// Create draws the default reference the box hints, with a graticule and without one; the + /// frame's grid follows, and Undo takes the layout away. + #[test] + fn create_draws_the_default_reference_hinted() { + // Whether `text` is `pattern` with each `{token}` filled. + fn fills(pattern: &str, text: &str) -> bool { + let mut parts = pattern.split('{').enumerate().map(|(i, p)| if i == 0 { p } else { p.split_once('}').unwrap().1 }); + let Some(mut rest) = text.strip_prefix(parts.next().unwrap()) else { return false }; + parts.all(|part| match rest.find(part).filter(|_| !part.is_empty()) { + Some(at) => { + rest = &rest[at + part.len()..]; + true + } + None => part.is_empty(), + }) + } + for (size, graticule) in [("a4", true), ("a4", false), ("figure-1col", true), ("figure-1col", false)] { + let mut h = at(Step::Review, |d| (d.size, d.elements.graticule) = (size.into(), graticule)); + let hint = wizard(&h).default_reference(); + let before = h.state().session.project.layouts.len(); + click(&mut h, "Create"); + let layout = h.state().session.project.layouts.last().unwrap(); + let text = layout.elements.iter().find_map(|e| match &e.kind { + ElementKind::Text { text, .. } if e.name == "Reference" => Some(text.clone()), + _ => None, + }); + let text = text.expect("a reference"); + // A figure runs the lines together as one. + let between = if size == "a4" { "\n" } else { " · " }; + assert!(fills(&hint.join(between), &text), "{size} {graticule}: {hint:?} / {text}"); + assert_eq!(text.contains("Graticule"), graticule, "{size}: {text}"); + let grid = layout.elements.iter().find_map(|e| match &e.kind { + ElementKind::MapFrame { grid, extent_of: None, .. } => Some(grid.is_some()), + _ => None, + }); + assert_eq!(grid, Some(graticule), "{size}"); + h.state_mut().run("edit.undo", Value::Null).unwrap(); + assert_eq!(h.state().session.project.layouts.len(), before); + } + } + /// Create puts the sources, the reference and the heading given on the sheet, and Undo takes /// it away. #[test] diff --git a/docs/user-guide/layouts.md b/docs/user-guide/layouts.md index 4e1744ba58..234e4cfbeb 100644 --- a/docs/user-guide/layouts.md +++ b/docs/user-guide/layouts.md @@ -57,9 +57,10 @@ Layouts open as tabs next to the maps; while one is open, its groups lead the Pu `Publication`; the review says when a layout has that name, so the new one is numbered. The **elements** are what is drawn around the map: the locator (the default, named as what it will be, a globe, an inset or none), the north arrow (auto, always or none), the legend or not, which - can be set always on a box and to list the context layers, the colorbar and the scale bar or - not, whether the map may be veiled for the legend's room, and the decimal mark; a choice the - sheet can't use is off and isn't sent. Under them, the north arrow's style, the scale bar's + can be set always on a box and to list the context layers, the colorbar, the scale bar and the + graticule or not (without one the default reference names none), whether the map may be veiled + for the legend's room, and the decimal mark; a choice the sheet can't use is off and isn't + sent. Under them, the north arrow's style, the scale bar's units and style, and the legend's title and columns (Auto, or 1 to 6) can be picked, and layers ticked to be left out of the legend (every layer of that name). The **placement** is the arrangement (below): `best`, the favourite, one by name or one saved, or From e79c8d24e10177bc2fa300ccf700485a8f2a6672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Gregorio=20Rinc=C3=B3n?= Date: Sat, 28 Nov 2026 12:51:05 -0500 Subject: [PATCH 2/4] refactor(engine,ui): decide the default publication reference in one place --- .../engine/src/cmd/layout/publication/mod.rs | 6 +- .../src/cmd/layout/publication/sheet.rs | 9 +-- crates/ui-egui/src/publicationwizard/mod.rs | 2 +- .../ui-egui/src/publicationwizard/sources.rs | 66 +++++++++---------- 4 files changed, 39 insertions(+), 44 deletions(-) diff --git a/crates/engine/src/cmd/layout/publication/mod.rs b/crates/engine/src/cmd/layout/publication/mod.rs index 33a121ab95..af6eb5fa7f 100644 --- a/crates/engine/src/cmd/layout/publication/mod.rs +++ b/crates/engine/src/cmd/layout/publication/mod.rs @@ -194,11 +194,7 @@ pub(in crate::cmd::layout) fn publication(s: &mut Session, p: &Value) -> CmdResu let strip_scale = grid.as_ref().map_or(k, |g| k * (g.label_size / grid_pt)); let room_side = if labelled.left || labelled.right { LABEL_ROOM_SIDE * strip_scale } else { 0.0 }; let room_end = if labelled.top || labelled.bottom { LABEL_ROOM_END * strip_scale } else { 0.0 }; - let reference = reference.unwrap_or_else(|| { - let [projection_line, datum_and_grid] = PUBLICATION_DEFAULT_REFERENCE; - let line = if step.is_some() { datum_and_grid } else { "Datum: {datum}" }; - vec![projection_line.into(), line.into()] - }); + let reference = reference.unwrap_or_else(|| publication_default_reference(step.is_some()).map(Into::into).to_vec()); let step_said = step.map_or_else(|| "—".to_string(), step_text); let fill = |t: &str| t.replace("{projection}", &projection).replace("{datum}", &datum).replace("{grid}", &step_said); // Text is measured as it is drawn: bold as bold, and the tokens the layout fills only when it diff --git a/crates/engine/src/cmd/layout/publication/sheet.rs b/crates/engine/src/cmd/layout/publication/sheet.rs index 6430cd7733..8f2453879f 100644 --- a/crates/engine/src/cmd/layout/publication/sheet.rs +++ b/crates/engine/src/cmd/layout/publication/sheet.rs @@ -63,10 +63,11 @@ pub const PUBLICATION_DEFAULT_CREDIT: &str = "Made with RustGIS · {date}"; /// give them. pub const PUBLICATION_HEADINGS: [&str; 2] = ["Sources", "Cartographic reference"]; -/// The cartographic reference's lines when `"reference"` isn't given, on a sheet with a graticule -/// (`{projection}`, `{datum}` and `{grid}` are filled with the sheet's). Without one the command -/// writes the datum alone in place of the second. -pub const PUBLICATION_DEFAULT_REFERENCE: [&str; 2] = ["Projection: {projection}", "Datum: {datum} · Graticule: {grid}"]; +/// The cartographic reference's lines when `"reference"` isn't given, with a graticule or without +/// one (`{projection}`, `{datum}` and `{grid}` are filled with the sheet's). +pub fn publication_default_reference(graticule: bool) -> [&'static str; 2] { + ["Projection: {projection}", if graticule { "Datum: {datum} · Graticule: {grid}" } else { "Datum: {datum}" }] +} /// The most texts a publication layout takes in one list, such as its sources. pub const MAX_PUBLICATION_LINES: usize = 50; diff --git a/crates/ui-egui/src/publicationwizard/mod.rs b/crates/ui-egui/src/publicationwizard/mod.rs index 34a93d6486..3fc22b110a 100644 --- a/crates/ui-egui/src/publicationwizard/mod.rs +++ b/crates/ui-egui/src/publicationwizard/mod.rs @@ -20,7 +20,7 @@ use map::{Area, area_extent, map_step}; use review::review_step; use rustgis_engine::Session; use rustgis_engine::cmd::layout::{ - MAX_PUBLICATION_LINES, MAX_PUBLICATION_TEXT, PUBLICATION_DEFAULT_REFERENCE, PUBLICATION_HEADINGS, PUBLICATION_PROFILES, + MAX_PUBLICATION_LINES, MAX_PUBLICATION_TEXT, PUBLICATION_HEADINGS, PUBLICATION_PROFILES, publication_default_reference, publication_style_accent, }; use rustgis_engine::geom::Extent; diff --git a/crates/ui-egui/src/publicationwizard/sources.rs b/crates/ui-egui/src/publicationwizard/sources.rs index 0d3ba340ce..61b934f022 100644 --- a/crates/ui-egui/src/publicationwizard/sources.rs +++ b/crates/ui-egui/src/publicationwizard/sources.rs @@ -19,20 +19,9 @@ pub(super) fn reference_step(ui: &mut egui::Ui, d: &mut Draft) { limit_note(ui, d, &[Field::Reference]); } -/// The default reference's second line without a graticule, as `layout.publication` writes it. -const DATUM_ALONE: &str = "Datum: {datum}"; - -impl Draft { - /// The lines `layout.publication` writes when no reference is typed. - pub(super) fn default_reference(&self) -> [&'static str; 2] { - let [projection, datum_and_grid] = PUBLICATION_DEFAULT_REFERENCE; - [projection, if self.elements.graticule { datum_and_grid } else { DATUM_ALONE }] - } -} - /// The reference's box and the tick that leaves it out, as two rows of a step's grid. fn reference_rows(ui: &mut egui::Ui, d: &mut Draft) { - let hint = d.default_reference().join("\n"); + let hint = publication_default_reference(d.elements.graticule).join("\n"); list(ui, d, tl!("Reference"), Field::Reference, &hint, 2); ui.label(""); // Wrapped to the column: a long label would widen the narrowed window. @@ -527,37 +516,46 @@ mod tests { } } - /// Create draws the default reference the box hints, with a graticule and without one; the - /// frame's grid follows, and Undo takes the layout away. + /// The reference's box hints the default's lines, following the graticule's tick, on a sheet + /// and on a figure. #[test] - fn create_draws_the_default_reference_hinted() { - // Whether `text` is `pattern` with each `{token}` filled. - fn fills(pattern: &str, text: &str) -> bool { - let mut parts = pattern.split('{').enumerate().map(|(i, p)| if i == 0 { p } else { p.split_once('}').unwrap().1 }); - let Some(mut rest) = text.strip_prefix(parts.next().unwrap()) else { return false }; - parts.all(|part| match rest.find(part).filter(|_| !part.is_empty()) { - Some(at) => { - rest = &rest[at + part.len()..]; - true - } - None => part.is_empty(), - }) + fn the_reference_box_hints_the_default() { + let with = "Projection: {projection}\nDatum: {datum} · Graticule: {grid}"; + let without = "Projection: {projection}\nDatum: {datum}"; + for (step, size) in [(Step::Sources, "a4"), (Step::Reference, "figure-1col")] { + let mut h = at(step, |d| d.size = size.into()); + let hint = |h: &Wizard| { + let edit = h.get_by_role_and_label(Role::MultilineTextInput, "Reference"); + edit.accesskit_node().placeholder().map(str::to_owned) + }; + assert_eq!(hint(&h).as_deref(), Some(with), "{size}"); + h.state_mut().dialogs.publication.as_mut().unwrap().elements.graticule = false; + h.run_steps(4); + assert_eq!(hint(&h).as_deref(), Some(without), "{size}"); } - for (size, graticule) in [("a4", true), ("a4", false), ("figure-1col", true), ("figure-1col", false)] { + } + + /// Create draws the default reference with a graticule and without one, a figure's on one + /// line; the frame's grid follows, and Undo takes the layout away. + #[test] + fn create_draws_the_default_reference() { + let sheet = "Projection: Web Mercator\nDatum: WGS 84"; + let figure = "Projection: Web Mercator · Datum: WGS 84"; + for (size, graticule, want) in [ + ("a4", true, format!("{sheet} · Graticule: 30°")), + ("a4", false, sheet.to_string()), + ("figure-1col", true, format!("{figure} · Graticule: 30°")), + ("figure-1col", false, figure.to_string()), + ] { let mut h = at(Step::Review, |d| (d.size, d.elements.graticule) = (size.into(), graticule)); - let hint = wizard(&h).default_reference(); let before = h.state().session.project.layouts.len(); click(&mut h, "Create"); let layout = h.state().session.project.layouts.last().unwrap(); let text = layout.elements.iter().find_map(|e| match &e.kind { - ElementKind::Text { text, .. } if e.name == "Reference" => Some(text.clone()), + ElementKind::Text { text, .. } if e.name == "Reference" => Some(text.as_str()), _ => None, }); - let text = text.expect("a reference"); - // A figure runs the lines together as one. - let between = if size == "a4" { "\n" } else { " · " }; - assert!(fills(&hint.join(between), &text), "{size} {graticule}: {hint:?} / {text}"); - assert_eq!(text.contains("Graticule"), graticule, "{size}: {text}"); + assert_eq!(text, Some(want.as_str()), "{size} {graticule}"); let grid = layout.elements.iter().find_map(|e| match &e.kind { ElementKind::MapFrame { grid, extent_of: None, .. } => Some(grid.is_some()), _ => None, From 5edbb9399b2e6addb7a9d88d1e28cf04ff380cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Gregorio=20Rinc=C3=B3n?= Date: Sat, 28 Nov 2026 13:04:02 -0500 Subject: [PATCH 3/4] fix(ui): name the wizard's tick for the frame grid it leaves out --- crates/engine/src/cmd/layout.rs | 2 +- .../ui-egui/src/publicationwizard/elements.rs | 36 +++++++++---------- .../ui-egui/src/publicationwizard/review.rs | 2 +- .../ui-egui/src/publicationwizard/sources.rs | 16 ++++----- docs/user-guide/layouts.md | 16 +++++---- 5 files changed, 37 insertions(+), 35 deletions(-) diff --git a/crates/engine/src/cmd/layout.rs b/crates/engine/src/cmd/layout.rs index ce11f715d0..4e33b817fb 100644 --- a/crates/engine/src/cmd/layout.rs +++ b/crates/engine/src/cmd/layout.rs @@ -74,7 +74,7 @@ pub fn commands() -> Vec { r#""title"?: text, "#, r#""subtitle"?: text, "#, r#""sources"?: text | [texts] (any of the texts may hold a layer's figure as the layout's texts do: {count:Layer}, {sum:Layer:field}, {mean:…}, {min:…}, {max:…}, filled in when the page is drawn), "#, - r#""reference"?: text | [texts] (default: the projection, datum and graticule), "#, + r#""reference"?: text | [texts] (default: the projection, datum and graticule; none named without a graticule), "#, r#""note"?: text, "#, r#""author"?: text (default: "Made with RustGIS · {date}"; "" or [] for none), "#, r#""headings"?: [the sources' heading, the reference's heading, an editorial column's heading], "#, diff --git a/crates/ui-egui/src/publicationwizard/elements.rs b/crates/ui-egui/src/publicationwizard/elements.rs index 571f9bcadb..93bebbbe08 100644 --- a/crates/ui-egui/src/publicationwizard/elements.rs +++ b/crates/ui-egui/src/publicationwizard/elements.rs @@ -50,8 +50,8 @@ pub struct Elements { pub scale_bar: bool, /// Whether the map outside the extent may be veiled for the legend's room. pub veil: bool, - /// Whether the map frame has a graticule. - pub graticule: bool, + /// Whether the map frame has its grid; the map's own graticule is drawn either way. + pub frame_grid: bool, /// A decimal comma rather than a point. pub comma: bool, pub north_style: ArrowStyle, @@ -76,7 +76,7 @@ impl Default for Elements { colorbar: true, scale_bar: true, veil: true, - graticule: true, + frame_grid: true, comma: false, north_style: ArrowStyle::default(), scale_units: ScaleUnits::default(), @@ -259,7 +259,7 @@ impl Draft { ("contextInLegend", (e.context && self.usable(Control::Context, s)).then(|| true.into())), ("colorbar", (!e.colorbar && self.usable(Control::Colorbar, s)).then(|| "none".into())), ("scaleBar", scale_bar), - ("grid", (!e.graticule).then(|| "none".into())), + ("grid", (!e.frame_grid).then(|| "none".into())), ("veil", (!e.veil && self.usable(Control::Veil, s)).then(|| false.into())), ("decimal", e.comma.then(|| ",".into())), ] { @@ -374,7 +374,7 @@ pub(super) fn elements_value(s: &Session, d: &Draft) -> String { push_if(e.context && d.usable(Control::Context, s), tl!("Context layers listed")); push_if(d.draws_colorbar(s), tl!("Colorbar")); push_if(d.draws_scale_bar(s), &scale); - push_if(!e.graticule, tl!("No graticule")); + push_if(!e.frame_grid, tl!("No frame grid")); push_if(!e.veil && d.usable(Control::Veil, s), tl!("No veil")); push_if(true, if e.comma { tl!("Decimal comma") } else { tl!("Decimal point") }); on.join("\n") @@ -445,7 +445,7 @@ pub(super) fn elements_step(ui: &mut egui::Ui, s: &Session, d: &mut Draft) { tl!(v.label()) }); }); - ui.checkbox(&mut d.elements.graticule, tl!("Graticule")); + ui.checkbox(&mut d.elements.frame_grid, tl!("Frame grid")); let usable = d.usable(Control::Veil, s); let why = if d.column() { tl!("In this style the map isn't veiled.") } else { tl!("There is no legend or colorbar to make room for.") }; tick(ui, usable, &mut d.elements.veil, tl!("Veil the map outside the extent if the legend needs room"), why); @@ -626,7 +626,7 @@ mod tests { raster(&mut app); type Set = fn(&mut Elements); let cases: [(Set, Value); 13] = [ - (|e| e.graticule = false, json!({"grid": "none"})), + (|e| e.frame_grid = false, json!({"grid": "none"})), (|e| e.locator = LocatorChoice::Globe, json!({"locator": "globe"})), (|e| e.locator = LocatorChoice::Inset, json!({"locator": "inset"})), (|e| e.locator = LocatorChoice::None, json!({"locator": "none"})), @@ -1246,28 +1246,28 @@ mod tests { assert!(h.query_by_label(want).is_some()); } - /// The graticule's box is on, and unticked it sends no grid, on a whole globe too. + /// The frame grid's box is on, and unticked it sends no grid, on a whole globe too. #[test] - fn the_graticule_box_sets_the_answer() { + fn the_frame_grid_box_sets_the_answer() { for prepare in [(|_| {}) as fn(&mut RustGisApp), globe] { let mut h = step_of(prepare); - assert!(!off(&h, "Graticule")); - click_box(&mut h, "Graticule"); - assert!(!draft(&h).elements.graticule); + assert!(!off(&h, "Frame grid")); + click_box(&mut h, "Frame grid"); + assert!(!draft(&h).elements.frame_grid); assert_eq!(draft(&h).sent(&h.state().session)["grid"], "none"); - click_box(&mut h, "Graticule"); + click_box(&mut h, "Frame grid"); assert!(draft(&h).sent(&h.state().session).get("grid").is_none()); } } - /// The review says a graticule left out, and nothing for the default. + /// The review says a frame grid left out, and nothing for the default. #[test] - fn the_review_says_there_is_no_graticule() { + fn the_review_says_there_is_no_frame_grid() { let mut h = step_of(|app| app.dialogs.publication.as_mut().unwrap().step = Step::Review); - assert!(h.query_by_label_contains("No graticule").is_none()); - h.state_mut().dialogs.publication.as_mut().unwrap().elements.graticule = false; + assert!(h.query_by_label_contains("No frame grid").is_none()); + h.state_mut().dialogs.publication.as_mut().unwrap().elements.frame_grid = false; h.run_steps(4); - let want = "Locator: Default (globe)\nNorth arrow: Auto (none from 20°)\nLegend\nScale bar\nNo graticule\nDecimal point"; + let want = "Locator: Default (globe)\nNorth arrow: Auto (none from 20°)\nLegend\nScale bar\nNo frame grid\nDecimal point"; assert!(h.query_by_label(want).is_some()); } diff --git a/crates/ui-egui/src/publicationwizard/review.rs b/crates/ui-egui/src/publicationwizard/review.rs index 333c232baa..2062c2dff8 100644 --- a/crates/ui-egui/src/publicationwizard/review.rs +++ b/crates/ui-egui/src/publicationwizard/review.rs @@ -66,7 +66,7 @@ fn reference_value(d: &Draft) -> String { match d.left_out(Field::Reference) { Some(_) if typed.is_empty() => tl!("(none)").to_string(), Some(_) => tl!("(none; the lines typed aren't used)").to_string(), - None if typed.is_empty() && d.elements.graticule => { + None if typed.is_empty() && d.elements.frame_grid => { tl!("The default: projection, datum and graticule, filled in on the sheet").to_string() } None if typed.is_empty() => tl!("The default: projection and datum, filled in on the sheet").to_string(), diff --git a/crates/ui-egui/src/publicationwizard/sources.rs b/crates/ui-egui/src/publicationwizard/sources.rs index 61b934f022..853f1dbf7c 100644 --- a/crates/ui-egui/src/publicationwizard/sources.rs +++ b/crates/ui-egui/src/publicationwizard/sources.rs @@ -21,7 +21,7 @@ pub(super) fn reference_step(ui: &mut egui::Ui, d: &mut Draft) { /// The reference's box and the tick that leaves it out, as two rows of a step's grid. fn reference_rows(ui: &mut egui::Ui, d: &mut Draft) { - let hint = publication_default_reference(d.elements.graticule).join("\n"); + let hint = publication_default_reference(d.elements.frame_grid).join("\n"); list(ui, d, tl!("Reference"), Field::Reference, &hint, 2); ui.label(""); // Wrapped to the column: a long label would widen the narrowed window. @@ -496,14 +496,14 @@ mod tests { } } - /// Without a graticule the review's default names the projection and datum alone, on a sheet + /// Without a frame grid the review's default names the projection and datum alone, on a sheet /// and on a figure; lines typed and no reference read as with one. #[test] - fn without_a_graticule_the_default_reference_names_none() { + fn without_a_frame_grid_the_default_reference_names_no_graticule() { let with = "The default: projection, datum and graticule, filled in on the sheet"; let without = "The default: projection and datum, filled in on the sheet"; for size in ["a4", "figure-1col"] { - let mut h = at(Step::Review, |d| (d.size, d.elements.graticule) = (size.into(), false)); + let mut h = at(Step::Review, |d| (d.size, d.elements.frame_grid) = (size.into(), false)); assert!(h.query_by_label(without).is_some() && h.query_by_label(with).is_none(), "{size}"); h.state_mut().dialogs.publication.as_mut().unwrap().reference = "UTM 23S".into(); h.run_steps(4); @@ -516,7 +516,7 @@ mod tests { } } - /// The reference's box hints the default's lines, following the graticule's tick, on a sheet + /// The reference's box hints the default's lines, following the frame grid's tick, on a sheet /// and on a figure. #[test] fn the_reference_box_hints_the_default() { @@ -529,13 +529,13 @@ mod tests { edit.accesskit_node().placeholder().map(str::to_owned) }; assert_eq!(hint(&h).as_deref(), Some(with), "{size}"); - h.state_mut().dialogs.publication.as_mut().unwrap().elements.graticule = false; + h.state_mut().dialogs.publication.as_mut().unwrap().elements.frame_grid = false; h.run_steps(4); assert_eq!(hint(&h).as_deref(), Some(without), "{size}"); } } - /// Create draws the default reference with a graticule and without one, a figure's on one + /// Create draws the default reference with a frame grid and without one, a figure's on one /// line; the frame's grid follows, and Undo takes the layout away. #[test] fn create_draws_the_default_reference() { @@ -547,7 +547,7 @@ mod tests { ("figure-1col", true, format!("{figure} · Graticule: 30°")), ("figure-1col", false, figure.to_string()), ] { - let mut h = at(Step::Review, |d| (d.size, d.elements.graticule) = (size.into(), graticule)); + let mut h = at(Step::Review, |d| (d.size, d.elements.frame_grid) = (size.into(), graticule)); let before = h.state().session.project.layouts.len(); click(&mut h, "Create"); let layout = h.state().session.project.layouts.last().unwrap(); diff --git a/docs/user-guide/layouts.md b/docs/user-guide/layouts.md index 234e4cfbeb..37e99edbdf 100644 --- a/docs/user-guide/layouts.md +++ b/docs/user-guide/layouts.md @@ -58,11 +58,12 @@ Layouts open as tabs next to the maps; while one is open, its groups lead the Pu **elements** are what is drawn around the map: the locator (the default, named as what it will be, a globe, an inset or none), the north arrow (auto, always or none), the legend or not, which can be set always on a box and to list the context layers, the colorbar, the scale bar and the - graticule or not (without one the default reference names none), whether the map may be veiled - for the legend's room, and the decimal mark; a choice the sheet can't use is off and isn't - sent. Under them, the north arrow's style, the scale bar's - units and style, and the legend's title and columns (Auto, or 1 to 6) can be picked, and - layers ticked to be left out of the legend (every layer of that name). The + frame grid or not (without it the default reference leaves the graticule out; the map's own + graticule is still drawn when on), whether the map may be veiled for the legend's room, and the + decimal mark; a choice the sheet can't use is off and isn't sent. Under them, the north + arrow's style, the scale bar's units and style, and the legend's title and columns (Auto, or 1 + to 6) can be picked, and layers ticked to be left out of the legend (every layer of that + name). The **placement** is the arrangement (below): `best`, the favourite, one by name or one saved, or **Custom**, a corner for each surround (a corner another has swaps the two; on Panel, Editorial and Modular only the north arrow and scale bar take one, the locator and legend sitting in the @@ -202,8 +203,9 @@ Layouts open as tabs next to the maps; while one is open, its groups lead the Pu font (the title and headings bold, as drawn) and wrapped to their box, so none runs past it, and each box grows to hold them. `{projection}`, `{datum}` and `{grid}` are filled from the map when the layout is made. `{date}` and the other dynamic text - tokens stay live. The reference defaults to the projection, datum and graticule, and the - authorship to "Made with RustGIS · {date}" (`"author": ""` leaves it out). `headings` renames the two columns. + tokens stay live. The reference defaults to the projection, datum and graticule (none named + with `"grid": "none"`), and the authorship to "Made with RustGIS · {date}" (`"author": ""` + leaves it out). `headings` renames the two columns. - **The locator** (at the frame's top left unless the data is there): `"locator": "globe"` (a sheet's default) adds a separate globe map with simplified copies of the map's visible polygon layers held in the project. Streamed layers, rasters, points, lines and labels are left out. From 263b1520f8dedb70d4f77a8842bf4b9e16a70a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Gregorio=20Rinc=C3=B3n?= Date: Sat, 28 Nov 2026 13:16:43 -0500 Subject: [PATCH 4/4] docs(engine): say what the default publication reference is without a grid --- crates/engine/src/cmd/layout.rs | 2 +- docs/user-guide/layouts.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/layout.rs b/crates/engine/src/cmd/layout.rs index 4e33b817fb..17553ae834 100644 --- a/crates/engine/src/cmd/layout.rs +++ b/crates/engine/src/cmd/layout.rs @@ -74,7 +74,7 @@ pub fn commands() -> Vec { r#""title"?: text, "#, r#""subtitle"?: text, "#, r#""sources"?: text | [texts] (any of the texts may hold a layer's figure as the layout's texts do: {count:Layer}, {sum:Layer:field}, {mean:…}, {min:…}, {max:…}, filled in when the page is drawn), "#, - r#""reference"?: text | [texts] (default: the projection, datum and graticule; none named without a graticule), "#, + r#""reference"?: text | [texts] (default: the projection, datum and graticule; the projection and datum alone with "grid": "none"), "#, r#""note"?: text, "#, r#""author"?: text (default: "Made with RustGIS · {date}"; "" or [] for none), "#, r#""headings"?: [the sources' heading, the reference's heading, an editorial column's heading], "#, diff --git a/docs/user-guide/layouts.md b/docs/user-guide/layouts.md index 37e99edbdf..afbee908f6 100644 --- a/docs/user-guide/layouts.md +++ b/docs/user-guide/layouts.md @@ -203,9 +203,9 @@ Layouts open as tabs next to the maps; while one is open, its groups lead the Pu font (the title and headings bold, as drawn) and wrapped to their box, so none runs past it, and each box grows to hold them. `{projection}`, `{datum}` and `{grid}` are filled from the map when the layout is made. `{date}` and the other dynamic text - tokens stay live. The reference defaults to the projection, datum and graticule (none named - with `"grid": "none"`), and the authorship to "Made with RustGIS · {date}" (`"author": ""` - leaves it out). `headings` renames the two columns. + tokens stay live. The reference defaults to the projection, datum and graticule (the + projection and datum alone with `"grid": "none"`), and the authorship to + "Made with RustGIS · {date}" (`"author": ""` leaves it out). `headings` renames the two columns. - **The locator** (at the frame's top left unless the data is there): `"locator": "globe"` (a sheet's default) adds a separate globe map with simplified copies of the map's visible polygon layers held in the project. Streamed layers, rasters, points, lines and labels are left out.