mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 00:30:05 +00:00 
			
		
		
		
	Add tornado possible to alert dock widget
This commit is contained in:
		
							parent
							
								
									49ba9b905b
								
							
						
					
					
						commit
						f0347da923
					
				
					 2 changed files with 45 additions and 10 deletions
				
			
		|  | @ -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<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>> | ||||
|  | @ -131,6 +136,13 @@ QVariant AlertModel::data(const QModelIndex& index, int role) const | |||
|          return QString::fromStdString( | ||||
|             awips::GetSignificanceText(textEventKey.significance_)); | ||||
| 
 | ||||
|       case static_cast<int>(Column::TornadoPossible): | ||||
|          if (p->GetTornadoPossible(textEventKey)) | ||||
|          { | ||||
|             return tr("Possible"); | ||||
|          } | ||||
|          break; | ||||
| 
 | ||||
|       case static_cast<int>(Column::ThreatCategory): | ||||
|          if (role == Qt::DisplayRole) | ||||
|          { | ||||
|  | @ -224,6 +236,9 @@ AlertModel::headerData(int section, Qt::Orientation orientation, int role) const | |||
|          case static_cast<int>(Column::ThreatCategory): | ||||
|             return tr("Category"); | ||||
| 
 | ||||
|          case static_cast<int>(Column::TornadoPossible): | ||||
|             return tr("Tornado"); | ||||
| 
 | ||||
|          case static_cast<int>(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<int>(Column::TornadoPossible): | ||||
|          contentsSize = fontMetrics.size(0, QString(4, 'W')); | ||||
|          break; | ||||
| 
 | ||||
|       case static_cast<int>(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); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat