mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 18:20:04 +00:00
Merge branch 'dpaulat:develop' into audio_location_methods
This commit is contained in:
commit
1a37dbff27
14 changed files with 238 additions and 32 deletions
|
|
@ -3,8 +3,8 @@
|
|||
IDI_ICON1 ICON "icons\\scwx-256.ico"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,4,4,0
|
||||
PRODUCTVERSION 0,4,4,0
|
||||
FILEVERSION 0,4,5,0
|
||||
PRODUCTVERSION 0,4,5,0
|
||||
FILEFLAGS 0x0L
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEOS 0x00040004L
|
||||
|
|
@ -17,12 +17,12 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Dan Paulat"
|
||||
VALUE "FileDescription", "Supercell Wx"
|
||||
VALUE "FileVersion", "0.4.4.0"
|
||||
VALUE "FileVersion", "0.4.5.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2021-2024 Dan Paulat"
|
||||
VALUE "InternalName", "scwx"
|
||||
VALUE "OriginalFilename", "supercell-wx.exe"
|
||||
VALUE "ProductName", "Supercell Wx"
|
||||
VALUE "ProductVersion", "0.4.4.0"
|
||||
VALUE "ProductVersion", "0.4.5.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
|||
|
|
@ -34,6 +34,10 @@ public:
|
|||
explicit AlertModelImpl();
|
||||
~AlertModelImpl() = default;
|
||||
|
||||
bool GetObserved(const types::TextEventKey& key);
|
||||
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);
|
||||
static std::chrono::system_clock::time_point
|
||||
|
|
@ -49,6 +53,18 @@ public:
|
|||
|
||||
const GeographicLib::Geodesic& geodesic_;
|
||||
|
||||
std::unordered_map<types::TextEventKey,
|
||||
bool,
|
||||
types::TextEventHash<types::TextEventKey>>
|
||||
observedMap_;
|
||||
std::unordered_map<types::TextEventKey,
|
||||
awips::ThreatCategory,
|
||||
types::TextEventHash<types::TextEventKey>>
|
||||
threatCategoryMap_;
|
||||
std::unordered_map<types::TextEventKey,
|
||||
bool,
|
||||
types::TextEventHash<types::TextEventKey>>
|
||||
tornadoPossibleMap_;
|
||||
std::unordered_map<types::TextEventKey,
|
||||
common::Coordinate,
|
||||
types::TextEventHash<types::TextEventKey>>
|
||||
|
|
@ -125,6 +141,29 @@ QVariant AlertModel::data(const QModelIndex& index, int role) const
|
|||
return QString::fromStdString(
|
||||
awips::GetSignificanceText(textEventKey.significance_));
|
||||
|
||||
case static_cast<int>(Column::Tornado):
|
||||
if (textEventKey.phenomenon_ == awips::Phenomenon::Tornado &&
|
||||
p->GetObserved(textEventKey))
|
||||
{
|
||||
return tr("Observed");
|
||||
}
|
||||
if (p->GetTornadoPossible(textEventKey))
|
||||
{
|
||||
return tr("Possible");
|
||||
}
|
||||
break;
|
||||
|
||||
case static_cast<int>(Column::ThreatCategory):
|
||||
if (role == Qt::DisplayRole)
|
||||
{
|
||||
return QString::fromStdString(awips::GetThreatCategoryName(
|
||||
p->GetThreatCategory(textEventKey)));
|
||||
}
|
||||
else
|
||||
{
|
||||
return static_cast<int>(p->GetThreatCategory(textEventKey));
|
||||
}
|
||||
|
||||
case static_cast<int>(Column::State):
|
||||
return QString::fromStdString(AlertModelImpl::GetState(textEventKey));
|
||||
|
||||
|
|
@ -204,6 +243,12 @@ AlertModel::headerData(int section, Qt::Orientation orientation, int role) const
|
|||
case static_cast<int>(Column::Significance):
|
||||
return tr("Significance");
|
||||
|
||||
case static_cast<int>(Column::ThreatCategory):
|
||||
return tr("Category");
|
||||
|
||||
case static_cast<int>(Column::Tornado):
|
||||
return tr("Tornado");
|
||||
|
||||
case static_cast<int>(Column::State):
|
||||
return tr("State");
|
||||
|
||||
|
|
@ -240,6 +285,14 @@ AlertModel::headerData(int section, Qt::Orientation orientation, int role) const
|
|||
contentsSize = fontMetrics.size(0, QString(10, 'W'));
|
||||
break;
|
||||
|
||||
case static_cast<int>(Column::ThreatCategory):
|
||||
contentsSize = fontMetrics.size(0, QString(6, 'W'));
|
||||
break;
|
||||
|
||||
case static_cast<int>(Column::Tornado):
|
||||
contentsSize = fontMetrics.size(0, QString(5, 'W'));
|
||||
break;
|
||||
|
||||
case static_cast<int>(Column::State):
|
||||
contentsSize = fontMetrics.size(0, "WW, WW");
|
||||
break;
|
||||
|
|
@ -285,6 +338,12 @@ void AlertModel::HandleAlert(const types::TextEventKey& alertKey,
|
|||
std::shared_ptr<const awips::Segment> alertSegment =
|
||||
alertMessages[messageIndex]->segments().back();
|
||||
|
||||
p->observedMap_.insert_or_assign(alertKey, alertSegment->observed_);
|
||||
p->threatCategoryMap_.insert_or_assign(alertKey,
|
||||
alertSegment->threatCategory_);
|
||||
p->tornadoPossibleMap_.insert_or_assign(alertKey,
|
||||
alertSegment->tornadoPossible_);
|
||||
|
||||
if (alertSegment->codedLocation_.has_value())
|
||||
{
|
||||
// Update centroid and distance
|
||||
|
|
@ -365,6 +424,46 @@ AlertModelImpl::AlertModelImpl() :
|
|||
{
|
||||
}
|
||||
|
||||
bool AlertModelImpl::GetObserved(const types::TextEventKey& key)
|
||||
{
|
||||
bool observed = false;
|
||||
|
||||
auto it = observedMap_.find(key);
|
||||
if (it != observedMap_.cend())
|
||||
{
|
||||
observed = it->second;
|
||||
}
|
||||
|
||||
return observed;
|
||||
}
|
||||
|
||||
awips::ThreatCategory
|
||||
AlertModelImpl::GetThreatCategory(const types::TextEventKey& key)
|
||||
{
|
||||
awips::ThreatCategory threatCategory = awips::ThreatCategory::Base;
|
||||
|
||||
auto it = threatCategoryMap_.find(key);
|
||||
if (it != threatCategoryMap_.cend())
|
||||
{
|
||||
threatCategory = it->second;
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -21,15 +21,17 @@ class AlertModel : public QAbstractTableModel
|
|||
public:
|
||||
enum class Column : int
|
||||
{
|
||||
Etn = 0,
|
||||
OfficeId = 1,
|
||||
Phenomenon = 2,
|
||||
Significance = 3,
|
||||
State = 4,
|
||||
Counties = 5,
|
||||
StartTime = 6,
|
||||
EndTime = 7,
|
||||
Distance = 8
|
||||
Etn = 0,
|
||||
OfficeId = 1,
|
||||
Phenomenon = 2,
|
||||
Significance = 3,
|
||||
ThreatCategory = 4,
|
||||
Tornado = 5,
|
||||
State = 6,
|
||||
Counties = 7,
|
||||
StartTime = 8,
|
||||
EndTime = 9,
|
||||
Distance = 10
|
||||
};
|
||||
|
||||
explicit AlertModel(QObject* parent = nullptr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue