Hide the radar sweep if no data is available

This commit is contained in:
Dan Paulat 2025-08-30 18:26:10 -05:00
parent a306fb4363
commit f679f37fc1

View file

@ -146,6 +146,21 @@ void RadarProductLayer::Initialize(
&view::RadarProductView::SweepComputed,
this,
[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(
@ -281,6 +296,16 @@ void RadarProductLayer::Render(
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 *
mbgl::util::tileSize_D / mbgl::util::DEGREES_MAX;
const float xScale = scale / params.width;
@ -308,7 +333,9 @@ void RadarProductLayer::Render(
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_1D, p->texture_);
glBindVertexArray(p->vao_);
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(p->numVertices_));
}
if (wireframeEnabled)
{