mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 04:50:06 +00:00 
			
		
		
		
	Add indicator of what level is currently being updated with level 2 chunks.
This commit is contained in:
		
							parent
							
								
									6ca76b9eca
								
							
						
					
					
						commit
						0bda6296c0
					
				
					 9 changed files with 114 additions and 4 deletions
				
			
		|  | @ -963,6 +963,13 @@ void MainWindowImpl::ConnectMapSignals() | |||
|             } | ||||
|          }, | ||||
|          Qt::QueuedConnection); | ||||
|       connect( | ||||
|          mapWidget, | ||||
|          &map::MapWidget::IncomingLevel2ElevationChanged, | ||||
|          this, | ||||
|          [this](float incomingElevation) | ||||
|          { level2SettingsWidget_->UpdateIncomingElevation(incomingElevation); }, | ||||
|          Qt::QueuedConnection); | ||||
|    } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ | |||
| #include <scwx/qt/types/time_types.hpp> | ||||
| #include <scwx/qt/util/geographic_lib.hpp> | ||||
| #include <scwx/common/constants.hpp> | ||||
| #include <scwx/provider/aws_level2_chunks_data_provider.hpp> | ||||
| #include <scwx/provider/nexrad_data_provider_factory.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/map.hpp> | ||||
|  | @ -271,6 +272,8 @@ public: | |||
|    common::Level3ProductCategoryMap availableCategoryMap_ {}; | ||||
|    std::shared_mutex                availableCategoryMutex_ {}; | ||||
| 
 | ||||
|    float incomingLevel2Elevation_ {-90}; | ||||
| 
 | ||||
|    std::unordered_map<boost::uuids::uuid, | ||||
|                       std::shared_ptr<ProviderManager>, | ||||
|                       boost::hash<boost::uuids::uuid>> | ||||
|  | @ -450,6 +453,11 @@ float RadarProductManager::gate_size() const | |||
|    return (is_tdwr()) ? 150.0f : 250.0f; | ||||
| } | ||||
| 
 | ||||
| float RadarProductManager::incoming_level_2_elevation() const | ||||
| { | ||||
|    return p->incomingLevel2Elevation_; | ||||
| } | ||||
| 
 | ||||
| std::string RadarProductManager::radar_id() const | ||||
| { | ||||
|    return p->radarId_; | ||||
|  | @ -1542,6 +1550,16 @@ RadarProductManager::GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType, | |||
|          foundTime        = std::chrono::floor<std::chrono::seconds>( | ||||
|             scwx::util::TimePoint(radarData0->modified_julian_date(), | ||||
|                                   radarData0->collection_time())); | ||||
| 
 | ||||
|          const float incomingElevation = | ||||
|             std::dynamic_pointer_cast<provider::AwsLevel2ChunksDataProvider>( | ||||
|                p->level2ChunksProviderManager_->provider_) | ||||
|                ->GetCurrentElevation(); | ||||
|          if (incomingElevation != p->incomingLevel2Elevation_) | ||||
|          { | ||||
|             p->incomingLevel2Elevation_ = incomingElevation; | ||||
|             Q_EMIT IncomingLevel2ElevationChanged(incomingElevation); | ||||
|          } | ||||
|       } | ||||
|    } | ||||
|    else // It is not in the chunk provider, so get it from the archive
 | ||||
|  | @ -1576,6 +1594,12 @@ RadarProductManager::GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType, | |||
|                   elevationCut  = recordElevationCut; | ||||
|                   elevationCuts = std::move(recordElevationCuts); | ||||
|                   foundTime     = collectionTime; | ||||
| 
 | ||||
|                   if (p->incomingLevel2Elevation_ != -90) | ||||
|                   { | ||||
|                      p->incomingLevel2Elevation_ = -90; | ||||
|                      Q_EMIT IncomingLevel2ElevationChanged(-90); | ||||
|                   } | ||||
|                } | ||||
|             } | ||||
|          } | ||||
|  |  | |||
|  | @ -43,10 +43,11 @@ public: | |||
| 
 | ||||
|    [[nodiscard]] const std::vector<float>& | ||||
|    coordinates(common::RadialSize radialSize, bool smoothingEnabled) const; | ||||
|    [[nodiscard]] const scwx::util::time_zone*       default_time_zone() const; | ||||
|    [[nodiscard]] bool                               is_tdwr() const; | ||||
|    [[nodiscard]] float                              gate_size() const; | ||||
|    [[nodiscard]] std::string                        radar_id() const; | ||||
|    [[nodiscard]] const scwx::util::time_zone* default_time_zone() const; | ||||
|    [[nodiscard]] float                        gate_size() const; | ||||
|    [[nodiscard]] float       incoming_level_2_elevation() const; | ||||
|    [[nodiscard]] bool        is_tdwr() const; | ||||
|    [[nodiscard]] std::string radar_id() const; | ||||
|    [[nodiscard]] std::shared_ptr<config::RadarSite> radar_site() const; | ||||
| 
 | ||||
|    void Initialize(); | ||||
|  | @ -148,6 +149,7 @@ signals: | |||
|    void NewDataAvailable(common::RadarProductGroup             group, | ||||
|                          const std::string&                    product, | ||||
|                          std::chrono::system_clock::time_point latestTime); | ||||
|    void IncomingLevel2ElevationChanged(float incomingElevation); | ||||
| 
 | ||||
| private: | ||||
|    std::unique_ptr<RadarProductManagerImpl> p; | ||||
|  |  | |||
|  | @ -656,6 +656,12 @@ std::vector<float> MapWidget::GetElevationCuts() const | |||
|    } | ||||
| } | ||||
| 
 | ||||
| float MapWidget::GetIncomingLevel2Elevation() const | ||||
| { | ||||
|    return p->radarProductManager_->incoming_level_2_elevation(); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| common::Level2Product | ||||
| MapWidgetImpl::GetLevel2ProductOrDefault(const std::string& productName) const | ||||
| { | ||||
|  | @ -1796,6 +1802,14 @@ void MapWidgetImpl::RadarProductManagerConnect() | |||
| { | ||||
|    if (radarProductManager_ != nullptr) | ||||
|    { | ||||
|       connect(radarProductManager_.get(), | ||||
|               &manager::RadarProductManager::IncomingLevel2ElevationChanged, | ||||
|               this, | ||||
|               [this](float incomingElevation) | ||||
|               { | ||||
|                  Q_EMIT widget_->IncomingLevel2ElevationChanged( | ||||
|                     incomingElevation); | ||||
|               }); | ||||
|       connect(radarProductManager_.get(), | ||||
|               &manager::RadarProductManager::Level3ProductsChanged, | ||||
|               this, | ||||
|  | @ -1916,6 +1930,10 @@ void MapWidgetImpl::RadarProductManagerDisconnect() | |||
|                  &manager::RadarProductManager::NewDataAvailable, | ||||
|                  this, | ||||
|                  nullptr); | ||||
|       disconnect(radarProductManager_.get(), | ||||
|                  &manager::RadarProductManager::IncomingLevel2ElevationChanged, | ||||
|                  this, | ||||
|                  nullptr); | ||||
|    } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -45,6 +45,7 @@ public: | |||
|                                            GetAvailableLevel3Categories(); | ||||
|    [[nodiscard]] std::optional<float>      GetElevation() const; | ||||
|    [[nodiscard]] std::vector<float>        GetElevationCuts() const; | ||||
|    [[nodiscard]] float                     GetIncomingLevel2Elevation() const; | ||||
|    [[nodiscard]] std::vector<std::string>  GetLevel3Products(); | ||||
|    [[nodiscard]] std::string               GetMapStyle() const; | ||||
|    [[nodiscard]] common::RadarProductGroup GetRadarProductGroup() const; | ||||
|  | @ -184,6 +185,7 @@ signals: | |||
|    void RadarSweepUpdated(); | ||||
|    void RadarSweepNotUpdated(types::NoUpdateReason reason); | ||||
|    void WidgetPainted(); | ||||
|    void IncomingLevel2ElevationChanged(float incomingElevation); | ||||
| }; | ||||
| 
 | ||||
| } // namespace map
 | ||||
|  |  | |||
|  | @ -1,3 +1,4 @@ | |||
| #include <qlabel.h> | ||||
| #include <scwx/qt/ui/level2_settings_widget.hpp> | ||||
| #include <scwx/qt/ui/flow_layout.hpp> | ||||
| #include <scwx/qt/manager/hotkey_manager.hpp> | ||||
|  | @ -30,6 +31,7 @@ public: | |||
|        self_ {self}, | ||||
|        layout_ {new QVBoxLayout(self)}, | ||||
|        elevationGroupBox_ {}, | ||||
|        incomingElevationLabel_ {}, | ||||
|        elevationButtons_ {}, | ||||
|        elevationCuts_ {}, | ||||
|        elevationButtonsChanged_ {false}, | ||||
|  | @ -39,10 +41,14 @@ public: | |||
|    { | ||||
|       layout_->setContentsMargins(0, 0, 0, 0); | ||||
| 
 | ||||
|       incomingElevationLabel_ = new QLabel("", self); | ||||
|       layout_->addWidget(incomingElevationLabel_); | ||||
| 
 | ||||
|       elevationGroupBox_ = new QGroupBox(tr("Elevation"), self); | ||||
|       new ui::FlowLayout(elevationGroupBox_); | ||||
|       layout_->addWidget(elevationGroupBox_); | ||||
| 
 | ||||
| 
 | ||||
|       settingsGroupBox_       = new QGroupBox(tr("Settings"), self); | ||||
|       QLayout* settingsLayout = new QVBoxLayout(settingsGroupBox_); | ||||
|       layout_->addWidget(settingsGroupBox_); | ||||
|  | @ -67,6 +73,7 @@ public: | |||
|    QLayout*              layout_; | ||||
| 
 | ||||
|    QGroupBox*              elevationGroupBox_; | ||||
|    QLabel*                 incomingElevationLabel_; | ||||
|    std::list<QToolButton*> elevationButtons_; | ||||
|    std::vector<float>      elevationCuts_; | ||||
|    bool                    elevationButtonsChanged_; | ||||
|  | @ -240,12 +247,19 @@ void Level2SettingsWidget::UpdateElevationSelection(float elevation) | |||
|    p->currentElevationButton_ = newElevationButton; | ||||
| } | ||||
| 
 | ||||
| void Level2SettingsWidget::UpdateIncomingElevation(float incomingElevation) | ||||
| { | ||||
|    p->incomingElevationLabel_->setText("Incoming Elevation: " + | ||||
|       QString::number(incomingElevation, 'f', 1) + common::Characters::DEGREE); | ||||
| } | ||||
| 
 | ||||
| void Level2SettingsWidget::UpdateSettings(map::MapWidget* activeMap) | ||||
| { | ||||
|    std::optional<float> currentElevationOption = activeMap->GetElevation(); | ||||
|    const float          currentElevation = | ||||
|       currentElevationOption.has_value() ? *currentElevationOption : 0.0f; | ||||
|    std::vector<float> elevationCuts    = activeMap->GetElevationCuts(); | ||||
|    float incomingElevation = activeMap->GetIncomingLevel2Elevation(); | ||||
| 
 | ||||
|    if (p->elevationCuts_ != elevationCuts) | ||||
|    { | ||||
|  | @ -279,6 +293,7 @@ void Level2SettingsWidget::UpdateSettings(map::MapWidget* activeMap) | |||
|    } | ||||
| 
 | ||||
|    UpdateElevationSelection(currentElevation); | ||||
|    UpdateIncomingElevation(incomingElevation); | ||||
| } | ||||
| 
 | ||||
| } // namespace ui
 | ||||
|  |  | |||
|  | @ -23,6 +23,7 @@ public: | |||
|    void showEvent(QShowEvent* event) override; | ||||
| 
 | ||||
|    void UpdateElevationSelection(float elevation); | ||||
|    void UpdateIncomingElevation(float incomingElevation); | ||||
|    void UpdateSettings(map::MapWidget* activeMap); | ||||
| 
 | ||||
| signals: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak