Skip to content

feat(ui): a "Flat-area detail" field in a Shaded Relief's style pane (#3143, part 3) - #3357

Merged
elpidioassinaturas merged 1 commit into
opengeos:mainfrom
elpidioassinaturas:feat/3143-flat-pane
Nov 29, 2026
Merged

elpidioassinaturas merged 1 commit into
opengeos:mainfrom
elpidioassinaturas:feat/3143-flat-pane

Conversation

@elpidioassinaturas

@elpidioassinaturas elpidioassinaturas commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Closes #3143 (part 3 of 3; parts 1 and 2 were #3315 and #3342).

The style pane's Shaded Relief settings gain Flat-area detail (0 to 1), after Terrain type. It runs raster.symbology with "flats", the setting parts 1 and 2 added. An amount above 0 turns the setting on, with the default size, and shows Flat-area size (1 to 32 cells) below it. The size is set in whole cells. Setting the amount back to 0 sends "flats": false, which turns the setting off and hides the size field.

The Shaded Relief settings with Flat-area detail 1 and Flat-area size 6 after Terrain type

The user guide describes it after Terrain type: what it brings out, the formula in words, the size, that only ground flatter than 4° changes, that it's best on a terrain model rather than a surface model, and the "flats" key.

Two doc comments of Flats (crates/map/src/raster.rs) take the reviews' wording from #3315:

  • the shift is 40 per unit of the DEM's height (a metre in a DEM in metres);
  • the neighbourhood is cut off at the grid's edges unless a whole turn wraps.

Tests

  • the_relief_pane_sets_its_flat_area_detail (ui-egui, kittest): a Shaded Relief layer's pane has no size field while the setting is off. Setting Flat-area detail to 0.7 (by accessibility, as assistive technology sets a number) turns it on at size 6 and shows the size. A size of 9.6 is stored as 10. 0 turns it off and hides the size again.

cargo fmt, clippy -D warnings (map, ui-egui) and test-hygiene pass, as do the map and ui-egui tests.

Surfaces

The field is in the desktop and browser style pane, which both draw through ui-egui. The command line, Python, the Assistant, MCP, scripts and plugins already had the "flats" key from part 2. i18n: the two labels and their hover texts fall back to English until the translation files are updated.

Size: 100 changed lines (+91 −9), about 50 of them tests.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Shaded Relief now includes a Flat-area detail control for adjusting detail on nearly level terrain. When enabled, you can also set the neighborhood size in whole cells.
  • Documentation
    • The Rasters guide explains the setting, its ranges and defaults, and how it behaves when projects are saved.

…pengeos#3143, part 3)

The style pane's Shaded Relief settings gain Flat-area detail (0 to 1),
after Terrain type; it runs raster.symbology with "flats", the setting
parts 1 and 2 added. An amount turns it on and shows Flat-area size (1 to
32 cells, whole); 0 turns it off. The user guide describes it after
Terrain type. Two doc comments of Flats say the shift is per unit of the
DEM's height and that the neighbourhood is cut off at the grid's edges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Shaded Relief pane now exposes controls for flat-area detail and size. Tests cover enabling, resizing, and disabling the setting. The guide and Flats documentation describe the setting, its limits, and neighborhood behavior.

Changes: Flat-area detail

Layer / File(s) Summary
Flat-area detail controls and behavior
crates/ui-egui/src/panes.rs, crates/map/src/raster.rs, docs/user-guide/data.md
The pane can set flat-area detail and size. Tests cover enabling, resizing, and disabling the setting. The documentation describes the setting, its limits, and how neighborhoods behave at grid edges. The Flats::shift documentation specifies height adjustments in DEM units.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related PRs

  • opengeos/RustGIS#3315: Adds the flats setting and its storage, which this pane reads and writes.
  • opengeos/RustGIS#3342: Adds flats parsing to the raster.symbology command; this pane uses the same setting and defaults.

Suggested reviewers: giswqs, mavrick-f, jgregoriorincon

Merge Risk: Minimal · up to f3adf

This adds Flat-area detail and size controls to the Shaded Relief pane, along with matching documentation. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a "Flat-area detail" field added to the Shaded Relief style pane in the UI. It matches the objectives and the panes.rs changes. It also states the part number (part 3)…
Description check Passed The description follows the template's main sections. It has a Summary that explains the change and why (part 3 of the Flat-area detail feature, linked to #3143). It has a Testing section that names t…
Linked Issues check Passed [#3143] The issue asks for an off-by-default Shaded Relief setting, raster.symbology "flats" with amount 0..1 and size in cells (default 6), plus documentation that the setting is best on a terrain mo…
Out of Scope Changes check Passed All changed areas map to #3143 requirements: crates/ui-egui/src/panes.rs (Flat-area detail and size controls and the test), crates/map/src/raster.rs (doc comments of Flats only, no declaration changes…
Full details: Title check

Explanation

The title names the main change: a "Flat-area detail" field added to the Shaded Relief style pane in the UI. It matches the objectives and the panes.rs changes. It also states the part number (part 3), which is supplementary detail. The title is short, specific, and follows the conventional feat(ui) prefix style.

Full details: Description check

Explanation

The description follows the template's main sections. It has a Summary that explains the change and why (part 3 of the Flat-area detail feature, linked to #3143). It has a Testing section that names the kittest test, the commands run, and the results. It has a UI evidence section with a screenshot of the new field. It has a Related issue reference (Closes #3143). The template's section for UI evidence says to show before and after for changes to existing UI. The description gives after-only, which is allowed for brand-new UI, so this is acceptable. The description is thorough and specific. The section headings are not in the exact template layout, since 'Summary', 'Testing', and 'Surfaces' appear, but the required information is present.

Full details: Linked Issues check

Explanation

[#3143] The issue asks for an off-by-default Shaded Relief setting, raster.symbology "flats" with amount 0..1 and size in cells (default 6), plus documentation that the setting is best on a terrain model. This PR (part 3 of 3) covers the user-facing part: (a) the style pane adds Flat-area detail (0 to 1) after Terrain type; an amount above 0 enables the setting at the default size 6 and shows Flat-area size (1 to 32 whole cells); 0 sends "flats": false and hides the size field; (b) the user guide (docs/user-guide/data.md) describes the 4° fade, size, ranges, the "flats" key and the terrain-model advice; (c) the Flats doc comments in crates/map/src/raster.rs are corrected. Test the_relief_pane_sets_its_flat_area_detail covers enabling, default size 6, whole-cell rounding (9.6 stored as 10) and disabling. The flat-ground computation and the "flats" key come from parts 1 and 2 (#3315, #3342), which this PR uses and does not re-implement. Repository reads failed in this review, so that dependency is taken from the PR description and the summary, not confirmed from source.

Full details: Out of Scope Changes check

Explanation

All changed areas map to #3143 requirements: crates/ui-egui/src/panes.rs (Flat-area detail and size controls and the test), crates/map/src/raster.rs (doc comments of Flats only, no declaration changes), and docs/user-guide/data.md (documentation of the new setting). The PR description states no change to the command line, Python, Assistant, MCP, scripts or plugins; those surfaces already had the "flats" key from part 2. The i18n fallback to English for the two labels is a limitation, not an unrelated change. No unrelated change was identified in the supplied summary. Repository diffs could not be read, so the check relies on the supplied summary and description.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit taps the sliders with a paw,
Flat ground gains detail, hills stay as they were.
The size steps up in whole cells, neat and round,
Then detail fades when set to zero.
I nibble a clover and hop across the map.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 3b094282-248b-4099-837d-c17f2090f829
Commits

Reviewing files that changed from the base of the PR and between 355f92c and f3adfab.

Files selected for processing: 3

  • crates/map/src/raster.rs
  • crates/ui-egui/src/panes.rs
  • docs/user-guide/data.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

Comment thread crates/ui-egui/src/panes.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I read the diff, the base-branch AGENTS.md, the PR metadata and the stats. prior-reviews.json has no threads, so nothing was already raised. I also read the surrounding code: Flats and shift in crates/map/src/raster.rs, relief_flats in crates/engine/src/cmd/raster.rs, the render-side FlatMeans, and the pane's Shaded Relief block. I could not build or run the tests (no shell here), so the test results below are from reading, not from running.

Bugs: none found. The two doc-comment changes match the code. The edge clipping in FlatMeans::mean and the 40-per-unit, ±80 clamp in Flats::shift are both as the new text says. The pane's amount and size arms send values the command accepts: x > 0 else false, and x.round() within the slider's 1..=32 range.

Security: none found. The change only adds UI rows that call an existing command key.

Performance: none found. The pane adds one row and rebuilds a small Vec per frame, which is negligible.

Quality:

  • Confidence: high that this is only a nit. The hover texts for the two new rows hard-code "1 to 32" and "flatter than 4°", which duplicate Flats::MAX_SIZE and Flats::SLOPE. They will go stale if those constants change. I left an inline comment on crates/ui-egui/src/panes.rs:7669. It is buffered rather than posted, because the tool needs confirmed=true and I did not want to risk a duplicate.
  • Minor, not raised: let _ = app.run(...) silently discards a refused command. The existing arms do the same, and the slider ranges make a refusal unreachable here, so I did not flag it.
  • Minor, not raised: the size row shows fractions while it is dragged (max_decimals(3)), though the stored value is rounded.

AGENTS.md: no breaks found.

  • Text is wrapped in tl!, and labels and hover texts are present.
  • No new command id or parameter key, so command-surface.txt needs no change.
  • No project save format change, so no schema update is needed.
  • The "flats" key was already in the command, its capability and its schema from earlier parts.
  • Twin check: the Shaded Relief slider list exists only in panes.rs (grep for "Terrain type" and "Aerial perspective" found no other copy), and the "flats" read routes are unchanged.

Not verified: the new kittest drives the sliders through AccessKit SetValue. I could not confirm that this path ends in the drag-settled branch the pane uses, so please check that the test passes in CI.

Change size

Compared with main (merge base f0598c8 to PR head f3adfab), the whole PR.

Measure Value
Files changed 3 (added 0, modified 3, removed 0, renamed 0)
Size before 881.3 KB
Size after 886.5 KB
Total size change +5.2 KB
Path Before After Change
crates/ui-egui/src/panes.rs 525.7 KB 529.6 KB +3.9 KB
docs/user-guide/data.md 159.7 KB 160.9 KB +1.2 KB
crates/map/src/raster.rs 195.9 KB 196.0 KB +101 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3357/
Web app https://preview.rustgis.app/pr-3357/app/
Commit f3adfab

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@elpidioassinaturas
elpidioassinaturas added this pull request to the merge queue Nov 29, 2026
Merged via the queue into opengeos:main with commit a58f28d Nov 29, 2026
28 checks passed
@elpidioassinaturas
elpidioassinaturas deleted the feat/3143-flat-pane branch November 29, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Shaded Relief: detail on flat ground (floodplains, terraces, plateaus) from each cell's height above its neighbourhood

2 participants