Skip to content

Instantly share code, notes, and snippets.

@portaloffreedom
Created October 21, 2021 13:18
Fix qwt for gazebo version 10
diff --git a/gazebo/gui/plot/IncrementalPlot.cc b/gazebo/gui/plot/IncrementalPlot.cc
index 232bc41e39..61734a4822 100644
--- a/gazebo/gui/plot/IncrementalPlot.cc
+++ b/gazebo/gui/plot/IncrementalPlot.cc
@@ -24,6 +24,7 @@
#include <map>
#include <ignition/math/Helpers.hh>
+#include <qwt/QwtScaleMap>
#include "gazebo/common/Console.hh"
#include "gazebo/common/Time.hh"
diff --git a/gazebo/gui/plot/PlotCurve.cc b/gazebo/gui/plot/PlotCurve.cc
index 71e6d36110..1d7bd293fd 100644
--- a/gazebo/gui/plot/PlotCurve.cc
+++ b/gazebo/gui/plot/PlotCurve.cc
@@ -62,71 +62,71 @@ namespace gazebo
/// \return Bounding box of the sample.
public: virtual QRectF boundingRect() const
{
- if (this->d_boundingRect.width() < 0.0)
- this->d_boundingRect = qwtBoundingRect(*this);
+ if (this->boundingRect().width() < 0.0)
+ this->boundingRect() = qwtBoundingRect(*this);
// set a minimum bounding box height
// this prevents plot's auto scale to zoom in on near-zero
// floating point noise.
double minHeight = 1e-3;
- double absHeight = std::fabs(this->d_boundingRect.height());
+ double absHeight = std::fabs(this->boundingRect().height());
if (absHeight < minHeight)
{
double halfMinHeight = minHeight * 0.5;
- double mid = this->d_boundingRect.top() +
+ double mid = this->boundingRect().top() +
(absHeight * 0.5);
- this->d_boundingRect.setTop(mid - halfMinHeight);
- this->d_boundingRect.setBottom(mid + halfMinHeight);
+ this->boundingRect().setTop(mid - halfMinHeight);
+ this->boundingRect().setBottom(mid + halfMinHeight);
}
- return this->d_boundingRect;
+ return this->boundingRect();
}
/// \brief Add a point to the sample.
/// \param[in] _point Point to add.
public: inline void Add(const QPointF &_point)
{
- this->d_samples += _point;
+ this->m_samples += _point;
- if (this->d_samples.size() > maxSampleSize)
+ if (this->m_samples.size() > maxSampleSize)
{
// remove sample window
// update bounding rect?
- this->d_samples.remove(0, windowSize);
+ this->m_samples.remove(0, windowSize);
}
- if (this->d_samples.size() == 1)
+ if (this->m_samples.size() == 1)
{
// init bounding rect
- this->d_boundingRect.setTopLeft(_point);
- this->d_boundingRect.setBottomRight(_point);
+ this->boundingRect().setTopLeft(_point);
+ this->boundingRect().setBottomRight(_point);
return;
}
// expand bounding rect
- if (_point.x() < this->d_boundingRect.left())
- this->d_boundingRect.setLeft(_point.x());
- else if (_point.x() > this->d_boundingRect.right())
- this->d_boundingRect.setRight(_point.x());
- if (_point.y() < this->d_boundingRect.top())
- this->d_boundingRect.setTop(_point.y());
- else if (_point.y() > this->d_boundingRect.bottom())
- this->d_boundingRect.setBottom(_point.y());
+ if (_point.x() < this->boundingRect().left())
+ this->boundingRect().setLeft(_point.x());
+ else if (_point.x() > this->boundingRect().right())
+ this->boundingRect().setRight(_point.x());
+ if (_point.y() < this->boundingRect().top())
+ this->boundingRect().setTop(_point.y());
+ else if (_point.y() > this->boundingRect().bottom())
+ this->boundingRect().setBottom(_point.y());
}
/// \brief Clear the sample data.
public: void Clear()
{
- this->d_samples.clear();
- this->d_samples.squeeze();
- this->d_boundingRect = QRectF(0.0, 0.0, -1.0, -1.0);
+ this->m_samples.clear();
+ this->m_samples.squeeze();
+ this->boundingRect() = QRectF(0.0, 0.0, -1.0, -1.0);
}
/// \brief Get the sample data.
/// \return A vector of same points.
public: QVector<QPointF> Samples() const
{
- return this->d_samples;
+ return this->m_samples;
}
/// \brief maxium sample size of this curve.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment