mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 21:20:06 +00:00
initial basic WFO base alert location method
This commit is contained in:
parent
6b4045081e
commit
bf24dac317
7 changed files with 198 additions and 140 deletions
|
|
@ -151,6 +151,7 @@ void AlertManager::Impl::HandleAlert(const types::TextEventKey& key,
|
|||
std::string alertCounty = audioSettings.alert_county().GetValue();
|
||||
auto alertRadius = units::length::kilometers<double>(
|
||||
audioSettings.alert_radius().GetValue());
|
||||
std::string alertWFO = audioSettings.alert_wfo().GetValue();
|
||||
|
||||
auto message = textEventManager_->message_list(key).at(messageIndex);
|
||||
|
||||
|
|
@ -195,6 +196,10 @@ void AlertManager::Impl::HandleAlert(const types::TextEventKey& key,
|
|||
auto fipsIds = segment->header_->ugc_.fips_ids();
|
||||
auto it = std::find(fipsIds.cbegin(), fipsIds.cend(), alertCounty);
|
||||
activeAtLocation = it != fipsIds.cend();
|
||||
} else if (locationMethod == types::LocationMethod::WFO) {
|
||||
std::string wfoId = vtec.pVtec_.office_id();
|
||||
|
||||
activeAtLocation = wfoId == alertWFO;
|
||||
}
|
||||
|
||||
if (activeAtLocation)
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public:
|
|||
alertLongitude_.SetDefault(0.0);
|
||||
alertRadius_.SetDefault(0.0);
|
||||
alertRadarSite_.SetDefault("default");
|
||||
alertWFO_.SetDefault("");
|
||||
ignoreMissingCodecs_.SetDefault(false);
|
||||
|
||||
alertLatitude_.SetMinimum(-90.0);
|
||||
|
|
@ -62,6 +63,14 @@ public:
|
|||
config::CountyDatabase::GetCountyName(value) != value;
|
||||
});
|
||||
|
||||
alertWFO_.SetValidator(
|
||||
[](const std::string& value)
|
||||
{
|
||||
return value.empty() ||
|
||||
config::CountyDatabase::GetWFOs().count(value) != 0;
|
||||
});
|
||||
|
||||
|
||||
auto& alertAudioPhenomena = types::GetAlertAudioPhenomena();
|
||||
alertEnabled_.reserve(alertAudioPhenomena.size() + 1);
|
||||
|
||||
|
|
@ -94,6 +103,7 @@ public:
|
|||
SettingsVariable<std::string> alertRadarSite_ {"alert_radar_site"};
|
||||
SettingsVariable<double> alertRadius_ {"alert_radius"};
|
||||
SettingsVariable<std::string> alertCounty_ {"alert_county"};
|
||||
SettingsVariable<std::string> alertWFO_ {"alert_wfo"};
|
||||
SettingsVariable<bool> ignoreMissingCodecs_ {"ignore_missing_codecs"};
|
||||
|
||||
std::unordered_map<awips::Phenomenon, SettingsVariable<bool>>
|
||||
|
|
@ -111,6 +121,7 @@ AudioSettings::AudioSettings() :
|
|||
&p->alertRadarSite_,
|
||||
&p->alertRadius_,
|
||||
&p->alertCounty_,
|
||||
&p->alertWFO_,
|
||||
&p->ignoreMissingCodecs_});
|
||||
RegisterVariables(p->variables_);
|
||||
SetDefaults();
|
||||
|
|
@ -157,6 +168,11 @@ SettingsVariable<std::string>& AudioSettings::alert_county() const
|
|||
return p->alertCounty_;
|
||||
}
|
||||
|
||||
SettingsVariable<std::string>& AudioSettings::alert_wfo() const
|
||||
{
|
||||
return p->alertWFO_;
|
||||
}
|
||||
|
||||
SettingsVariable<bool>&
|
||||
AudioSettings::alert_enabled(awips::Phenomenon phenomenon) const
|
||||
{
|
||||
|
|
@ -188,6 +204,7 @@ bool operator==(const AudioSettings& lhs, const AudioSettings& rhs)
|
|||
lhs.p->alertRadarSite_ == rhs.p->alertRadarSite_ &&
|
||||
lhs.p->alertRadius_ == rhs.p->alertRadius_ &&
|
||||
lhs.p->alertCounty_ == rhs.p->alertCounty_ &&
|
||||
lhs.p->alertWFO_ == rhs.p->alertWFO_ &&
|
||||
lhs.p->alertEnabled_ == rhs.p->alertEnabled_);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public:
|
|||
SettingsVariable<double>& alert_radius() const;
|
||||
SettingsVariable<std::string>& alert_radar_site() const;
|
||||
SettingsVariable<std::string>& alert_county() const;
|
||||
SettingsVariable<std::string>& alert_wfo() const;
|
||||
SettingsVariable<bool>& alert_enabled(awips::Phenomenon phenomenon) const;
|
||||
SettingsVariable<bool>& ignore_missing_codecs() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ static const std::unordered_map<LocationMethod, std::string>
|
|||
{LocationMethod::Track, "Track"},
|
||||
{LocationMethod::RadarSite, "Radar Site"},
|
||||
{LocationMethod::County, "County"},
|
||||
{LocationMethod::WFO, "WFO"},
|
||||
{LocationMethod::All, "All"},
|
||||
{LocationMethod::Unknown, "?"}};
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ enum class LocationMethod
|
|||
Track,
|
||||
RadarSite,
|
||||
County,
|
||||
WFO,
|
||||
All,
|
||||
Unknown
|
||||
};
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ public:
|
|||
&alertAudioRadarSite_,
|
||||
&alertAudioRadius_,
|
||||
&alertAudioCounty_,
|
||||
&alertAudioWFO_,
|
||||
&hoverTextWrap_,
|
||||
&tooltipMethod_,
|
||||
&placefileTextDropShadowEnabled_,
|
||||
|
|
@ -262,6 +263,7 @@ public:
|
|||
settings::SettingsInterface<std::string> alertAudioRadarSite_ {};
|
||||
settings::SettingsInterface<double> alertAudioRadius_ {};
|
||||
settings::SettingsInterface<std::string> alertAudioCounty_ {};
|
||||
settings::SettingsInterface<std::string> alertAudioWFO_ {};
|
||||
|
||||
std::unordered_map<awips::Phenomenon, settings::SettingsInterface<bool>>
|
||||
alertAudioEnabled_ {};
|
||||
|
|
@ -1194,6 +1196,16 @@ void SettingsDialogImpl::SetupAudioTab()
|
|||
alertAudioCounty_.SetSettingsVariable(audioSettings.alert_county());
|
||||
alertAudioCounty_.SetEditWidget(self_->ui->alertAudioCountyLineEdit);
|
||||
alertAudioCounty_.SetResetButton(self_->ui->resetAlertAudioCountyButton);
|
||||
|
||||
alertAudioWFO_.SetSettingsVariable(audioSettings.alert_wfo());
|
||||
for (const auto& pair : config::CountyDatabase::GetWFOs())
|
||||
{
|
||||
self_->ui->alertAudioWFOComboBox->addItem(
|
||||
QString::fromStdString(pair.first));
|
||||
}
|
||||
alertAudioWFO_.SetEditWidget(self_->ui->alertAudioWFOComboBox);
|
||||
alertAudioWFO_.SetResetButton(self_->ui->resetAlertAudioWFOButton);
|
||||
|
||||
}
|
||||
|
||||
void SettingsDialogImpl::SetupTextTab()
|
||||
|
|
|
|||
|
|
@ -136,8 +136,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>511</width>
|
||||
<height>647</height>
|
||||
<width>274</width>
|
||||
<height>691</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
|
@ -610,8 +610,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>66</width>
|
||||
<height>18</height>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
|
|
@ -691,8 +691,15 @@
|
|||
<string>Alerts</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_10">
|
||||
<item row="3" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioLongitudeButton">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>County</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioRadarSiteButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
|
|
@ -702,6 +709,71 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Location Method</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="alertAudioSoundLineEdit"/>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioLatitudeButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Longitude</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QToolButton" name="alertAudioRadarSiteSelectButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QLabel" name="alertAudioRadiusUnitsLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Latitude</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="alertAudioLatitudeSpinBox">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-90.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>90.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.000100000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="alertAudioRadiusSpinBox">
|
||||
<property name="decimals">
|
||||
|
|
@ -718,8 +790,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioLatitudeButton">
|
||||
<item row="7" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioCountyButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
|
|
@ -729,38 +801,25 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="alertAudioLocationMethodComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<item row="0" column="4">
|
||||
<widget class="QToolButton" name="alertAudioSoundTestButton">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/play-solid.svg</normaloff>:/res/icons/font-awesome-6/play-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>County</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioSoundButton">
|
||||
<item row="7" column="3">
|
||||
<widget class="QToolButton" name="alertAudioCountySelectButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QLabel" name="alertAudioRadiusUnitsLabel">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="alertAudioRadiusLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>Radius</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -780,14 +839,10 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioLocationMethodButton">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
<string>Radar Site</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -798,32 +853,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="3">
|
||||
<widget class="QToolButton" name="alertAudioCountySelectButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="alertAudioSoundLineEdit"/>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="alertAudioLatitudeSpinBox">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-90.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>90.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.000100000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QToolButton" name="alertAudioSoundStopButton">
|
||||
<property name="icon">
|
||||
|
|
@ -832,8 +861,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioRadiusButton">
|
||||
<item row="1" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioLocationMethodButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
|
|
@ -843,20 +872,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Latitude</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Sound</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QLabel" name="alertAudioCountyLabel">
|
||||
<property name="sizePolicy">
|
||||
|
|
@ -870,11 +885,25 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QToolButton" name="alertAudioSoundTestButton">
|
||||
<item row="5" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioRadiusButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/play-solid.svg</normaloff>:/res/icons/font-awesome-6/play-solid.svg</iconset>
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioSoundButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -891,66 +920,58 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Location Method</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioCountyButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="alertAudioRadiusLabel">
|
||||
<property name="text">
|
||||
<string>Radius</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Longitude</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="text">
|
||||
<string>Radar Site</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QToolButton" name="alertAudioRadarSiteSelectButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioRadarSiteButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="alertAudioRadarSiteComboBox"/>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="alertAudioLocationMethodComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioLongitudeButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Sound</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="alertAudioWFOComboBox"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="text">
|
||||
<string>WFO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="6">
|
||||
<widget class="QToolButton" name="resetAlertAudioWFOButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../scwx-qt.qrc">
|
||||
<normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</normaloff>:/res/icons/font-awesome-6/rotate-left-solid.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue