camp#142: per-layer colormap range override (PR1 — backend + numeric UI)#147
Merged
Conversation
PR1: range-override backend via marine_colormap::RangeModel + numeric context-menu UI + persist/restore across all three raster layer types
Part of #142 (PR1). Add an operator-settable colormap range to each of the three raster layers so an outlier band (e.g. backscatter max 925, mean 0.16) no longer collapses the useful colour range under auto-scaling. Each of GggsTileLayer, SonarLiveCacheLayer and RasterLayer now owns a marine_colormap::RangeModel. renderImage() feeds range_model_.lo()/hi() into the shared RasterGlRenderer's u_min/u_max instead of the raw data_min_/ data_max_. In Auto mode the model tracks the folded data extents (update_auto() after each auto-range fold: tilesReady / foldAutoRange / imageReady); in Manual mode it returns the operator override, untouched by incoming data. The override is applied at render time and is transparent to the auto-range accumulation (camp#138 coordination noted at each update_auto call site). Public API per layer: setRangeOverride(lo, hi) -> Manual + persist + re-render, resetRangeToAuto() -> Auto, rangeMode()/rangeLo()/rangeHi() accessors. A "Colormap range" context submenu ("Set range..." two QInputDialog prompts pre-filled with the current range; "Reset to auto") is gated on scalar, the same condition as the colormap submenu. Range mode + bounds persist per layer (range_mode / range_min / range_max) under each layer's existing settings group — settingsKey() for the two tile layers, itemID() for RasterLayer. Because a marine_colormap type now appears in camp_map's public headers, link marine_colormap PUBLIC on camp_map (was PRIVATE under camp#141) so the include dir + symbols propagate to consumers (camp_map_ros, the executable, tests). GL-free tests in test/test_range_persist.cpp cover all three layers: default Auto, setRangeOverride -> Manual + lo/hi, Manual persist/restore round-trip, Auto persist/restore, reset -> Auto. Uncertainty-band auto-default is deferred to camp#145 (needs band semantics, camp#104); PR1 delivers only the mechanism. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Three minor review findings from the local review-code pass: - Restore only honors a Manual range when both extents are present, not just when range_mode=="manual" — a partial/corrupt settings entry falls back to Auto rather than snapping to the [0,1] read-defaults (gggs_tile_layer, raster_layer, sonar_live_cache_layer). - Raise the "Set range…" QInputDialog decimals 4 -> 6 so a pre-filled range (e.g. -73.2153 dB) is not quantized when re-opened. - *AutoRoundTrips tests now assert the restored extents (0,1 default), not just rangeMode()==Auto, locking in that an Auto round-trip never pins a manual override. 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
PR1 of 2 for #142 — the backend + numeric UI for a per-layer colormap
range override. Lets an operator pin a manual colormap range when an outlier
skews the auto-range (the motivating case: backscatter band 2 with
Max=925 / Mean=0.16 collapses the auto colormap).
This is Part of #142; the issue stays open until PR2 lands the interactive
marine_colormap_widgets::ColormapLegendWidget(draggable colorbar).What it does
marine_colormap::RangeModel range_model_(Auto/Manual) toGggsTileLayer,RasterLayer, andSonarLiveCacheLayer; renders fromrange_model_.lo()/hi()and folds auto extents viaupdate_auto()(a no-opwhile Manual, so outliers can't re-widen a pinned range).
setRangeOverride(lo, hi),resetRangeToAuto(),rangeMode().prompts, pre-filled with the current resolved range) + Reset to auto.
Scalar layers only.
range_mode/range_min/range_maxper layer (under the key eachlayer's read/writeSettings already use —
settingsKey()for GGGS/live,itemID()for raster).test/test_range_persist.cppcovering all three layers(default → override → reset, and manual/auto persistence round-trips).
Review fixes folded in (local review-code, 0 must-fix)
range_mode=="manual"— a partial/corrupt entry falls back to Auto ratherthan snapping to the
[0,1]read-defaults.-73.2153dB)isn't quantized on re-open.
*AutoRoundTripstests now assert the restored extents, not just the mode.Test
Host build clean; 151 tests, 0 errors, 0 failures, 1 skipped
(container can't build camp's lower-layer deps; host-verified).
Authored-By:
Claude Code AgentModel:
Claude Opus 4.8