mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 06:20:06 +00:00 
			
		
		
		
	Emit signals when a sweep is not updated (with reason)
This commit is contained in:
		
							parent
							
								
									745eba34f2
								
							
						
					
					
						commit
						6b179fe35c
					
				
					 7 changed files with 44 additions and 1 deletions
				
			
		|  | @ -1010,6 +1010,10 @@ void MapWidgetImpl::RadarProductViewConnect() | ||||||
|             Q_EMIT widget_->RadarSweepUpdated(); |             Q_EMIT widget_->RadarSweepUpdated(); | ||||||
|          }, |          }, | ||||||
|          Qt::QueuedConnection); |          Qt::QueuedConnection); | ||||||
|  |       connect(radarProductView.get(), | ||||||
|  |               &view::RadarProductView::SweepNotComputed, | ||||||
|  |               widget_, | ||||||
|  |               &MapWidget::RadarSweepNotUpdated); | ||||||
|    } |    } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1027,6 +1031,10 @@ void MapWidgetImpl::RadarProductViewDisconnect() | ||||||
|                  &view::RadarProductView::SweepComputed, |                  &view::RadarProductView::SweepComputed, | ||||||
|                  this, |                  this, | ||||||
|                  nullptr); |                  nullptr); | ||||||
|  |       disconnect(radarProductView.get(), | ||||||
|  |                  &view::RadarProductView::SweepNotComputed, | ||||||
|  |                  widget_, | ||||||
|  |                  nullptr); | ||||||
|    } |    } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| #include <scwx/common/products.hpp> | #include <scwx/common/products.hpp> | ||||||
| #include <scwx/qt/config/radar_site.hpp> | #include <scwx/qt/config/radar_site.hpp> | ||||||
|  | #include <scwx/qt/types/map_types.hpp> | ||||||
| #include <scwx/qt/types/radar_product_record.hpp> | #include <scwx/qt/types/radar_product_record.hpp> | ||||||
| 
 | 
 | ||||||
| #include <chrono> | #include <chrono> | ||||||
|  | @ -143,6 +144,7 @@ signals: | ||||||
|    void MapStyleChanged(const std::string& styleName); |    void MapStyleChanged(const std::string& styleName); | ||||||
|    void RadarSiteUpdated(std::shared_ptr<config::RadarSite> radarSite); |    void RadarSiteUpdated(std::shared_ptr<config::RadarSite> radarSite); | ||||||
|    void RadarSweepUpdated(); |    void RadarSweepUpdated(); | ||||||
|  |    void RadarSweepNotUpdated(types::NoUpdateReason reason); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace map
 | } // namespace map
 | ||||||
|  |  | ||||||
|  | @ -21,6 +21,14 @@ enum class MapTime | ||||||
|    Archive |    Archive | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | enum class NoUpdateReason | ||||||
|  | { | ||||||
|  |    NoChange, | ||||||
|  |    NotLoaded, | ||||||
|  |    InvalidProduct, | ||||||
|  |    InvalidData | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| std::string GetMapTimeName(MapTime mapTime); | std::string GetMapTimeName(MapTime mapTime); | ||||||
| 
 | 
 | ||||||
| } // namespace types
 | } // namespace types
 | ||||||
|  |  | ||||||
|  | @ -402,6 +402,7 @@ void Level2ProductView::ComputeSweep() | ||||||
| 
 | 
 | ||||||
|    if (p->dataBlockType_ == wsr88d::rda::DataBlockType::Unknown) |    if (p->dataBlockType_ == wsr88d::rda::DataBlockType::Unknown) | ||||||
|    { |    { | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::InvalidProduct); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -423,8 +424,14 @@ void Level2ProductView::ComputeSweep() | ||||||
|       SelectTime(foundTime); |       SelectTime(foundTime); | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    if (radarData == nullptr || radarData == p->elevationScan_) |    if (radarData == nullptr) | ||||||
|    { |    { | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::NotLoaded); | ||||||
|  |       return; | ||||||
|  |    } | ||||||
|  |    if (radarData == p->elevationScan_) | ||||||
|  |    { | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::NoChange); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -443,6 +450,7 @@ void Level2ProductView::ComputeSweep() | ||||||
|    { |    { | ||||||
|       logger_->warn("No moment data for {}", |       logger_->warn("No moment data for {}", | ||||||
|                     common::GetLevel2Name(p->product_)); |                     common::GetLevel2Name(p->product_)); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::InvalidData); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -133,6 +133,7 @@ void Level3RadialView::ComputeSweep() | ||||||
|    if (message == nullptr) |    if (message == nullptr) | ||||||
|    { |    { | ||||||
|       logger_->debug("Level 3 data not found"); |       logger_->debug("Level 3 data not found"); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::NotLoaded); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -142,11 +143,13 @@ void Level3RadialView::ComputeSweep() | ||||||
|    if (gpm == nullptr) |    if (gpm == nullptr) | ||||||
|    { |    { | ||||||
|       logger_->warn("Graphic Product Message not found"); |       logger_->warn("Graphic Product Message not found"); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::InvalidData); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
|    else if (gpm == graphic_product_message()) |    else if (gpm == graphic_product_message()) | ||||||
|    { |    { | ||||||
|       // Skip if this is the message we previously processed
 |       // Skip if this is the message we previously processed
 | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::NoChange); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
|    set_graphic_product_message(gpm); |    set_graphic_product_message(gpm); | ||||||
|  | @ -160,6 +163,7 @@ void Level3RadialView::ComputeSweep() | ||||||
|    if (descriptionBlock == nullptr || symbologyBlock == nullptr) |    if (descriptionBlock == nullptr || symbologyBlock == nullptr) | ||||||
|    { |    { | ||||||
|       logger_->warn("Missing blocks"); |       logger_->warn("Missing blocks"); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::InvalidData); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -168,6 +172,7 @@ void Level3RadialView::ComputeSweep() | ||||||
|    if (numberOfLayers < 1) |    if (numberOfLayers < 1) | ||||||
|    { |    { | ||||||
|       logger_->warn("No layers present in symbology block"); |       logger_->warn("No layers present in symbology block"); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::InvalidData); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -219,6 +224,7 @@ void Level3RadialView::ComputeSweep() | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       logger_->debug("No radial data found"); |       logger_->debug("No radial data found"); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::InvalidData); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -227,6 +233,7 @@ void Level3RadialView::ComputeSweep() | ||||||
|    if (radials < 1 || radials > 720) |    if (radials < 1 || radials > 720) | ||||||
|    { |    { | ||||||
|       logger_->warn("Unsupported number of radials: {}", radials); |       logger_->warn("Unsupported number of radials: {}", radials); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::InvalidData); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -254,6 +261,7 @@ void Level3RadialView::ComputeSweep() | ||||||
|    if (gates < 1) |    if (gates < 1) | ||||||
|    { |    { | ||||||
|       logger_->warn("No range bins in radial data"); |       logger_->warn("No range bins in radial data"); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::InvalidData); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -116,6 +116,7 @@ void Level3RasterView::ComputeSweep() | ||||||
|    if (message == nullptr) |    if (message == nullptr) | ||||||
|    { |    { | ||||||
|       logger_->debug("Level 3 data not found"); |       logger_->debug("Level 3 data not found"); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::NotLoaded); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -125,11 +126,13 @@ void Level3RasterView::ComputeSweep() | ||||||
|    if (gpm == nullptr) |    if (gpm == nullptr) | ||||||
|    { |    { | ||||||
|       logger_->warn("Graphic Product Message not found"); |       logger_->warn("Graphic Product Message not found"); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::InvalidData); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
|    else if (gpm == graphic_product_message()) |    else if (gpm == graphic_product_message()) | ||||||
|    { |    { | ||||||
|       // Skip if this is the message we previously processed
 |       // Skip if this is the message we previously processed
 | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::NoChange); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
|    set_graphic_product_message(gpm); |    set_graphic_product_message(gpm); | ||||||
|  | @ -143,6 +146,7 @@ void Level3RasterView::ComputeSweep() | ||||||
|    if (descriptionBlock == nullptr || symbologyBlock == nullptr) |    if (descriptionBlock == nullptr || symbologyBlock == nullptr) | ||||||
|    { |    { | ||||||
|       logger_->warn("Missing blocks"); |       logger_->warn("Missing blocks"); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::InvalidData); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -151,6 +155,7 @@ void Level3RasterView::ComputeSweep() | ||||||
|    if (numberOfLayers < 1) |    if (numberOfLayers < 1) | ||||||
|    { |    { | ||||||
|       logger_->warn("No layers present in symbology block"); |       logger_->warn("No layers present in symbology block"); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::InvalidData); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -182,6 +187,7 @@ void Level3RasterView::ComputeSweep() | ||||||
|    if (rasterData == nullptr) |    if (rasterData == nullptr) | ||||||
|    { |    { | ||||||
|       logger_->debug("No raster data found"); |       logger_->debug("No raster data found"); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::InvalidData); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  | @ -196,6 +202,7 @@ void Level3RasterView::ComputeSweep() | ||||||
|    if (maxColumns == 0) |    if (maxColumns == 0) | ||||||
|    { |    { | ||||||
|       logger_->debug("No raster bins found"); |       logger_->debug("No raster bins found"); | ||||||
|  |       Q_EMIT SweepNotComputed(types::NoUpdateReason::InvalidData); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ | ||||||
| #include <scwx/common/color_table.hpp> | #include <scwx/common/color_table.hpp> | ||||||
| #include <scwx/common/products.hpp> | #include <scwx/common/products.hpp> | ||||||
| #include <scwx/qt/manager/radar_product_manager.hpp> | #include <scwx/qt/manager/radar_product_manager.hpp> | ||||||
|  | #include <scwx/qt/types/map_types.hpp> | ||||||
| 
 | 
 | ||||||
| #include <chrono> | #include <chrono> | ||||||
| #include <memory> | #include <memory> | ||||||
|  | @ -75,6 +76,7 @@ protected slots: | ||||||
| signals: | signals: | ||||||
|    void ColorTableUpdated(); |    void ColorTableUpdated(); | ||||||
|    void SweepComputed(); |    void SweepComputed(); | ||||||
|  |    void SweepNotComputed(types::NoUpdateReason reason); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|    std::unique_ptr<RadarProductViewImpl> p; |    std::unique_ptr<RadarProductViewImpl> p; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat