diff --git a/scwx-qt/source/scwx/qt/model/alert_model.cpp b/scwx-qt/source/scwx/qt/model/alert_model.cpp index 18ff2055..fd316c1d 100644 --- a/scwx-qt/source/scwx/qt/model/alert_model.cpp +++ b/scwx-qt/source/scwx/qt/model/alert_model.cpp @@ -35,6 +35,7 @@ public: ~AlertModelImpl() = default; awips::ThreatCategory GetThreatCategory(const types::TextEventKey& key); + bool GetTornadoPossible(const types::TextEventKey& key); static std::string GetCounties(const types::TextEventKey& key); static std::string GetState(const types::TextEventKey& key); @@ -55,6 +56,10 @@ public: awips::ThreatCategory, types::TextEventHash> threatCategoryMap_; + std::unordered_map> + tornadoPossibleMap_; std::unordered_map> @@ -131,6 +136,13 @@ QVariant AlertModel::data(const QModelIndex& index, int role) const return QString::fromStdString( awips::GetSignificanceText(textEventKey.significance_)); + case static_cast(Column::TornadoPossible): + if (p->GetTornadoPossible(textEventKey)) + { + return tr("Possible"); + } + break; + case static_cast(Column::ThreatCategory): if (role == Qt::DisplayRole) { @@ -224,6 +236,9 @@ AlertModel::headerData(int section, Qt::Orientation orientation, int role) const case static_cast(Column::ThreatCategory): return tr("Category"); + case static_cast(Column::TornadoPossible): + return tr("Tornado"); + case static_cast(Column::State): return tr("State"); @@ -264,6 +279,10 @@ AlertModel::headerData(int section, Qt::Orientation orientation, int role) const contentsSize = fontMetrics.size(0, QString(6, 'W')); break; + case static_cast(Column::TornadoPossible): + contentsSize = fontMetrics.size(0, QString(4, 'W')); + break; + case static_cast(Column::State): contentsSize = fontMetrics.size(0, "WW, WW"); break; @@ -311,6 +330,8 @@ void AlertModel::HandleAlert(const types::TextEventKey& alertKey, p->threatCategoryMap_.insert_or_assign(alertKey, alertSegment->threatCategory_); + p->tornadoPossibleMap_.insert_or_assign(alertKey, + alertSegment->tornadoPossible_); if (alertSegment->codedLocation_.has_value()) { @@ -406,6 +427,19 @@ AlertModelImpl::GetThreatCategory(const types::TextEventKey& key) return threatCategory; } +bool AlertModelImpl::GetTornadoPossible(const types::TextEventKey& key) +{ + bool tornadoPossible = false; + + auto it = tornadoPossibleMap_.find(key); + if (it != tornadoPossibleMap_.cend()) + { + tornadoPossible = it->second; + } + + return tornadoPossible; +} + std::string AlertModelImpl::GetCounties(const types::TextEventKey& key) { auto messageList = manager::TextEventManager::Instance()->message_list(key); diff --git a/scwx-qt/source/scwx/qt/model/alert_model.hpp b/scwx-qt/source/scwx/qt/model/alert_model.hpp index 71fb0dfb..6654dcb1 100644 --- a/scwx-qt/source/scwx/qt/model/alert_model.hpp +++ b/scwx-qt/source/scwx/qt/model/alert_model.hpp @@ -21,16 +21,17 @@ class AlertModel : public QAbstractTableModel public: enum class Column : int { - Etn = 0, - OfficeId = 1, - Phenomenon = 2, - Significance = 3, - ThreatCategory = 4, - State = 5, - Counties = 6, - StartTime = 7, - EndTime = 8, - Distance = 9 + Etn = 0, + OfficeId = 1, + Phenomenon = 2, + Significance = 3, + ThreatCategory = 4, + TornadoPossible = 5, + State = 6, + Counties = 7, + StartTime = 8, + EndTime = 9, + Distance = 10 }; explicit AlertModel(QObject* parent = nullptr);