mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 02:20:04 +00:00 
			
		
		
		
	Select level 3 radar products
This commit is contained in:
		
							parent
							
								
									ab83b50e0a
								
							
						
					
					
						commit
						732a7e233c
					
				
					 4 changed files with 74 additions and 13 deletions
				
			
		|  | @ -252,10 +252,7 @@ void MainWindow::on_actionOpen_triggered() | |||
| 
 | ||||
|                if (record != nullptr) | ||||
|                { | ||||
|                   currentMap->SelectRadarProduct(record->radar_id(), | ||||
|                                                  record->radar_product_group(), | ||||
|                                                  record->radar_product(), | ||||
|                                                  record->time()); | ||||
|                   currentMap->SelectRadarProduct(record); | ||||
|                } | ||||
|                else | ||||
|                { | ||||
|  |  | |||
|  | @ -293,11 +293,22 @@ void MapWidget::SelectRadarProduct(common::Level2Product product) | |||
|    } | ||||
| } | ||||
| 
 | ||||
| void MapWidget::SelectRadarProduct(const std::string&        radarId, | ||||
|                                    common::RadarProductGroup group, | ||||
|                                    const std::string&        product, | ||||
|                                    std::chrono::system_clock::time_point time) | ||||
| void MapWidget::SelectRadarProduct( | ||||
|    std::shared_ptr<types::RadarProductRecord> record) | ||||
| { | ||||
|    const std::string                     radarId = record->radar_id(); | ||||
|    common::RadarProductGroup             group = record->radar_product_group(); | ||||
|    const std::string                     product = record->radar_product(); | ||||
|    std::chrono::system_clock::time_point time    = record->time(); | ||||
| 
 | ||||
|    int16_t productCode = 0; | ||||
| 
 | ||||
|    std::shared_ptr<wsr88d::Level3File> level3File = record->level3_file(); | ||||
|    if (level3File != nullptr && level3File->message() != nullptr) | ||||
|    { | ||||
|       productCode = level3File->message()->header().message_code(); | ||||
|    } | ||||
| 
 | ||||
|    BOOST_LOG_TRIVIAL(debug) | ||||
|       << logPrefix_ << "SelectRadarProduct(" << radarId << ", " | ||||
|       << common::GetRadarProductGroupName(group) << ", " << product << ", " | ||||
|  | @ -313,6 +324,61 @@ void MapWidget::SelectRadarProduct(const std::string&        radarId, | |||
| 
 | ||||
|       SelectRadarProduct(level2Product); | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       // TODO: Combine this with the SelectRadarProduct(Level2Product) function
 | ||||
|       std::shared_ptr<view::RadarProductView>& radarProductView = | ||||
|          p->context_->radarProductView_; | ||||
| 
 | ||||
|       radarProductView = view::RadarProductViewFactory::Create( | ||||
|          group, product, 0.0f, p->radarProductManager_); | ||||
|       radarProductView->SelectTime(p->selectedTime_); | ||||
| 
 | ||||
|       connect( | ||||
|          radarProductView.get(), | ||||
|          &view::RadarProductView::ColorTableUpdated, | ||||
|          this, | ||||
|          [&]() { update(); }, | ||||
|          Qt::QueuedConnection); | ||||
|       connect( | ||||
|          radarProductView.get(), | ||||
|          &view::RadarProductView::SweepComputed, | ||||
|          this, | ||||
|          [&]() | ||||
|          { | ||||
|             std::shared_ptr<config::RadarSite> radarSite = | ||||
|                p->radarProductManager_->radar_site(); | ||||
| 
 | ||||
|             RadarRangeLayer::Update( | ||||
|                p->map_, | ||||
|                radarProductView->range(), | ||||
|                {radarSite->latitude(), radarSite->longitude()}); | ||||
|             update(); | ||||
|             emit RadarSweepUpdated(); | ||||
|          }, | ||||
|          Qt::QueuedConnection); | ||||
| 
 | ||||
|       util::async( | ||||
|          [=]() | ||||
|          { | ||||
|             std::string colorTableFile = | ||||
|                manager::SettingsManager::palette_settings()->palette( | ||||
|                   common::GetLevel3Palette(productCode)); | ||||
|             if (!colorTableFile.empty()) | ||||
|             { | ||||
|                std::shared_ptr<common::ColorTable> colorTable = | ||||
|                   common::ColorTable::Load(colorTableFile); | ||||
|                radarProductView->LoadColorTable(colorTable); | ||||
|             } | ||||
| 
 | ||||
|             radarProductView->Initialize(); | ||||
|          }); | ||||
| 
 | ||||
|       if (p->map_ != nullptr) | ||||
|       { | ||||
|          AddLayers(); | ||||
|       } | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| void MapWidget::SetActive(bool isActive) | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include <scwx/common/products.hpp> | ||||
| #include <scwx/qt/types/radar_product_record.hpp> | ||||
| 
 | ||||
| #include <chrono> | ||||
| #include <memory> | ||||
|  | @ -40,10 +41,7 @@ public: | |||
| 
 | ||||
|    void SelectElevation(float elevation); | ||||
|    void SelectRadarProduct(common::Level2Product product); | ||||
|    void SelectRadarProduct(const std::string&                    radarId, | ||||
|                            common::RadarProductGroup             group, | ||||
|                            const std::string&                    product, | ||||
|                            std::chrono::system_clock::time_point time); | ||||
|    void SelectRadarProduct(std::shared_ptr<types::RadarProductRecord> record); | ||||
|    void SetActive(bool isActive); | ||||
|    void SetMapParameters(double latitude, | ||||
|                          double longitude, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat