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

Last change on this file since 15 was 15, checked in by Bayard Gildas, 5 years ago

sources reformatted with flair-format-dir script

File size: 1.5 KB
Line 
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}
5#ifndef SCOPE_H_INCLUDED
6#define SCOPE_H_INCLUDED
7
8#include <qwt_plot.h>
9#include <QPen>
10
11class ScrollBar;
12class QwtPlotCurve;
13class QwtPlotItem;
14class QMouseEvent;
15
16class Scope : public QwtPlot {
17  Q_OBJECT
18
19public:
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);
26
27protected:
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;
38
39  void updateCurve(Curve *curve);
40  bool eventFilter(QObject *, QEvent *);
41
42private:
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
56private 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.