Allow radar product manager to be updated in a view

This commit is contained in:
Dan Paulat 2022-10-08 23:06:46 -05:00
parent c9936a5ea4
commit 5dd1a327c8
11 changed files with 87 additions and 53 deletions

View file

@ -26,9 +26,7 @@ static constexpr uint32_t VALUES_PER_VERTEX = 2u;
class Level3RadialViewImpl
{
public:
explicit Level3RadialViewImpl(
std::shared_ptr<manager::RadarProductManager> radarProductManager) :
radarProductManager_ {radarProductManager},
explicit Level3RadialViewImpl() :
selectedTime_ {},
latitude_ {},
longitude_ {},
@ -39,8 +37,6 @@ public:
}
~Level3RadialViewImpl() = default;
std::shared_ptr<manager::RadarProductManager> radarProductManager_;
std::chrono::system_clock::time_point selectedTime_;
std::vector<float> vertices_;
@ -57,8 +53,8 @@ public:
Level3RadialView::Level3RadialView(
const std::string& product,
std::shared_ptr<manager::RadarProductManager> radarProductManager) :
Level3ProductView(product),
p(std::make_unique<Level3RadialViewImpl>(radarProductManager))
Level3ProductView(product, radarProductManager),
p(std::make_unique<Level3RadialViewImpl>())
{
}
Level3RadialView::~Level3RadialView() = default;
@ -109,10 +105,13 @@ void Level3RadialView::ComputeSweep()
std::scoped_lock sweepLock(sweep_mutex());
std::shared_ptr<manager::RadarProductManager> radarProductManager =
radar_product_manager();
// Retrieve message from Radar Product Manager
std::shared_ptr<wsr88d::rpg::Level3Message> message =
p->radarProductManager_->GetLevel3Data(GetRadarProductName(),
p->selectedTime_);
radarProductManager->GetLevel3Data(GetRadarProductName(),
p->selectedTime_);
if (message == nullptr)
{
logger_->debug("Level 3 data not found");
@ -218,7 +217,7 @@ void Level3RadialView::ComputeSweep()
common::RadialSize::_0_5Degree :
common::RadialSize::_1Degree;
const std::vector<float>& coordinates =
p->radarProductManager_->coordinates(radialSize);
radarProductManager->coordinates(radialSize);
// There should be a positive number of range bins in radial data
const uint16_t gates = radialData->number_of_range_bins();
@ -270,7 +269,7 @@ void Level3RadialView::ComputeSweep()
const uint16_t gateSize = std::max<uint16_t>(
1,
dataMomentInterval /
static_cast<uint16_t>(p->radarProductManager_->gate_size()));
static_cast<uint16_t>(radarProductManager->gate_size()));
// Compute gate range [startGate, endGate)
const uint16_t startGate = 0;