camp#142: interactive colorbar dialog from the layer context menu (PR2 — closes #142)#151
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR2 of 2 for #142 — the interactive colorbar, completing the
operator-overridable colormap range. Replaces PR1's two sequential
QInputDialogprompts with a "Colormap range…" dialog opened from each scalarlayer's context menu (ADR-0009).
Closes #142.
What it does
raster/colormap_range_dialog.{h,cpp}(
camp::raster::showColormapRangeDialog) — a modal dialog hostingmarine_colormap_widgets::ColormapLegendWidget(drag the min/max handles) plusmin/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.
GggsTileLayer,RasterLayer, andSonarLiveCacheLayer— oneshared helper, so the three menus stay DRY (the duplicated numeric-prompt
lambdas from PR1 are gone).
ColormapRangeStatesnapshot (palette index, data extentsas the colorbar domain, current mode/lo/hi). An existing Manual override is
displayed via
ColormapLegendWidget::setManual— the slot added inmarine_colormap#10 specifically so a consumer can open on a persisted override.
rangeChangedfires for both a manual pin and an auto fold; the dialogdisambiguates on
mode()→setRangeOverridevsresetRangeToAuto.find_package(marine_colormap_widgets)+<depend>+link PRIVATE to
camp_map(used only in the.cpp; the public headerforward-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 (PR1test_range_persist). Themodal
exec()event loop makes the glue itself impractical to unit-testheadlessly, 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) → Addto 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 debounceor persist-on-close could trim the churn.
The uncertainty-band default (
qualitypalette +[0, threshold]on open) staysa separate follow-up (needs #104 band semantics).
Authored-By:
Claude Code AgentModel:
Claude Opus 4.8