source: flair-src/trunk/tools/FlairGCS/src/Scope.h@ 9

Last change on this file since 9 was 9, checked in by Sanahuja Guillaume, 7 years ago

gcs

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