mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 08:40:06 +00:00 
			
		
		
		
	Load radar data asynchronously
This commit is contained in:
		
							parent
							
								
									803a25e884
								
							
						
					
					
						commit
						3625515b8a
					
				
					 6 changed files with 71 additions and 13 deletions
				
			
		|  | @ -1,5 +1,6 @@ | |||
| #include <scwx/qt/manager/radar_product_manager.hpp> | ||||
| #include <scwx/common/constants.hpp> | ||||
| #include <scwx/util/threads.hpp> | ||||
| 
 | ||||
| #include <deque> | ||||
| #include <execution> | ||||
|  | @ -182,6 +183,33 @@ void RadarProductManager::LoadLevel2Data(const std::string& filename) | |||
|    emit Level2DataLoaded(); | ||||
| } | ||||
| 
 | ||||
| std::unordered_map<uint16_t, std::shared_ptr<wsr88d::rda::DigitalRadarData>> | ||||
| RadarProductManager::GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType, | ||||
|                                    uint8_t                    elevationIndex, | ||||
|                                    std::chrono::system_clock::time_point time) | ||||
| { | ||||
|    std::unordered_map<uint16_t, std::shared_ptr<wsr88d::rda::DigitalRadarData>> | ||||
|       radarData; | ||||
| 
 | ||||
|    if (p->level2Data_.size() > 0) | ||||
|    { | ||||
|       // TODO: Pull this from the database
 | ||||
|       radarData = p->level2Data_[0]->radar_data()[elevationIndex]; | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       scwx::util::async([&]() { | ||||
|          QString filename = qgetenv("AR2V_FILE"); | ||||
|          if (!filename.isEmpty()) | ||||
|          { | ||||
|             LoadLevel2Data(filename.toUtf8().constData()); | ||||
|          } | ||||
|       }); | ||||
|    } | ||||
| 
 | ||||
|    return radarData; | ||||
| } | ||||
| 
 | ||||
| } // namespace manager
 | ||||
| } // namespace qt
 | ||||
| } // namespace scwx
 | ||||
|  |  | |||
|  | @ -33,6 +33,11 @@ public: | |||
|    void Initialize(); | ||||
|    void LoadLevel2Data(const std::string& filename); | ||||
| 
 | ||||
|    std::unordered_map<uint16_t, std::shared_ptr<wsr88d::rda::DigitalRadarData>> | ||||
|    GetLevel2Data(wsr88d::rda::DataBlockType            dataBlockType, | ||||
|                  uint8_t                               elevationIndex, | ||||
|                  std::chrono::system_clock::time_point time = {}); | ||||
| 
 | ||||
| signals: | ||||
|    void Level2DataLoaded(); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat