mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 09:50:06 +00:00 
			
		
		
		
	Adding impact based warnings to ibw namespace
This commit is contained in:
		
							parent
							
								
									38a2831779
								
							
						
					
					
						commit
						7101cdf183
					
				
					 6 changed files with 29 additions and 23 deletions
				
			
		|  | @ -10,7 +10,6 @@ | |||
| #include <scwx/util/strings.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| 
 | ||||
| #include <format> | ||||
| 
 | ||||
| #include <QApplication> | ||||
|  | @ -38,7 +37,7 @@ public: | |||
|    ~AlertModelImpl() = default; | ||||
| 
 | ||||
|    bool                       GetObserved(const types::TextEventKey& key); | ||||
|    awips::ThreatCategory GetThreatCategory(const types::TextEventKey& key); | ||||
|    awips::ibw::ThreatCategory GetThreatCategory(const types::TextEventKey& key); | ||||
|    bool GetTornadoPossible(const types::TextEventKey& key); | ||||
| 
 | ||||
|    static std::string GetCounties(const types::TextEventKey& key); | ||||
|  | @ -61,7 +60,7 @@ public: | |||
|                       types::TextEventHash<types::TextEventKey>> | ||||
|       observedMap_; | ||||
|    std::unordered_map<types::TextEventKey, | ||||
|                       awips::ThreatCategory, | ||||
|                       awips::ibw::ThreatCategory, | ||||
|                       types::TextEventHash<types::TextEventKey>> | ||||
|       threatCategoryMap_; | ||||
|    std::unordered_map<types::TextEventKey, | ||||
|  | @ -158,7 +157,7 @@ QVariant AlertModel::data(const QModelIndex& index, int role) const | |||
|       case static_cast<int>(Column::ThreatCategory): | ||||
|          if (role == Qt::DisplayRole) | ||||
|          { | ||||
|             return QString::fromStdString(awips::GetThreatCategoryName( | ||||
|             return QString::fromStdString(awips::ibw::GetThreatCategoryName( | ||||
|                p->GetThreatCategory(textEventKey))); | ||||
|          } | ||||
|          else | ||||
|  | @ -439,10 +438,10 @@ bool AlertModelImpl::GetObserved(const types::TextEventKey& key) | |||
|    return observed; | ||||
| } | ||||
| 
 | ||||
| awips::ThreatCategory | ||||
| awips::ibw::ThreatCategory | ||||
| AlertModelImpl::GetThreatCategory(const types::TextEventKey& key) | ||||
| { | ||||
|    awips::ThreatCategory threatCategory = awips::ThreatCategory::Base; | ||||
|    awips::ibw::ThreatCategory threatCategory = awips::ibw::ThreatCategory::Base; | ||||
| 
 | ||||
|    auto it = threatCategoryMap_.find(key); | ||||
|    if (it != threatCategoryMap_.cend()) | ||||
|  |  | |||
|  | @ -179,7 +179,7 @@ QWidget* AlertPaletteSettingsWidget::Impl::CreateStackedWidgetPage( | |||
|    page->setLayout(gridLayout); | ||||
| 
 | ||||
|    const auto& impactBasedWarningInfo = | ||||
|       awips::GetImpactBasedWarningInfo(phenomenon); | ||||
|       awips::ibw::GetImpactBasedWarningInfo(phenomenon); | ||||
| 
 | ||||
|    int row = 0; | ||||
| 
 | ||||
|  | @ -200,13 +200,13 @@ QWidget* AlertPaletteSettingsWidget::Impl::CreateStackedWidgetPage( | |||
| 
 | ||||
|    for (auto& category : impactBasedWarningInfo.threatCategories_) | ||||
|    { | ||||
|       if (category == awips::ThreatCategory::Base) | ||||
|       if (category == awips::ibw::ThreatCategory::Base) | ||||
|       { | ||||
|          continue; | ||||
|       } | ||||
| 
 | ||||
|       AddPhenomenonLine( | ||||
|          awips::GetThreatCategoryName(category), gridLayout, row++); | ||||
|          awips::ibw::GetThreatCategoryName(category), gridLayout, row++); | ||||
|    } | ||||
| 
 | ||||
|    AddPhenomenonLine("Inactive", gridLayout, row++); | ||||
|  |  | |||
|  | @ -9,6 +9,8 @@ namespace scwx | |||
| { | ||||
| namespace awips | ||||
| { | ||||
| namespace ibw | ||||
| { | ||||
| 
 | ||||
| enum class ThreatCategory : int | ||||
| { | ||||
|  | @ -32,5 +34,6 @@ const ImpactBasedWarningInfo& GetImpactBasedWarningInfo(Phenomenon phenomenon); | |||
| ThreatCategory     GetThreatCategory(const std::string& name); | ||||
| const std::string& GetThreatCategoryName(ThreatCategory threatCategory); | ||||
| 
 | ||||
| } // namespace ibw
 | ||||
| } // namespace awips
 | ||||
| } // namespace scwx
 | ||||
|  |  | |||
|  | @ -65,7 +65,7 @@ struct Segment | |||
|    std::optional<CodedTimeMotionLocation> codedMotion_ {}; | ||||
| 
 | ||||
|    bool                observed_ {false}; | ||||
|    ThreatCategory threatCategory_ {ThreatCategory::Base}; | ||||
|    ibw::ThreatCategory threatCategory_ {ibw::ThreatCategory::Base}; | ||||
|    bool                tornadoPossible_ {false}; | ||||
| 
 | ||||
|    Segment() = default; | ||||
|  |  | |||
|  | @ -10,8 +10,10 @@ namespace scwx | |||
| { | ||||
| namespace awips | ||||
| { | ||||
| namespace ibw | ||||
| { | ||||
| 
 | ||||
| static const std::string logPrefix_ = "scwx::awips::impact_based_warnings"; | ||||
| static const std::string logPrefix_ = "scwx::awips::ibw::impact_based_warnings"; | ||||
| 
 | ||||
| static const boost::unordered_flat_map<Phenomenon, ImpactBasedWarningInfo> | ||||
|    impactBasedWarningInfo_ { | ||||
|  | @ -62,5 +64,6 @@ const std::string& GetThreatCategoryName(ThreatCategory threatCategory) | |||
|    return threatCategoryName_.at(threatCategory); | ||||
| } | ||||
| 
 | ||||
| } // namespace ibw
 | ||||
| } // namespace awips
 | ||||
| } // namespace scwx
 | ||||
|  |  | |||
|  | @ -378,7 +378,7 @@ void ParseCodedInformation(std::shared_ptr<Segment> segment, | |||
|          segment->tornadoPossible_ = true; | ||||
|       } | ||||
| 
 | ||||
|       else if (segment->threatCategory_ == ThreatCategory::Base && | ||||
|       else if (segment->threatCategory_ == ibw::ThreatCategory::Base && | ||||
|                (threatTagIt = std::find_if(kThreatCategoryTags.cbegin(), | ||||
|                                            kThreatCategoryTags.cend(), | ||||
|                                            [&it](const std::string& tag) { | ||||
|  | @ -389,18 +389,19 @@ void ParseCodedInformation(std::shared_ptr<Segment> segment, | |||
|          const std::string threatCategoryName = | ||||
|             it->substr(threatTagIt->length()); | ||||
| 
 | ||||
|          ThreatCategory threatCategory = GetThreatCategory(threatCategoryName); | ||||
|          ibw::ThreatCategory threatCategory = | ||||
|             ibw::GetThreatCategory(threatCategoryName); | ||||
| 
 | ||||
|          switch (threatCategory) | ||||
|          { | ||||
|          case ThreatCategory::Significant: | ||||
|          case ibw::ThreatCategory::Significant: | ||||
|             // "Significant" is no longer an official tag, and has largely been
 | ||||
|             // replaced with "Considerable".
 | ||||
|             threatCategory = ThreatCategory::Considerable; | ||||
|             threatCategory = ibw::ThreatCategory::Considerable; | ||||
|             break; | ||||
| 
 | ||||
|          case ThreatCategory::Unknown: | ||||
|             threatCategory = ThreatCategory::Base; | ||||
|          case ibw::ThreatCategory::Unknown: | ||||
|             threatCategory = ibw::ThreatCategory::Base; | ||||
|             break; | ||||
| 
 | ||||
|          default: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat