mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:30:05 +00:00
Enable/disable auto update of radar data based on timeline selection
This commit is contained in:
parent
80f04be510
commit
4963add9cc
8 changed files with 129 additions and 39 deletions
|
|
@ -706,6 +706,20 @@ void MainWindowImpl::ConnectAnimationSignals()
|
||||||
&manager::TimelineManager::AnimationStateUpdated,
|
&manager::TimelineManager::AnimationStateUpdated,
|
||||||
animationDockWidget_,
|
animationDockWidget_,
|
||||||
&ui::AnimationDockWidget::UpdateAnimationState);
|
&ui::AnimationDockWidget::UpdateAnimationState);
|
||||||
|
|
||||||
|
connect(timelineManager_.get(),
|
||||||
|
&manager::TimelineManager::LiveStateUpdated,
|
||||||
|
animationDockWidget_,
|
||||||
|
&ui::AnimationDockWidget::UpdateLiveState);
|
||||||
|
connect(timelineManager_.get(),
|
||||||
|
&manager::TimelineManager::LiveStateUpdated,
|
||||||
|
[this](bool isLive)
|
||||||
|
{
|
||||||
|
for (auto map : maps_)
|
||||||
|
{
|
||||||
|
map->SetAutoUpdate(isLive);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindowImpl::ConnectOtherSignals()
|
void MainWindowImpl::ConnectOtherSignals()
|
||||||
|
|
|
||||||
|
|
@ -366,6 +366,7 @@ void TimelineManager::Impl::SelectTime(
|
||||||
|
|
||||||
logger_->debug("Time updated: Live");
|
logger_->debug("Time updated: Live");
|
||||||
|
|
||||||
|
emit self_->LiveStateUpdated(true);
|
||||||
emit self_->VolumeTimeUpdated(selectedTime);
|
emit self_->VolumeTimeUpdated(selectedTime);
|
||||||
emit self_->SelectedTimeUpdated(selectedTime);
|
emit self_->SelectedTimeUpdated(selectedTime);
|
||||||
|
|
||||||
|
|
@ -391,6 +392,9 @@ void TimelineManager::Impl::SelectTime(
|
||||||
auto elementPtr =
|
auto elementPtr =
|
||||||
util::GetBoundedElementPointer(volumeTimes, selectedTime);
|
util::GetBoundedElementPointer(volumeTimes, selectedTime);
|
||||||
|
|
||||||
|
// The timeline is no longer live
|
||||||
|
emit self_->LiveStateUpdated(false);
|
||||||
|
|
||||||
if (elementPtr != nullptr)
|
if (elementPtr != nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -469,6 +473,13 @@ void TimelineManager::Impl::Step(Direction direction)
|
||||||
adjustedTime_);
|
adjustedTime_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (it == volumeTimes.cend())
|
||||||
|
{
|
||||||
|
// Should not get here, but protect against an error
|
||||||
|
logger_->error("No suitable volume time found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (direction == Direction::Back)
|
if (direction == Direction::Back)
|
||||||
{
|
{
|
||||||
// Only if we aren't at the beginning of the volume times set
|
// Only if we aren't at the beginning of the volume times set
|
||||||
|
|
@ -481,6 +492,7 @@ void TimelineManager::Impl::Step(Direction direction)
|
||||||
logger_->debug("Volume time updated: {}",
|
logger_->debug("Volume time updated: {}",
|
||||||
scwx::util::TimeString(adjustedTime_));
|
scwx::util::TimeString(adjustedTime_));
|
||||||
|
|
||||||
|
emit self_->LiveStateUpdated(false);
|
||||||
emit self_->VolumeTimeUpdated(adjustedTime_);
|
emit self_->VolumeTimeUpdated(adjustedTime_);
|
||||||
emit self_->SelectedTimeUpdated(adjustedTime_);
|
emit self_->SelectedTimeUpdated(adjustedTime_);
|
||||||
}
|
}
|
||||||
|
|
@ -497,6 +509,7 @@ void TimelineManager::Impl::Step(Direction direction)
|
||||||
logger_->debug("Volume time updated: {}",
|
logger_->debug("Volume time updated: {}",
|
||||||
scwx::util::TimeString(adjustedTime_));
|
scwx::util::TimeString(adjustedTime_));
|
||||||
|
|
||||||
|
emit self_->LiveStateUpdated(false);
|
||||||
emit self_->VolumeTimeUpdated(adjustedTime_);
|
emit self_->VolumeTimeUpdated(adjustedTime_);
|
||||||
emit self_->SelectedTimeUpdated(adjustedTime_);
|
emit self_->SelectedTimeUpdated(adjustedTime_);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ signals:
|
||||||
void VolumeTimeUpdated(std::chrono::system_clock::time_point dateTime);
|
void VolumeTimeUpdated(std::chrono::system_clock::time_point dateTime);
|
||||||
|
|
||||||
void AnimationStateUpdated(types::AnimationState state);
|
void AnimationStateUpdated(types::AnimationState state);
|
||||||
|
void LiveStateUpdated(bool isLive);
|
||||||
void ViewTypeUpdated(types::MapTime viewType);
|
void ViewTypeUpdated(types::MapTime viewType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ public:
|
||||||
overlayLayer_ {nullptr},
|
overlayLayer_ {nullptr},
|
||||||
colorTableLayer_ {nullptr},
|
colorTableLayer_ {nullptr},
|
||||||
autoRefreshEnabled_ {true},
|
autoRefreshEnabled_ {true},
|
||||||
|
autoUpdateEnabled_ {true},
|
||||||
selectedLevel2Product_ {common::Level2Product::Unknown},
|
selectedLevel2Product_ {common::Level2Product::Unknown},
|
||||||
lastPos_(),
|
lastPos_(),
|
||||||
currentStyleIndex_ {0},
|
currentStyleIndex_ {0},
|
||||||
|
|
@ -146,6 +147,7 @@ public:
|
||||||
std::shared_ptr<ColorTableLayer> colorTableLayer_;
|
std::shared_ptr<ColorTableLayer> colorTableLayer_;
|
||||||
|
|
||||||
bool autoRefreshEnabled_;
|
bool autoRefreshEnabled_;
|
||||||
|
bool autoUpdateEnabled_;
|
||||||
|
|
||||||
common::Level2Product selectedLevel2Product_;
|
common::Level2Product selectedLevel2Product_;
|
||||||
|
|
||||||
|
|
@ -520,6 +522,11 @@ void MapWidget::SetAutoRefresh(bool enabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MapWidget::SetAutoUpdate(bool enabled)
|
||||||
|
{
|
||||||
|
p->autoUpdateEnabled_ = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
void MapWidget::SetMapLocation(double latitude,
|
void MapWidget::SetMapLocation(double latitude,
|
||||||
double longitude,
|
double longitude,
|
||||||
bool updateRadarSite)
|
bool updateRadarSite)
|
||||||
|
|
@ -869,7 +876,7 @@ void MapWidgetImpl::RadarProductManagerConnect()
|
||||||
const std::string& product,
|
const std::string& product,
|
||||||
std::chrono::system_clock::time_point latestTime)
|
std::chrono::system_clock::time_point latestTime)
|
||||||
{
|
{
|
||||||
if (autoRefreshEnabled_ &&
|
if (autoUpdateEnabled_ &&
|
||||||
context_->radar_product_group() == group &&
|
context_->radar_product_group() == group &&
|
||||||
(group == common::RadarProductGroup::Level2 ||
|
(group == common::RadarProductGroup::Level2 ||
|
||||||
context_->radar_product() == product))
|
context_->radar_product() == product))
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ public:
|
||||||
|
|
||||||
void SetActive(bool isActive);
|
void SetActive(bool isActive);
|
||||||
void SetAutoRefresh(bool enabled);
|
void SetAutoRefresh(bool enabled);
|
||||||
|
void SetAutoUpdate(bool enabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the current map location.
|
* @brief Sets the current map location.
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,22 @@ void AnimationDockWidget::UpdateAnimationState(types::AnimationState state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AnimationDockWidget::UpdateLiveState(bool isLive)
|
||||||
|
{
|
||||||
|
static const QString prefix = tr("Auto Update");
|
||||||
|
static const QString disabled = tr("Disabled");
|
||||||
|
static const QString enabled = tr("Enabled");
|
||||||
|
|
||||||
|
if (isLive)
|
||||||
|
{
|
||||||
|
ui->autoUpdateLabel->setText(QString("%1: %2").arg(prefix).arg(enabled));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->autoUpdateLabel->setText(QString("%1: %2").arg(prefix).arg(disabled));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void UpdateAnimationState(types::AnimationState state);
|
void UpdateAnimationState(types::AnimationState state);
|
||||||
|
void UpdateLiveState(bool isLive);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ViewTypeChanged(types::MapTime viewType);
|
void ViewTypeChanged(types::MapTime viewType);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,13 @@
|
||||||
<string>Timeline</string>
|
<string>Timeline</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="autoUpdateLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto Update: Enabled</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="liveViewRadioButton">
|
<widget class="QRadioButton" name="liveViewRadioButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
@ -103,17 +110,41 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
<widget class="QFrame" name="frame_3">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="loopTimeLabel">
|
<widget class="QLabel" name="loopTimeLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Loop Time (Minutes)</string>
|
<string>Loop Time</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<widget class="QSpinBox" name="loopTimeSpinBox">
|
<widget class="QSpinBox" name="loopTimeSpinBox">
|
||||||
<property name="correctionMode">
|
<property name="correctionMode">
|
||||||
<enum>QAbstractSpinBox::CorrectToNearestValue</enum>
|
<enum>QAbstractSpinBox::CorrectToNearestValue</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string> min</string>
|
||||||
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -125,18 +156,21 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="loopSpeedLabel">
|
<widget class="QLabel" name="loopSpeedLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Loop Speed</string>
|
<string>Loop Speed</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="1">
|
||||||
<widget class="QDoubleSpinBox" name="loopSpeedSpinBox">
|
<widget class="QDoubleSpinBox" name="loopSpeedSpinBox">
|
||||||
<property name="correctionMode">
|
<property name="correctionMode">
|
||||||
<enum>QAbstractSpinBox::CorrectToNearestValue</enum>
|
<enum>QAbstractSpinBox::CorrectToNearestValue</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string>x</string>
|
||||||
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -145,6 +179,9 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="frame_2">
|
<widget class="QFrame" name="frame_2">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue