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