From 0f351d181ed0c9e9d2813203c3b8c195b4b57459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Gregorio=20Rinc=C3=B3n?= Date: Mon, 30 Nov 2026 04:42:11 -0500 Subject: [PATCH 1/5] feat(layout): choose a colorbar's label size and decimals --- crates/engine/src/cmd/layout.rs | 24 +-- crates/engine/src/cmd/layout/chart.rs | 23 ++- crates/engine/src/cmd/layout/elements.rs | 8 +- .../engine/src/cmd/layout/publication/mod.rs | 2 + crates/engine/src/cmd/layout/text.rs | 2 +- crates/engine/src/cmd/layout/update.rs | 27 +-- crates/engine/src/project.rs | 1 + crates/engine/src/project_capabilities.rs | 67 ++++++++ crates/engine/src/tests.rs | 9 +- crates/engine/src/tests/layout_colorbar.rs | 142 ++++++++++++++++ crates/map/src/layout.rs | 8 + crates/map/src/layout/colorbar.rs | 3 + crates/map/src/layout/elements.rs | 21 ++- crates/map/src/layout/scale_bar.rs | 4 +- crates/map/src/layout/text.rs | 11 ++ crates/render/src/layout.rs | 8 +- crates/render/src/layout/colorbar.rs | 40 +++-- crates/render/src/layout/losses.rs | 4 +- crates/render/src/layout/scale_bar.rs | 25 ++- crates/render/src/layout/tests.rs | 158 ++++++++++++++++-- .../ui-egui/src/layoutview/format/colorbar.rs | 18 +- crates/ui-egui/src/layoutview/tests.rs | 46 +++++ docs/maintaining.md | 7 + docs/user-guide/layouts.md | 6 +- schema/fixtures/layout_colorbar_labels.rgis | 1 + schema/project.schema.json | 2 + 26 files changed, 592 insertions(+), 75 deletions(-) create mode 100644 crates/engine/src/tests/layout_colorbar.rs create mode 100644 schema/fixtures/layout_colorbar_labels.rgis diff --git a/crates/engine/src/cmd/layout.rs b/crates/engine/src/cmd/layout.rs index fcf3484f75..3bb1b5151d 100644 --- a/crates/engine/src/cmd/layout.rs +++ b/crates/engine/src/cmd/layout.rs @@ -7,14 +7,14 @@ use std::sync::LazyLock; use rustgis_geom::{Coord, Extent}; use rustgis_map::layout::{ - Arrange, ArrowStyle, Background, CHART_BAR, CHART_BARS, CHART_OUTLINE, ChartOrder, ChartOutline, ClassLabels, CoordFormat, ElementKind, - ExtentIndicator, FeatureCounts, FontFamily, FrameShape, GRID_LABEL_PT, Grid, GridEdges, GridKind, GridStyle, Guides, LAYOUT_TEXT_SIZE, - LINE_SPACING, LayerNames, Layout, LegendFit, LegendSizes, LineDir, LineHead, MAX_CHART_BARS, MAX_CHART_DECIMALS, - MAX_CHART_OUTLINE_WIDTH, MAX_COLORBAR_TICKS, MAX_GRID_WIDTH, MAX_GUIDES, MAX_LEGEND_COLUMNS, MAX_LEGEND_LABEL_CHARS, MAX_LEGEND_LABELS, - MAX_LINE_SPACING, MAX_SCALE_BEFORE_ZERO, MAX_SCALE_DECIMALS, MAX_SCALE_DIVISIONS, MAX_SCALE_SUBDIVISIONS, MAX_SECTIONS, MAX_TICK_MM, - MAX_UNIT_LABEL_CHARS, MIN_ELEMENT_MM, MIN_LINE_SPACING, MapSeries, Orientation, PAGES, SCALE_BAR_TEXT_PT, ScaleBarFit, ScaleBarStyle, - ScaleLabelPosition, ScaleUnits, Section, SectionLine, TABLE_TEXT_PT, TextAlign, TextCase, TextVAlign, TickSide, UnitLabelPosition, - fit_scale, line_angle, line_at_angle, line_length, + Arrange, ArrowStyle, Background, CHART_BAR, CHART_BARS, CHART_OUTLINE, COLORBAR_TEXT_PT, ChartOrder, ChartOutline, ClassLabels, + CoordFormat, ElementKind, ExtentIndicator, FeatureCounts, FontFamily, FrameShape, GRID_LABEL_PT, Grid, GridEdges, GridKind, GridStyle, + Guides, LAYOUT_TEXT_SIZE, LINE_SPACING, LayerNames, Layout, LegendFit, LegendSizes, LineDir, LineHead, MAX_CHART_BARS, + MAX_CHART_DECIMALS, MAX_CHART_OUTLINE_WIDTH, MAX_COLORBAR_DECIMALS, MAX_COLORBAR_TICKS, MAX_GRID_WIDTH, MAX_GUIDES, MAX_LEGEND_COLUMNS, + MAX_LEGEND_LABEL_CHARS, MAX_LEGEND_LABELS, MAX_LINE_SPACING, MAX_SCALE_BEFORE_ZERO, MAX_SCALE_DECIMALS, MAX_SCALE_DIVISIONS, + MAX_SCALE_SUBDIVISIONS, MAX_SECTIONS, MAX_TICK_MM, MAX_UNIT_LABEL_CHARS, MIN_ELEMENT_MM, MIN_LINE_SPACING, MapSeries, Orientation, + PAGES, SCALE_BAR_TEXT_PT, ScaleBarFit, ScaleBarStyle, ScaleLabelPosition, ScaleUnits, Section, SectionLine, TABLE_TEXT_PT, TextAlign, + TextCase, TextVAlign, TickSide, UnitLabelPosition, fit_scale, line_angle, line_at_angle, line_length, }; use rustgis_map::report::StatKind; use rustgis_map::symbology::{Dash, MAX_DASH_STEP, MAX_DASH_STEPS}; @@ -218,7 +218,7 @@ pub fn commands() -> Vec { r##""exclude"?: [layer names] (legend: layers it leaves out though the map draws them), "##, r##""layerOrder"?: [layer names] (legend: these layers first, in this order, the others after them as the map draws them; the map is not changed), "##, r##""columns"?: 1..6 (legend: the columns its rows are laid in; default 1; with a fit that adds columns, the fewest it starts from), "##, - r##""textSize"?: points, 4 to 100 (legend: its layers' names and classes' labels, its title, rows, swatches and gaps following in proportion and a point symbol keeping the size the map draws it at; default 9; scaleBar: its labels, the room over the bar and between them following, the bar keeping its size; default 8; table: its text, its rows and columns following; default 8; refused outside that range, and for other kinds unless null, as showNoData is), "##, + r##""textSize"?: points, 4 to 100 (legend: its layers' names and classes' labels, its title, rows, swatches and gaps following in proportion and a point symbol keeping the size the map draws it at; default 9; scaleBar: its labels, the room over the bar and between them following, the bar keeping its size; default 8; table: its text, its rows and columns following; default 8; colorbar: its labels, the bar making room for them; default 8; refused outside that range, and for other kinds unless null, as showNoData is), "##, r##""classLabels"?: {"": {"": ""}} (legend: its own text for a class, by the label the layer shows for it, up to 200 characters; the layer keeps its label; a layer or class it can't find is refused), "##, r##""sizes"?: "rows" (default) | "nested" (legend: a point layer's rows of marker sizes drawn as one block, the markers one inside another on a common base, each led to its value; refused for other kinds), "##, r##""showCounts"?: bool (legend: each class row, and a one-symbol layer's row, ends in the number of features the layer's filters keep; default false; none for rasters, web layers, size and diagram rows, layers read in place other than from a local Shapefile, GeoPackage, FlatGeobuf or GeoParquet (each of those is read whole to count), or Unique Values by an expression over too many features and classes; refused for other kinds), "##, @@ -247,7 +247,7 @@ pub fn commands() -> Vec { r##""other"?: bool (chart: the bars past "bars" gathered in a last Other bar, its statistic over their features, their sum when not grouped, last whatever the order; default false: left out, which a warning says, as it says features with no number left out), "##, r##""stack"?: a field (chart, grouped by another field, summing or counting: each bar split by this field's values, a stretch per value in the key over the bars, the values its bars show by their total, largest first (A to Z when ordered by category), past 8 values 7 and a grey Other, which a warning counts; in the palette diagrams take, or with classes in the colour each value's features share on the map, a value with several keeping its palette colour, which a warning counts; values written are the bar's total; default none), "##, r##""values"?: bool (chart: each bar's value written past its end, its thousands apart with commas; default false), "##, - r##""decimals"?: "auto" (the default: a chart's values up to 2, the zeros they end in dropped; a scale bar's labels each the decimals it needs, as before)|0..6 (chart: its values' decimals)|0..3 (scaleBar: its labels' decimals, fixed, with the thousands set apart), "##, + r##""decimals"?: "auto" (the default: a chart's values up to 2, the zeros they end in dropped; a scale bar's labels each the decimals it needs, as before)|0..6 (chart: its values' decimals)|0..3 (scaleBar: its labels' decimals, fixed, with the thousands set apart)|0..6 (colorbar: its labels' decimals, fixed, with the thousands set apart; "auto", its default, shortens classes' and values' labels), "##, r##""barColor"?: "#RRGGBB"|"#RRGGBBAA" (chart: its bars' colour, default #3B82C4), "##, r##""classes"?: bool (chart: each bar in the colour its features have on the map, by the layer's symbology classes: a bar per feature its feature's, a grouped bar the colour its features share; a bar whose features have several, which a warning counts, and an Other bar keep barColor; default false), "##, r##""labelAlign"?: "left" (the default)|"right" (chart: bars running across have their labels at the left of their column, or at its right against the bars), "##, @@ -336,7 +336,7 @@ pub fn commands() -> Vec { r##""labels"?: {"": "