Plot -> Sweep, standardizing signal/slot naming convention

This commit is contained in:
Dan Paulat 2021-10-31 17:00:21 -05:00
parent d7e60a0d8c
commit 2f1f15938a
9 changed files with 67 additions and 66 deletions

View file

@ -41,9 +41,7 @@ public:
vbo_ {GL_INVALID_INDEX},
vao_ {GL_INVALID_INDEX},
texture_ {GL_INVALID_INDEX},
numVertices_ {0},
colorTableUpdated_(false),
plotUpdated_(true)
sweepTimeNeedsUpdate_ {true}
{
// TODO: Manage font at the global level, texture at the view level
}
@ -61,10 +59,7 @@ public:
GLuint vao_;
GLuint texture_;
GLsizeiptr numVertices_;
bool colorTableUpdated_;
bool plotUpdated_;
bool sweepTimeNeedsUpdate_;
};
OverlayLayer::OverlayLayer(
@ -127,32 +122,32 @@ void OverlayLayer::initialize()
gl.glUniform4f(p->uColorLocation_, 0.0f, 0.0f, 0.0f, 0.75f);
connect(p->radarProductView_.get(),
&view::RadarProductView::PlotUpdated,
&view::RadarProductView::SweepComputed,
this,
&OverlayLayer::ReceivePlotUpdate);
&OverlayLayer::UpdateSweepTimeNextFrame);
}
void OverlayLayer::render(const QMapbox::CustomLayerRenderParameters& params)
{
gl::OpenGLFunctions& gl = p->gl_;
static std::string plotTimeString;
static std::string sweepTimeString;
if (p->plotUpdated_)
if (p->sweepTimeNeedsUpdate_)
{
using namespace std::chrono;
auto plotTime =
time_point_cast<seconds>(p->radarProductView_->PlotTime());
auto sweepTime =
time_point_cast<seconds>(p->radarProductView_->SweepTime());
if (plotTime.time_since_epoch().count() != 0)
if (sweepTime.time_since_epoch().count() != 0)
{
zoned_time zt = {current_zone(), plotTime};
zoned_time zt = {current_zone(), sweepTime};
std::ostringstream os;
os << zt;
plotTimeString = os.str();
sweepTimeString = os.str();
}
p->plotUpdated_ = false;
p->sweepTimeNeedsUpdate_ = false;
}
glm::mat4 projection = glm::ortho(0.0f,
@ -181,7 +176,7 @@ void OverlayLayer::render(const QMapbox::CustomLayerRenderParameters& params)
gl.glDrawArrays(GL_TRIANGLES, 0, 6);
// Render time
p->textShader_.RenderText(plotTimeString,
p->textShader_.RenderText(sweepTimeString,
params.width - 7.0f,
7.0f,
16.0f,
@ -211,14 +206,14 @@ void OverlayLayer::deinitialize()
p->texture_ = GL_INVALID_INDEX;
disconnect(p->radarProductView_.get(),
&view::RadarProductView::PlotUpdated,
&view::RadarProductView::SweepComputed,
this,
&OverlayLayer::ReceivePlotUpdate);
&OverlayLayer::UpdateSweepTimeNextFrame);
}
void OverlayLayer::ReceivePlotUpdate()
void OverlayLayer::UpdateSweepTimeNextFrame()
{
p->plotUpdated_ = true;
p->sweepTimeNeedsUpdate_ = true;
}
} // namespace map

View file

@ -29,7 +29,7 @@ public:
void deinitialize() override final;
public slots:
void ReceivePlotUpdate();
void UpdateSweepTimeNextFrame();
private:
std::unique_ptr<OverlayLayerImpl> p;

View file

@ -41,8 +41,8 @@ public:
vao_ {GL_INVALID_INDEX},
texture_ {GL_INVALID_INDEX},
numVertices_ {0},
colorTableUpdated_(false),
plotUpdated_(false)
colorTableNeedsUpdate_ {false},
sweepNeedsUpdate_ {false}
{
}
~RadarProductLayerImpl() = default;
@ -59,8 +59,8 @@ public:
GLsizeiptr numVertices_;
bool colorTableUpdated_;
bool plotUpdated_;
bool colorTableNeedsUpdate_;
bool sweepNeedsUpdate_;
};
RadarProductLayer::RadarProductLayer(
@ -112,18 +112,18 @@ void RadarProductLayer::initialize()
connect(p->radarProductView_.get(),
&view::RadarProductView::ColorTableLoaded,
this,
&RadarProductLayer::ReceiveColorTableUpdate);
&RadarProductLayer::UpdateColorTableNextFrame);
connect(p->radarProductView_.get(),
&view::RadarProductView::PlotUpdated,
&view::RadarProductView::SweepComputed,
this,
&RadarProductLayer::ReceivePlotUpdate);
&RadarProductLayer::UpdateSweepNextFrame);
}
void RadarProductLayer::UpdateSweep()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "UpdateSweep()";
p->plotUpdated_ = false;
p->sweepNeedsUpdate_ = false;
gl::OpenGLFunctions& gl = p->gl_;
@ -187,12 +187,12 @@ void RadarProductLayer::render(
{
gl::OpenGLFunctions& gl = p->gl_;
if (p->colorTableUpdated_)
if (p->colorTableNeedsUpdate_)
{
UpdateColorTable();
}
if (p->plotUpdated_)
if (p->sweepNeedsUpdate_)
{
UpdateSweep();
}
@ -241,18 +241,18 @@ void RadarProductLayer::deinitialize()
disconnect(p->radarProductView_.get(),
&view::RadarProductView::ColorTableLoaded,
this,
&RadarProductLayer::ReceiveColorTableUpdate);
&RadarProductLayer::UpdateColorTableNextFrame);
disconnect(p->radarProductView_.get(),
&view::RadarProductView::PlotUpdated,
&view::RadarProductView::SweepComputed,
this,
&RadarProductLayer::ReceivePlotUpdate);
&RadarProductLayer::UpdateSweepNextFrame);
}
void RadarProductLayer::UpdateColorTable()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "UpdateColorTable()";
p->colorTableUpdated_ = false;
p->colorTableNeedsUpdate_ = false;
gl::OpenGLFunctions& gl = p->gl_;
@ -272,14 +272,14 @@ void RadarProductLayer::UpdateColorTable()
gl.glGenerateMipmap(GL_TEXTURE_1D);
}
void RadarProductLayer::ReceiveColorTableUpdate()
void RadarProductLayer::UpdateColorTableNextFrame()
{
p->colorTableUpdated_ = true;
p->colorTableNeedsUpdate_ = true;
}
void RadarProductLayer::ReceivePlotUpdate()
void RadarProductLayer::UpdateSweepNextFrame()
{
p->plotUpdated_ = true;
p->sweepNeedsUpdate_ = true;
}
static glm::vec2

View file

@ -30,12 +30,13 @@ public:
void render(const QMapbox::CustomLayerRenderParameters&) override final;
void deinitialize() override final;
private:
void UpdateColorTable();
void UpdateSweep();
public slots:
void ReceiveColorTableUpdate();
void ReceivePlotUpdate();
private slots:
void UpdateColorTableNextFrame();
void UpdateSweepNextFrame();
private:
std::unique_ptr<RadarProductLayerImpl> p;