26 #include <QtCore/QList> 27 #include <QtCore/QMap> 29 #include <QtGui/QBrush> 30 #include <QGraphicsEllipseItem> 31 #include <QtCore/QMutex> 33 #include <QPushButton> 34 #include <QtCore/QTime> 52 UPlotItem(qreal dataX, qreal dataY, qreal width=2);
61 void setPreviousItem(
UPlotItem * previousItem);
62 void setData(
const QPointF & data);
66 const QPointF &
data()
const {
return _data;}
69 virtual void hoverEnterEvent(QGraphicsSceneHoverEvent * event);
70 virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent * event);
71 virtual void focusInEvent(QFocusEvent * event);
72 virtual void focusOutEvent(QFocusEvent * event);
73 virtual void keyReleaseEvent(QKeyEvent * keyEvent);
75 virtual void showDescription(
bool shown);
77 void init(qreal dataX, qreal dataY);
104 UPlotCurve(
const QString & name,
const QVector<UPlotItem *>
data, QObject * parent = 0);
108 UPlotCurve(
const QString & name,
const QVector<qreal> &
x,
const QVector<qreal> & y, QObject * parent = 0);
114 const QPen &
pen()
const {
return _pen;}
118 const QBrush &
brush()
const {
return _brush;}
123 void setPen(
const QPen & pen);
127 void setBrush(
const QBrush & brush);
129 void setItemsColor(
const QColor & color);
135 QString
name()
const {
return _name;}
139 int itemsSize()
const;
140 QPointF getItemData(
int index);
142 void setData(QVector<UPlotItem*> & data);
143 void getData(QVector<qreal> & x, QVector<qreal> & y)
const;
144 void getData(QMap<qreal,qreal> & data)
const;
145 void draw(QPainter * painter,
const QRect & limits);
152 virtual void clear();
157 void setVisible(
bool visible);
162 void setXIncrement(qreal increment);
167 void setXStart(qreal val);
196 void addValues(QVector<UPlotItem *> & data);
201 void addValues(
const QVector<qreal> & xs,
const QVector<qreal> & ys);
207 void addValues(
const QVector<qreal> & ys);
208 void addValues(
const QVector<int> & ys);
214 void addValues(
const std::vector<qreal> & ys);
215 void addValues(
const std::vector<int> & ys);
217 void setData(
const QVector<qreal> & x,
const QVector<qreal> & y);
218 void setData(
const std::vector<qreal> & x,
const std::vector<qreal> & y);
219 void setData(
const QVector<qreal> & y);
220 void setData(
const std::vector<qreal> & y);
231 void attach(
UPlot * plot);
232 void detach(
UPlot * plot);
234 const QVector<qreal> &
getMinMax()
const {
return _minMax;}
235 int removeItem(
int index);
238 virtual void update(qreal scaleX, qreal scaleY, qreal offsetX, qreal offsetY, qreal xDir, qreal yDir,
int maxItemsKept);
277 void setThreshold(qreal threshold);
285 virtual void update(qreal scaleX, qreal scaleY, qreal offsetX, qreal offsetY, qreal xDir, qreal yDir,
int maxItemsKept);
309 void setAxis(qreal &
min, qreal &
max);
317 int step()
const {
return _step;}
325 void setReversed(
bool reversed);
328 virtual void paintEvent(QPaintEvent * event);
356 QPixmap createSymbol(
const QPen & pen,
const QBrush & brush);
357 void showStdDevMeanMax(
bool shown);
365 void updateStdDevMeanMax();
368 virtual void contextMenuEvent(QContextMenuEvent * event);
397 void setFlat(
bool on);
401 QString getAllCurveDataAsText()
const;
404 void removeLegendItem(
const UPlotCurve * curve);
409 void legendItemRemoved(
const UPlotCurve * curve);
410 void legendItemToggled(
const UPlotCurve * curve,
bool toggled);
411 void legendItemMoved(
const UPlotCurve * curve,
int);
414 virtual void contextMenuEvent(QContextMenuEvent * event);
417 void redirectToggled(
bool);
451 QSize sizeHint()
const;
452 QSize minimumSizeHint()
const;
454 virtual void paintEvent(QPaintEvent* event);
497 UPlot(QWidget * parent = 0);
503 UPlotCurve * addCurve(
const QString & curveName,
const QColor & color = QColor());
507 bool addCurve(
UPlotCurve * curve,
bool ownershipTransferred =
true);
511 QStringList curveNames();
512 bool contains(
const QString & curveName);
514 QString getAllCurveDataAsText()
const;
519 QString
title()
const {
return this->objectName();}
520 QPen getRandomPenColored();
521 void showLegend(
bool shown);
522 void showGrid(
bool shown);
523 void showRefreshRate(
bool shown);
524 void trackMouse(
bool tracking);
525 void keepAllData(
bool kept);
526 void showXAxis(
bool shown) {_horizontalAxis->setVisible(shown);}
527 void showYAxis(
bool shown) {_verticalAxis->setVisible(shown);}
530 void setFixedXAxis(qreal x1, qreal x2);
531 void setFixedYAxis(qreal y1, qreal y2);
532 void setMaxVisibleItems(
int maxVisibleItems);
533 void setTitle(
const QString & text);
534 void setXLabel(
const QString & text);
535 void setYLabel(
const QString & text, Qt::Orientation
orientation = Qt::Vertical);
536 void setWorkingDirectory(
const QString & workingDirectory);
537 void setGraphicsView(
bool on);
538 void setBackgroundColor(
const QColor & color);
539 QRectF sceneRect()
const;
547 void showCurve(
const UPlotCurve * curve,
bool shown);
555 void frameData(
bool xAxis =
true,
bool yAxis =
false);
558 void captureScreen();
560 void moveCurve(
const UPlotCurve *,
int index);
563 virtual void contextMenuEvent(QContextMenuEvent * event);
564 virtual void paintEvent(QPaintEvent * event);
565 virtual void resizeEvent(QResizeEvent * event);
566 virtual void mousePressEvent(QMouseEvent * event);
567 virtual void mouseMoveEvent(QMouseEvent * event);
568 virtual void mouseReleaseEvent(QMouseEvent * event);
569 virtual void mouseDoubleClickEvent(QMouseEvent * event);
573 void addItem(QGraphicsItem * item);
576 void replot(QPainter * painter);
577 bool updateAxis(qreal x, qreal y);
578 bool updateAxis(qreal x1, qreal x2, qreal y1, qreal y2);
580 void createActions();
582 void selectScreenCaptureFormat();
583 bool mousePosToValue(
const QPoint & pos, qreal & x, qreal & y);
590 qreal _axisMaximums[4];
591 bool _axisMaximumsSet[4];
QString _autoScreenCaptureFormat
virtual bool isMinMaxValid() const
QGraphicsTextItem * _text
QGraphicsItem * _sceneRoot
UPlotAxis * _verticalAxis
virtual void update(qreal scaleX, qreal scaleY, qreal offsetX, qreal offsetY, qreal xDir, qreal yDir, int maxItemsKept)
QList< UPlotCurve * > _curves
GLM_FUNC_DECL genType min(genType const &x, genType const &y)
const QBrush & brush() const
def init(descriptorDim, matchThreshold, iterations, cuda, model_path)
QGraphicsRectItem * _textBackground
QAction * _aAddVerticalLine
UPlotItem * _previousItem
const UPlotCurve * curve() const
QAction * _aShowStdDevMeanMax
virtual bool isMinMaxValid() const
QAction * _aMouseTracking
UOrientableLabel * _yLabel
QWidget * _graphicsViewHolder
Qt::Orientation _orientation
QTime _refreshIntervalTime
QAction * _aChangeBackgroundColor
Qt::Orientation orientation() const
QString _workingDirectory
QAction * _aCopyAllCurvesToClipboard
void showYAxis(bool shown)
UPlotAxis * _horizontalAxis
QColor itemsColor() const
bool contains(const M &m, const typename M::key_type &k)
Qt::Orientation _orientation
const QVector< qreal > & getMinMax() const
QScrollArea * _scrollArea
QAction * _aShowRefreshRate
QAction * _aAddHorizontalLine
QAction * _aShowAllStdDevMeanMax
QList< QGraphicsItem * > _items
void addValue(int pos, float val, float *vals, T *point, T *points, int n)
QAction * _aYLabelVertical
QGraphicsRectItem * _rootItem
QList< QGraphicsLineItem * > vGridLines
QAction * _aCopyToClipboard
QAction * _aAutoScreenCapture
GLM_FUNC_DECL genType max(genType const &x, genType const &y)
UPlotItem * nextItem() const
UPlotItem * previousItem() const
const QPointF & data() const
QAction * _aUseFlatButtons
void showXAxis(bool shown)
QList< QGraphicsLineItem * > hGridLines
Qt::Orientation _orientation
GLM_FUNC_DECL detail::tmat4x4< T, P > orientation(detail::tvec3< T, P > const &Normal, detail::tvec3< T, P > const &Up)