mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:30:06 +00:00
Hide the radar sweep if no data is available
This commit is contained in:
parent
a306fb4363
commit
f679f37fc1
1 changed files with 49 additions and 22 deletions
|
|
@ -146,6 +146,21 @@ void RadarProductLayer::Initialize(
|
||||||
&view::RadarProductView::SweepComputed,
|
&view::RadarProductView::SweepComputed,
|
||||||
this,
|
this,
|
||||||
[this]() { p->sweepNeedsUpdate_ = true; });
|
[this]() { p->sweepNeedsUpdate_ = true; });
|
||||||
|
connect(radarProductView.get(),
|
||||||
|
&view::RadarProductView::SweepNotComputed,
|
||||||
|
this,
|
||||||
|
[this](types::NoUpdateReason reason)
|
||||||
|
{
|
||||||
|
if (reason == types::NoUpdateReason::NotAvailable)
|
||||||
|
{
|
||||||
|
// Ensure the radar product is hidden by re-rendering
|
||||||
|
Q_EMIT NeedsRendering();
|
||||||
|
}
|
||||||
|
if (reason == types::NoUpdateReason::NoChange)
|
||||||
|
{
|
||||||
|
Q_EMIT NeedsRendering();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadarProductLayer::UpdateSweep(
|
void RadarProductLayer::UpdateSweep(
|
||||||
|
|
@ -281,6 +296,16 @@ void RadarProductLayer::Render(
|
||||||
UpdateSweep(mapContext);
|
UpdateSweep(mapContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<view::RadarProductView> radarProductView =
|
||||||
|
mapContext->radar_product_view();
|
||||||
|
|
||||||
|
const bool sweepVisible =
|
||||||
|
radarProductView != nullptr &&
|
||||||
|
radarProductView->load_status() !=
|
||||||
|
types::RadarProductLoadStatus::ProductNotAvailable;
|
||||||
|
|
||||||
|
if (sweepVisible)
|
||||||
|
{
|
||||||
const float scale = std::pow(2.0, params.zoom) * 2.0f *
|
const float scale = std::pow(2.0, params.zoom) * 2.0f *
|
||||||
mbgl::util::tileSize_D / mbgl::util::DEGREES_MAX;
|
mbgl::util::tileSize_D / mbgl::util::DEGREES_MAX;
|
||||||
const float xScale = scale / params.width;
|
const float xScale = scale / params.width;
|
||||||
|
|
@ -308,7 +333,9 @@ void RadarProductLayer::Render(
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_1D, p->texture_);
|
glBindTexture(GL_TEXTURE_1D, p->texture_);
|
||||||
glBindVertexArray(p->vao_);
|
glBindVertexArray(p->vao_);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(p->numVertices_));
|
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(p->numVertices_));
|
||||||
|
}
|
||||||
|
|
||||||
if (wireframeEnabled)
|
if (wireframeEnabled)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue