Add radar and overlay layer opacity control - #682
Conversation
Radar products and other overlay layers can be faded with a slider or percent field so streets and satellite imagery show through. Map style layers stay fully opaque. Opacity is stored per layer and applied in the fragment shaders at render time. Co-authored-by: Dan Paulat <dpaulat@users.noreply.github.com>
Call Application::FinishInitialization so PlacefileManager does not block the test destructor, and compare serialized opacity as float. Co-authored-by: Dan Paulat <dpaulat@users.noreply.github.com>
|
|
||
| void MainWindowImpl::ConfigureRadarOpacityControls() | ||
| { | ||
| auto* opacityWidget = new QWidget(mapSettingsGroup_); |
There was a problem hiding this comment.
warning: initializing non-owner 'QWidget *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
)
^| void MainWindowImpl::ConfigureRadarOpacityControls() | ||
| { | ||
| auto* opacityWidget = new QWidget(mapSettingsGroup_); | ||
| auto* opacityLayout = new QHBoxLayout(opacityWidget); |
There was a problem hiding this comment.
warning: initializing non-owner 'QHBoxLayout *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
_);
^| opacityLayout->setContentsMargins(0, 0, 0, 0); | ||
|
|
||
| auto* opacityLabel = new QLabel(QObject::tr("Radar Opacity"), opacityWidget); | ||
| radarOpacitySlider_ = |
There was a problem hiding this comment.
warning: assigning newly created 'gsl::owner<>' to non-owner 'QSlider *' [cppcoreguidelines-owning-memory]
t);
^| auto* opacityLabel = new QLabel(QObject::tr("Radar Opacity"), opacityWidget); | ||
| radarOpacitySlider_ = | ||
| new QSlider(Qt::Orientation::Horizontal, opacityWidget); | ||
| radarOpacitySlider_->setRange(0, 100); |
There was a problem hiding this comment.
warning: 100 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
t);
^| new QSlider(Qt::Orientation::Horizontal, opacityWidget); | ||
| radarOpacitySlider_->setRange(0, 100); | ||
| radarOpacitySlider_->setTickPosition(QSlider::TickPosition::TicksBelow); | ||
| radarOpacitySlider_->setTickInterval(25); |
There was a problem hiding this comment.
warning: 25 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
w);
^| tr("Layer opacity. Map style layers stay opaque.")); | ||
| opacityLayout->addWidget(p->opacitySlider_); | ||
| p->opacitySpinBox_ = new QFocusedSpinBox(opacityFrame); | ||
| p->opacitySpinBox_->setRange(0, 100); |
There was a problem hiding this comment.
warning: 100 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
p->opacitySpinBox_->setRange(0, 100);
^| updatingOpacityControls_ = true; | ||
|
|
||
| const auto selectedRows = GetSelectedRows(); | ||
| int opacityPercent = 100; |
There was a problem hiding this comment.
warning: 100 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
int opacityPercent = 100;
^| int opacityPercent = 100; | ||
| bool anyEditable = false; | ||
|
|
||
| for (int row : selectedRows) |
There was a problem hiding this comment.
warning: variable 'row' of type 'int' can be declared 'const' [misc-const-correctness]
| for (int row : selectedRows) | |
| for (int const row : selectedRows) |
| opacitySpinBox_->setValue(percent); | ||
| updatingOpacityControls_ = false; | ||
|
|
||
| for (int row : GetSelectedRows()) |
There was a problem hiding this comment.
warning: variable 'row' of type 'int' can be declared 'const' [misc-const-correctness]
| for (int row : GetSelectedRows()) | |
| for (int const row : GetSelectedRows()) |
| const QStyleOptionViewItem& /* option */, | ||
| const QModelIndex& /* index */) const | ||
| { | ||
| auto* spinBox = new QFocusedSpinBox(parent); |
There was a problem hiding this comment.
warning: initializing non-owner 'QFocusedSpinBox *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
auto* spinBox = new QFocusedSpinBox(parent);
^
Fixes SCWX-168 / #168.
Radar products (BR, BV, CC, and the rest) can now be faded on the fly so satellite imagery and streets show through. Overlay layers in Layer Manager get the same control; MapLibre map styles stay fully opaque.
What changed
layers.json. Map Underlay and Map Symbology are locked at 100%.line-opacity.Testing
Unit tests (
LayerTypes.*andLayerModelOpacityTest.*) all passed:Manual GUI check on KLSX reflectivity over a satellite style: Radar Opacity 100% → 40% → 15% → 100%, streets visible through faded radar. Layer Manager shows an Opacity column, with map style layers labeled Opaque.
Radar opacity at 100%
Radar opacity at 40% with streets visible through radar
Radar opacity at 15%
Layer Manager Opacity column and slider
radar_opacity_slider_and_layer_manager.mp4
To show artifacts inline, enable in settings.
Linear Issue: SCWX-168