mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 07:20:04 +00:00 
			
		
		
		
	Display time zone according to settings
This commit is contained in:
		
							parent
							
								
									5fb9dc6a5f
								
							
						
					
					
						commit
						d3375de968
					
				
					 4 changed files with 44 additions and 15 deletions
				
			
		|  | @ -1,12 +1,13 @@ | |||
| #include <scwx/qt/manager/radar_product_manager.hpp> | ||||
| #include <scwx/qt/manager/radar_product_manager_notifier.hpp> | ||||
| #include <scwx/qt/settings/general_settings.hpp> | ||||
| #include <scwx/qt/types/time_types.hpp> | ||||
| #include <scwx/qt/util/geographic_lib.hpp> | ||||
| #include <scwx/common/constants.hpp> | ||||
| #include <scwx/provider/nexrad_data_provider_factory.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/map.hpp> | ||||
| #include <scwx/util/threads.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| #include <scwx/wsr88d/nexrad_file_factory.hpp> | ||||
| 
 | ||||
| #include <deque> | ||||
|  | @ -391,6 +392,34 @@ RadarProductManager::coordinates(common::RadialSize radialSize) const | |||
|       throw std::invalid_argument("Invalid radial size"); | ||||
|    } | ||||
| } | ||||
| const scwx::util::time_zone* RadarProductManager::default_time_zone() const | ||||
| { | ||||
|    types::DefaultTimeZone defaultTimeZone = types::GetDefaultTimeZone( | ||||
|       settings::GeneralSettings::Instance().default_time_zone().GetValue()); | ||||
| 
 | ||||
|    switch (defaultTimeZone) | ||||
|    { | ||||
|    case types::DefaultTimeZone::Radar: | ||||
|    { | ||||
|       auto radarSite = radar_site(); | ||||
|       if (radarSite != nullptr) | ||||
|       { | ||||
|          return radarSite->time_zone(); | ||||
|       } | ||||
|       [[fallthrough]]; | ||||
|    } | ||||
| 
 | ||||
|    case types::DefaultTimeZone::Local: | ||||
| #if defined(_MSC_VER) | ||||
|       return std::chrono::current_zone(); | ||||
| #else | ||||
|       return date::current_zone(); | ||||
| #endif | ||||
| 
 | ||||
|    default: | ||||
|       return nullptr; | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| float RadarProductManager::gate_size() const | ||||
| { | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| #include <scwx/qt/config/radar_site.hpp> | ||||
| #include <scwx/qt/request/nexrad_file_request.hpp> | ||||
| #include <scwx/qt/types/radar_product_record.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| #include <scwx/wsr88d/ar2v_file.hpp> | ||||
| #include <scwx/wsr88d/level3_file.hpp> | ||||
| 
 | ||||
|  | @ -41,8 +42,9 @@ public: | |||
|    static void DumpRecords(); | ||||
| 
 | ||||
|    const std::vector<float>& coordinates(common::RadialSize radialSize) const; | ||||
|    float                     gate_size() const; | ||||
|    std::string               radar_id() const; | ||||
|    const scwx::util::time_zone*       default_time_zone() const; | ||||
|    float                              gate_size() const; | ||||
|    std::string                        radar_id() const; | ||||
|    std::shared_ptr<config::RadarSite> radar_site() const; | ||||
| 
 | ||||
|    void Initialize(); | ||||
|  |  | |||
|  | @ -288,13 +288,12 @@ void OverlayLayer::Render(const QMapLibre::CustomLayerRenderParameters& params) | |||
|       scwx::util::ClockFormat clockFormat = scwx::util::GetClockFormat( | ||||
|          settings::GeneralSettings::Instance().clock_format().GetValue()); | ||||
| 
 | ||||
|       const scwx::util::time_zone* currentZone; | ||||
|       auto radarProductManager = radarProductView->radar_product_manager(); | ||||
| 
 | ||||
| #if defined(_MSC_VER) | ||||
|       currentZone = std::chrono::current_zone(); | ||||
| #else | ||||
|       currentZone = date::current_zone(); | ||||
| #endif | ||||
|       const scwx::util::time_zone* currentZone = | ||||
|          (radarProductManager != nullptr) ? | ||||
|             radarProductManager->default_time_zone() : | ||||
|             nullptr; | ||||
| 
 | ||||
|       p->sweepTimeString_ = scwx::util::TimeString( | ||||
|          radarProductView->sweep_time(), clockFormat, currentZone, false); | ||||
|  |  | |||
|  | @ -180,13 +180,12 @@ Level3ProductView::GetDescriptionFields() const | |||
|       util::ClockFormat clockFormat = util::GetClockFormat( | ||||
|          settings::GeneralSettings::Instance().clock_format().GetValue()); | ||||
| 
 | ||||
|       const scwx::util::time_zone* currentZone; | ||||
|       auto radarProductManager = radar_product_manager(); | ||||
| 
 | ||||
| #if defined(_MSC_VER) | ||||
|       currentZone = std::chrono::current_zone(); | ||||
| #else | ||||
|       currentZone = date::current_zone(); | ||||
| #endif | ||||
|       const scwx::util::time_zone* currentZone = | ||||
|          (radarProductManager != nullptr) ? | ||||
|             radarProductManager->default_time_zone() : | ||||
|             nullptr; | ||||
| 
 | ||||
|       auto descriptionBlock = p->graphicMessage_->description_block(); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat