mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 09:30:25 +08:00
UPlot: changed float to qreal (double). Added UPlot::frameData() function.
This commit is contained in:
@@ -246,7 +246,7 @@ Q_SIGNALS:
|
||||
void timeLimitChanged(float);
|
||||
void mappingModeChanged(bool);
|
||||
void noMoreImagesReceived();
|
||||
void loopClosureThrChanged(float);
|
||||
void loopClosureThrChanged(qreal);
|
||||
void twistReceived(float x, float y, float z, float roll, float pitch, float yaw, int row, int col);
|
||||
|
||||
private:
|
||||
|
||||
@@ -46,14 +46,14 @@ class RTABMAPGUI_EXP StatItem : public QWidget
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
StatItem(const QString & name, bool cacheOn, const std::vector<float> & x, const std::vector<float> & y, const QString & unit = QString(), const QMenu * menu = 0, QGridLayout * grid = 0, QWidget * parent = 0);
|
||||
StatItem(const QString & name, bool cacheOn, const std::vector<qreal> & x, const std::vector<qreal> & y, const QString & unit = QString(), const QMenu * menu = 0, QGridLayout * grid = 0, QWidget * parent = 0);
|
||||
virtual ~StatItem();
|
||||
void addValue(float y);
|
||||
void addValue(float x, float y);
|
||||
void setValues(const std::vector<float> & x, const std::vector<float> & y);
|
||||
void addValue(qreal y);
|
||||
void addValue(qreal x, qreal y);
|
||||
void setValues(const std::vector<qreal> & x, const std::vector<qreal> & y);
|
||||
QString value() const;
|
||||
std::vector<float> xValues() const {return _x;}
|
||||
std::vector<float> yValues() const {return _y;}
|
||||
std::vector<qreal> xValues() const {return _x;}
|
||||
std::vector<qreal> yValues() const {return _y;}
|
||||
void setCacheOn(bool on);
|
||||
void clearCache();
|
||||
|
||||
@@ -61,9 +61,9 @@ public Q_SLOTS:
|
||||
void updateMenu(const QMenu * menu);
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueAdded(float);
|
||||
void valueAdded(float, float);
|
||||
void valuesChanged(const std::vector<float> &, const std::vector<float> &);
|
||||
void valueAdded(qreal);
|
||||
void valueAdded(qreal, qreal);
|
||||
void valuesChanged(const std::vector<qreal> &, const std::vector<qreal> &);
|
||||
void plotRequested(const StatItem *, const QString &);
|
||||
|
||||
private Q_SLOTS:
|
||||
@@ -80,8 +80,8 @@ private:
|
||||
QMenu * _menu;
|
||||
|
||||
bool _cacheOn;
|
||||
std::vector<float> _x;
|
||||
std::vector<float> _y;
|
||||
std::vector<qreal> _x;
|
||||
std::vector<qreal> _y;
|
||||
};
|
||||
|
||||
|
||||
@@ -104,9 +104,9 @@ public:
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateStat(const QString & statFullName, bool cacheOn);
|
||||
void updateStat(const QString & statFullName, float y, bool cacheOn);
|
||||
void updateStat(const QString & statFullName, float x, float y, bool cacheOn);
|
||||
void updateStat(const QString & statFullName, const std::vector<float> & x, const std::vector<float> & y, bool cacheOn);
|
||||
void updateStat(const QString & statFullName, qreal y, bool cacheOn);
|
||||
void updateStat(const QString & statFullName, qreal x, qreal y, bool cacheOn);
|
||||
void updateStat(const QString & statFullName, const std::vector<qreal> & x, const std::vector<qreal> & y, bool cacheOn);
|
||||
void clear();
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
/**
|
||||
* Constructor 3
|
||||
*/
|
||||
UPlotCurve(const QString & name, const QVector<float> & x, const QVector<float> & y, QObject * parent = 0);
|
||||
UPlotCurve(const QString & name, const QVector<qreal> & x, const QVector<qreal> & y, QObject * parent = 0);
|
||||
virtual ~UPlotCurve();
|
||||
|
||||
/**
|
||||
@@ -140,8 +140,8 @@ public:
|
||||
QPointF getItemData(int index);
|
||||
bool isVisible() const {return _visible;}
|
||||
void setData(QVector<UPlotItem*> & data); // take the ownership
|
||||
void getData(QVector<float> & x, QVector<float> & y) const; // only call in Qt MainThread
|
||||
void getData(QMap<float,float> & data) const; // only call in Qt MainThread
|
||||
void getData(QVector<qreal> & x, QVector<qreal> & y) const; // only call in Qt MainThread
|
||||
void getData(QMap<qreal,qreal> & data) const; // only call in Qt MainThread
|
||||
void draw(QPainter * painter, const QRect & limits);
|
||||
|
||||
public Q_SLOTS:
|
||||
@@ -159,12 +159,12 @@ public Q_SLOTS:
|
||||
*
|
||||
* Set increment of the x values (when auto-increment is used).
|
||||
*/
|
||||
void setXIncrement(float increment);
|
||||
void setXIncrement(qreal increment);
|
||||
/**
|
||||
*
|
||||
* Set starting x value (when auto-increment is used).
|
||||
*/
|
||||
void setXStart(float val);
|
||||
void setXStart(qreal val);
|
||||
/**
|
||||
*
|
||||
* Add a single value, using a custom UPlotItem.
|
||||
@@ -175,12 +175,12 @@ public Q_SLOTS:
|
||||
* Add a single value y, x is auto-incremented by the increment set with setXIncrement().
|
||||
* @see setXStart()
|
||||
*/
|
||||
void addValue(float y);
|
||||
void addValue(qreal y);
|
||||
/**
|
||||
*
|
||||
* Add a single value y at x.
|
||||
*/
|
||||
void addValue(float x, float y);
|
||||
void addValue(qreal x, qreal y);
|
||||
/**
|
||||
*
|
||||
* For convenience...
|
||||
@@ -198,26 +198,26 @@ public Q_SLOTS:
|
||||
*
|
||||
* Add multiple values y at x. Vectors must have the same size.
|
||||
*/
|
||||
void addValues(const QVector<float> & xs, const QVector<float> & ys);
|
||||
void addValues(const QVector<qreal> & xs, const QVector<qreal> & ys);
|
||||
/**
|
||||
*
|
||||
* Add multiple values y, x is auto-incremented by the increment set with setXIncrement().
|
||||
* @see setXStart()
|
||||
*/
|
||||
void addValues(const QVector<float> & ys);
|
||||
void addValues(const QVector<qreal> & ys);
|
||||
void addValues(const QVector<int> & ys); // for convenience
|
||||
/**
|
||||
*
|
||||
* Add multiple values y, x is auto-incremented by the increment set with setXIncrement().
|
||||
* @see setXStart()
|
||||
*/
|
||||
void addValues(const std::vector<float> & ys); // for convenience
|
||||
void addValues(const std::vector<qreal> & ys); // for convenience
|
||||
void addValues(const std::vector<int> & ys); // for convenience
|
||||
|
||||
void setData(const QVector<float> & x, const QVector<float> & y);
|
||||
void setData(const std::vector<float> & x, const std::vector<float> & y);
|
||||
void setData(const QVector<float> & y);
|
||||
void setData(const std::vector<float> & y);
|
||||
void setData(const QVector<qreal> & x, const QVector<qreal> & y);
|
||||
void setData(const std::vector<qreal> & x, const std::vector<qreal> & y);
|
||||
void setData(const QVector<qreal> & y);
|
||||
void setData(const std::vector<qreal> & y);
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
@@ -231,11 +231,11 @@ protected:
|
||||
void attach(UPlot * plot);
|
||||
void detach(UPlot * plot);
|
||||
void updateMinMax();
|
||||
const QVector<float> & getMinMax() const {return _minMax;}
|
||||
const QVector<qreal> & getMinMax() const {return _minMax;}
|
||||
int removeItem(int index);
|
||||
void _addValue(UPlotItem * data);;
|
||||
virtual bool isMinMaxValid() const {return _minMax.size();}
|
||||
virtual void update(float scaleX, float scaleY, float offsetX, float offsetY, float xDir, float yDir, int maxItemsKept);
|
||||
virtual void update(qreal scaleX, qreal scaleY, qreal offsetX, qreal offsetY, qreal xDir, qreal yDir, int maxItemsKept);
|
||||
QList<QGraphicsItem *> _items;
|
||||
UPlot * _plot;
|
||||
|
||||
@@ -246,11 +246,11 @@ private:
|
||||
QString _name;
|
||||
QPen _pen;
|
||||
QBrush _brush;
|
||||
float _xIncrement;
|
||||
float _xStart;
|
||||
qreal _xIncrement;
|
||||
qreal _xStart;
|
||||
bool _visible;
|
||||
bool _valuesShown;
|
||||
QVector<float> _minMax; // minX, maxX, minY, maxY
|
||||
QVector<qreal> _minMax; // minX, maxX, minY, maxY
|
||||
QGraphicsRectItem * _rootItem;
|
||||
QColor _itemsColor;
|
||||
};
|
||||
@@ -267,14 +267,14 @@ public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
UPlotCurveThreshold(const QString & name, float thesholdValue, Qt::Orientation orientation = Qt::Horizontal, QObject * parent = 0);
|
||||
UPlotCurveThreshold(const QString & name, qreal thesholdValue, Qt::Orientation orientation = Qt::Horizontal, QObject * parent = 0);
|
||||
virtual ~UPlotCurveThreshold();
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Set threshold value.
|
||||
*/
|
||||
void setThreshold(float threshold);
|
||||
void setThreshold(qreal threshold);
|
||||
/**
|
||||
* Set orientation (Qt::Horizontal or Qt::Vertical).
|
||||
*/
|
||||
@@ -282,7 +282,7 @@ public Q_SLOTS:
|
||||
|
||||
protected:
|
||||
friend class UPlot;
|
||||
virtual void update(float scaleX, float scaleY, float offsetX, float offsetY, float xDir, float yDir, int maxItemsKept);
|
||||
virtual void update(qreal scaleX, qreal scaleY, qreal offsetX, qreal offsetY, qreal xDir, qreal yDir, int maxItemsKept);
|
||||
virtual bool isMinMaxValid() const {return false;}
|
||||
|
||||
private:
|
||||
@@ -298,7 +298,7 @@ public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
UPlotAxis(Qt::Orientation orientation = Qt::Horizontal, float min=0, float max=1, QWidget * parent = 0);
|
||||
UPlotAxis(Qt::Orientation orientation = Qt::Horizontal, qreal min=0, qreal max=1, QWidget * parent = 0);
|
||||
virtual ~UPlotAxis();
|
||||
|
||||
public:
|
||||
@@ -306,7 +306,7 @@ public:
|
||||
* Set axis minimum and maximum values, compute the resulting
|
||||
* intervals depending on the size of the axis.
|
||||
*/
|
||||
void setAxis(float & min, float & max);
|
||||
void setAxis(qreal & min, qreal & max);
|
||||
/**
|
||||
* Size of the border between the first line and the beginning of the widget.
|
||||
*/
|
||||
@@ -329,8 +329,8 @@ protected:
|
||||
|
||||
private:
|
||||
Qt::Orientation _orientation;
|
||||
float _min;
|
||||
float _max;
|
||||
qreal _min;
|
||||
qreal _max;
|
||||
int _count;
|
||||
int _step;
|
||||
bool _reversed;
|
||||
@@ -472,8 +472,8 @@ private:
|
||||
* QApplication app(argc, argv);
|
||||
* UPlot plot;
|
||||
* UPlotCurve * curve = plot.addCurve("My curve");
|
||||
* float y[10] = {0, 1, 2, 3, -3, -2, -1, 0, 1, 2};
|
||||
* curve->addValues(std::vector<float>(y, y+10));
|
||||
* qreal y[10] = {0, 1, 2, 3, -3, -2, -1, 0, 1, 2};
|
||||
* curve->addValues(std::vector<qreal>(y, y+10));
|
||||
* plot.showGrid(true);
|
||||
* plot.setGraphicsView(true);
|
||||
* plot.show();
|
||||
@@ -513,7 +513,7 @@ public:
|
||||
/**
|
||||
* Add a threshold to the plot.
|
||||
*/
|
||||
UPlotCurveThreshold * addThreshold(const QString & name, float value, Qt::Orientation orientation = Qt::Horizontal);
|
||||
UPlotCurveThreshold * addThreshold(const QString & name, qreal value, Qt::Orientation orientation = Qt::Horizontal);
|
||||
QString title() const {return this->objectName();}
|
||||
QPen getRandomPenColored();
|
||||
void showLegend(bool shown);
|
||||
@@ -525,8 +525,8 @@ public:
|
||||
void showYAxis(bool shown) {_verticalAxis->setVisible(shown);}
|
||||
void setVariableXAxis() {_fixedAxis[0] = false;}
|
||||
void setVariableYAxis() {_fixedAxis[1] = false;}
|
||||
void setFixedXAxis(float x1, float x2);
|
||||
void setFixedYAxis(float y1, float y2);
|
||||
void setFixedXAxis(qreal x1, qreal x2);
|
||||
void setFixedYAxis(qreal y1, qreal y2);
|
||||
void setMaxVisibleItems(int maxVisibleItems);
|
||||
void setTitle(const QString & text);
|
||||
void setXLabel(const QString & text);
|
||||
@@ -550,6 +550,8 @@ public Q_SLOTS:
|
||||
*/
|
||||
void clearData();
|
||||
|
||||
void frameData(bool xAxis = true, bool yAxis = false);
|
||||
|
||||
private Q_SLOTS:
|
||||
void captureScreen();
|
||||
void updateAxis(const UPlotCurve * curve);
|
||||
@@ -570,20 +572,20 @@ private:
|
||||
|
||||
private:
|
||||
void replot(QPainter * painter);
|
||||
bool updateAxis(float x, float y);
|
||||
bool updateAxis(float x1, float x2, float y1, float y2);
|
||||
bool updateAxis(qreal x, qreal y);
|
||||
bool updateAxis(qreal x1, qreal x2, qreal y1, qreal y2);
|
||||
void setupUi();
|
||||
void createActions();
|
||||
void createMenus();
|
||||
void selectScreenCaptureFormat();
|
||||
bool mousePosToValue(const QPoint & pos, float & x, float & y);
|
||||
bool mousePosToValue(const QPoint & pos, qreal & x, qreal & y);
|
||||
|
||||
private:
|
||||
UPlotLegend * _legend;
|
||||
QGraphicsView * _view;
|
||||
QGraphicsItem * _sceneRoot;
|
||||
QWidget * _graphicsViewHolder;
|
||||
float _axisMaximums[4]; // {x1->x2, y1->y2}
|
||||
qreal _axisMaximums[4]; // {x1->x2, y1->y2}
|
||||
bool _axisMaximumsSet[4]; // {x1->x2, y1->y2}
|
||||
bool _fixedAxis[2];
|
||||
UPlotAxis * _verticalAxis;
|
||||
|
||||
Reference in New Issue
Block a user