mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-30 13:30:06 +00:00 
			
		
		
		
	Stub for selecting radar product on successful file load
This commit is contained in:
		
							parent
							
								
									2000f3acb1
								
							
						
					
					
						commit
						7c44bafeb5
					
				
					 8 changed files with 68 additions and 43 deletions
				
			
		|  | @ -10,5 +10,8 @@ namespace util | |||
| std::chrono::system_clock::time_point TimePoint(uint16_t modifiedJulianDate, | ||||
|                                                 uint32_t milliseconds); | ||||
| 
 | ||||
| std::string TimeString(std::chrono::system_clock::time_point time, | ||||
|                        const std::chrono::time_zone* timeZone = nullptr); | ||||
| 
 | ||||
| } // namespace util
 | ||||
| } // namespace scwx
 | ||||
|  |  | |||
|  | @ -8,9 +8,9 @@ namespace common | |||
| { | ||||
| 
 | ||||
| static const std::unordered_map<RadarProductGroup, std::string> | ||||
|    productGroupName_ {{RadarProductGroup::Level2, "L2"}, | ||||
|                       {RadarProductGroup::Level3, "L3"}, | ||||
|                       {RadarProductGroup::Unknown, "?"}}; | ||||
|    radarProductGroupName_ {{RadarProductGroup::Level2, "L2"}, | ||||
|                            {RadarProductGroup::Level3, "L3"}, | ||||
|                            {RadarProductGroup::Unknown, "?"}}; | ||||
| 
 | ||||
| static const std::unordered_map<Level2Product, std::string> level2Name_ { | ||||
|    {Level2Product::Reflectivity, "REF"}, | ||||
|  | @ -42,20 +42,20 @@ static const std::unordered_map<Level2Product, std::string> level2Palette_ { | |||
|    {Level2Product::ClutterFilterPowerRemoved, "???"}, | ||||
|    {Level2Product::Unknown, "???"}}; | ||||
| 
 | ||||
| const std::string& GetProductGroupName(RadarProductGroup group) | ||||
| const std::string& GetRadarProductGroupName(RadarProductGroup group) | ||||
| { | ||||
|    return productGroupName_.at(group); | ||||
|    return radarProductGroupName_.at(group); | ||||
| } | ||||
| 
 | ||||
| RadarProductGroup GetProductGroup(const std::string& name) | ||||
| RadarProductGroup GetRadarProductGroup(const std::string& name) | ||||
| { | ||||
|    auto result = std::find_if( | ||||
|       productGroupName_.cbegin(), | ||||
|       productGroupName_.cend(), | ||||
|       radarProductGroupName_.cbegin(), | ||||
|       radarProductGroupName_.cend(), | ||||
|       [&](const std::pair<RadarProductGroup, std::string>& pair) -> bool | ||||
|       { return pair.second == name; }); | ||||
| 
 | ||||
|    if (result != productGroupName_.cend()) | ||||
|    if (result != radarProductGroupName_.cend()) | ||||
|    { | ||||
|       return result->first; | ||||
|    } | ||||
|  |  | |||
|  | @ -1,3 +1,8 @@ | |||
| // Enable chrono formatters
 | ||||
| #ifndef __cpp_lib_format | ||||
| #   define __cpp_lib_format 202110L | ||||
| #endif | ||||
| 
 | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| namespace scwx | ||||
|  | @ -5,8 +10,8 @@ namespace scwx | |||
| namespace util | ||||
| { | ||||
| 
 | ||||
| std::chrono::system_clock::time_point | ||||
| TimePoint(uint16_t modifiedJulianDate, uint32_t milliseconds) | ||||
| std::chrono::system_clock::time_point TimePoint(uint16_t modifiedJulianDate, | ||||
|                                                 uint32_t milliseconds) | ||||
| { | ||||
|    using namespace std::chrono; | ||||
|    using sys_days       = time_point<system_clock, days>; | ||||
|  | @ -16,5 +21,25 @@ TimePoint(uint16_t modifiedJulianDate, uint32_t milliseconds) | |||
|           std::chrono::milliseconds {milliseconds}; | ||||
| } | ||||
| 
 | ||||
| } // namespace qt
 | ||||
| std::string TimeString(std::chrono::system_clock::time_point time, | ||||
|                        const std::chrono::time_zone*         timeZone) | ||||
| { | ||||
|    using namespace std::chrono; | ||||
|    auto               timeInSeconds = time_point_cast<seconds>(time); | ||||
|    std::ostringstream os; | ||||
| 
 | ||||
|    if (timeZone != nullptr) | ||||
|    { | ||||
|       zoned_time zt = {current_zone(), timeInSeconds}; | ||||
|       os << zt; | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       os << timeInSeconds; | ||||
|    } | ||||
| 
 | ||||
|    return os.str(); | ||||
| } | ||||
| 
 | ||||
| } // namespace util
 | ||||
| } // namespace scwx
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat