mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 12:30:04 +00:00 
			
		
		
		
	Disable range folding display by default when smoothing
This commit is contained in:
		
							parent
							
								
									cc0ebcd13c
								
							
						
					
					
						commit
						a65504a2cb
					
				
					 5 changed files with 107 additions and 32 deletions
				
			
		|  | @ -135,6 +135,7 @@ public: | |||
|    std::shared_ptr<wsr88d::rda::GenericRadarData::MomentDataBlock> | ||||
|       momentDataBlock0_; | ||||
| 
 | ||||
|    bool lastShowSmoothedRangeFolding_ {false}; | ||||
|    bool lastSmoothingEnabled_ {false}; | ||||
| 
 | ||||
|    std::vector<float>    coordinates_ {}; | ||||
|  | @ -144,6 +145,8 @@ public: | |||
|    std::vector<uint8_t>  cfpMoments_ {}; | ||||
|    std::uint16_t         edgeValue_ {}; | ||||
| 
 | ||||
|    bool showSmoothedRangeFolding_ {false}; | ||||
| 
 | ||||
|    float                    latitude_; | ||||
|    float                    longitude_; | ||||
|    float                    elevationCut_; | ||||
|  | @ -519,7 +522,9 @@ void Level2ProductView::ComputeSweep() | |||
| 
 | ||||
|    std::shared_ptr<manager::RadarProductManager> radarProductManager = | ||||
|       radar_product_manager(); | ||||
|    const bool smoothingEnabled = smoothing_enabled(); | ||||
|    const bool smoothingEnabled    = smoothing_enabled(); | ||||
|    p->showSmoothedRangeFolding_   = show_smoothed_range_folding(); | ||||
|    bool& showSmoothedRangeFolding = p->showSmoothedRangeFolding_; | ||||
| 
 | ||||
|    std::shared_ptr<wsr88d::rda::ElevationScan> radarData; | ||||
|    std::chrono::system_clock::time_point       requestedTime {selected_time()}; | ||||
|  | @ -533,13 +538,16 @@ void Level2ProductView::ComputeSweep() | |||
|       return; | ||||
|    } | ||||
|    if (radarData == p->elevationScan_ && | ||||
|        smoothingEnabled == p->lastSmoothingEnabled_) | ||||
|        smoothingEnabled == p->lastSmoothingEnabled_ && | ||||
|        (showSmoothedRangeFolding == p->lastShowSmoothedRangeFolding_ || | ||||
|         !smoothingEnabled)) | ||||
|    { | ||||
|       Q_EMIT SweepNotComputed(types::NoUpdateReason::NoChange); | ||||
|       return; | ||||
|    } | ||||
| 
 | ||||
|    p->lastSmoothingEnabled_ = smoothingEnabled; | ||||
|    p->lastShowSmoothedRangeFolding_ = showSmoothedRangeFolding; | ||||
|    p->lastSmoothingEnabled_         = smoothingEnabled; | ||||
| 
 | ||||
|    logger_->debug("Computing Sweep"); | ||||
| 
 | ||||
|  | @ -798,10 +806,16 @@ void Level2ProductView::ComputeSweep() | |||
|                const std::uint8_t& dm3 = nextDataMomentsArray8[i]; | ||||
|                const std::uint8_t& dm4 = nextDataMomentsArray8[i + 1]; | ||||
| 
 | ||||
|                if (dm1 < snrThreshold && dm1 != RANGE_FOLDED && | ||||
|                    dm2 < snrThreshold && dm2 != RANGE_FOLDED && | ||||
|                    dm3 < snrThreshold && dm3 != RANGE_FOLDED && | ||||
|                    dm4 < snrThreshold && dm4 != RANGE_FOLDED) | ||||
|                if ((!showSmoothedRangeFolding && //
 | ||||
|                     (dm1 < snrThreshold || dm1 == RANGE_FOLDED) && | ||||
|                     (dm2 < snrThreshold || dm2 == RANGE_FOLDED) && | ||||
|                     (dm3 < snrThreshold || dm3 == RANGE_FOLDED) && | ||||
|                     (dm4 < snrThreshold || dm4 == RANGE_FOLDED)) || | ||||
|                    (showSmoothedRangeFolding && //
 | ||||
|                     dm1 < snrThreshold && dm1 != RANGE_FOLDED && | ||||
|                     dm2 < snrThreshold && dm2 != RANGE_FOLDED && | ||||
|                     dm3 < snrThreshold && dm3 != RANGE_FOLDED && | ||||
|                     dm4 < snrThreshold && dm4 != RANGE_FOLDED)) | ||||
|                { | ||||
|                   // Skip only if all data moments are hidden
 | ||||
|                   continue; | ||||
|  | @ -855,10 +869,16 @@ void Level2ProductView::ComputeSweep() | |||
|                const std::uint16_t& dm3 = nextDataMomentsArray16[i]; | ||||
|                const std::uint16_t& dm4 = nextDataMomentsArray16[i + 1]; | ||||
| 
 | ||||
|                if (dm1 < snrThreshold && dm1 != RANGE_FOLDED && | ||||
|                    dm2 < snrThreshold && dm2 != RANGE_FOLDED && | ||||
|                    dm3 < snrThreshold && dm3 != RANGE_FOLDED && | ||||
|                    dm4 < snrThreshold && dm4 != RANGE_FOLDED) | ||||
|                if ((!showSmoothedRangeFolding && //
 | ||||
|                     (dm1 < snrThreshold || dm1 == RANGE_FOLDED) && | ||||
|                     (dm2 < snrThreshold || dm2 == RANGE_FOLDED) && | ||||
|                     (dm3 < snrThreshold || dm3 == RANGE_FOLDED) && | ||||
|                     (dm4 < snrThreshold || dm4 == RANGE_FOLDED)) || | ||||
|                    (showSmoothedRangeFolding && //
 | ||||
|                     dm1 < snrThreshold && dm1 != RANGE_FOLDED && | ||||
|                     dm2 < snrThreshold && dm2 != RANGE_FOLDED && | ||||
|                     dm3 < snrThreshold && dm3 != RANGE_FOLDED && | ||||
|                     dm4 < snrThreshold && dm4 != RANGE_FOLDED)) | ||||
|                { | ||||
|                   // Skip only if all data moments are hidden
 | ||||
|                   continue; | ||||
|  | @ -1012,7 +1032,8 @@ void Level2ProductView::Impl::ComputeEdgeValue() | |||
| template<typename T> | ||||
| T Level2ProductView::Impl::RemapDataMoment(T dataMoment) const | ||||
| { | ||||
|    if (dataMoment != 0) | ||||
|    if (dataMoment != 0 && | ||||
|        (dataMoment != RANGE_FOLDED || showSmoothedRangeFolding_)) | ||||
|    { | ||||
|       return dataMoment; | ||||
|    } | ||||
|  |  | |||
|  | @ -58,7 +58,10 @@ public: | |||
|    std::vector<std::uint8_t> dataMoments8_ {}; | ||||
|    std::uint8_t              edgeValue_ {}; | ||||
| 
 | ||||
|    bool showSmoothedRangeFolding_ {false}; | ||||
| 
 | ||||
|    std::shared_ptr<wsr88d::rpg::GenericRadialDataPacket> lastRadialData_ {}; | ||||
|    bool lastShowSmoothedRangeFolding_ {false}; | ||||
|    bool lastSmoothingEnabled_ {false}; | ||||
| 
 | ||||
|    float         latitude_; | ||||
|  | @ -130,7 +133,9 @@ void Level3RadialView::ComputeSweep() | |||
| 
 | ||||
|    std::shared_ptr<manager::RadarProductManager> radarProductManager = | ||||
|       radar_product_manager(); | ||||
|    const bool smoothingEnabled = smoothing_enabled(); | ||||
|    const bool smoothingEnabled    = smoothing_enabled(); | ||||
|    p->showSmoothedRangeFolding_   = show_smoothed_range_folding(); | ||||
|    bool& showSmoothedRangeFolding = p->showSmoothedRangeFolding_; | ||||
| 
 | ||||
|    // Retrieve message from Radar Product Manager
 | ||||
|    std::shared_ptr<wsr88d::rpg::Level3Message> message; | ||||
|  | @ -162,7 +167,9 @@ void Level3RadialView::ComputeSweep() | |||
|       return; | ||||
|    } | ||||
|    else if (gpm == graphic_product_message() && | ||||
|             smoothingEnabled == p->lastSmoothingEnabled_) | ||||
|             smoothingEnabled == p->lastSmoothingEnabled_ && | ||||
|             (showSmoothedRangeFolding == p->lastShowSmoothedRangeFolding_ || | ||||
|              !smoothingEnabled)) | ||||
|    { | ||||
|       // Skip if this is the message we previously processed
 | ||||
|       Q_EMIT SweepNotComputed(types::NoUpdateReason::NoChange); | ||||
|  | @ -170,7 +177,8 @@ void Level3RadialView::ComputeSweep() | |||
|    } | ||||
|    set_graphic_product_message(gpm); | ||||
| 
 | ||||
|    p->lastSmoothingEnabled_ = smoothingEnabled; | ||||
|    p->lastShowSmoothedRangeFolding_ = showSmoothedRangeFolding; | ||||
|    p->lastSmoothingEnabled_         = smoothingEnabled; | ||||
| 
 | ||||
|    // A message with radial data should have a Product Description Block and
 | ||||
|    // Product Symbology Block
 | ||||
|  | @ -398,10 +406,16 @@ void Level3RadialView::ComputeSweep() | |||
|             const std::uint8_t& dm3 = nextDataMomentsArray8[i]; | ||||
|             const std::uint8_t& dm4 = nextDataMomentsArray8[i + 1]; | ||||
| 
 | ||||
|             if (dm1 < snrThreshold && dm1 != RANGE_FOLDED && | ||||
|                 dm2 < snrThreshold && dm2 != RANGE_FOLDED && | ||||
|                 dm3 < snrThreshold && dm3 != RANGE_FOLDED && | ||||
|                 dm4 < snrThreshold && dm4 != RANGE_FOLDED) | ||||
|             if ((!showSmoothedRangeFolding && //
 | ||||
|                  (dm1 < snrThreshold || dm1 == RANGE_FOLDED) && | ||||
|                  (dm2 < snrThreshold || dm2 == RANGE_FOLDED) && | ||||
|                  (dm3 < snrThreshold || dm3 == RANGE_FOLDED) && | ||||
|                  (dm4 < snrThreshold || dm4 == RANGE_FOLDED)) || | ||||
|                 (showSmoothedRangeFolding && //
 | ||||
|                  dm1 < snrThreshold && dm1 != RANGE_FOLDED && | ||||
|                  dm2 < snrThreshold && dm2 != RANGE_FOLDED && | ||||
|                  dm3 < snrThreshold && dm3 != RANGE_FOLDED && | ||||
|                  dm4 < snrThreshold && dm4 != RANGE_FOLDED)) | ||||
|             { | ||||
|                // Skip only if all data moments are hidden
 | ||||
|                continue; | ||||
|  | @ -502,7 +516,8 @@ void Level3RadialView::ComputeSweep() | |||
| std::uint8_t | ||||
| Level3RadialView::Impl::RemapDataMoment(std::uint8_t dataMoment) const | ||||
| { | ||||
|    if (dataMoment != 0) | ||||
|    if (dataMoment != 0 && | ||||
|        (dataMoment != RANGE_FOLDED || showSmoothedRangeFolding_)) | ||||
|    { | ||||
|       return dataMoment; | ||||
|    } | ||||
|  |  | |||
|  | @ -41,8 +41,11 @@ public: | |||
|    std::vector<std::uint8_t> dataMoments8_ {}; | ||||
|    std::uint8_t              edgeValue_ {}; | ||||
| 
 | ||||
|    bool showSmoothedRangeFolding_ {false}; | ||||
| 
 | ||||
|    std::shared_ptr<wsr88d::rpg::RasterDataPacket> lastRasterData_ {}; | ||||
|    bool                                           lastSmoothingEnabled_ {false}; | ||||
|    bool lastShowSmoothedRangeFolding_ {false}; | ||||
|    bool lastSmoothingEnabled_ {false}; | ||||
| 
 | ||||
|    float    latitude_; | ||||
|    float    longitude_; | ||||
|  | @ -113,7 +116,9 @@ void Level3RasterView::ComputeSweep() | |||
| 
 | ||||
|    std::shared_ptr<manager::RadarProductManager> radarProductManager = | ||||
|       radar_product_manager(); | ||||
|    const bool smoothingEnabled = smoothing_enabled(); | ||||
|    const bool smoothingEnabled    = smoothing_enabled(); | ||||
|    p->showSmoothedRangeFolding_   = show_smoothed_range_folding(); | ||||
|    bool& showSmoothedRangeFolding = p->showSmoothedRangeFolding_; | ||||
| 
 | ||||
|    // Retrieve message from Radar Product Manager
 | ||||
|    std::shared_ptr<wsr88d::rpg::Level3Message> message; | ||||
|  | @ -145,7 +150,9 @@ void Level3RasterView::ComputeSweep() | |||
|       return; | ||||
|    } | ||||
|    else if (gpm == graphic_product_message() && | ||||
|             smoothingEnabled == p->lastSmoothingEnabled_) | ||||
|             smoothingEnabled == p->lastSmoothingEnabled_ && | ||||
|             (showSmoothedRangeFolding == p->lastShowSmoothedRangeFolding_ || | ||||
|              !smoothingEnabled)) | ||||
|    { | ||||
|       // Skip if this is the message we previously processed
 | ||||
|       Q_EMIT SweepNotComputed(types::NoUpdateReason::NoChange); | ||||
|  | @ -153,7 +160,8 @@ void Level3RasterView::ComputeSweep() | |||
|    } | ||||
|    set_graphic_product_message(gpm); | ||||
| 
 | ||||
|    p->lastSmoothingEnabled_ = smoothingEnabled; | ||||
|    p->lastShowSmoothedRangeFolding_ = showSmoothedRangeFolding; | ||||
|    p->lastSmoothingEnabled_         = smoothingEnabled; | ||||
| 
 | ||||
|    // A message with radial data should have a Product Description Block and
 | ||||
|    // Product Symbology Block
 | ||||
|  | @ -364,10 +372,16 @@ void Level3RasterView::ComputeSweep() | |||
|             const std::uint8_t& dm3 = nextDataMomentsArray8[bin]; | ||||
|             const std::uint8_t& dm4 = nextDataMomentsArray8[bin + 1]; | ||||
| 
 | ||||
|             if (dm1 < snrThreshold && dm1 != RANGE_FOLDED && | ||||
|                 dm2 < snrThreshold && dm2 != RANGE_FOLDED && | ||||
|                 dm3 < snrThreshold && dm3 != RANGE_FOLDED && | ||||
|                 dm4 < snrThreshold && dm4 != RANGE_FOLDED) | ||||
|             if ((!showSmoothedRangeFolding && //
 | ||||
|                  (dm1 < snrThreshold || dm1 == RANGE_FOLDED) && | ||||
|                  (dm2 < snrThreshold || dm2 == RANGE_FOLDED) && | ||||
|                  (dm3 < snrThreshold || dm3 == RANGE_FOLDED) && | ||||
|                  (dm4 < snrThreshold || dm4 == RANGE_FOLDED)) || | ||||
|                 (showSmoothedRangeFolding && //
 | ||||
|                  dm1 < snrThreshold && dm1 != RANGE_FOLDED && | ||||
|                  dm2 < snrThreshold && dm2 != RANGE_FOLDED && | ||||
|                  dm3 < snrThreshold && dm3 != RANGE_FOLDED && | ||||
|                  dm4 < snrThreshold && dm4 != RANGE_FOLDED)) | ||||
|             { | ||||
|                // Skip only if all data moments are hidden
 | ||||
|                continue; | ||||
|  | @ -424,7 +438,8 @@ void Level3RasterView::ComputeSweep() | |||
| std::uint8_t | ||||
| Level3RasterViewImpl::RemapDataMoment(std::uint8_t dataMoment) const | ||||
| { | ||||
|    if (dataMoment != 0) | ||||
|    if (dataMoment != 0 && | ||||
|        (dataMoment != RANGE_FOLDED || showSmoothedRangeFolding_)) | ||||
|    { | ||||
|       return dataMoment; | ||||
|    } | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| #include <scwx/qt/view/radar_product_view.hpp> | ||||
| #include <scwx/qt/settings/product_settings.hpp> | ||||
| #include <scwx/common/constants.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| 
 | ||||
|  | @ -28,27 +29,44 @@ class RadarProductViewImpl | |||
| { | ||||
| public: | ||||
|    explicit RadarProductViewImpl( | ||||
|       RadarProductView*                             self, | ||||
|       std::shared_ptr<manager::RadarProductManager> radarProductManager) : | ||||
|        self_ {self}, | ||||
|        initialized_ {false}, | ||||
|        sweepMutex_ {}, | ||||
|        selectedTime_ {}, | ||||
|        radarProductManager_ {radarProductManager} | ||||
|    { | ||||
|       auto& productSettings = settings::ProductSettings::Instance(); | ||||
|       connection_           = productSettings.changed_signal().connect( | ||||
|          [this]() | ||||
|          { | ||||
|             showSmoothedRangeFolding_ = settings::ProductSettings::Instance() | ||||
|                                            .show_smoothed_range_folding() | ||||
|                                            .GetValue(); | ||||
|             self_->Update(); | ||||
|          }); | ||||
|       ; | ||||
|    } | ||||
|    ~RadarProductViewImpl() {} | ||||
| 
 | ||||
|    RadarProductView* self_; | ||||
| 
 | ||||
|    bool       initialized_; | ||||
|    std::mutex sweepMutex_; | ||||
| 
 | ||||
|    std::chrono::system_clock::time_point selectedTime_; | ||||
|    bool                                  showSmoothedRangeFolding_ {false}; | ||||
|    bool                                  smoothingEnabled_ {false}; | ||||
| 
 | ||||
|    std::shared_ptr<manager::RadarProductManager> radarProductManager_; | ||||
| 
 | ||||
|    boost::signals2::scoped_connection connection_; | ||||
| }; | ||||
| 
 | ||||
| RadarProductView::RadarProductView( | ||||
|    std::shared_ptr<manager::RadarProductManager> radarProductManager) : | ||||
|     p(std::make_unique<RadarProductViewImpl>(radarProductManager)) {}; | ||||
|     p(std::make_unique<RadarProductViewImpl>(this, radarProductManager)) {}; | ||||
| RadarProductView::~RadarProductView() = default; | ||||
| 
 | ||||
| const std::vector<boost::gil::rgba8_pixel_t>& | ||||
|  | @ -88,6 +106,11 @@ std::chrono::system_clock::time_point RadarProductView::selected_time() const | |||
|    return p->selectedTime_; | ||||
| } | ||||
| 
 | ||||
| bool RadarProductView::show_smoothed_range_folding() const | ||||
| { | ||||
|    return p->showSmoothedRangeFolding_; | ||||
| } | ||||
| 
 | ||||
| bool RadarProductView::smoothing_enabled() const | ||||
| { | ||||
|    return p->smoothingEnabled_; | ||||
|  |  | |||
|  | @ -49,8 +49,9 @@ public: | |||
| 
 | ||||
|    std::shared_ptr<manager::RadarProductManager> radar_product_manager() const; | ||||
|    std::chrono::system_clock::time_point         selected_time() const; | ||||
|    bool                                          smoothing_enabled() const; | ||||
|    std::mutex&                                   sweep_mutex(); | ||||
|    bool        show_smoothed_range_folding() const; | ||||
|    bool        smoothing_enabled() const; | ||||
|    std::mutex& sweep_mutex(); | ||||
| 
 | ||||
|    void set_radar_product_manager( | ||||
|       std::shared_ptr<manager::RadarProductManager> radarProductManager); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat