Skip to content

Commit

Permalink
Merge pull request #322 from dpaulat/feature/radar-smoothing
Browse files Browse the repository at this point in the history
Radar Smoothing
  • Loading branch information
dpaulat authored Dec 16, 2024
2 parents ddf53b5 + 88b1d5c commit bef8628
Show file tree
Hide file tree
Showing 27 changed files with 1,185 additions and 348 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Checks:
- 'misc-*'
- 'modernize-*'
- 'performance-*'
- '-cppcoreguidelines-pro-type-reinterpret-cast'
- '-misc-include-cleaner'
- '-misc-non-private-member-variables-in-classes'
- '-modernize-use-trailing-return-type'
Expand Down
6 changes: 3 additions & 3 deletions scwx-qt/gl/radar.frag
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ uniform float uDataMomentScale;

uniform bool uCFPEnabled;

flat in uint dataMoment;
flat in uint cfpMoment;
in float dataMoment;
in float cfpMoment;

layout (location = 0) out vec4 fragColor;

void main()
{
float texCoord = float(dataMoment - uDataMomentOffset) / uDataMomentScale;
float texCoord = (dataMoment - float(uDataMomentOffset)) / uDataMomentScale;

if (uCFPEnabled && cfpMoment > 8u)
{
Expand Down
4 changes: 2 additions & 2 deletions scwx-qt/gl/radar.vert
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ layout (location = 2) in uint aCfpMoment;
uniform mat4 uMVPMatrix;
uniform vec2 uMapScreenCoord;

flat out uint dataMoment;
flat out uint cfpMoment;
out float dataMoment;
out float cfpMoment;

vec2 latLngToScreenCoordinate(in vec2 latLng)
{
Expand Down
33 changes: 33 additions & 0 deletions scwx-qt/source/scwx/qt/main/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ MainWindow::MainWindow(QWidget* parent) :
p->mapSettingsGroup_ = new ui::CollapsibleGroup(tr("Map Settings"), this);
p->mapSettingsGroup_->GetContentsLayout()->addWidget(ui->mapStyleLabel);
p->mapSettingsGroup_->GetContentsLayout()->addWidget(ui->mapStyleComboBox);
p->mapSettingsGroup_->GetContentsLayout()->addWidget(
ui->smoothRadarDataCheckBox);
p->mapSettingsGroup_->GetContentsLayout()->addWidget(
ui->trackLocationCheckBox);
ui->radarToolboxScrollAreaContents->layout()->replaceWidget(
Expand Down Expand Up @@ -642,6 +644,11 @@ void MainWindow::on_actionDumpRadarProductRecords_triggered()
manager::RadarProductManager::DumpRecords();
}

void MainWindow::on_actionRadarWireframe_triggered(bool checked)
{
p->activeMap_->SetRadarWireframeEnabled(checked);
}

void MainWindow::on_actionUserManual_triggered()
{
QDesktopServices::openUrl(QUrl {"https://supercell-wx.readthedocs.io/"});
Expand Down Expand Up @@ -1085,6 +1092,25 @@ void MainWindowImpl::ConnectOtherSignals()
}
}
});
connect(
mainWindow_->ui->smoothRadarDataCheckBox,
&QCheckBox::checkStateChanged,
mainWindow_,
[this](Qt::CheckState state)
{
const bool smoothingEnabled = (state == Qt::CheckState::Checked);

auto it = std::find(maps_.cbegin(), maps_.cend(), activeMap_);
if (it != maps_.cend())
{
const std::size_t i = std::distance(maps_.cbegin(), it);
settings::MapSettings::Instance().smoothing_enabled(i).StageValue(
smoothingEnabled);
}

// Turn on smoothing
activeMap_->SetSmoothingEnabled(smoothingEnabled);
});
connect(mainWindow_->ui->trackLocationCheckBox,
&QCheckBox::checkStateChanged,
mainWindow_,
Expand Down Expand Up @@ -1471,6 +1497,13 @@ void MainWindowImpl::UpdateRadarProductSettings()
{
level2SettingsGroup_->setVisible(false);
}

mainWindow_->ui->smoothRadarDataCheckBox->setCheckState(
activeMap_->GetSmoothingEnabled() ? Qt::CheckState::Checked :
Qt::CheckState::Unchecked);

mainWindow_->ui->actionRadarWireframe->setChecked(
activeMap_->GetRadarWireframeEnabled());
}

void MainWindowImpl::UpdateRadarSite()
Expand Down
3 changes: 2 additions & 1 deletion scwx-qt/source/scwx/qt/main/main_window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class MainWindow : public QMainWindow
void keyPressEvent(QKeyEvent* ev) override final;
void keyReleaseEvent(QKeyEvent* ev) override final;
void showEvent(QShowEvent* event) override;
void closeEvent(QCloseEvent *event) override;
void closeEvent(QCloseEvent* event) override;

signals:
void ActiveMapMoved(double latitude, double longitude);
Expand All @@ -49,6 +49,7 @@ private slots:
void on_actionImGuiDebug_triggered();
void on_actionDumpLayerList_triggered();
void on_actionDumpRadarProductRecords_triggered();
void on_actionRadarWireframe_triggered(bool checked);
void on_actionUserManual_triggered();
void on_actionDiscord_triggered();
void on_actionGitHubRepository_triggered();
Expand Down
21 changes: 19 additions & 2 deletions scwx-qt/source/scwx/qt/main/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
<addaction name="separator"/>
<addaction name="actionDumpLayerList"/>
<addaction name="actionDumpRadarProductRecords"/>
<addaction name="separator"/>
<addaction name="actionRadarWireframe"/>
</widget>
<widget class="QMenu" name="menuTools">
<property name="title">
Expand Down Expand Up @@ -153,8 +155,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>205</width>
<height>701</height>
<width>190</width>
<height>680</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
Expand Down Expand Up @@ -329,6 +331,13 @@
<item>
<widget class="QComboBox" name="mapStyleComboBox"/>
</item>
<item>
<widget class="QCheckBox" name="smoothRadarDataCheckBox">
<property name="text">
<string>Smooth Radar Data</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="trackLocationCheckBox">
<property name="text">
Expand Down Expand Up @@ -497,6 +506,14 @@
<string>Location &amp;Marker Manager</string>
</property>
</action>
<action name="actionRadarWireframe">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Radar &amp;Wireframe</string>
</property>
</action>
</widget>
<resources>
<include location="../../../../scwx-qt.qrc"/>
Expand Down
Loading

0 comments on commit bef8628

Please sign in to comment.