mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 03:00:06 +00:00 
			
		
		
		
	Load latest record by default when selecting level 2 product
This commit is contained in:
		
							parent
							
								
									b9531149de
								
							
						
					
					
						commit
						ccfceb6605
					
				
					 1 changed files with 17 additions and 7 deletions
				
			
		|  | @ -497,10 +497,19 @@ void RadarProductManagerImpl::LoadNexradFile( | ||||||
| std::shared_ptr<types::RadarProductRecord> | std::shared_ptr<types::RadarProductRecord> | ||||||
| RadarProductManagerImpl::GetLevel2ProductRecord( | RadarProductManagerImpl::GetLevel2ProductRecord( | ||||||
|    std::chrono::system_clock::time_point time) |    std::chrono::system_clock::time_point time) | ||||||
|  | { | ||||||
|  |    std::shared_ptr<types::RadarProductRecord> record; | ||||||
|  | 
 | ||||||
|  |    if (!level2ProductRecords_.empty() && | ||||||
|  |        time == std::chrono::system_clock::time_point {}) | ||||||
|  |    { | ||||||
|  |       // If a default-initialized time point is given, return the latest record
 | ||||||
|  |       record = level2ProductRecords_.rbegin()->second; | ||||||
|  |    } | ||||||
|  |    else | ||||||
|    { |    { | ||||||
|       // TODO: Round to minutes
 |       // TODO: Round to minutes
 | ||||||
|    std::shared_ptr<types::RadarProductRecord> record = |       record = util::GetBoundedElementValue(level2ProductRecords_, time); | ||||||
|       util::GetBoundedElementValue(level2ProductRecords_, time); |  | ||||||
| 
 | 
 | ||||||
|       // Does the record contain the time we are looking for?
 |       // Does the record contain the time we are looking for?
 | ||||||
|       if (record != nullptr && (time < record->level2_file()->start_time() || |       if (record != nullptr && (time < record->level2_file()->start_time() || | ||||||
|  | @ -508,6 +517,7 @@ RadarProductManagerImpl::GetLevel2ProductRecord( | ||||||
|       { |       { | ||||||
|          record = nullptr; |          record = nullptr; | ||||||
|       } |       } | ||||||
|  |    } | ||||||
| 
 | 
 | ||||||
|    return record; |    return record; | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat