diff --git a/crates/engine/src/tests/qgis_layouts.rs b/crates/engine/src/tests/qgis_layouts.rs
index abf209c2f4..b7ef54bdd3 100644
--- a/crates/engine/src/tests/qgis_layouts.rs
+++ b/crates/engine/src/tests/qgis_layouts.rs
@@ -217,3 +217,40 @@ fn a_long_layout_name_numbered_keeps_its_page_and_says_the_cut() {
let answer = s.run("project.importQgis", &sheets()).unwrap();
assert!(!said(&answer), "{answer}");
}
+
+/// A QGIS layout's scale bar, north arrow and map overview come in showing the frames the import
+/// made, inline and from a copy, and the layout exports.
+#[test]
+fn a_layouts_surrounds_show_the_imported_frames() {
+ let text = r#"TEPSG:2056
+
+
+
+
+
+ "#;
+ let check = |s: &Session| {
+ let l = s.project.layouts.iter().find(|l| l.name == "Surrounds").unwrap();
+ let frames: Vec = l.elements.iter().filter(|e| matches!(e.kind, ElementKind::MapFrame { .. })).map(|e| e.id).collect();
+ let (overview, main) = (frames[0], frames[1]);
+ assert!(l.elements.iter().any(|e| matches!(e.kind, ElementKind::ScaleBar { frame, .. } if frame == main)));
+ assert!(l.elements.iter().any(|e| matches!(e.kind, ElementKind::NorthArrow { frame, .. } if frame == main)));
+ let shown = l.elements.iter().find(|e| e.id == overview).unwrap().kind.extent_indicators();
+ assert_eq!(shown.iter().map(|i| i.of).collect::>(), [main]);
+ };
+ let mut s = Session::new(Project::default());
+ s.run("project.importQgis", &json!({"text": text})).unwrap();
+ check(&s);
+ let dir = std::env::temp_dir().join(format!("rustgis-qgis-surrounds-{}", std::process::id()));
+ std::fs::create_dir_all(&dir).unwrap();
+ let png = dir.join("surrounds.png");
+ s.run("layout.export", &json!({"layout": "Surrounds", "path": png.display().to_string(), "dpi": 36})).unwrap();
+ assert!(std::fs::metadata(&png).unwrap().len() > 0);
+ let _ = std::fs::remove_dir_all(&dir);
+ // From a copy.
+ let mut s = Session::new(Project::default());
+ let read = crate::cmd::reads::read_ahead(&mut s, "project.importQgis", &json!({"text": text})).unwrap();
+ let done = read.run(&Control::new()).unwrap();
+ crate::cmd::reads::read_land(&mut s, done).unwrap();
+ check(&s);
+}
diff --git a/crates/map/src/qgis/layout.rs b/crates/map/src/qgis/layout.rs
index 84d2691ae8..baac281a11 100644
--- a/crates/map/src/qgis/layout.rs
+++ b/crates/map/src/qgis/layout.rs
@@ -3,11 +3,12 @@
//! its labels text, its pictures pictures (read by the engine, from the file each names), its
//! rectangles and ellipses those shapes, and its lines and polygons straight lines along their
//! edges. Items are drawn in QGIS's order (its `zValue`), placed where QGIS draws them on their
-//! page in millimetres, a turned label turned about its centre as QGIS turns it.
+//! page in millimetres, a turned label turned about its centre as QGIS turns it. Its scale bars,
+//! north arrows and map overviews show their map's frame ([`surround`], piece 12b).
//!
-//! What a RustGIS layout has no place for is noted, counted over all the layouts: scale bars,
-//! legends, north arrows, tables, HTML and the other item kinds, map grids and overviews, the
-//! atlas, groups, blending, and settings set by expressions. A QGIS 2 composer isn't read.
+//! What a RustGIS layout has no place for is noted, counted over all the layouts: legends,
+//! tables, HTML and the other item kinds, map grids, the atlas, groups, blending, and settings set
+//! by expressions. A QGIS 2 composer isn't read.
use roxmltree::Node;
@@ -73,7 +74,6 @@ pub struct LayoutPicture {
#[derive(Default)]
pub(super) struct Tally {
legends: usize,
- scale_bars: usize,
north_arrows: usize,
tables: usize,
html: usize,
@@ -83,7 +83,6 @@ pub(super) struct Tally {
groups: usize,
map_backgrounds: usize,
grids: usize,
- overviews: usize,
atlases: usize,
locked_layers: usize,
turned_items: usize,
@@ -154,8 +153,53 @@ pub(super) struct Tally {
/// Labels whose margins leave their text less than an element can be across or down, its box
/// widened to it.
tiny_text: usize,
+ /// The QGIS layout being read's map items, by (uuid, layout) to their elements, and the elements
+ /// waiting for one's frame ([`surround::link`]).
+ maps: std::collections::HashMap<(String, usize), u32>,
+ /// The map items that will come in, by (uuid, layout) ([`surround::known_maps`]).
+ known: std::collections::HashSet<(String, usize)>,
+ /// Overviews past what a frame outlines, and scale bars' text bold, italic, underlined,
+ /// buffered or shadowed.
+ overviews_past: usize,
+ /// Overviews of a map another overview of the same item already outlines, kept once.
+ overviews_twice: usize,
+ bar_text_styles: usize,
+ /// Pages whose fill is more than a colour (several layers, a pattern, another kind).
+ papers: usize,
+ /// Scale bars drawn with a symbol of several layers, patterned, dashed or of another kind.
+ bar_symbols: usize,
+ linked: Vec,
+ /// Scale bars and north arrows whose map isn't on their page, left out; overviews of a map
+ /// not on theirs, not drawn.
+ unlinked: usize,
+ overviews_unlinked: usize,
+ /// Overviews' fills (drawn as their outlines), and overviews inverted or centring their map.
+ overview_fills: usize,
+ overview_ways: usize,
+ /// North arrows to true north or offset from the map's.
+ true_north: usize,
+ /// Numeric scale bars of a map other than their layout's first, printing its scale.
+ numeric_other: usize,
+ /// Numeric scale bars, printing the scale in RustGIS's format.
+ numeric_formats: usize,
+ /// Numeric scale bars' text sizes outside what a text takes (1 to 400 pt), and overviews
+ /// switched off.
+ numeric_sizes: usize,
+ overviews_off: usize,
+ /// Scale bars as RustGIS's nearest: their style, colours, units, divisions (past RustGIS's),
+ /// subdivisions, fixed division values, placement, and text sizes (past a layout's).
+ bar_styles: usize,
+ bar_colors: usize,
+ bar_units: usize,
+ bar_divisions: usize,
+ bar_subdivisions: usize,
+ bar_values: usize,
+ bar_layout: usize,
+ bar_text_sizes: usize,
}
+mod surround;
+
/// `text` written into a label as it reads: its braces as parentheses, as a brace starts one of
/// RustGIS's tokens (`{date}`).
fn as_written(text: &str) -> String {
@@ -225,7 +269,7 @@ fn read_layout(node: Node, dir: &str, title: &Title, room: usize, tally: &mut Ta
// the first [`MAX_PAGES`] and reads.
let collection = child(node, "PageCollection");
// The paper: a page's fill symbol's colour (when not white), else its collection's.
- let paper = collection.and_then(paper_of).flatten();
+ let collection_paper = collection.and_then(paper_of).unwrap_or((None, false));
let entries =
collection.map_or(0, |pc| pc.children().filter(|c| c.has_tag_name("LayoutItem") && c.attribute("type") == Some(PAGE)).count());
tally.pages_left += entries.saturating_sub(MAX_PAGE_NODES);
@@ -235,11 +279,15 @@ fn read_layout(node: Node, dir: &str, title: &Title, room: usize, tally: &mut Ta
.filter(|c| c.has_tag_name("LayoutItem") && c.attribute("type") == Some(PAGE))
.take(MAX_PAGE_NODES)
.enumerate()
- .map(|(i, p)| Slot {
- top: p.attribute("position").and_then(|v| pair(v, dpi)).map(|(_, y)| y),
- page: if i < MAX_PAGES { Page::read(p, dpi) } else { None },
- paper: paper_of(p).unwrap_or(paper),
- layout: None,
+ .map(|(i, p)| {
+ let (paper, paper_rough) = paper_of(p).unwrap_or(collection_paper);
+ Slot {
+ top: p.attribute("position").and_then(|v| pair(v, dpi)).map(|(_, y)| y),
+ page: if i < MAX_PAGES { Page::read(p, dpi) } else { None },
+ paper,
+ paper_rough,
+ layout: None,
+ }
})
.collect()
})
@@ -249,7 +297,8 @@ fn read_layout(node: Node, dir: &str, title: &Title, room: usize, tally: &mut Ta
// A layout with no page QGIS can read: A4 portrait, as QGIS starts one, said (the pages
// that don't read counted above).
tally.no_pages += 1;
- pages = vec![Slot { top: Some(0.0), page: Some(Page { top: 0.0, w: 210.0, h: 297.0 }), paper, layout: None }];
+ let (paper, paper_rough) = collection_paper;
+ pages = vec![Slot { top: Some(0.0), page: Some(Page { top: 0.0, w: 210.0, h: 297.0 }), paper, paper_rough, layout: None }];
}
if child(node, "Atlas").is_some_and(|a| a.attribute("enabled") == Some("1")) {
tally.atlases += 1;
@@ -274,6 +323,7 @@ fn read_layout(node: Node, dir: &str, title: &Title, room: usize, tally: &mut Ta
};
let mut layout = Layout::new(name, p.w, p.h);
layout.paper = slot.paper;
+ tally.papers += usize::from(slot.paper_rough);
slot.layout = Some(n);
layouts.push(ProjectLayout { layout, frames: Vec::new(), pictures: Vec::new() });
}
@@ -295,9 +345,14 @@ fn read_layout(node: Node, dir: &str, title: &Title, room: usize, tally: &mut Ta
// `@layout_name` prints the QGIS layout's name as far as a text holds, not the layout's.
let pages = Pages::new(pages, entries.max(1), given.chars().take(MAX_TEXT).collect());
tally.titled.clear();
+ tally.maps.clear();
+ tally.linked.clear();
+ tally.known = surround::known_maps(&items, &pages, dpi);
for (_, _, item) in items {
read_item(item, &pages, &mut layouts, &multiframes, dir, dpi, tally);
}
+ // Its scale bars, north arrows and overviews, each with its map's frame on its page.
+ surround::link(&mut layouts, tally);
// A page without a map shows the project's title as written (a frame shows its map's name).
// Its text is cut to what a text holds after that, and a cut said.
for (page, element, n, whole, stopped) in std::mem::take(&mut tally.titled) {
@@ -337,16 +392,23 @@ fn read_layout(node: Node, dir: &str, title: &Title, room: usize, tally: &mut Ta
layouts
}
-/// The paper a fill symbol under `node` gives: `None` with no symbol, `Some(None)` for white (or a
-/// colour that doesn't read).
-fn paper_of(node: Node) -> Option"#
+ )
+ };
+ let overview = |of: &str, fill: &str| {
+ format!(r#"{}"#, symbol(fill))
+ };
+ let items = format!("{}{}", map("{main}", 10.0, 1, ""), map("{ov}", 115.0, 0, &overview("{main}", "255,0,0,0")));
+ let mut report = Report::default();
+ let p = read(&layout(PAGE, &items), &mut report);
+ let l = &p.layouts[0].layout;
+ // The overview map drawn first (lowest), the main map over it.
+ let frames: Vec<&crate::layout::Element> = l.elements.iter().filter(|e| matches!(e.kind, ElementKind::MapFrame { .. })).collect();
+ let shown = frames[0].kind.extent_indicators();
+ assert_eq!(shown.len(), 1);
+ assert!(frames[1].kind.extent_indicators().is_empty());
+ let ExtentIndicator { of, color, width } = shown[0];
+ assert_eq!((of, color), (frames[1].id, Rgba::rgb(0, 0, 200)));
+ assert!(width > 0.0);
+ assert!(report.notes.is_empty(), "{:?}", report.notes);
+ // A filled overview, and one of a map on another page.
+ let items = format!(
+ "{}{}{}",
+ map("{main}", 10.0, 0, ""),
+ map("{ov}", 115.0, 0, &(overview("{main}", "255,0,0,80") + &overview("{far}", "255,0,0,0"))),
+ map("{far}", 230.0, 0, "")
+ );
+ let mut report = Report::default();
+ read(&layout(TWO_PAGES, &items), &mut report);
+ assert!(said(&report, "map overviews' fills, drawn as their outlines (1)"), "{:?}", report.notes);
+ assert!(said(&report, "map overviews of their own map, or of a map not on their page or left out (1)"), "{:?}", report.notes);
+}
+
+/// A scale bar past a full layout is counted with the elements it leaves out.
+#[test]
+fn a_scale_bar_past_a_full_layout_is_counted() {
+ let mut items = map("{m}", 10.0, 0, "");
+ for i in 0..499 {
+ items.push_str(&format!(r#""#));
+ }
+ items
+ .push_str(&bar("{m}", r#"style="Single Box" segmentSizeMode="1" zValue="5""#, BAR_COLOURS).replace(r#"zValue="1" style"#, "style"));
+ let mut report = Report::default();
+ let p = read(&layout(PAGE, &items), &mut report);
+ assert!(bars(&p.layouts[0].layout).is_empty());
+ assert!(said(&report, "elements past the 500 a layout keeps (1)"), "{:?}", report.notes);
+}
+
+/// The corpus's sheet of surrounds, as QGIS 4.4 wrote it: its scale bars, numeric scale and north
+/// arrow show the main map's frame, its overview map outlines it.
+#[test]
+fn the_corpus_surrounds_show_the_main_map() {
+ let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("testdata/qgis/generated/qgs");
+ let text = std::fs::read_to_string(root.join("layout-surrounds.qgs")).unwrap();
+ let mut report = Report::default();
+ let p = super::read_project(&text, &root.to_string_lossy(), &mut |_, _| Err((super::IMAGE_UNOPENED, false)), &mut report).unwrap();
+ let l = &p.layouts[0].layout;
+ let frames: Vec<&crate::layout::Element> = l.elements.iter().filter(|e| matches!(e.kind, ElementKind::MapFrame { .. })).collect();
+ assert_eq!(frames.len(), 2);
+ // The main map is the larger.
+ let (main, overview) = if frames[0].w > frames[1].w { (frames[0], frames[1]) } else { (frames[1], frames[0]) };
+ let styles: Vec = bars(l)
+ .iter()
+ .filter_map(|e| match e.kind {
+ ElementKind::ScaleBar { frame, style, units: ScaleUnits::Meters, divisions: 4, .. } if frame == main.id => Some(style),
+ _ => None,
+ })
+ .collect();
+ assert_eq!(styles.len(), 3, "{:?}", l.elements);
+ for s in [ScaleBarStyle::Alternating, ScaleBarStyle::Line, ScaleBarStyle::Stepped] {
+ assert!(styles.contains(&s));
+ }
+ assert!(l.elements.iter().any(|e| matches!(e.kind, ElementKind::NorthArrow { frame, .. } if frame == main.id)));
+ assert!(l.elements.iter().any(|e| matches!(&e.kind, ElementKind::Text { text, .. } if text == "{scale}")));
+ let shown = overview.kind.extent_indicators();
+ assert_eq!(shown.len(), 1);
+ assert_eq!((shown[0].of, shown[0].color), (main.id, Rgba::rgb(200, 0, 0)));
+ // What it says: the north arrow, the numeric scale's format and the bars' division values,
+ // nothing more.
+ let texts: Vec<&str> = report.notes.iter().map(|n| n.text.as_str()).collect();
+ assert_eq!(
+ texts,
+ [
+ "its print layouts' north arrows (pictures turned with a map), drawn as RustGIS's arrow (1)",
+ "its print layouts' numeric scale bars, printing the scale in RustGIS's format (1:25,000) (1)",
+ "its print layouts' scale bars' division values, chosen anew to fit their box (3)"
+ ]
+ );
+}
+
+/// A map whose extent doesn't read doesn't come in, so its scale bar is left out, said as only
+/// that.
+#[test]
+fn a_surround_of_a_map_that_doesnt_come_in_says_only_that() {
+ let broken = r#""#;
+ let items = format!("{broken}{}", bar("{m}", r#"style="Double Box" unitType="yd""#, BAR_COLOURS));
+ let mut report = Report::default();
+ let p = read(&layout(PAGE, &items), &mut report);
+ assert!(bars(&p.layouts[0].layout).is_empty());
+ let texts: Vec<&str> = report.notes.iter().map(|n| n.text.as_str()).collect();
+ assert_eq!(
+ texts,
+ [
+ "its print layouts' scale bars and north arrows whose map isn't on their page, or is left out (1)",
+ "its print layouts' items whose place or shape doesn't read (1)"
+ ]
+ );
+}
+
+/// A numeric scale's text size past what a text takes is drawn at the nearest, said; forced bold
+/// on a bar's text is said; an overview and a grid switched off are said.
+#[test]
+fn numeric_sizes_forced_bold_and_switched_off_overviews_are_said() {
+ let numeric = r#""#;
+ let forced = bar("{m}", r#"style="Single Box" segmentSizeMode="1""#, BAR_COLOURS)
+ .replace(r#"textColor="0,0,0,255"/>"#, r#"textColor="0,0,0,255" forcedBold="1"/>"#);
+ let off = r#""#;
+ let items = format!("{}{}{numeric}{forced}", map("{m}", 10.0, 0, ""), map("{o}", 115.0, 0, off));
+ let mut report = Report::default();
+ let p = read(&layout(PAGE, &items), &mut report);
+ let size = p.layouts[0].layout.elements.iter().find_map(|e| match e.kind {
+ ElementKind::Text { size, .. } => Some(size),
+ _ => None,
+ });
+ assert_eq!(size, Some(400.0));
+ for part in [
+ "numeric scale bars' text sizes outside 1 to 400 pt, drawn at the nearest (1)",
+ "scale bars' text bold, italic, underlined, buffered or shadowed, drawn plain (1)",
+ "map overviews and grids switched off (2)",
+ ] {
+ assert!(said(&report, part), "{part}: {:?}", report.notes);
+ }
+}
+
+/// A north arrow read before its map, whose map a full layout then leaves out, is left out too and
+/// said only as that: none of its own notes, nor its placement's, are said.
+#[test]
+fn a_surround_whose_map_a_full_layout_leaves_out_says_only_that() {
+ let mut items = String::new();
+ for i in 0..499 {
+ items.push_str(&format!(r#""#));
+ }
+ items.push_str(r#""#);
+ items.push_str(&map("{m}", 10.0, 3, ""));
+ let mut report = Report::default();
+ let p = read(&layout(PAGE, &items), &mut report);
+ assert!(p.layouts[0].layout.elements.iter().all(|e| !matches!(e.kind, ElementKind::NorthArrow { .. })));
+ let texts: Vec<&str> = report.notes.iter().map(|n| n.text.as_str()).collect();
+ assert_eq!(
+ texts,
+ [
+ "its print layouts' scale bars and north arrows whose map isn't on their page, or is left out (1)",
+ "its print layouts' elements past the 500 a layout keeps (1)"
+ ]
+ );
+}
+
+/// A scale bar with no unit label written prints its units' abbreviation; one written empty prints
+/// none, as QGIS does.
+#[test]
+fn a_scale_bar_without_a_unit_label_prints_its_abbreviation() {
+ let label = |attrs: &str| {
+ let p = read(&layout(PAGE, &(map("{m}", 10.0, 0, "") + &bar("{m}", attrs, BAR_COLOURS))), &mut Report::default());
+ match &bars(&p.layouts[0].layout)[0].kind {
+ ElementKind::ScaleBar { unit_label, .. } => unit_label.clone(),
+ _ => None,
+ }
+ };
+ assert_eq!(label(r#"style="Single Box" unitType="km""#), None);
+ assert_eq!(label(r#"style="Single Box" unitType="km" unitLabelString="""#), Some(String::new()));
+}
+
+/// An overview with neither fill nor outline draws nothing, in QGIS as here: no indicator, nothing
+/// said.
+#[test]
+fn an_invisible_overview_draws_nothing() {
+ let invisible = r#"
"#;
+ let items = format!("{}{}", map("{main}", 10.0, 1, ""), map("{ov}", 115.0, 0, invisible));
+ let mut report = Report::default();
+ let p = read(&layout(PAGE, &items), &mut report);
+ assert!(p.layouts[0].layout.elements.iter().all(|e| e.kind.extent_indicators().is_empty()));
+ assert!(report.notes.is_empty(), "{:?}", report.notes);
+}
+
+/// A scale bar's colours take their symbol's own opacity.
+#[test]
+fn a_scale_bars_colours_take_their_symbols_opacity() {
+ let symbol = |tag: &str, c: &str| {
+ format!(
+ r#"<{tag}>
{tag}>"#
+ )
+ };
+ let children = symbol("fillSymbol1", "0,0,0,255") + &symbol("fillSymbol2", "255,255,255,255");
+ let p = read(
+ &layout(PAGE, &(map("{m}", 10.0, 0, "") + &bar("{m}", r#"style="Single Box" segmentSizeMode="1""#, &children))),
+ &mut Report::default(),
+ );
+ assert!(matches!(bars(&p.layouts[0].layout)[0].kind, ElementKind::ScaleBar { color, fill, .. } if color.a() == 64 && fill.a() == 64));
+}
+
+/// A scale bar and north arrow that link say their placement's notes as other items do
+/// (blending, left out of exports); an overview's hairline outline (no width) is drawn thin.
+#[test]
+fn linked_surrounds_say_their_placement_and_a_hairline_overview_is_drawn() {
+ let arrow = r#""#;
+ let hairline = r#"
"#;
+ let items = format!(
+ "{}{}{arrow}{}",
+ map("{m}", 10.0, 1, ""),
+ map("{o}", 115.0, 0, hairline),
+ bar("{m}", r#"style="Single Box" segmentSizeMode="1" excludeFromExports="1""#, BAR_COLOURS)
+ );
+ let mut report = Report::default();
+ let p = read(&layout(PAGE, &items), &mut report);
+ assert!(said(&report, "items' blending modes, drawn normally (1)"), "{:?}", report.notes);
+ assert!(said(&report, "items left out of exports, kept hidden (1)"), "{:?}", report.notes);
+ let shown: Vec = p.layouts[0].layout.elements.iter().flat_map(|e| e.kind.extent_indicators()).collect();
+ assert_eq!(shown.len(), 1);
+ assert_eq!((shown[0].width, shown[0].color), (super::layout::surround_hairline(), Rgba::rgb(0, 0, 200)));
+}
+
+/// A scale bar whose dark divisions' fill is switched off draws in its text's colour, said; its
+/// light divisions switched off are transparent.
+#[test]
+fn a_scale_bars_fill_switched_off_is_said() {
+ let fill = |tag: &str, style: &str| {
+ format!(
+ r#"<{tag}>
{tag}>"#
+ )
+ };
+ let children = fill("fillSymbol1", "no") + &fill("fillSymbol2", "no");
+ let text = bar("{m}", r#"style="Single Box" segmentSizeMode="1""#, &children)
+ .replace(r#"textColor="0,0,0,255""#, r#"textColor="20,40,60,255""#);
+ let mut report = Report::default();
+ let p = read(&layout(PAGE, &(map("{m}", 10.0, 0, "") + &text)), &mut report);
+ assert!(
+ matches!(bars(&p.layouts[0].layout)[0].kind, ElementKind::ScaleBar { color, fill, .. } if color == Rgba::rgb(20, 40, 60) && fill.a() == 0)
+ );
+ assert!(said(&report, "scale bars whose lines, labels and dark divisions differ in colour, drawn in one (1)"), "{:?}", report.notes);
+}
+
+/// A map item's overviews past what a frame outlines are said as past it, and not held; a second
+/// overview of the same map is kept once, said.
+#[test]
+fn overviews_past_a_frames_are_said() {
+ let targets: String = (0..18).map(|i| map(&format!("{{t{i}}}"), 10.0, 1, "")).collect();
+ let mut overviews: String = (0..18).map(|i| format!(r#""#)).collect();
+ overviews.push_str(r#""#);
+ let items = format!("{targets}{}", map("{ov}", 115.0, 0, &overviews));
+ let mut report = Report::default();
+ let p = read(&layout(PAGE, &items), &mut report);
+ let mut shown: Vec = p.layouts[0].layout.elements.iter().flat_map(|e| e.kind.extent_indicators()).map(|i| i.of).collect();
+ assert_eq!(shown.len(), 16);
+ shown.sort_unstable();
+ shown.dedup();
+ assert_eq!(shown.len(), 16, "each frame outlined once");
+ assert!(said(&report, "map overviews past the 16 a frame outlines (2)"), "{:?}", report.notes);
+ assert!(said(&report, "map overviews of a map their map item already outlines (kept once) (1)"), "{:?}", report.notes);
+}
+
+/// A symbol layer switched off (`enabled="0"`) gives no colour: a light division fill switched off
+/// is transparent.
+#[test]
+fn a_switched_off_symbol_layer_gives_no_colour() {
+ let light = r#"
"#;
+ let p = read(
+ &layout(PAGE, &(map("{m}", 10.0, 0, "") + &bar("{m}", r#"style="Single Box" segmentSizeMode="1""#, light))),
+ &mut Report::default(),
+ );
+ assert!(matches!(bars(&p.layouts[0].layout)[0].kind, ElementKind::ScaleBar { fill, .. } if fill.a() == 0));
+}
+
+/// A scale bar drawn with a symbol of several layers, or a patterned one, is said; a plain one
+/// isn't.
+#[test]
+fn scale_bars_symbols_beyond_a_plain_colour_are_said() {
+ let fill = |tag: &str, layers: &str| format!(r#"<{tag}>{layers}{tag}>"#);
+ let layer = |c: &str, style: &str| {
+ format!(
+ r#"
"#
+ )
+ };
+ let one = |children: &str| {
+ let mut report = Report::default();
+ read(&layout(PAGE, &(map("{m}", 10.0, 0, "") + &bar("{m}", r#"style="Single Box" segmentSizeMode="1""#, children))), &mut report);
+ said(
+ &report,
+ "scale bars drawn with symbols of several layers, patterned, dashed, outlined or of another kind, in a plain colour (1)",
+ )
+ };
+ assert!(one(&fill("fillSymbol2", &(layer("255,255,255,255", "solid") + &layer("255,0,0,255", "solid")))));
+ assert!(one(&fill("fillSymbol2", &layer("255,255,255,255", "horizontal"))));
+ assert!(!one(&fill("fillSymbol2", &layer("255,255,255,255", "solid"))));
+ // A fill outlined of its own; a second layer switched off stays plain.
+ let outlined = layer("255,255,255,255", "solid")
+ .replace("", r#"
"#);
+ assert!(one(&fill("fillSymbol2", &outlined)));
+ let off = layer("255,0,0,255", "solid").replace(r#"enabled="1""#, r#"enabled="0""#);
+ assert!(!one(&fill("fillSymbol2", &(layer("255,255,255,255", "solid") + &off))));
+ // A line style's tick dashed of its own.
+ let tick = r#"
"#;
+ let mut report = Report::default();
+ read(&layout(PAGE, &(map("{m}", 10.0, 0, "") + &bar("{m}", r#"style="Line Ticks Up" segmentSizeMode="1""#, tick))), &mut report);
+ assert!(said(&report, "in a plain colour (1)"), "{:?}", report.notes);
+}
+
+/// A bar's line width is compared in millimetres whatever its unit: 0.3 pt is not RustGIS's
+/// 0.3 mm, said; 0.3 mm isn't; one in map units is said.
+#[test]
+fn a_bar_line_width_is_read_in_its_unit() {
+ let line = |w: &str, unit: &str| {
+ format!(
+ r#"
"#
+ )
+ };
+ let said_width = |children: &str| {
+ let mut report = Report::default();
+ read(
+ &layout(PAGE, &(map("{m}", 10.0, 0, "") + &bar("{m}", r#"style="Line Ticks Up" segmentSizeMode="1""#, children))),
+ &mut report,
+ );
+ said(&report, "scale bars' heights, line widths, spacing,")
+ };
+ assert!(said_width(&line("0.3", "Point")));
+ assert!(!said_width(&line("0.3", "MM")));
+ assert!(said_width(&line("0.3", "MapUnit")));
+ // Pixels at 96 dpi and inches converted; a unit in any case, or none, as QGIS reads it.
+ assert!(!said_width(&line(&(0.3 * 96.0 / 25.4).to_string(), "Pixel")));
+ assert!(!said_width(&line(&(0.3 / 25.4).to_string(), "Inch")));
+ assert!(!said_width(&line("0.3", "mm")));
+ assert!(!said_width(&line("0.3", "")));
+}
+
+/// A bar's spacing (between its labels and its bar, inside its box) other than QGIS's default is
+/// said; the default isn't.
+#[test]
+fn a_bars_spacing_of_its_own_is_said() {
+ let spaced = |attrs: &str| {
+ let mut report = Report::default();
+ read(&layout(PAGE, &(map("{m}", 10.0, 0, "") + &bar("{m}", attrs, BAR_COLOURS))), &mut report);
+ said(&report, "scale bars' heights, line widths, spacing,")
+ };
+ assert!(!spaced(r#"style="Single Box" segmentSizeMode="1" labelBarSpace="3" boxContentSpace="1""#));
+ assert!(spaced(r#"style="Single Box" segmentSizeMode="1" labelBarSpace="6""#));
+ assert!(spaced(r#"style="Single Box" segmentSizeMode="1" boxContentSpace="2.5""#));
+}
diff --git a/crates/map/src/qgis/layout_tests.rs b/crates/map/src/qgis/layout_tests.rs
index a4954a6677..2c512262a7 100644
--- a/crates/map/src/qgis/layout_tests.rs
+++ b/crates/map/src/qgis/layout_tests.rs
@@ -126,10 +126,14 @@ fn qgis_layout_items_without_a_place_are_noted() {
let mut report = Report::default();
let p = super::read_project(&text, &root.to_string_lossy(), &mut |_, _| Err((super::IMAGE_UNOPENED, false)), &mut report).unwrap();
assert_eq!(p.layouts.len(), 1);
+ // Its scale bar and north arrow come in, showing its map's frame.
+ let l = &p.layouts[0].layout;
+ let frame = l.first_frame().unwrap();
+ assert!(l.elements.iter().any(|e| matches!(e.kind, ElementKind::ScaleBar { frame: f, .. } if f == frame)));
+ assert!(l.elements.iter().any(|e| matches!(e.kind, ElementKind::NorthArrow { frame: f, .. } if f == frame)));
for part in [
"legends (1)",
- "scale bars (1)",
- "north arrows (pictures turned with a map) (1)",
+ "north arrows (pictures turned with a map), drawn as RustGIS's arrow (1)",
"attribute tables (1)",
"HTML frames (1)",
"marker items (1)",
@@ -529,9 +533,8 @@ fn merged_notes_keep_their_count_past_the_cap() {
assert_eq!((closing.count, closing.text.as_str()), (4, "4 more note(s) not listed"), "{closing:?}");
}
-/// Pictures that never come in as elements (north arrows, SVGs, no file, a path that doesn't
-/// check) aren't counted past a full layout: they are said as what they are; a picture that
-/// would come in is.
+/// Pictures that never come in as elements (SVGs, no file, a path that doesn't check) aren't
+/// counted past a full layout: they are said as what they are; a picture that would come in is.
#[test]
fn a_full_layout_counts_only_pictures_that_would_come_in() {
let mut items = String::new();
@@ -552,8 +555,9 @@ fn a_full_layout_counts_only_pictures_that_would_come_in() {
let qgs = format!(r#"{page}{items}"#);
let mut report = Report::default();
read(&qgs, &mut report);
+ // The north arrows' map isn't in the layout: they are said as that, not counted past it.
assert!(!said(&report, "elements past the 500"), "{:?}", report.notes);
- assert!(said(&report, "north arrows (pictures turned with a map) (3)"), "{:?}", report.notes);
+ assert!(said(&report, "scale bars and north arrows whose map isn't on their page, or is left out (3)"), "{:?}", report.notes);
assert!(said(&report, "pictures that can't be read (1;"), "{:?}", report.notes);
// What doesn't come in isn't said as drawn otherwise.
assert!(!said(&report, "blending modes"), "{:?}", report.notes);
@@ -1001,3 +1005,53 @@ fn a_label_read_short_is_said_cut() {
read(&qgs("TT"), &mut report);
assert!(said(&report, "labels longer than 5000 characters, cut there (1)"), "{:?}", report.notes);
}
+
+/// A page's fill takes its first layer switched on: one switched off gives no colour.
+#[test]
+fn a_pages_switched_off_fill_layer_gives_no_paper() {
+ let layer = |enabled: &str, c: &str| {
+ format!(
+ r#"
"#
+ )
+ };
+ let qgs = |layers: &str| {
+ format!(
+ r#"{layers}"#
+ )
+ };
+ let p = read(&qgs(&(layer("0", "0,0,255,255") + &layer("1", "255,255,200,255"))), &mut Report::default());
+ assert_eq!(p.layouts[0].layout.paper, Some(Rgba::rgb(255, 255, 200)));
+ let p = read(&qgs(&layer("0", "0,0,255,255")), &mut Report::default());
+ assert_eq!(p.layouts[0].layout.paper, None);
+}
+
+/// A page's fill switched off gives no paper; one of several layers or a pattern is said as drawn
+/// in a plain colour; a plain one isn't.
+#[test]
+fn a_pages_fill_beyond_a_colour_is_said() {
+ let layer = |c: &str, style: &str| {
+ format!(
+ r#"
"#
+ )
+ };
+ let page = |layers: &str| {
+ let qgs = format!(
+ r#"{layers}"#
+ );
+ let mut report = Report::default();
+ let p = read(&qgs, &mut report);
+ (
+ p.layouts[0].layout.paper,
+ said(&report, "pages whose fill has several layers, a pattern, an outline or is of another kind, drawn as a plain colour (1)"),
+ )
+ };
+ assert_eq!(page(&layer("0,0,255,255", "no")), (None, false));
+ assert_eq!(page(&layer("0,0,255,255", "solid")), (Some(Rgba::rgb(0, 0, 255)), false));
+ assert_eq!(page(&layer("0,0,255,255", "dense3")), (Some(Rgba::rgb(0, 0, 255)), true));
+ assert_eq!(page(&(layer("0,0,255,255", "solid") + &layer("255,0,0,255", "solid"))), (Some(Rgba::rgb(0, 0, 255)), true));
+ let outlined = layer("0,0,255,255", "solid")
+ .replace("", r#"
"#);
+ assert_eq!(page(&outlined), (Some(Rgba::rgb(0, 0, 255)), true));
+ let gradient = layer("0,0,255,255", "solid").replace(r#"class="SimpleFill""#, r#"class="GradientFill""#);
+ assert_eq!(page(&gradient), (Some(Rgba::rgb(0, 0, 255)), true));
+}
diff --git a/crates/map/src/qgis/mod.rs b/crates/map/src/qgis/mod.rs
index 04ce836d93..5ecfa5c71f 100644
--- a/crates/map/src/qgis/mod.rs
+++ b/crates/map/src/qgis/mod.rs
@@ -15,6 +15,8 @@ mod expr;
mod labels;
mod layout;
#[cfg(test)]
+mod layout_surround_tests;
+#[cfg(test)]
mod layout_tests;
mod raster;
mod renderer;
diff --git a/crates/map/src/qgis/tests.rs b/crates/map/src/qgis/tests.rs
index 6ed04a936c..e322004508 100644
--- a/crates/map/src/qgis/tests.rs
+++ b/crates/map/src/qgis/tests.rs
@@ -1152,7 +1152,7 @@ fn every_corpus_file_reads() {
}
}
let projects = files("generated/qgs", &["qgs", "qgz"]);
- assert_eq!(projects.len(), 39, "project corpus changed: {projects:?}");
+ assert_eq!(projects.len(), 40, "project corpus changed: {projects:?}");
for path in &projects {
let bytes = std::fs::read(path).unwrap();
let text = if path.extension().is_some_and(|e| e == "qgz") {
diff --git a/crates/map/testdata/qgis/README.md b/crates/map/testdata/qgis/README.md
index 61cd186d22..1f0e514cf7 100644
--- a/crates/map/testdata/qgis/README.md
+++ b/crates/map/testdata/qgis/README.md
@@ -10,7 +10,7 @@ no specification of these formats, so the corpus stands in for one: `every_corpu
| Folder | What | Licence |
|---|---|---|
| `generated/qml/` | 126 styles written through QGIS's API (4.2.3; the SVG marker ones 4.4.0), each varying one thing: every symbol layer type with its defaults, raster image markers (a PNG and a JPEG, in a file and embedded; sizes in each unit, rotation, an offset, anchor points, a fixed aspect ratio, opacity, and along a line), SVG markers (an SVG with `param(…)` colours and outline width and one without, in a file and embedded, one from QGIS's own library, which isn't copied here; colours with alpha; sizes in each unit, rotation, an offset, anchor points, a fixed aspect ratio, opacity, and along a line), every renderer (categorized and graduated by expression, rule-based with nested and else rules), every paint effect, data-defined size, angle and colour, labels (every placement, buffer, background, shadow, font, wrap, expression text, offsets, data-defined settings, scale ranges, curved labels, each callout, rule-based labels), layer settings (opacity, blend mode, scale range, reference scale, subset), diagrams (pie, by fields and expressions, a histogram, a stacked bar and a text diagram, two of them sized between two values) and raster renderers (grey, pseudocolour interpolated, discrete and exact, multiband, paletted, hillshade, contour) | Apache-2.0, like RustGIS: made by Dominik Strebel ([@pick2510](https://github.com/pick2510)) for the RustGIS project |
-| `generated/qgs/` | 39 projects: one per provider (OGR, GDAL, memory, delimited text by x/y and WKT, SpatiaLite, virtual (on a file, on another layer, and grouping), WMS, WMTS, XYZ, raster MBTiles, WFS (also with a filter), OGC API Features, WCS, ArcGIS feature, map, image and vector tile services, vector tiles by address, with a MapLibre style, from MBTiles and from PMTiles, PostGIS, SQL Server, GPX waypoints and tracks); project structure (groups, a mutually exclusive group, a map theme, a bookmark, a variable, a relation, a join, a virtual field, time from a field, two styles on a layer); groups nested, hidden, collapsed, empty and drawn as one (a group layer with its opacity and blending); bookmarks (turned, in a group, in degrees), relations (on one pair of fields, on two, a composition, a polymorphic one) and time settings (a span of months; time from a field, from a field for a duration, a fixed range); a layout with every item and an atlas; `layout-sheets.qgs`, print layouts as map sheets (an A4 landscape sheet of two pages with a framed, turned map, a title and a note with an expression, a turned label with a background and frame, a picture, a rounded rectangle, a translucent ellipse, a triangle and a dashed line, items placed in mm, cm, in and pt, a hidden item, one left out of exports and two grouped; and a Letter portrait sheet in inches), written by QGIS 4.4.0; the annotation layer with every item; annotations with their settings (styled marks, lines and a polygon with a hole, text aligned, turned, in HTML and with a buffer, rectangle text with a background and frame or of a fixed size, a picture file and an SVG, text along a line, one switched off, z order, the main annotation layer); `all-styles.qgz`, every style above on its own layer (written before the diagrams were added); `raster-markers.qgs`, each raster image marker style on its own layer, its image files named relative to it; `svg-markers.qgs`, the same for each SVG marker style, written by QGIS 4.4.0 | Apache-2.0 |
+| `generated/qgs/` | 40 projects: one per provider (OGR, GDAL, memory, delimited text by x/y and WKT, SpatiaLite, virtual (on a file, on another layer, and grouping), WMS, WMTS, XYZ, raster MBTiles, WFS (also with a filter), OGC API Features, WCS, ArcGIS feature, map, image and vector tile services, vector tiles by address, with a MapLibre style, from MBTiles and from PMTiles, PostGIS, SQL Server, GPX waypoints and tracks); project structure (groups, a mutually exclusive group, a map theme, a bookmark, a variable, a relation, a join, a virtual field, time from a field, two styles on a layer); groups nested, hidden, collapsed, empty and drawn as one (a group layer with its opacity and blending); bookmarks (turned, in a group, in degrees), relations (on one pair of fields, on two, a composition, a polymorphic one) and time settings (a span of months; time from a field, from a field for a duration, a fixed range); a layout with every item and an atlas; `layout-sheets.qgs`, print layouts as map sheets (an A4 landscape sheet of two pages with a framed, turned map, a title and a note with an expression, a turned label with a background and frame, a picture, a rounded rectangle, a translucent ellipse, a triangle and a dashed line, items placed in mm, cm, in and pt, a hidden item, one left out of exports and two grouped; and a Letter portrait sheet in inches), written by QGIS 4.4.0; `layout-surrounds.qgs`, a sheet with the surrounds tied to a map (scale bars of a single box, ticks up and a stepped line fitted to their box, a numeric one, a north arrow following the map, and an overview map outlining its extent), written by QGIS 4.4.0; the annotation layer with every item; annotations with their settings (styled marks, lines and a polygon with a hole, text aligned, turned, in HTML and with a buffer, rectangle text with a background and frame or of a fixed size, a picture file and an SVG, text along a line, one switched off, z order, the main annotation layer); `all-styles.qgz`, every style above on its own layer (written before the diagrams were added); `raster-markers.qgs`, each raster image marker style on its own layer, its image files named relative to it; `svg-markers.qgs`, the same for each SVG marker style, written by QGIS 4.4.0 | Apache-2.0 |
| `generated/data/` | The data those files use: `sample.gpkg` (layers `points`, `lines` and `polygons`, 9 made-up features each, fields `id`, `name`, `kind`, `value`, `angle`, `day`), `dem.tif` (3 bands of a linear surface), two CSVs, a GPX file, `picture.png` (a red 40 × 20 picture), `marker.png` (32 × 16, a red square and a blue bar) and `marker.jpg` (24 × 24, green with a yellow corner), the raster image markers' images; `icon.svg` (the same square and bar) and `marker.svg` (a triangle and a rectangle in `param(…)` colours), the SVG markers' images | Apache-2.0 |
| `generated/generate.py`, `scrub.py` | The generator, and the step that removes the user's name and absolute paths from what QGIS writes | Apache-2.0 |
| `generated/types.txt` | The element types QGIS 4.2.3 knows (symbol layers, renderers, providers, label placements, callouts, annotation and layout items, paint effects): the checklist the corpus was made from. A few have no file yet: the single-colour raster renderer, and the text table, fixed table, elevation profile and chart layout items | Apache-2.0 |
@@ -40,7 +40,7 @@ QGIS 4.2.3 wrote the corpus, and 4.4.0 the SVG marker files. The command runs wh
installed (here the Flathub Flatpak, whose `/tmp` is private, so it writes under `~/.cache`) and
writes the whole corpus again, so copy only the files you mean to replace: for the SVG markers,
`data/icon.svg`, `data/marker.svg`, `qml/symbol-svg-marker-*.qml` and `qgs/svg-markers.qgs`; for the map sheets,
-`qgs/layout-sheets.qgs`.
+`qgs/layout-sheets.qgs` and `qgs/layout-surrounds.qgs`.
```sh
mkdir -p ~/.cache/qgis-corpus
diff --git a/crates/map/testdata/qgis/generated/generate.py b/crates/map/testdata/qgis/generated/generate.py
index 1e4c21cfdd..b60abf7daa 100644
--- a/crates/map/testdata/qgis/generated/generate.py
+++ b/crates/map/testdata/qgis/generated/generate.py
@@ -1387,6 +1387,81 @@ def __exit__(self, *a):
# (After the annotations, which write `picture.png`.)
attempt("layout sheets", layout_sheets)
+
+
+# A sheet with the surrounds tied to a map (piece 12b): scale bars in the styles RustGIS draws
+# (fitted to their box) and a numeric one, a north arrow following the map, and an overview map
+# outlining the main map's extent. QGIS's own export is written to `renders/` for comparing.
+def layout_surrounds():
+ from qgis.core import QgsLayoutItemPage, QgsLayoutItemScaleBar, QgsLayoutItemMapOverview, QgsLayoutExporter, QgsFillSymbol, QgsTextFormat
+ from qgis.PyQt.QtGui import QFont
+ mm = Qgis.LayoutUnit.Millimeters
+ p = new_project()
+ p.relationManager().setPolymorphicRelations([])
+ p.setTitle("Surrounds")
+ pts, polys = layer("points"), layer("polygons")
+ p.addMapLayers([pts, polys])
+ lay = QgsPrintLayout(p)
+ lay.initializeDefaults()
+ lay.setName("Surrounds")
+ lay.pageCollection().page(0).setPageSize("A4", QgsLayoutItemPage.Orientation.Landscape)
+ m = QgsLayoutItemMap(lay)
+ lay.addLayoutItem(m)
+ m.attemptMove(QgsLayoutPoint(10, 10, mm))
+ m.attemptResize(QgsLayoutSize(180, 130, mm))
+ m.setExtent(QgsRectangle(2696300, 1261200, 2698000, 1262475))
+ m.setFrameEnabled(True)
+ ov = QgsLayoutItemMap(lay)
+ lay.addLayoutItem(ov)
+ ov.attemptMove(QgsLayoutPoint(200, 10, mm))
+ ov.attemptResize(QgsLayoutSize(85, 65, mm))
+ ov.setExtent(QgsRectangle(2694000, 1259500, 2700000, 1264000))
+ ov.setFrameEnabled(True)
+ o = QgsLayoutItemMapOverview("Overview", ov)
+ ov.overviews().addOverview(o)
+ o.setLinkedMap(m)
+ o.setFrameSymbol(QgsFillSymbol.createSimple({"style": "no", "outline_color": "200,0,0,255", "outline_width": "0.6"}))
+ fmt = QgsTextFormat()
+ fmt.setFont(QFont("DejaVu Sans"))
+ fmt.setSize(9)
+ for i, style in enumerate(["Single Box", "Line Ticks Up", "stepped"]):
+ sb = QgsLayoutItemScaleBar(lay)
+ lay.addLayoutItem(sb)
+ sb.setLinkedMap(m)
+ sb.setStyle(style)
+ sb.setTextFormat(fmt)
+ sb.setUnits(Qgis.DistanceUnit.Meters)
+ sb.setUnitLabel("m")
+ sb.setNumberOfSegments(4)
+ sb.setNumberOfSegmentsLeft(0)
+ sb.setSegmentSizeMode(Qgis.ScaleBarSegmentSizeMode.FitWidth)
+ sb.setMinimumBarWidth(50)
+ sb.setMaximumBarWidth(60)
+ sb.attemptMove(QgsLayoutPoint(10 + i * 80, 150, mm))
+ sb.attemptResize(QgsLayoutSize(60, 15, mm))
+ num = QgsLayoutItemScaleBar(lay)
+ lay.addLayoutItem(num)
+ num.setLinkedMap(m)
+ num.setStyle("Numeric")
+ num.setTextFormat(fmt)
+ num.attemptMove(QgsLayoutPoint(10, 175, mm))
+ num.attemptResize(QgsLayoutSize(60, 10, mm))
+ na = QgsLayoutItemPicture(lay)
+ lay.addLayoutItem(na)
+ na.setLinkedMap(m)
+ na.setNorthMode(QgsLayoutItemPicture.NorthMode.GridNorth)
+ na.setPicturePath(":/images/north_arrows/layout_default_north_arrow.svg")
+ na.attemptMove(QgsLayoutPoint(230, 90, mm))
+ na.attemptResize(QgsLayoutSize(20, 25, mm))
+ p.layoutManager().addLayout(lay)
+ save_project(p, "layout-surrounds")
+ os.makedirs(os.path.join(OUT, "renders"), exist_ok=True)
+ settings = QgsLayoutExporter.ImageExportSettings()
+ settings.dpi = 96
+ QgsLayoutExporter(lay).exportToImage(os.path.join(OUT, "renders", "Surrounds.png"), settings)
+
+
+attempt("layout surrounds", layout_surrounds)
attempt("all styles project", all_styles)
diff --git a/crates/map/testdata/qgis/generated/qgs/layout-surrounds.qgs b/crates/map/testdata/qgis/generated/qgs/layout-surrounds.qgs
new file mode 100644
index 0000000000..6ee5eed20a
--- /dev/null
+++ b/crates/map/testdata/qgis/generated/qgs/layout-surrounds.qgs
@@ -0,0 +1,2615 @@
+
+
+
+ Surrounds
+
+
+
+
+ PROJCRS["CH1903+ / LV95",BASEGEOGCRS["CH1903+",DATUM["CH1903+",ELLIPSOID["Bessel 1841",6377397.155,299.1528128,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4150]],CONVERSION["Swiss Oblique Mercator 1995",METHOD["Hotine Oblique Mercator (variant B)",ID["EPSG",9815]],PARAMETER["Latitude of projection centre",46.9524055555556,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8811]],PARAMETER["Longitude of projection centre",7.43958333333333,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8812]],PARAMETER["Azimuth at projection centre",90,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8813]],PARAMETER["Angle from Rectified to Skew Grid",90,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8814]],PARAMETER["Scale factor at projection centre",1,SCALEUNIT["unity",1],ID["EPSG",8815]],PARAMETER["Easting at projection centre",2600000,LENGTHUNIT["metre",1],ID["EPSG",8816]],PARAMETER["Northing at projection centre",1200000,LENGTHUNIT["metre",1],ID["EPSG",8817]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Cadastre, engineering survey, topographic mapping (large and medium scale)."],AREA["Liechtenstein; Switzerland."],BBOX[45.81,5.95,47.81,10.5]],ID["EPSG",2056]]
+ +proj=somerc +lat_0=46.9524055555556 +lon_0=7.43958333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs
+ 47
+ 2056
+ EPSG:2056
+ CH1903+ / LV95
+ somerc
+ EPSG:7004
+ false
+
+
+
+
+
+
+ 0
+ 0
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+ GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],MEMBER["World Geodetic System 1984 (G2296)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]
+ +proj=longlat +datum=WGS84 +no_defs
+ 3452
+ 4326
+ EPSG:4326
+ WGS 84
+ longlat
+ EPSG:7030
+ true
+
+
+
+
+
+
+
diff --git a/docs/user-guide/workspace.md b/docs/user-guide/workspace.md
index 381e67a9c4..078df5d9ea 100644
--- a/docs/user-guide/workspace.md
+++ b/docs/user-guide/workspace.md
@@ -440,10 +440,19 @@ older QGIS 3 labels keep their font and colour too; a page keeps its paper's col
their PNG or JPEG files, or kept in the project as written (a picture kept inside a `.qgz`
isn't read, noted: save it as a file beside the project and point the item at it); rectangles
and ellipses with their fill, outline and rounded corners; and lines and polygons as straight
-lines along their edges, with arrowheads. Labels' and pictures' backgrounds and frames, a map's
+lines along their edges, with arrowheads. Scale bars, north arrows and map overviews show the
+frame of the map item they follow, on their page: a scale bar in RustGIS's nearest style (a single
+box, ticks or a stepped line), with its label placement and, within what RustGIS takes, its
+units (metres, kilometres, feet or miles; others RustGIS's choice, with its own abbreviation),
+divisions, text size and unit label, each change noted; its division values chosen anew to fit
+its box, noted; a numeric scale bar as a text printing `{scale}`, the scale
+of the layout's first map (noted when it follows another); a north arrow (QGIS's is a picture) as
+RustGIS's arrow, noted; an overview as an extent indicator in its outline's colour, its fill
+noted. One whose map
+isn't on its page is left out, noted. Labels' and pictures' backgrounds and frames, a map's
frame, hidden items and locked ones carry over. What a layout can't hold is
-noted: scale bars, legends, north arrows, tables, HTML and other items, map grids, overviews and
-the atlas, SVG pictures, groups (their items kept on their own), turned maps, shapes and pictures
+noted: legends, tables, HTML and other items, map grids and
+the atlas, SVG pictures, scale bars' subdivisions and other styles, groups (their items kept on their own), turned maps, shapes and pictures
(drawn upright), stretched or clipped pictures, a polygon's fill, a map's background colour, label
styling RustGIS's text lacks (underlines, buffers, shadows), blending, and settings set by
expressions.