mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 08:00:06 +00:00
Renaming PhenomenonInfo to ImpactBasedWarningInfo
This commit is contained in:
parent
829d8a3152
commit
38a2831779
3 changed files with 31 additions and 26 deletions
|
|
@ -178,7 +178,8 @@ QWidget* AlertPaletteSettingsWidget::Impl::CreateStackedWidgetPage(
|
|||
QGridLayout* gridLayout = new QGridLayout(self_);
|
||||
page->setLayout(gridLayout);
|
||||
|
||||
const auto& phenomenonInfo = awips::GetPhenomenonInfo(phenomenon);
|
||||
const auto& impactBasedWarningInfo =
|
||||
awips::GetImpactBasedWarningInfo(phenomenon);
|
||||
|
||||
int row = 0;
|
||||
|
||||
|
|
@ -187,17 +188,17 @@ QWidget* AlertPaletteSettingsWidget::Impl::CreateStackedWidgetPage(
|
|||
|
||||
AddPhenomenonLine("Active", gridLayout, row++);
|
||||
|
||||
if (phenomenonInfo.hasObservedTag_)
|
||||
if (impactBasedWarningInfo.hasObservedTag_)
|
||||
{
|
||||
AddPhenomenonLine("Observed", gridLayout, row++);
|
||||
}
|
||||
|
||||
if (phenomenonInfo.hasTornadoPossibleTag_)
|
||||
if (impactBasedWarningInfo.hasTornadoPossibleTag_)
|
||||
{
|
||||
AddPhenomenonLine("Tornado Possible", gridLayout, row++);
|
||||
}
|
||||
|
||||
for (auto& category : phenomenonInfo.threatCategories_)
|
||||
for (auto& category : impactBasedWarningInfo.threatCategories_)
|
||||
{
|
||||
if (category == awips::ThreatCategory::Base)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@ enum class ThreatCategory : int
|
|||
Unknown
|
||||
};
|
||||
|
||||
struct PhenomenonInfo
|
||||
struct ImpactBasedWarningInfo
|
||||
{
|
||||
bool hasObservedTag_ {false};
|
||||
bool hasTornadoPossibleTag_ {false};
|
||||
std::vector<ThreatCategory> threatCategories_ {ThreatCategory::Base};
|
||||
};
|
||||
|
||||
const PhenomenonInfo& GetPhenomenonInfo(Phenomenon phenomenon);
|
||||
const ImpactBasedWarningInfo& GetImpactBasedWarningInfo(Phenomenon phenomenon);
|
||||
|
||||
ThreatCategory GetThreatCategory(const std::string& name);
|
||||
const std::string& GetThreatCategoryName(ThreatCategory threatCategory);
|
||||
|
|
|
|||
|
|
@ -13,25 +13,29 @@ namespace awips
|
|||
|
||||
static const std::string logPrefix_ = "scwx::awips::impact_based_warnings";
|
||||
|
||||
static const boost::unordered_flat_map<Phenomenon, PhenomenonInfo>
|
||||
phenomenaInfo_ {
|
||||
{Phenomenon::Marine, PhenomenonInfo {.hasTornadoPossibleTag_ {true}}},
|
||||
static const boost::unordered_flat_map<Phenomenon, ImpactBasedWarningInfo>
|
||||
impactBasedWarningInfo_ {
|
||||
{Phenomenon::Marine,
|
||||
ImpactBasedWarningInfo {.hasTornadoPossibleTag_ {true}}},
|
||||
{Phenomenon::FlashFlood,
|
||||
PhenomenonInfo {.threatCategories_ {ThreatCategory::Base,
|
||||
ThreatCategory::Considerable,
|
||||
ThreatCategory::Catastrophic}}},
|
||||
ImpactBasedWarningInfo {
|
||||
.threatCategories_ {ThreatCategory::Base,
|
||||
ThreatCategory::Considerable,
|
||||
ThreatCategory::Catastrophic}}},
|
||||
{Phenomenon::SevereThunderstorm,
|
||||
PhenomenonInfo {.hasTornadoPossibleTag_ {true},
|
||||
.threatCategories_ {ThreatCategory::Base,
|
||||
ThreatCategory::Considerable,
|
||||
ThreatCategory::Destructive}}},
|
||||
{Phenomenon::SnowSquall, PhenomenonInfo {}},
|
||||
ImpactBasedWarningInfo {
|
||||
.hasTornadoPossibleTag_ {true},
|
||||
.threatCategories_ {ThreatCategory::Base,
|
||||
ThreatCategory::Considerable,
|
||||
ThreatCategory::Destructive}}},
|
||||
{Phenomenon::SnowSquall, ImpactBasedWarningInfo {}},
|
||||
{Phenomenon::Tornado,
|
||||
PhenomenonInfo {.hasObservedTag_ {true},
|
||||
.threatCategories_ {ThreatCategory::Base,
|
||||
ThreatCategory::Considerable,
|
||||
ThreatCategory::Catastrophic}}},
|
||||
{Phenomenon::Unknown, PhenomenonInfo {}}};
|
||||
ImpactBasedWarningInfo {
|
||||
.hasObservedTag_ {true},
|
||||
.threatCategories_ {ThreatCategory::Base,
|
||||
ThreatCategory::Considerable,
|
||||
ThreatCategory::Catastrophic}}},
|
||||
{Phenomenon::Unknown, ImpactBasedWarningInfo {}}};
|
||||
|
||||
static const std::unordered_map<ThreatCategory, std::string>
|
||||
threatCategoryName_ {{ThreatCategory::Base, "Base"},
|
||||
|
|
@ -41,14 +45,14 @@ static const std::unordered_map<ThreatCategory, std::string>
|
|||
{ThreatCategory::Catastrophic, "Catastrophic"},
|
||||
{ThreatCategory::Unknown, "?"}};
|
||||
|
||||
const PhenomenonInfo& GetPhenomenonInfo(Phenomenon phenomenon)
|
||||
const ImpactBasedWarningInfo& GetImpactBasedWarningInfo(Phenomenon phenomenon)
|
||||
{
|
||||
auto it = phenomenaInfo_.find(phenomenon);
|
||||
if (it != phenomenaInfo_.cend())
|
||||
auto it = impactBasedWarningInfo_.find(phenomenon);
|
||||
if (it != impactBasedWarningInfo_.cend())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
return phenomenaInfo_.at(Phenomenon::Unknown);
|
||||
return impactBasedWarningInfo_.at(Phenomenon::Unknown);
|
||||
}
|
||||
|
||||
SCWX_GET_ENUM(ThreatCategory, GetThreatCategory, threatCategoryName_)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue