mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 03:20:05 +00:00 
			
		
		
		
	Fix issue where level 2 archive files where put in a cache at times of level 2
chunk files
This commit is contained in:
		
							parent
							
								
									0438b65208
								
							
						
					
					
						commit
						8989c0e88c
					
				
					 4 changed files with 84 additions and 71 deletions
				
			
		|  | @ -1843,6 +1843,7 @@ void MapWidgetImpl::RadarProductManagerConnect() | |||
|          this, | ||||
|          [this](common::RadarProductGroup             group, | ||||
|                 const std::string&                    product, | ||||
|                 bool                                  isChunks, | ||||
|                 std::chrono::system_clock::time_point latestTime) | ||||
|          { | ||||
|             if (autoRefreshEnabled_ && | ||||
|  | @ -1850,71 +1851,81 @@ void MapWidgetImpl::RadarProductManagerConnect() | |||
|                 (group == common::RadarProductGroup::Level2 || | ||||
|                  context_->radar_product() == product)) | ||||
|             { | ||||
|                // Create file request
 | ||||
|                std::shared_ptr<request::NexradFileRequest> request = | ||||
|                   std::make_shared<request::NexradFileRequest>( | ||||
|                      radarProductManager_->radar_id()); | ||||
| 
 | ||||
|                // File request callback
 | ||||
|                if (autoUpdateEnabled_) | ||||
|                if (isChunks && autoUpdateEnabled_) | ||||
|                { | ||||
|                   connect( | ||||
|                      request.get(), | ||||
|                      &request::NexradFileRequest::RequestComplete, | ||||
|                      this, | ||||
|                      [=, | ||||
|                       this](std::shared_ptr<request::NexradFileRequest> request) | ||||
|                      { | ||||
|                         // Select loaded record
 | ||||
|                         auto record = request->radar_product_record(); | ||||
|                   // Level 2 products may have multiple time points,
 | ||||
|                   // ensure the latest is selected
 | ||||
|                   widget_->SelectRadarProduct(group, product); | ||||
|                } | ||||
|                else | ||||
|                { | ||||
|                   // Create file request
 | ||||
|                   const std::shared_ptr<request::NexradFileRequest> request = | ||||
|                      std::make_shared<request::NexradFileRequest>( | ||||
|                         radarProductManager_->radar_id()); | ||||
| 
 | ||||
|                         // Validate record, and verify current map context
 | ||||
|                         // still displays site and product
 | ||||
|                         if (record != nullptr && | ||||
|                             radarProductManager_ != nullptr && | ||||
|                             radarProductManager_->radar_id() == | ||||
|                                request->current_radar_site() && | ||||
|                             context_->radar_product_group() == group && | ||||
|                             (group == common::RadarProductGroup::Level2 || | ||||
|                              context_->radar_product() == product)) | ||||
|                   // File request callback
 | ||||
|                   if (autoUpdateEnabled_) | ||||
|                   { | ||||
|                      connect( | ||||
|                         request.get(), | ||||
|                         &request::NexradFileRequest::RequestComplete, | ||||
|                         this, | ||||
|                         [group, product, this]( | ||||
|                            const std::shared_ptr<request::NexradFileRequest>& | ||||
|                               request) | ||||
|                         { | ||||
|                            // Select loaded record
 | ||||
|                            auto record = request->radar_product_record(); | ||||
| 
 | ||||
|                            // Validate record, and verify current map context
 | ||||
|                            // still displays site and product
 | ||||
|                            if (record != nullptr && | ||||
|                                radarProductManager_ != nullptr && | ||||
|                                radarProductManager_->radar_id() == | ||||
|                                   request->current_radar_site() && | ||||
|                                context_->radar_product_group() == group && | ||||
|                                (group == common::RadarProductGroup::Level2 || | ||||
|                                 context_->radar_product() == product)) | ||||
|                            { | ||||
|                               if (group == common::RadarProductGroup::Level2) | ||||
|                               { | ||||
|                                  // Level 2 products may have multiple time
 | ||||
|                                  // points, ensure the latest is selected
 | ||||
|                                  widget_->SelectRadarProduct(group, product); | ||||
|                               } | ||||
|                               else | ||||
|                               { | ||||
|                                  widget_->SelectRadarProduct(record); | ||||
|                               } | ||||
|                            } | ||||
|                         }); | ||||
|                   } | ||||
| 
 | ||||
|                   // Load file
 | ||||
|                   boost::asio::post( | ||||
|                      threadPool_, | ||||
|                      [group, latestTime, request, product, this]() | ||||
|                      { | ||||
|                         try | ||||
|                         { | ||||
|                            if (group == common::RadarProductGroup::Level2) | ||||
|                            { | ||||
|                               // Level 2 products may have multiple time points,
 | ||||
|                               // ensure the latest is selected
 | ||||
|                               widget_->SelectRadarProduct(group, product); | ||||
|                               radarProductManager_->LoadLevel2Data(latestTime, | ||||
|                                                                    request); | ||||
|                            } | ||||
|                            else | ||||
|                            { | ||||
|                               widget_->SelectRadarProduct(record); | ||||
|                               radarProductManager_->LoadLevel3Data( | ||||
|                                  product, latestTime, request); | ||||
|                            } | ||||
|                         } | ||||
|                         catch (const std::exception& ex) | ||||
|                         { | ||||
|                            logger_->error(ex.what()); | ||||
|                         } | ||||
|                      }); | ||||
|                } | ||||
| 
 | ||||
|                // Load file
 | ||||
|                boost::asio::post( | ||||
|                   threadPool_, | ||||
|                   [=, this]() | ||||
|                   { | ||||
|                      try | ||||
|                      { | ||||
|                         if (group == common::RadarProductGroup::Level2) | ||||
|                         { | ||||
|                            radarProductManager_->LoadLevel2Data(latestTime, | ||||
|                                                                 request); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                            radarProductManager_->LoadLevel3Data( | ||||
|                               product, latestTime, request); | ||||
|                         } | ||||
|                      } | ||||
|                      catch (const std::exception& ex) | ||||
|                      { | ||||
|                         logger_->error(ex.what()); | ||||
|                      } | ||||
|                   }); | ||||
|             } | ||||
|          }, | ||||
|          Qt::QueuedConnection); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak