diff --git a/crates/ui-egui/src/publicationwizard/map.rs b/crates/ui-egui/src/publicationwizard/map.rs index 7b9c3fc77d..e0710155fe 100644 --- a/crates/ui-egui/src/publicationwizard/map.rs +++ b/crates/ui-egui/src/publicationwizard/map.rs @@ -1,6 +1,7 @@ //! The wizard's map step. use super::*; use crate::dialogs::MapOwner; +use rustgis_engine::cmd::workspace::view_extent; use rustgis_engine::map::Layer; /// Which area the map frame shows. @@ -14,6 +15,9 @@ pub enum Area { Layer { map: MapOwner, layer: u64 }, /// The selected features of the map it was picked in. Selection { map: MapOwner }, + /// The coordinates typed ([`Draft::coords`]), whichever flat map is active; a map on the globe + /// takes none. + Coordinates, } /// The name `layout.publication` gives when none is: data, not translated. @@ -28,11 +32,13 @@ enum Held<'a> { View, Layer(&'a Layer), Selection, + /// West, south, east and north. + Coordinates([f64; 4]), } /// What `area` names now, or why it no longer holds: the one check the step, the review and Create /// share, so a stale pick reads the same in the three. It reads no places, as it runs every frame. -fn held<'a>(s: &'a Session, area: &Area) -> Result, &'static str> { +fn held<'a>(s: &'a Session, area: &Area, coords: Option<[f64; 4]>) -> Result, &'static str> { let map = s.map(); match area { Area::View => Ok(Held::View), @@ -47,9 +53,54 @@ fn held<'a>(s: &'a Session, area: &Area) -> Result, &'static str> { .ok_or_else(|| tl!("The layer picked is no longer in the map: pick the map extent again.")), Area::Selection { .. } if map.selection_count() == 0 => Err(tl!("Nothing is selected: pick the map extent again.")), Area::Selection { .. } => Ok(Held::Selection), + Area::Coordinates if map.projection.is_globe() => Err(on_globe()), + // What `layout.publication` asks of an `extent`; the fields keep it to the Earth. + Area::Coordinates => coords + .filter(|[w, s, e, n]| w < e && s < n) + .map(Held::Coordinates) + .ok_or_else(|| tl!("West must be less than East, and South less than North.")), } } +fn on_globe() -> &'static str { + tl!("A map on the globe takes no coordinates: pick another map extent.") +} + +/// What the coordinate fields start on: the view, rounded outward to the five decimals they show; +/// the whole Earth where the view has nothing to frame. +fn from_view(s: &Session) -> [f64; 4] { + let [w, so, e, n] = framed(view_extent(s)).unwrap_or([-180.0, -90.0, 180.0, 90.0]); + let down = |v: f64| (v * 1e5).floor() / 1e5; + let up = |v: f64| (v * 1e5).ceil() / 1e5; + [down(w).max(-180.0), down(so).max(-90.0), up(e).min(180.0), up(n).min(90.0)] +} + +/// The four fields of the coordinates, written to the draft as they change: no command runs, so a +/// value holds even when Next is pressed while it is being typed. +fn coordinate_fields(ui: &mut egui::Ui, coords: &mut [f64; 4]) { + egui::Grid::new("publication_wizard_coordinates").num_columns(2).spacing(egui::vec2(8.0, 4.0)).show(ui, |ui| { + for (text, at, most) in [(tl!("West"), 0, 180.0), (tl!("East"), 2, 180.0), (tl!("South"), 1, 90.0), (tl!("North"), 3, 90.0)] { + let label = ui.label(text); + if let Some(v) = coords.get_mut(at) { + // A decimal comma too, which egui's own parser reads as no number, and a degree sign + // pasted with the value. Finite numbers only: the range would take NaN as a limit. + let field = egui::DragValue::new(v).range(-most..=most).speed(0.01).max_decimals(5).custom_parser(|t| { + t.trim() + .trim_end_matches('°') + .trim_end() + .replace(',', ".") + .replace('\u{2212}', "-") + .parse::() + .ok() + .filter(|v| v.is_finite()) + }); + ui.add(field).labelled_by(label.id); + } + ui.end_row(); + } + }); +} + /// The map step: the area the map frame shows and the layout's name. pub(super) fn map_step(ui: &mut egui::Ui, s: &Session, d: &mut Draft) { let map = s.map(); @@ -66,9 +117,9 @@ pub(super) fn map_step(ui: &mut egui::Ui, s: &Session, d: &mut Draft) { ui.end_row(); ui.label(""); // A pick that no longer holds marks nothing. - let held = held(s, &d.area); + let marked = held(s, &d.area, d.coords); ui.horizontal(|ui| { - let picked = match held { + let picked = match marked { Ok(Held::Layer(l)) => Some(l), _ => None, }; @@ -97,7 +148,7 @@ pub(super) fn map_step(ui: &mut egui::Ui, s: &Session, d: &mut Draft) { }); ui.end_row(); ui.label(""); - let selection = egui::RadioButton::new(matches!(held, Ok(Held::Selection)), tl!("Selection")); + let selection = egui::RadioButton::new(matches!(marked, Ok(Held::Selection)), tl!("Selection")); if ui .add_enabled(map.selection_count() > 0, selection) .on_hover_text(tl!("The selected features.")) @@ -107,6 +158,29 @@ pub(super) fn map_step(ui: &mut egui::Ui, s: &Session, d: &mut Draft) { d.area = Area::Selection { map: MapOwner::of(s) }; } ui.end_row(); + ui.label(""); + let coordinates = egui::RadioButton::new(d.area == Area::Coordinates, tl!("Coordinates")); + if ui + .add_enabled(!map.projection.is_globe(), coordinates) + .on_hover_text(tl!("An area typed as longitude and latitude (WGS 84), in decimal degrees.")) + .on_disabled_hover_text(on_globe()) + .clicked() + { + d.area = Area::Coordinates; + } + ui.end_row(); + if d.area == Area::Coordinates { + ui.label(""); + ui.vertical(|ui| { + coordinate_fields(ui, d.coords.get_or_insert_with(|| from_view(s))); + // Read after the fields: this frame's pick and values, not the ones it began with. + if let Err(why) = held(s, &d.area, d.coords) { + ui.set_max_width(field_width(ui)); + ui.add(egui::Label::new(egui::RichText::new(why).color(ui.visuals().warn_fg_color)).wrap()); + } + }); + ui.end_row(); + } let label = ui.label(tl!("Name")); ui.add(egui::TextEdit::singleline(&mut d.name).hint_text(DEFAULT_NAME).desired_width(field_width(ui))).labelled_by(label.id); ui.end_row(); @@ -125,11 +199,18 @@ pub(super) fn name_label(s: &Session, name: &str) -> String { } /// How the review names the area. -pub(super) fn area_label(s: &Session, area: &Area) -> String { - match held(s, area) { +pub(super) fn area_label(s: &Session, area: &Area, coords: Option<[f64; 4]>) -> String { + match held(s, area, coords) { Ok(Held::View) => tl!("The view").to_string(), Ok(Held::Layer(l)) => i18n::fmt("Layer: {layer}", &[("layer", &l.name)]), Ok(Held::Selection) => tl!("Selected features").to_string(), + Ok(Held::Coordinates([w, so, e, n])) => { + let [w, so, e, n] = [w, so, e, n].map(|v| v.to_string()); + i18n::fmt( + "West {west}, South {south}, East {east}, North {north}", + &[("west", &w), ("south", &so), ("east", &e), ("north", &n)], + ) + } Err(_) => tl!("(none)").to_string(), } } @@ -152,9 +233,11 @@ fn framed(e: Extent) -> Option<[f64; 4]> { /// The `extent` to send for `area`, none for the view; a pick that no longer holds is an error /// rather than another area framed. Read once, at Create, on the UI thread where /// `layout.publication` runs next: it may walk the whole layer, or the whole selection. -pub(super) fn area_extent(s: &Session, area: &Area) -> Result, String> { - let extent = match held(s, area)? { +pub(super) fn area_extent(s: &Session, area: &Area, coords: Option<[f64; 4]>) -> Result, String> { + let extent = match held(s, area, coords)? { Held::View => return Ok(None), + // As typed: checked by `held`, so neither widened nor cut. + Held::Coordinates(typed) => return Ok(Some(typed)), Held::Layer(l) => l.shown_extent(), Held::Selection => s.map().selection_extent(), }; @@ -168,6 +251,7 @@ mod tests { use egui::accesskit::Role; use egui_kittest::kittest::{NodeT, Queryable}; use rustgis_engine::data::{Dataset, GeometryType}; + use rustgis_engine::geom::{Coord, lonlat_to_merc}; fn close(got: Option<[f64; 4]>, want: [f64; 4]) { let got = got.expect("an extent"); @@ -193,17 +277,17 @@ mod tests { fn each_area_sends_its_own_extent() { let mut app = app(); let map = MapOwner::of(&app.session); - assert_eq!(area_extent(&app.session, &Area::View), Ok(None)); + assert_eq!(area_extent(&app.session, &Area::View, None), Ok(None)); app.run("layer.definitionQuery", json!({"layer": "Cities", "where": "pop_max > 10000000"})).unwrap(); let (id, shown, all) = { let l = app.session.map().layers.iter().find(|l| l.name == "Cities").unwrap(); (l.instance_id(), l.shown_extent(), l.extent()) }; assert_ne!(shown, all, "the query narrows it"); - assert_eq!(area_extent(&app.session, &Area::Layer { map: map.clone(), layer: id }), Ok(framed(shown))); + assert_eq!(area_extent(&app.session, &Area::Layer { map: map.clone(), layer: id }, None), Ok(framed(shown))); app.run("select.byAttributes", json!({"layer": "Cities", "where": "name = 'Tokyo'"})).unwrap(); let selected = app.session.map().selection_extent(); - let got = area_extent(&app.session, &Area::Selection { map }).unwrap(); + let got = area_extent(&app.session, &Area::Selection { map }, None).unwrap(); assert_eq!(got, framed(selected)); assert!(got.is_some_and(|[w, s, e, n]| w < e && s < n), "one point, framed: {got:?}"); } @@ -286,8 +370,8 @@ mod tests { h.run_steps(4); let state = h.state(); let area = state.dialogs.publication.as_ref().unwrap().area.clone(); - assert_eq!(area_label(&state.session, &area), "Layer: No places"); - assert_eq!(area_extent(&state.session, &area), Err("There is nothing to frame there: pick another map extent.".to_string())); + assert_eq!(area_label(&state.session, &area, None), "Layer: No places"); + assert_eq!(area_extent(&state.session, &area, None), Err("There is nothing to frame there: pick another map extent.".to_string())); } /// A pick that no longer holds reads the same everywhere: no choice marked on the step, @@ -329,8 +413,8 @@ mod tests { let map = MapOwner::of(&app.session); let area = if layer { Area::Layer { map, layer: app.session.map().layers[0].instance_id() } } else { Area::Selection { map } }; change(&mut app); - assert_eq!(area_label(&app.session, &area), "(none)", "{case}"); - assert_eq!(area_extent(&app.session, &area), Err(why.to_string()), "{case}"); + assert_eq!(area_label(&app.session, &area, None), "(none)", "{case}"); + assert_eq!(area_extent(&app.session, &area, None), Err(why.to_string()), "{case}"); open(&mut app); let d = app.dialogs.publication.as_mut().unwrap(); (d.area, d.step) = (area, Step::Map); @@ -412,4 +496,260 @@ mod tests { d.size = "figure-1col".into(); assert_eq!(d.params(), json!({"profile": "figure-1col", "name": "Rivers"})); } + + type Wizard = egui_kittest::Harness<'static, RustGisApp>; + + const ORDER: &str = "West must be less than East, and South less than North."; + const ON_GLOBE: &str = "A map on the globe takes no coordinates: pick another map extent."; + + /// The map step, drawn at `size`. + fn map_wizard(prepare: impl FnOnce(&mut RustGisApp), size: egui::Vec2) -> Wizard { + let mut app = app(); + open(&mut app); + app.dialogs.publication.as_mut().unwrap().step = Step::Map; + prepare(&mut app); + harness_sized(app, size) + } + + fn step_harness() -> Wizard { + map_wizard(|_| {}, egui::vec2(1400.0, 1000.0)) + } + + fn pick(h: &mut Wizard, radio: &str) { + h.get_by_role_and_label(Role::RadioButton, radio).click(); + h.run_steps(4); + } + + fn draft(h: &Wizard) -> &Draft { + h.state().dialogs.publication.as_ref().expect("the wizard is open") + } + + fn sent(h: &Wizard) -> Result, String> { + area_extent(&h.state().session, &draft(h).area, draft(h).coords) + } + + fn type_into(h: &mut Wizard, field: &str, text: &str) { + h.get_by_role_and_label(Role::SpinButton, field).click(); + h.run_steps(4); + h.event(egui::Event::Text(text.into())); + h.run_steps(4); + } + + /// Coordinates picked the first time holds the view, rounded outward to five decimals; what + /// it holds then stays as the view moves and as another choice is tried. + #[test] + fn coordinates_start_on_the_view_and_keep_what_they_hold() { + let mut h = step_harness(); + assert!(h.query_by_role(Role::SpinButton).is_none() && draft(&h).coords.is_none()); + let view = framed(view_extent(&h.state().session)).unwrap(); + pick(&mut h, "Coordinates"); + assert_eq!(draft(&h).area, Area::Coordinates); + let held = draft(&h).coords.expect("filled from the view"); + assert!(held[0] <= view[0] && held[1] <= view[1] && held[2] >= view[2] && held[3] >= view[3], "{held:?} {view:?}"); + assert!(held.iter().zip(view).all(|(a, b)| (a - b).abs() <= 1e-5), "{held:?} {view:?}"); + assert!(held.iter().all(|v| ((v * 1e5).round() - v * 1e5).abs() < 1e-6), "five decimals: {held:?}"); + for field in ["West", "East", "South", "North"] { + h.get_by_role_and_label(Role::SpinButton, field); + } + assert_eq!(sent(&h), Ok(Some(held))); + h.state_mut().session.map_mut().camera.center.x += 1_000_000.0; + h.run_steps(4); + assert_eq!(draft(&h).coords, Some(held), "the view moved"); + pick(&mut h, "View"); + assert!(h.query_by_role(Role::SpinButton).is_none()); + assert_eq!(sent(&h), Ok(None)); + pick(&mut h, "Coordinates"); + assert_eq!(draft(&h).coords, Some(held)); + } + + /// A view over ±180° is cut there, as `layout.publication` cuts the view. + #[test] + fn a_view_over_the_antimeridian_is_cut_at_180() { + let mut h = map_wizard( + |a| { + let m = a.session.map_mut(); + m.camera.center = lonlat_to_merc(Coord::new(180.0, 0.0)); + }, + egui::vec2(1400.0, 1000.0), + ); + let view = framed(view_extent(&h.state().session)).unwrap(); + pick(&mut h, "Coordinates"); + let [w, _, e, _] = draft(&h).coords.unwrap(); + assert_eq!(e, 180.0); + assert!(w > 0.0 && (w - view[0]).abs() <= 1e-5, "{w} {view:?}"); + } + + /// A value typed, with a decimal comma too, holds without Enter, cut to ±180 and ±90. + #[test] + fn a_typed_value_holds_without_enter_and_is_cut_to_the_earth() { + for (field, at, text, want) in + [("West", 0, "-40,5°", -40.5), ("East", 2, "200", 180.0), ("South", 1, "-95", -90.0), ("North", 3, "12.25", 12.25)] + { + let mut h = step_harness(); + pick(&mut h, "Coordinates"); + type_into(&mut h, field, text); + click(&mut h, "Next"); + assert_eq!(draft(&h).coords.unwrap()[at], want, "{field}: {text}"); + } + } + + /// What reads as no finite number leaves the field as it was. + #[test] + fn a_value_that_is_no_finite_number_leaves_the_field() { + for text in ["NaN", "inf", "-infinity"] { + let mut h = step_harness(); + pick(&mut h, "Coordinates"); + let before = draft(&h).coords; + type_into(&mut h, "West", text); + click(&mut h, "Next"); + assert_eq!(draft(&h).coords, before, "{text}"); + } + } + + /// A short drag over a field moves it by hundredths, not degrees. + #[test] + fn a_short_drag_moves_a_field_by_hundredths() { + let mut h = step_harness(); + pick(&mut h, "Coordinates"); + let before = draft(&h).coords.unwrap()[0]; + let at = h.get_by_role_and_label(Role::SpinButton, "West").rect().center(); + let to = at + egui::vec2(10.0, 0.0); + h.drag_at(at); + h.run_steps(2); + h.hover_at(to); + h.run_steps(2); + h.drop_at(to); + h.run_steps(4); + let moved = (draft(&h).coords.unwrap()[0] - before).abs(); + assert!(moved > 0.0 && moved <= 0.1 + 1e-9, "moved {moved}°"); + } + + /// Coordinates out of order are said on the step, read "(none)" in the review, and Create says + /// why and makes nothing; the choice stays marked, its fields shown. + #[test] + fn coordinates_out_of_order_are_said_and_make_nothing() { + for bad in [[10.0, 0.0, 10.0, 5.0], [11.0, 0.0, 10.0, 5.0], [0.0, 5.0, 10.0, 5.0], [0.0, 6.0, 10.0, 5.0]] { + let mut h = map_wizard( + |a| { + let d = a.dialogs.publication.as_mut().unwrap(); + (d.area, d.coords) = (Area::Coordinates, Some(bad)); + }, + egui::vec2(1400.0, 1000.0), + ); + assert!(h.query_by_label(ORDER).is_some(), "{bad:?}"); + assert_eq!(h.query_all_by_role(Role::SpinButton).count(), 4, "{bad:?}"); + let marked = h.get_by_role_and_label(Role::RadioButton, "Coordinates").accesskit_node().toggled(); + assert_eq!(marked, Some(egui::accesskit::Toggled::True), "{bad:?}"); + assert_eq!(area_label(&h.state().session, &draft(&h).area, draft(&h).coords), "(none)"); + assert_eq!(sent(&h), Err(ORDER.to_string())); + h.state_mut().dialogs.publication.as_mut().unwrap().step = Step::Review; + h.run_steps(4); + let before = h.state().session.project.layouts.len(); + click(&mut h, "Create"); + assert_eq!(h.state().session.project.layouts.len(), before, "{bad:?}"); + assert_eq!(h.state().dialogs.open, Some("publicationWizard")); + } + } + + /// Coordinates picked over a pick that no longer holds never shows that pick's reason under + /// the fields, not even in the frame of the click. + #[test] + fn picking_coordinates_shows_no_reason_of_the_pick_before() { + let mut h = step_harness(); + // Shown once before, so no first-show pass hides the frame of the click. + pick(&mut h, "Coordinates"); + let map = MapOwner::of(&h.state().session); + h.state_mut().dialogs.publication.as_mut().unwrap().area = Area::Layer { map, layer: u64::MAX }; + h.run_steps(4); + h.get_by_role_and_label(Role::RadioButton, "Coordinates").click(); + h.step(); + assert_eq!(draft(&h).area, Area::Coordinates); + assert!(h.query_by_label("The layer picked is no longer in the map: pick the map extent again.").is_none()); + } + + /// Typed coordinates name no map or layer: they hold through another map, a rename, a layer + /// removed and a selection cleared, and the review shows them. + #[test] + fn coordinates_hold_whatever_changes_in_the_session() { + let mut app = app(); + let coords = Some([-10.5, -20.0, 30.0, 40.25]); + for (command, params) in [ + ("map.rename", json!({"name": "Renamed"})), + ("select.byAttributes", json!({"layer": "Cities", "where": "name = 'Tokyo'"})), + ("select.clear", Value::Null), + ("layer.remove", json!({"layer": "Cities"})), + ("map.new", json!({})), + ] { + app.run(command, params).unwrap(); + assert_eq!(area_extent(&app.session, &Area::Coordinates, coords), Ok(coords), "{command}"); + } + assert_eq!(area_label(&app.session, &Area::Coordinates, coords), "West -10.5, South -20, East 30, North 40.25"); + } + + /// On the globe the choice is off; one picked before no longer holds, and is said. + #[test] + fn a_map_on_the_globe_takes_no_coordinates() { + let globe = |a: &mut RustGisApp| a.session.map_mut().projection = rustgis_engine::map::Projection::Globe; + let h = map_wizard(globe, egui::vec2(1400.0, 1000.0)); + assert!(h.get_by_role_and_label(Role::RadioButton, "Coordinates").accesskit_node().is_disabled()); + let h = map_wizard( + |a| { + globe(a); + let d = a.dialogs.publication.as_mut().unwrap(); + (d.area, d.coords) = (Area::Coordinates, Some([0.0, 0.0, 1.0, 1.0])); + }, + egui::vec2(1400.0, 1000.0), + ); + assert!(h.query_by_label(ON_GLOBE).is_some()); + assert_eq!(sent(&h), Err(ON_GLOBE.to_string())); + assert_eq!(area_label(&h.state().session, &draft(&h).area, draft(&h).coords), "(none)"); + } + + /// Create frames the typed area, for a sheet and a figure, the whole world on Mercator too. + #[test] + fn create_frames_the_typed_area() { + for (size, coords) in + [("a4", [100.0, 10.0, 120.0, 30.0]), ("figure-1col", [100.0, 10.0, 120.0, 30.0]), ("a4", [-180.0, -90.0, 180.0, 90.0])] + { + let mut app = app(); + open(&mut app); + let d = app.dialogs.publication.as_mut().unwrap(); + d.size = size.into(); + (d.area, d.coords, d.step) = (Area::Coordinates, Some(coords), Step::Review); + let before = app.session.project.layouts.len(); + let mut h = harness(app); + click(&mut h, "Create"); + let layouts = &h.state().session.project.layouts; + assert_eq!(layouts.len(), before + 1, "{size} {coords:?}"); + let center = layouts.last().unwrap().elements.iter().find_map(|el| match &el.kind { + rustgis_engine::map::layout::ElementKind::MapFrame { center, .. } if el.name == "Map Frame" => Some(*center), + _ => None, + }); + let c = center.expect("the map frame"); + let [w, s, e, n] = coords; + assert!(c.x >= w && c.x <= e && c.y >= s && c.y <= n, "{size}: {c:?}"); + } + } + + /// The fields stay inside the window at its smallest. + #[test] + fn the_coordinate_fields_stay_in_the_window() { + let mut h = map_wizard(|_| {}, egui::vec2(420.0, 600.0)); + pick(&mut h, "Coordinates"); + for field in ["West", "East", "South", "North"] { + let right = h.get_by_role_and_label(Role::SpinButton, field).rect().right(); + assert!(right <= 420.0, "{field} runs to {right}"); + } + } + + /// Opened again after Cancel, the wizard is back on the view with no coordinates. + #[test] + fn cancel_forgets_the_coordinates() { + let mut h = step_harness(); + pick(&mut h, "Coordinates"); + click(&mut h, "Cancel"); + open(h.state_mut()); + let d = draft(&h); + assert!(d.area == Area::View && d.coords.is_none()); + } } diff --git a/crates/ui-egui/src/publicationwizard/mod.rs b/crates/ui-egui/src/publicationwizard/mod.rs index e7654e3eb4..58f9b85bff 100644 --- a/crates/ui-egui/src/publicationwizard/mod.rs +++ b/crates/ui-egui/src/publicationwizard/mod.rs @@ -110,6 +110,9 @@ pub struct Draft { pub size: String, pub orientation: Orientation, pub area: Area, + /// West, south, east and north as typed for [`Area::Coordinates`], filled from the view when + /// it is first picked and kept while another choice is. + pub coords: Option<[f64; 4]>, /// The layout's name; empty leaves it to the command. pub name: String, pub style: String, @@ -165,6 +168,7 @@ impl Draft { size: "a4".into(), orientation: Orientation::Auto, area: Area::View, + coords: None, name: String::new(), style: "classic".into(), title: s.map().name.clone(), @@ -626,7 +630,7 @@ pub fn show(app: &mut RustGisApp, ctx: &egui::Context) { // A layout the command refuses is said (a map with no extent), and the wizard stays. if create { let held = d.arrangement.held(&app.session).map_err(String::from); - match held.and_then(|_| area_extent(&app.session, &d.area)) { + match held.and_then(|_| area_extent(&app.session, &d.area, d.coords)) { Ok(extent) => { let mut params = d.sent(&app.session); if let Some(extent) = extent { diff --git a/crates/ui-egui/src/publicationwizard/review.rs b/crates/ui-egui/src/publicationwizard/review.rs index 5963605b17..9609f3671c 100644 --- a/crates/ui-egui/src/publicationwizard/review.rs +++ b/crates/ui-egui/src/publicationwizard/review.rs @@ -15,7 +15,7 @@ pub(super) fn review_step(ui: &mut egui::Ui, s: &Session, d: &Draft) { ui.end_row(); }; row(tl!("Size"), size_label(&d.size)); - row(tl!("Map extent"), area_label(s, &d.area)); + row(tl!("Map extent"), area_label(s, &d.area, d.coords)); row(tl!("Name"), name_label(s, &d.name)); if d.figure() { row(tl!("Elements"), elements_value(s, d)); diff --git a/docs/user-guide/layouts.md b/docs/user-guide/layouts.md index de182fb8f0..75c7bf45b7 100644 --- a/docs/user-guide/layouts.md +++ b/docs/user-guide/layouts.md @@ -58,7 +58,13 @@ Layouts open as tabs next to the maps; while one is open, its groups lead the Pu line is widened to 0.01°, and what lies past ±180° or ±90° is left out of the frame; an area with nothing to frame, one gone by Create, or one picked before the map or the project was switched or the map renamed, is said and nothing is made); without a name the layout is - `Publication`; the review says when a layout has that name, so the new one is numbered. The + `Publication`; the review says when a layout has that name, so the new one is numbered. It can + also be **Coordinates**: West, East, South and North as longitude and latitude (WGS 84) + in decimal degrees, whatever the map's projection, filled from the view + when first picked, West less than East and South less than North. They are asked as the sheet + is made (the frame's properties don't take them afterwards, and what the sheet derives from + the area stays as made); an area crossing ±180° isn't taken (a view that crosses it is cut + there, as with View), and the choice is off for a map on the globe. The **elements** are what is drawn around the map: the locator (the default, named as what it will be, a globe, an inset, both or none), the north arrow (auto, always or none) and its style, the legend or not and its title, the colorbar, the scale bar with its units and style, and the frame