Rev | Line | |
---|
[10] | 1 | // %flair:license{
|
---|
| 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
| 4 | // %flair:license}
|
---|
[9] | 5 | #ifndef SCOPE_H_INCLUDED
|
---|
| 6 | #define SCOPE_H_INCLUDED
|
---|
| 7 |
|
---|
| 8 | #include <qwt_plot.h>
|
---|
| 9 | #include <QPen>
|
---|
| 10 |
|
---|
| 11 | class ScrollBar;
|
---|
| 12 | class QwtPlotCurve;
|
---|
| 13 | class QwtPlotItem;
|
---|
| 14 | class QMouseEvent;
|
---|
| 15 |
|
---|
| 16 | class Scope: public QwtPlot {
|
---|
| 17 | Q_OBJECT
|
---|
| 18 |
|
---|
| 19 | public:
|
---|
| 20 | Scope(QString title,float ymin, float ymax,float view_size_s=20,unsigned int refresh_rate_ms=40,unsigned int history_size=20000);
|
---|
| 21 | ~Scope();
|
---|
| 22 | int addCurve(QPen pen,QString legend);
|
---|
| 23 | void resetXView(void);
|
---|
| 24 | void resetYView(void);
|
---|
| 25 |
|
---|
| 26 | protected:
|
---|
| 27 | struct Curve {
|
---|
| 28 | QwtPlotCurve* plot;
|
---|
| 29 | double* data_x;
|
---|
| 30 | double* data_y;
|
---|
| 31 | unsigned int index;
|
---|
| 32 | unsigned int min_index;
|
---|
| 33 | unsigned int max_index;
|
---|
| 34 | };
|
---|
| 35 | QList<Curve*> curves;
|
---|
| 36 | float elapsed_time_s;
|
---|
| 37 |
|
---|
| 38 | void updateCurve(Curve* curve);
|
---|
| 39 | bool eventFilter(QObject *, QEvent *);
|
---|
| 40 |
|
---|
| 41 | private:
|
---|
| 42 | float ymin,ymax;
|
---|
| 43 | float view_size_s,orig_view_size_s;
|
---|
| 44 | unsigned int history_size;
|
---|
| 45 | ScrollBar* scrollbar;
|
---|
| 46 | bool scrolling;
|
---|
| 47 | float min_scroll,max_scroll;
|
---|
| 48 |
|
---|
| 49 | void alignScales(void);
|
---|
| 50 | void showCurve(QwtPlotItem *item, bool on);
|
---|
| 51 | void computeMinIndex(Curve* curve,float displayed_min_time);
|
---|
| 52 | void computeMaxIndex(Curve* curve,float displayed_max_time);
|
---|
| 53 | void changeViewSize(float new_view_size_s);
|
---|
| 54 |
|
---|
| 55 | private slots:
|
---|
| 56 | void legendChecked(const QVariant &itemInfo, bool on );
|
---|
| 57 | void scrollBarMoved(Qt::Orientation o, float min, float max);
|
---|
| 58 | };
|
---|
| 59 |
|
---|
| 60 |
|
---|
| 61 | #endif // SCOPE_H_INCLUDED
|
---|
Note:
See
TracBrowser
for help on using the repository browser.