Merge pull request #407 from AdenKoperczak/radar_self_center_setting

Map centering on radar site selection setting
This commit is contained in:
Dan Paulat 2025-04-05 06:40:24 -05:00 committed by GitHub
commit 430ff9e984
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 39 additions and 10 deletions

View file

@ -1265,11 +1265,16 @@ void MapWidgetImpl::AddLayer(types::LayerType type,
case types::InformationLayer::RadarSite:
radarSiteLayer_ = std::make_shared<RadarSiteLayer>(context_);
AddLayer(layerName, radarSiteLayer_, before);
connect(radarSiteLayer_.get(),
&RadarSiteLayer::RadarSiteSelected,
this,
[this](const std::string& id)
{ widget_->RadarSiteRequested(id); });
connect(
radarSiteLayer_.get(),
&RadarSiteLayer::RadarSiteSelected,
this,
[this](const std::string& id)
{
auto& generalSettings = settings::GeneralSettings::Instance();
widget_->RadarSiteRequested(
id, generalSettings.center_on_radar_selection().GetValue());
});
break;
// Create the location marker layer

View file

@ -47,6 +47,7 @@ public:
// SetDefault, SetMinimum, and SetMaximum are descriptive
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
antiAliasingEnabled_.SetDefault(true);
centerOnRadarSelection_.SetDefault(false);
clockFormat_.SetDefault(defaultClockFormatValue);
customStyleDrawLayer_.SetDefault(".*\\.annotations\\.points");
debugEnabled_.SetDefault(false);
@ -148,7 +149,8 @@ public:
Impl(const Impl&&) = delete;
Impl& operator=(const Impl&&) = delete;
SettingsVariable<bool> antiAliasingEnabled_ {"anti_aliasing_enabled"};
SettingsVariable<bool> antiAliasingEnabled_ {"anti_aliasing_enabled"};
SettingsVariable<bool> centerOnRadarSelection_ {"center_on_radar_selection"};
SettingsVariable<std::string> clockFormat_ {"clock_format"};
SettingsVariable<std::string> customStyleDrawLayer_ {
"custom_style_draw_layer"};
@ -189,6 +191,7 @@ GeneralSettings::GeneralSettings() :
SettingsCategory("general"), p(std::make_unique<Impl>())
{
RegisterVariables({&p->antiAliasingEnabled_,
&p->centerOnRadarSelection_,
&p->clockFormat_,
&p->customStyleDrawLayer_,
&p->customStyleUrl_,
@ -233,6 +236,11 @@ SettingsVariable<bool>& GeneralSettings::anti_aliasing_enabled() const
return p->antiAliasingEnabled_;
}
SettingsVariable<bool>& GeneralSettings::center_on_radar_selection() const
{
return p->centerOnRadarSelection_;
}
SettingsVariable<std::string>& GeneralSettings::clock_format() const
{
return p->clockFormat_;
@ -413,6 +421,7 @@ GeneralSettings& GeneralSettings::Instance()
bool operator==(const GeneralSettings& lhs, const GeneralSettings& rhs)
{
return (lhs.p->antiAliasingEnabled_ == rhs.p->antiAliasingEnabled_ &&
lhs.p->centerOnRadarSelection_ == rhs.p->centerOnRadarSelection_ &&
lhs.p->clockFormat_ == rhs.p->clockFormat_ &&
lhs.p->customStyleDrawLayer_ == rhs.p->customStyleDrawLayer_ &&
lhs.p->customStyleUrl_ == rhs.p->customStyleUrl_ &&

View file

@ -21,7 +21,8 @@ public:
GeneralSettings(GeneralSettings&&) noexcept;
GeneralSettings& operator=(GeneralSettings&&) noexcept;
[[nodiscard]] SettingsVariable<bool>& anti_aliasing_enabled() const;
[[nodiscard]] SettingsVariable<bool>& anti_aliasing_enabled() const;
[[nodiscard]] SettingsVariable<bool>& center_on_radar_selection() const;
[[nodiscard]] SettingsVariable<std::string>& clock_format() const;
[[nodiscard]] SettingsVariable<std::string>& custom_style_draw_layer() const;
[[nodiscard]] SettingsVariable<std::string>& custom_style_url() const;

View file

@ -139,6 +139,7 @@ public:
&warningsProvider_,
&radarSiteThreshold_,
&antiAliasingEnabled_,
&centerOnRadarSelection_,
&showMapAttribution_,
&showMapCenter_,
&showMapLogo_,
@ -258,6 +259,7 @@ public:
settings::SettingsInterface<std::string> warningsProvider_ {};
settings::SettingsInterface<double> radarSiteThreshold_ {};
settings::SettingsInterface<bool> antiAliasingEnabled_ {};
settings::SettingsInterface<bool> centerOnRadarSelection_ {};
settings::SettingsInterface<bool> showMapAttribution_ {};
settings::SettingsInterface<bool> showMapCenter_ {};
settings::SettingsInterface<bool> showMapLogo_ {};
@ -813,6 +815,11 @@ void SettingsDialogImpl::SetupGeneralTab()
generalSettings.anti_aliasing_enabled());
antiAliasingEnabled_.SetEditWidget(self_->ui->antiAliasingEnabledCheckBox);
centerOnRadarSelection_.SetSettingsVariable(
generalSettings.center_on_radar_selection());
centerOnRadarSelection_.SetEditWidget(
self_->ui->centerOnRadarSelectionCheckBox);
showMapAttribution_.SetSettingsVariable(
generalSettings.show_map_attribution());
showMapAttribution_.SetEditWidget(self_->ui->showMapAttributionCheckBox);

View file

@ -135,9 +135,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-260</y>
<y>-412</y>
<width>511</width>
<height>812</height>
<height>841</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -625,6 +625,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="centerOnRadarSelectionCheckBox">
<property name="text">
<string>Center Map on Radar Selection</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cursorIconAlwaysOnCheckBox">
<property name="acceptDrops">

@ -1 +1 @@
Subproject commit 1f3e1259130a5eb4a6df37d721fe6c8301213e7e
Subproject commit 6a76030a4c3864cb387033d10ce3de88b292828d