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;

View file

@ -26,7 +26,7 @@ public:
explicit RadarProductViewImpl(
std::shared_ptr<manager::RadarProductManager> radarProductManager) :
radarProductManager_(radarProductManager),
plotTime_(),
sweepTime_(),
colorTable_ {boost::gil::rgba8_pixel_t(0, 128, 0, 255),
boost::gil::rgba8_pixel_t(255, 192, 0, 255),
boost::gil::rgba8_pixel_t(255, 0, 0, 255)}
@ -40,7 +40,7 @@ public:
std::vector<uint8_t> dataMoments8_;
std::vector<uint16_t> dataMoments16_;
std::chrono::system_clock::time_point plotTime_;
std::chrono::system_clock::time_point sweepTime_;
std::vector<boost::gil::rgba8_pixel_t> colorTable_;
};
@ -52,7 +52,7 @@ RadarProductView::RadarProductView(
connect(radarProductManager.get(),
&manager::RadarProductManager::Level2DataLoaded,
this,
&RadarProductView::UpdatePlot);
&RadarProductView::ComputeSweep);
}
RadarProductView::~RadarProductView() = default;
@ -69,7 +69,7 @@ RadarProductView::color_table() const
void RadarProductView::Initialize()
{
UpdatePlot();
ComputeSweep();
}
std::tuple<const void*, size_t, size_t> RadarProductView::GetMomentData()
@ -117,14 +117,14 @@ void RadarProductView::LoadColorTable(
emit ColorTableLoaded();
}
std::chrono::system_clock::time_point RadarProductView::PlotTime()
std::chrono::system_clock::time_point RadarProductView::SweepTime()
{
return p->plotTime_;
return p->sweepTime_;
}
void RadarProductView::UpdatePlot()
void RadarProductView::ComputeSweep()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "UpdatePlot()";
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()";
boost::timer::cpu_timer timer;
@ -143,8 +143,8 @@ void RadarProductView::UpdatePlot()
auto radarData = level2Data->radar_data()[0];
wsr88d::rda::DataBlockType blockType = wsr88d::rda::DataBlockType::MomentRef;
p->plotTime_ = TimePoint(radarData[0]->modified_julian_date(),
radarData[0]->collection_time());
p->sweepTime_ = TimePoint(radarData[0]->modified_julian_date(),
radarData[0]->collection_time());
// Calculate vertices
timer.start();
@ -352,7 +352,7 @@ void RadarProductView::UpdatePlot()
BOOST_LOG_TRIVIAL(debug)
<< logPrefix_ << "Vertices calculated in " << timer.format(6, "%ws");
emit PlotUpdated();
emit SweepComputed();
}
static std::chrono::system_clock::time_point

View file

@ -33,14 +33,14 @@ public:
std::tuple<const void*, size_t, size_t> GetMomentData();
void LoadColorTable(std::shared_ptr<common::ColorTable> colorTable);
std::chrono::system_clock::time_point PlotTime();
std::chrono::system_clock::time_point SweepTime();
public slots:
void UpdatePlot();
protected slots:
void ComputeSweep();
signals:
void ColorTableLoaded();
void PlotUpdated();
void SweepComputed();
private:
std::unique_ptr<RadarProductViewImpl> p;