My Project
 All Classes Functions Variables Pages
plot2D.h
1 #ifndef PLOT2D_H
2 #define PLOT2D_H
3 #include <math.h>
4 #include "array.h"
5 #include <QWidget>
6 #include <QPixmap>
7 #include <QPainter>
8 #include <QRect>
9 #include <QBrush>
10 #include <QMouseEvent>
11 #include <QString>
12 #include <QFontMetricsF>
13 #include <QClipboard>
14 #include <QApplication>
15 #include <QMessageBox>
16 
17 
18 class plot2D : public QWidget{
19  Q_OBJECT
20 public:
21  plot2D(QWidget *parent = 0);
22  void set_linedata(int cset, int* cc, double** xdata, double** ydata);
23  void set_pointdata(int cset, int* cc, double** xdata, double** ydata);
24  void set_linedata(int xcount, int ycount, double* xdata, double** ydata);
25  void set_pointdata(int xcount, int ycount, double* xdata, double** ydata);
26  void update_linedata(double** ydata, int ycount);
27  void set_labels(QString title, QString xbarlabel, QString ybarlabel);
28  void set_legend(QStringList* labels);
29  QSize sizeHint() const;
30  QSize minimumSizeHint() const;
31  void autoset_axis();
32  void set_linewidth(double linewidth);
33  void set_range(double plotxmin, double plotxmax,
34  double plotymin, double plotymax);
35  void data_to_clipboard();
36  void show_residuum();
37  unsigned char** get_bits();
38 public slots:
39  void zoom_in();
40  void zoom_out();
41 private:
42  double **xpdata, **ypdata, **xldata, **yldata;
43  int psets,lsets,*pcc,*lcc, freep, freel;
44  int showResiduum,resheight;
45  int showLegend;
46  int wheelselection;
47  QStringList leglabels;
48  void refresh_pixmap();
49  QPixmap pm;
50  int margin, ticklength, xsteps, ysteps;
51  double xmin,xmax,ymin,ymax; //Diagrammbereich
52  double xstep, ystep, xstep0, ystep0;//Achsskalen
53  double xprecission, yprecission; //Kommastellen der Beschriftung
54  double textheight;
55  double linewidth;
56  QPoint mouseposition;
57  QString title, xbarlabel, ybarlabel;
58  QRect dataarea;
59  QRect legendarea;
60  QRect zoombox;
61  int showzoombox; //Zoombox zeichnen oder nicht?
62  double xtoxdata(int x);
63  double ytoydata(int y);
64  double xdatatox(double x);
65  double ydatatoy(double y);
66  double resy(int i);
67  void add_axis_labels(QPainter* p);
68  void add_grid(QPainter* p);
69  void add_data(QPainter* p);
70  void add_residuum(QPainter* p);
71  void add_legend(QPainter* p);
72  void plot_single_set(int i);
73  QColor colorgradient(double x,double xmin,double xmax);
74 signals:
75  void keypressed(QKeyEvent *event);
76 protected:
77  void mouseMoveEvent(QMouseEvent *event);
78  void paintEvent(QPaintEvent *);
79  void resizeEvent(QResizeEvent *);
80  void mousePressEvent(QMouseEvent *event);
81  void wheelEvent(QWheelEvent * event );
82  void mouseReleaseEvent(QMouseEvent *event);
83  void keyPressEvent(QKeyEvent *event);
84 
85 };
86 
87 #endif // GRAPH_H
Definition: plot2D.h:18