mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 08:00:05 +00:00 
			
		
		
		
	Allow selection of radar smoothing
This commit is contained in:
		
							parent
							
								
									d3ae404f7a
								
							
						
					
					
						commit
						a8132ef9f1
					
				
					 7 changed files with 66 additions and 6 deletions
				
			
		|  | @ -322,6 +322,8 @@ MainWindow::MainWindow(QWidget* parent) : | ||||||
|    p->mapSettingsGroup_ = new ui::CollapsibleGroup(tr("Map Settings"), this); |    p->mapSettingsGroup_ = new ui::CollapsibleGroup(tr("Map Settings"), this); | ||||||
|    p->mapSettingsGroup_->GetContentsLayout()->addWidget(ui->mapStyleLabel); |    p->mapSettingsGroup_->GetContentsLayout()->addWidget(ui->mapStyleLabel); | ||||||
|    p->mapSettingsGroup_->GetContentsLayout()->addWidget(ui->mapStyleComboBox); |    p->mapSettingsGroup_->GetContentsLayout()->addWidget(ui->mapStyleComboBox); | ||||||
|  |    p->mapSettingsGroup_->GetContentsLayout()->addWidget( | ||||||
|  |       ui->smoothRadarDataCheckBox); | ||||||
|    p->mapSettingsGroup_->GetContentsLayout()->addWidget( |    p->mapSettingsGroup_->GetContentsLayout()->addWidget( | ||||||
|       ui->trackLocationCheckBox); |       ui->trackLocationCheckBox); | ||||||
|    ui->radarToolboxScrollAreaContents->layout()->replaceWidget( |    ui->radarToolboxScrollAreaContents->layout()->replaceWidget( | ||||||
|  | @ -1085,6 +1087,16 @@ void MainWindowImpl::ConnectOtherSignals() | ||||||
|                  } |                  } | ||||||
|               } |               } | ||||||
|            }); |            }); | ||||||
|  |    connect(mainWindow_->ui->smoothRadarDataCheckBox, | ||||||
|  |            &QCheckBox::checkStateChanged, | ||||||
|  |            mainWindow_, | ||||||
|  |            [this](Qt::CheckState state) | ||||||
|  |            { | ||||||
|  |               bool smoothingEnabled = (state == Qt::CheckState::Checked); | ||||||
|  | 
 | ||||||
|  |               // Turn on smoothing
 | ||||||
|  |               activeMap_->SetSmoothingEnabled(smoothingEnabled); | ||||||
|  |            }); | ||||||
|    connect(mainWindow_->ui->trackLocationCheckBox, |    connect(mainWindow_->ui->trackLocationCheckBox, | ||||||
|            &QCheckBox::checkStateChanged, |            &QCheckBox::checkStateChanged, | ||||||
|            mainWindow_, |            mainWindow_, | ||||||
|  | @ -1471,6 +1483,10 @@ void MainWindowImpl::UpdateRadarProductSettings() | ||||||
|    { |    { | ||||||
|       level2SettingsGroup_->setVisible(false); |       level2SettingsGroup_->setVisible(false); | ||||||
|    } |    } | ||||||
|  | 
 | ||||||
|  |    mainWindow_->ui->smoothRadarDataCheckBox->setCheckState( | ||||||
|  |       activeMap_->GetSmoothingEnabled() ? Qt::CheckState::Checked : | ||||||
|  |                                           Qt::CheckState::Unchecked); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MainWindowImpl::UpdateRadarSite() | void MainWindowImpl::UpdateRadarSite() | ||||||
|  |  | ||||||
|  | @ -153,8 +153,8 @@ | ||||||
|          <rect> |          <rect> | ||||||
|           <x>0</x> |           <x>0</x> | ||||||
|           <y>0</y> |           <y>0</y> | ||||||
|           <width>205</width> |           <width>190</width> | ||||||
|           <height>701</height> |           <height>680</height> | ||||||
|          </rect> |          </rect> | ||||||
|         </property> |         </property> | ||||||
|         <layout class="QVBoxLayout" name="verticalLayout_6"> |         <layout class="QVBoxLayout" name="verticalLayout_6"> | ||||||
|  | @ -329,6 +329,13 @@ | ||||||
|             <item> |             <item> | ||||||
|              <widget class="QComboBox" name="mapStyleComboBox"/> |              <widget class="QComboBox" name="mapStyleComboBox"/> | ||||||
|             </item> |             </item> | ||||||
|  |             <item> | ||||||
|  |              <widget class="QCheckBox" name="smoothRadarDataCheckBox"> | ||||||
|  |               <property name="text"> | ||||||
|  |                <string>Smooth Radar Data</string> | ||||||
|  |               </property> | ||||||
|  |              </widget> | ||||||
|  |             </item> | ||||||
|             <item> |             <item> | ||||||
|              <widget class="QCheckBox" name="trackLocationCheckBox"> |              <widget class="QCheckBox" name="trackLocationCheckBox"> | ||||||
|               <property name="text"> |               <property name="text"> | ||||||
|  |  | ||||||
|  | @ -225,7 +225,7 @@ public: | ||||||
|    std::shared_ptr<OverlayLayer>        overlayLayer_; |    std::shared_ptr<OverlayLayer>        overlayLayer_; | ||||||
|    std::shared_ptr<OverlayProductLayer> overlayProductLayer_ {nullptr}; |    std::shared_ptr<OverlayProductLayer> overlayProductLayer_ {nullptr}; | ||||||
|    std::shared_ptr<PlacefileLayer>      placefileLayer_; |    std::shared_ptr<PlacefileLayer>      placefileLayer_; | ||||||
|    std::shared_ptr<MarkerLayer>            markerLayer_; |    std::shared_ptr<MarkerLayer>         markerLayer_; | ||||||
|    std::shared_ptr<ColorTableLayer>     colorTableLayer_; |    std::shared_ptr<ColorTableLayer>     colorTableLayer_; | ||||||
|    std::shared_ptr<RadarSiteLayer>      radarSiteLayer_ {nullptr}; |    std::shared_ptr<RadarSiteLayer>      radarSiteLayer_ {nullptr}; | ||||||
| 
 | 
 | ||||||
|  | @ -233,6 +233,7 @@ public: | ||||||
| 
 | 
 | ||||||
|    bool autoRefreshEnabled_; |    bool autoRefreshEnabled_; | ||||||
|    bool autoUpdateEnabled_; |    bool autoUpdateEnabled_; | ||||||
|  |    bool smoothingEnabled_ {false}; | ||||||
| 
 | 
 | ||||||
|    common::Level2Product selectedLevel2Product_; |    common::Level2Product selectedLevel2Product_; | ||||||
| 
 | 
 | ||||||
|  | @ -727,6 +728,23 @@ std::uint16_t MapWidget::GetVcp() const | ||||||
|    } |    } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | bool MapWidget::GetSmoothingEnabled() const | ||||||
|  | { | ||||||
|  |    return p->smoothingEnabled_; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void MapWidget::SetSmoothingEnabled(bool smoothingEnabled) | ||||||
|  | { | ||||||
|  |    p->smoothingEnabled_ = smoothingEnabled; | ||||||
|  | 
 | ||||||
|  |    auto radarProductView = p->context_->radar_product_view(); | ||||||
|  |    if (radarProductView != nullptr) | ||||||
|  |    { | ||||||
|  |       radarProductView->set_smoothing_enabled(smoothingEnabled); | ||||||
|  |       radarProductView->Update(); | ||||||
|  |    } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void MapWidget::SelectElevation(float elevation) | void MapWidget::SelectElevation(float elevation) | ||||||
| { | { | ||||||
|    auto radarProductView = p->context_->radar_product_view(); |    auto radarProductView = p->context_->radar_product_view(); | ||||||
|  | @ -775,6 +793,7 @@ void MapWidget::SelectRadarProduct(common::RadarProductGroup group, | ||||||
| 
 | 
 | ||||||
|       radarProductView = view::RadarProductViewFactory::Create( |       radarProductView = view::RadarProductViewFactory::Create( | ||||||
|          group, productName, productCode, p->radarProductManager_); |          group, productName, productCode, p->radarProductManager_); | ||||||
|  |       radarProductView->set_smoothing_enabled(p->smoothingEnabled_); | ||||||
|       p->context_->set_radar_product_view(radarProductView); |       p->context_->set_radar_product_view(radarProductView); | ||||||
| 
 | 
 | ||||||
|       p->RadarProductViewConnect(); |       p->RadarProductViewConnect(); | ||||||
|  |  | ||||||
|  | @ -48,6 +48,7 @@ public: | ||||||
|    std::string                           GetRadarProductName() const; |    std::string                           GetRadarProductName() const; | ||||||
|    std::shared_ptr<config::RadarSite>    GetRadarSite() const; |    std::shared_ptr<config::RadarSite>    GetRadarSite() const; | ||||||
|    std::chrono::system_clock::time_point GetSelectedTime() const; |    std::chrono::system_clock::time_point GetSelectedTime() const; | ||||||
|  |    bool                                  GetSmoothingEnabled() const; | ||||||
|    std::uint16_t                         GetVcp() const; |    std::uint16_t                         GetVcp() const; | ||||||
| 
 | 
 | ||||||
|    void SelectElevation(float elevation); |    void SelectElevation(float elevation); | ||||||
|  | @ -117,6 +118,7 @@ public: | ||||||
|                          double pitch); |                          double pitch); | ||||||
|    void SetInitialMapStyle(const std::string& styleName); |    void SetInitialMapStyle(const std::string& styleName); | ||||||
|    void SetMapStyle(const std::string& styleName); |    void SetMapStyle(const std::string& styleName); | ||||||
|  |    void SetSmoothingEnabled(bool enabled); | ||||||
| 
 | 
 | ||||||
|    /**
 |    /**
 | ||||||
|     * Updates the coordinates associated with mouse movement from another map. |     * Updates the coordinates associated with mouse movement from another map. | ||||||
|  |  | ||||||
|  | @ -131,6 +131,8 @@ public: | ||||||
|    std::shared_ptr<wsr88d::rda::GenericRadarData::MomentDataBlock> |    std::shared_ptr<wsr88d::rda::GenericRadarData::MomentDataBlock> | ||||||
|       momentDataBlock0_; |       momentDataBlock0_; | ||||||
| 
 | 
 | ||||||
|  |    bool prevSmoothingEnabled_ {false}; | ||||||
|  | 
 | ||||||
|    std::vector<float>    coordinates_ {}; |    std::vector<float>    coordinates_ {}; | ||||||
|    std::vector<float>    vertices_ {}; |    std::vector<float>    vertices_ {}; | ||||||
|    std::vector<uint8_t>  dataMoments8_ {}; |    std::vector<uint8_t>  dataMoments8_ {}; | ||||||
|  | @ -512,6 +514,7 @@ void Level2ProductView::ComputeSweep() | ||||||
| 
 | 
 | ||||||
|    std::shared_ptr<manager::RadarProductManager> radarProductManager = |    std::shared_ptr<manager::RadarProductManager> radarProductManager = | ||||||
|       radar_product_manager(); |       radar_product_manager(); | ||||||
|  |    const bool smoothingEnabled = smoothing_enabled(); | ||||||
| 
 | 
 | ||||||
|    std::shared_ptr<wsr88d::rda::ElevationScan> radarData; |    std::shared_ptr<wsr88d::rda::ElevationScan> radarData; | ||||||
|    std::chrono::system_clock::time_point       requestedTime {selected_time()}; |    std::chrono::system_clock::time_point       requestedTime {selected_time()}; | ||||||
|  | @ -524,14 +527,14 @@ void Level2ProductView::ComputeSweep() | ||||||
|       Q_EMIT SweepNotComputed(types::NoUpdateReason::NotLoaded); |       Q_EMIT SweepNotComputed(types::NoUpdateReason::NotLoaded); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
|    if (radarData == p->elevationScan_) |    if (radarData == p->elevationScan_ && | ||||||
|  |        smoothingEnabled == p->prevSmoothingEnabled_) | ||||||
|    { |    { | ||||||
|       Q_EMIT SweepNotComputed(types::NoUpdateReason::NoChange); |       Q_EMIT SweepNotComputed(types::NoUpdateReason::NoChange); | ||||||
|       return; |       return; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    // TODO: Where does this come from?
 |    p->prevSmoothingEnabled_ = smoothingEnabled; | ||||||
|    bool smoothingEnabled = false; |  | ||||||
| 
 | 
 | ||||||
|    logger_->debug("Computing Sweep"); |    logger_->debug("Computing Sweep"); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -41,6 +41,7 @@ public: | ||||||
|    std::mutex sweepMutex_; |    std::mutex sweepMutex_; | ||||||
| 
 | 
 | ||||||
|    std::chrono::system_clock::time_point selectedTime_; |    std::chrono::system_clock::time_point selectedTime_; | ||||||
|  |    bool                                  smoothingEnabled_ {false}; | ||||||
| 
 | 
 | ||||||
|    std::shared_ptr<manager::RadarProductManager> radarProductManager_; |    std::shared_ptr<manager::RadarProductManager> radarProductManager_; | ||||||
| }; | }; | ||||||
|  | @ -87,6 +88,11 @@ std::chrono::system_clock::time_point RadarProductView::selected_time() const | ||||||
|    return p->selectedTime_; |    return p->selectedTime_; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | bool RadarProductView::smoothing_enabled() const | ||||||
|  | { | ||||||
|  |    return p->smoothingEnabled_; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| std::chrono::system_clock::time_point RadarProductView::sweep_time() const | std::chrono::system_clock::time_point RadarProductView::sweep_time() const | ||||||
| { | { | ||||||
|    return {}; |    return {}; | ||||||
|  | @ -105,6 +111,11 @@ void RadarProductView::set_radar_product_manager( | ||||||
|    ConnectRadarProductManager(); |    ConnectRadarProductManager(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void RadarProductView::set_smoothing_enabled(bool smoothingEnabled) | ||||||
|  | { | ||||||
|  |    p->smoothingEnabled_ = smoothingEnabled; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void RadarProductView::Initialize() | void RadarProductView::Initialize() | ||||||
| { | { | ||||||
|    ComputeSweep(); |    ComputeSweep(); | ||||||
|  |  | ||||||
|  | @ -49,10 +49,12 @@ public: | ||||||
| 
 | 
 | ||||||
|    std::shared_ptr<manager::RadarProductManager> radar_product_manager() const; |    std::shared_ptr<manager::RadarProductManager> radar_product_manager() const; | ||||||
|    std::chrono::system_clock::time_point         selected_time() const; |    std::chrono::system_clock::time_point         selected_time() const; | ||||||
|  |    bool                                          smoothing_enabled() const; | ||||||
|    std::mutex&                                   sweep_mutex(); |    std::mutex&                                   sweep_mutex(); | ||||||
| 
 | 
 | ||||||
|    void set_radar_product_manager( |    void set_radar_product_manager( | ||||||
|       std::shared_ptr<manager::RadarProductManager> radarProductManager); |       std::shared_ptr<manager::RadarProductManager> radarProductManager); | ||||||
|  |    void set_smoothing_enabled(bool smoothingEnabled); | ||||||
| 
 | 
 | ||||||
|    void Initialize(); |    void Initialize(); | ||||||
|    virtual void |    virtual void | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat