mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-11-01 15:50:05 +00:00
Refactoring Level2ProductViewImpl to Level2ProductView::Impl
This commit is contained in:
parent
7b938f9458
commit
13a015cd5f
2 changed files with 14 additions and 17 deletions
|
|
@ -53,11 +53,10 @@ static const std::unordered_map<common::Level2Product, std::string>
|
||||||
{common::Level2Product::CorrelationCoefficient, "%"},
|
{common::Level2Product::CorrelationCoefficient, "%"},
|
||||||
{common::Level2Product::ClutterFilterPowerRemoved, "dB"}};
|
{common::Level2Product::ClutterFilterPowerRemoved, "dB"}};
|
||||||
|
|
||||||
class Level2ProductViewImpl
|
class Level2ProductView::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Level2ProductViewImpl(Level2ProductView* self,
|
explicit Impl(Level2ProductView* self, common::Level2Product product) :
|
||||||
common::Level2Product product) :
|
|
||||||
self_ {self},
|
self_ {self},
|
||||||
product_ {product},
|
product_ {product},
|
||||||
selectedElevation_ {0.0f},
|
selectedElevation_ {0.0f},
|
||||||
|
|
@ -94,7 +93,7 @@ public:
|
||||||
UpdateOtherUnits(unitSettings.other_units().GetValue());
|
UpdateOtherUnits(unitSettings.other_units().GetValue());
|
||||||
UpdateSpeedUnits(unitSettings.speed_units().GetValue());
|
UpdateSpeedUnits(unitSettings.speed_units().GetValue());
|
||||||
}
|
}
|
||||||
~Level2ProductViewImpl()
|
~Impl()
|
||||||
{
|
{
|
||||||
auto& unitSettings = settings::UnitSettings::Instance();
|
auto& unitSettings = settings::UnitSettings::Instance();
|
||||||
|
|
||||||
|
|
@ -164,7 +163,7 @@ Level2ProductView::Level2ProductView(
|
||||||
common::Level2Product product,
|
common::Level2Product product,
|
||||||
std::shared_ptr<manager::RadarProductManager> radarProductManager) :
|
std::shared_ptr<manager::RadarProductManager> radarProductManager) :
|
||||||
RadarProductView(radarProductManager),
|
RadarProductView(radarProductManager),
|
||||||
p(std::make_unique<Level2ProductViewImpl>(this, product))
|
p(std::make_unique<Impl>(this, product))
|
||||||
{
|
{
|
||||||
ConnectRadarProductManager();
|
ConnectRadarProductManager();
|
||||||
}
|
}
|
||||||
|
|
@ -379,12 +378,12 @@ void Level2ProductView::SelectProduct(const std::string& productName)
|
||||||
p->SetProduct(productName);
|
p->SetProduct(productName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level2ProductViewImpl::SetProduct(const std::string& productName)
|
void Level2ProductView::Impl::SetProduct(const std::string& productName)
|
||||||
{
|
{
|
||||||
SetProduct(common::GetLevel2Product(productName));
|
SetProduct(common::GetLevel2Product(productName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level2ProductViewImpl::SetProduct(common::Level2Product product)
|
void Level2ProductView::Impl::SetProduct(common::Level2Product product)
|
||||||
{
|
{
|
||||||
product_ = product;
|
product_ = product;
|
||||||
|
|
||||||
|
|
@ -401,12 +400,12 @@ void Level2ProductViewImpl::SetProduct(common::Level2Product product)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level2ProductViewImpl::UpdateOtherUnits(const std::string& name)
|
void Level2ProductView::Impl::UpdateOtherUnits(const std::string& name)
|
||||||
{
|
{
|
||||||
otherUnits_ = types::GetOtherUnitsFromName(name);
|
otherUnits_ = types::GetOtherUnitsFromName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level2ProductViewImpl::UpdateSpeedUnits(const std::string& name)
|
void Level2ProductView::Impl::UpdateSpeedUnits(const std::string& name)
|
||||||
{
|
{
|
||||||
speedUnits_ = types::GetSpeedUnitsFromName(name);
|
speedUnits_ = types::GetSpeedUnitsFromName(name);
|
||||||
}
|
}
|
||||||
|
|
@ -536,8 +535,7 @@ void Level2ProductView::ComputeSweep()
|
||||||
|
|
||||||
// When there is missing data, insert another empty vertex radial at the end
|
// When there is missing data, insert another empty vertex radial at the end
|
||||||
// to avoid stretching
|
// to avoid stretching
|
||||||
const bool isRadarDataIncomplete =
|
const bool isRadarDataIncomplete = Impl::IsRadarDataIncomplete(radarData);
|
||||||
Level2ProductViewImpl::IsRadarDataIncomplete(radarData);
|
|
||||||
if (isRadarDataIncomplete)
|
if (isRadarDataIncomplete)
|
||||||
{
|
{
|
||||||
++vertexRadials;
|
++vertexRadials;
|
||||||
|
|
@ -819,7 +817,7 @@ void Level2ProductView::ComputeSweep()
|
||||||
Q_EMIT SweepComputed();
|
Q_EMIT SweepComputed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level2ProductViewImpl::ComputeCoordinates(
|
void Level2ProductView::Impl::ComputeCoordinates(
|
||||||
const std::shared_ptr<wsr88d::rda::ElevationScan>& radarData)
|
const std::shared_ptr<wsr88d::rda::ElevationScan>& radarData)
|
||||||
{
|
{
|
||||||
logger_->debug("ComputeCoordinates()");
|
logger_->debug("ComputeCoordinates()");
|
||||||
|
|
@ -940,7 +938,7 @@ void Level2ProductViewImpl::ComputeCoordinates(
|
||||||
logger_->debug("Coordinates calculated in {}", timer.format(6, "%ws"));
|
logger_->debug("Coordinates calculated in {}", timer.format(6, "%ws"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Level2ProductViewImpl::IsRadarDataIncomplete(
|
bool Level2ProductView::Impl::IsRadarDataIncomplete(
|
||||||
const std::shared_ptr<const wsr88d::rda::ElevationScan>& radarData)
|
const std::shared_ptr<const wsr88d::rda::ElevationScan>& radarData)
|
||||||
{
|
{
|
||||||
// Assume the data is incomplete when the delta between the first and last
|
// Assume the data is incomplete when the delta between the first and last
|
||||||
|
|
@ -1003,7 +1001,7 @@ Level2ProductView::GetBinLevel(const common::Coordinate& coordinate) const
|
||||||
static_cast<std::uint16_t>(radarData->crbegin()->first + 1);
|
static_cast<std::uint16_t>(radarData->crbegin()->first + 1);
|
||||||
|
|
||||||
// Add an extra radial when incomplete data exists
|
// Add an extra radial when incomplete data exists
|
||||||
if (Level2ProductViewImpl::IsRadarDataIncomplete(radarData))
|
if (Impl::IsRadarDataIncomplete(radarData))
|
||||||
{
|
{
|
||||||
++numRadials;
|
++numRadials;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,6 @@ namespace qt
|
||||||
namespace view
|
namespace view
|
||||||
{
|
{
|
||||||
|
|
||||||
class Level2ProductViewImpl;
|
|
||||||
|
|
||||||
class Level2ProductView : public RadarProductView
|
class Level2ProductView : public RadarProductView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
@ -73,7 +71,8 @@ protected slots:
|
||||||
void ComputeSweep() override;
|
void ComputeSweep() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Level2ProductViewImpl> p;
|
class Impl;
|
||||||
|
std::unique_ptr<Impl> p;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace view
|
} // namespace view
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue