Skip to content

camp#142: interactive colorbar dialog from the layer context menu (PR2 — closes #142)#151

Merged
rolker merged 1 commit into
jazzyfrom
feature/issue-142
Jun 30, 2026
Merged

camp#142: interactive colorbar dialog from the layer context menu (PR2 — closes #142)#151
rolker merged 1 commit into
jazzyfrom
feature/issue-142

Conversation

@rolker

@rolker rolker commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

PR2 of 2 for #142 — the interactive colorbar, completing the
operator-overridable colormap range. Replaces PR1's two sequential
QInputDialog prompts with a "Colormap range…" dialog opened from each scalar
layer's context menu (ADR-0009).

Closes #142.

What it does

  • New raster/colormap_range_dialog.{h,cpp}
    (camp::raster::showColormapRangeDialog) — a modal dialog hosting
    marine_colormap_widgets::ColormapLegendWidget (drag the min/max handles) plus
    min/max spin boxes for precise entry, kept in sync with the bar. Edits fire
    live so the map re-renders while the dialog is open.
  • Wired into GggsTileLayer, RasterLayer, and SonarLiveCacheLayer — one
    shared helper, so the three menus stay DRY (the duplicated numeric-prompt
    lambdas from PR1 are gone).
  • Seeds the bar from a ColormapRangeState snapshot (palette index, data extents
    as the colorbar domain, current mode/lo/hi). An existing Manual override is
    displayed via ColormapLegendWidget::setManual — the slot added in
    marine_colormap#10 specifically so a consumer can open on a persisted override.
  • rangeChanged fires for both a manual pin and an auto fold; the dialog
    disambiguates on mode()setRangeOverride vs resetRangeToAuto.
  • Build wiring: find_package(marine_colormap_widgets) + <depend> +
    link PRIVATE to camp_map (used only in the .cpp; the public header
    forward-declares QWidget).

Design

ADR-0009 records the placement decision (modal context-menu dialog vs docked
panel vs map overlay) and the seed/dispatch contract.

Testing

Host build clean; 151 tests, 0 errors, 0 failures, 1 skipped (container can't
build camp's lower-layer deps; host-verified).

The dialog is thin Qt glue over already-tested components — the widget's
setManual/drag/reset/rangeChanged (marine_colormap gtest) and the layers'
setRangeOverride/resetRangeToAuto/persistence (PR1 test_range_persist). The
modal exec() event loop makes the glue itself impractical to unit-test
headlessly, so it's validated by manual exercise (as the #108 band picker was).

Manual check: launch the worktree build → Stores tab → open a scalar
store (e.g. processed backscatter, or ~/data/stores/bathymetry/chart) → Add
to map
Layers tab → right-click → Colormap range… → drag the handles
or type bounds; the map recolours live. Reset to auto returns to data-driven.

Possible follow-up (non-blocking): each drag-move calls writeSettings()
(via setRangeOverride); QSettings caches in memory so it's cheap, but a debounce
or persist-on-close could trim the churn.

The uncertainty-band default (quality palette + [0, threshold] on open) stays
a separate follow-up (needs #104 band semantics).


Authored-By: Claude Code Agent
Model: Claude Opus 4.8

Replaces PR1's two sequential numeric prompts with an interactive
"Colormap range…" dialog opened from each scalar layer's context menu
(ADR-0009). The dialog hosts marine_colormap_widgets::ColormapLegendWidget
(drag the min/max handles) plus min/max spin boxes (precise entry, kept in
sync with the bar). Edits fire live so the map re-renders while open.

Implemented once in raster/colormap_range_dialog.{h,cpp}
(camp::raster::showColormapRangeDialog) and called from GggsTileLayer,
RasterLayer, and SonarLiveCacheLayer, so the wiring is not duplicated.

- Seeds the bar from a ColormapRangeState snapshot (palette, data extents
  as domain, current mode/lo/hi). An existing Manual override is shown via
  the new ColormapLegendWidget::setManual (marine_colormap#10).
- rangeChanged fires for both a manual pin and an auto fold; the dialog
  disambiguates on mode() -> setRangeOverride vs resetRangeToAuto.
- Links marine_colormap_widgets PRIVATE (used only in the .cpp; the public
  header forward-declares QWidget). package.xml + find_package wired.

The dialog is thin Qt glue over already-tested components (the widget's
setManual/drag/reset/rangeChanged in marine_colormap; the layers'
setRangeOverride/resetRangeToAuto/persistence in PR1 test_range_persist);
modal exec() makes the glue impractical to unit-test headlessly, so it is
validated by manual exercise (as #108 was). ADR-0009 records this.

Closes #142.

Host build clean; 151 tests, 0 failures, 1 skipped.
Copilot AI review requested due to automatic review settings June 30, 2026 01:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rolker rolker merged commit b544668 into jazzy Jun 30, 2026
1 check failed
@rolker rolker deleted the feature/issue-142 branch June 30, 2026 01:24
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.

Operator-overridable colormap range (auto-range default; manual min/max to tame outliers)

2 participants