mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:00:04 +00:00
Infrastructure updates for multiple elevations
This commit is contained in:
parent
87581892a7
commit
19f1207384
8 changed files with 85 additions and 32 deletions
|
|
@ -180,17 +180,19 @@ void RadarProductManager::LoadLevel2Data(const std::string& filename)
|
|||
emit Level2DataLoaded();
|
||||
}
|
||||
|
||||
std::shared_ptr<wsr88d::rda::ElevationScan>
|
||||
std::pair<float, std::shared_ptr<wsr88d::rda::ElevationScan>>
|
||||
RadarProductManager::GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType,
|
||||
uint16_t elevation,
|
||||
float elevation,
|
||||
std::chrono::system_clock::time_point time)
|
||||
{
|
||||
std::shared_ptr<wsr88d::rda::ElevationScan> radarData = nullptr;
|
||||
float elevationFound = 0.0f;
|
||||
std::shared_ptr<wsr88d::rda::ElevationScan> radarData = nullptr;
|
||||
|
||||
if (p->level2VolumeScans_.size() > 0)
|
||||
{
|
||||
radarData = p->level2VolumeScans_.crbegin()->second->GetElevationScan(
|
||||
dataBlockType, elevation, time);
|
||||
std::tie(elevationFound, radarData) =
|
||||
p->level2VolumeScans_.crbegin()->second->GetElevationScan(
|
||||
dataBlockType, elevation, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -203,7 +205,7 @@ RadarProductManager::GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType,
|
|||
});
|
||||
}
|
||||
|
||||
return radarData;
|
||||
return std::make_pair(elevationFound, radarData);
|
||||
}
|
||||
|
||||
} // namespace manager
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ public:
|
|||
void Initialize();
|
||||
void LoadLevel2Data(const std::string& filename);
|
||||
|
||||
std::shared_ptr<wsr88d::rda::ElevationScan>
|
||||
std::pair<float, std::shared_ptr<wsr88d::rda::ElevationScan>>
|
||||
GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType,
|
||||
uint16_t elevation,
|
||||
float elevation,
|
||||
std::chrono::system_clock::time_point time = {});
|
||||
|
||||
signals:
|
||||
|
|
|
|||
|
|
@ -44,8 +44,10 @@ public:
|
|||
std::shared_ptr<manager::RadarProductManager> radarProductManager) :
|
||||
product_ {product},
|
||||
radarProductManager_ {radarProductManager},
|
||||
momentDataBlock0_ {nullptr},
|
||||
latitude_ {},
|
||||
longitude_ {},
|
||||
elevation_ {},
|
||||
range_ {},
|
||||
sweepTime_ {},
|
||||
colorTable_ {},
|
||||
|
|
@ -81,6 +83,7 @@ public:
|
|||
|
||||
float latitude_;
|
||||
float longitude_;
|
||||
float elevation_;
|
||||
float range_;
|
||||
|
||||
std::chrono::system_clock::time_point sweepTime_;
|
||||
|
|
@ -122,6 +125,11 @@ Level2ProductView::color_table(uint16_t& minValue, uint16_t& maxValue) const
|
|||
}
|
||||
}
|
||||
|
||||
float Level2ProductView::elevation() const
|
||||
{
|
||||
return p->elevation_;
|
||||
}
|
||||
|
||||
float Level2ProductView::range() const
|
||||
{
|
||||
return p->range_;
|
||||
|
|
@ -276,8 +284,10 @@ void Level2ProductView::ComputeSweep()
|
|||
}
|
||||
|
||||
// TODO: Pick this based on view settings
|
||||
auto radarData =
|
||||
p->radarProductManager_->GetLevel2Data(p->dataBlockType_, 0);
|
||||
float elevation;
|
||||
std::shared_ptr<wsr88d::rda::ElevationScan> radarData;
|
||||
std::tie(elevation, radarData) =
|
||||
p->radarProductManager_->GetLevel2Data(p->dataBlockType_, 0.0f);
|
||||
if (radarData == nullptr)
|
||||
{
|
||||
return;
|
||||
|
|
@ -308,6 +318,7 @@ void Level2ProductView::ComputeSweep()
|
|||
auto volumeData0 = radarData0->volume_data_block();
|
||||
p->latitude_ = volumeData0->latitude();
|
||||
p->longitude_ = volumeData0->longitude();
|
||||
p->elevation_ = elevation;
|
||||
p->range_ =
|
||||
momentData0->data_moment_range() +
|
||||
momentData0->data_moment_range_sample_interval() * (gates - 0.5f);
|
||||
|
|
@ -464,16 +475,15 @@ void Level2ProductView::ComputeSweep()
|
|||
{
|
||||
const uint16_t baseCoord = gate - 1;
|
||||
|
||||
size_t offset1 = ((startRadial + radial) % common::MAX_RADIALS *
|
||||
size_t offset1 = ((startRadial + radial) % radials *
|
||||
common::MAX_DATA_MOMENT_GATES +
|
||||
baseCoord) *
|
||||
2;
|
||||
size_t offset2 = offset1 + gateSize * 2;
|
||||
size_t offset3 =
|
||||
(((startRadial + radial + 1) % common::MAX_RADIALS) *
|
||||
common::MAX_DATA_MOMENT_GATES +
|
||||
baseCoord) *
|
||||
2;
|
||||
size_t offset3 = (((startRadial + radial + 1) % radials) *
|
||||
common::MAX_DATA_MOMENT_GATES +
|
||||
baseCoord) *
|
||||
2;
|
||||
size_t offset4 = offset3 + gateSize * 2;
|
||||
|
||||
vertices[vIndex++] = coordinates[offset1];
|
||||
|
|
@ -500,15 +510,14 @@ void Level2ProductView::ComputeSweep()
|
|||
{
|
||||
const uint16_t baseCoord = gate;
|
||||
|
||||
size_t offset1 = ((startRadial + radial) % common::MAX_RADIALS *
|
||||
size_t offset1 = ((startRadial + radial) % radials *
|
||||
common::MAX_DATA_MOMENT_GATES +
|
||||
baseCoord) *
|
||||
2;
|
||||
size_t offset2 = (((startRadial + radial + 1) % radials) *
|
||||
common::MAX_DATA_MOMENT_GATES +
|
||||
baseCoord) *
|
||||
2;
|
||||
size_t offset2 =
|
||||
(((startRadial + radial + 1) % common::MAX_RADIALS) *
|
||||
common::MAX_DATA_MOMENT_GATES +
|
||||
baseCoord) *
|
||||
2;
|
||||
|
||||
vertices[vIndex++] = p->latitude_;
|
||||
vertices[vIndex++] = p->longitude_;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public:
|
|||
|
||||
const std::vector<boost::gil::rgba8_pixel_t>&
|
||||
color_table(uint16_t& minValue, uint16_t& maxValue) const override;
|
||||
float elevation() const override;
|
||||
float range() const override;
|
||||
std::chrono::system_clock::time_point sweep_time() const override;
|
||||
const std::vector<float>& vertices() const override;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,11 @@ RadarProductView::color_table(uint16_t& minValue, uint16_t& maxValue) const
|
|||
return DEFAULT_COLOR_TABLE;
|
||||
}
|
||||
|
||||
float RadarProductView::elevation() const
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float RadarProductView::range() const
|
||||
{
|
||||
return 0.0f;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public:
|
|||
|
||||
virtual const std::vector<boost::gil::rgba8_pixel_t>&
|
||||
color_table(uint16_t& minValue, uint16_t& maxValue) const;
|
||||
virtual float elevation() const;
|
||||
virtual float range() const;
|
||||
virtual std::chrono::system_clock::time_point sweep_time() const;
|
||||
virtual const std::vector<float>& vertices() const = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue