ODIN
complex1d.h
1 /***************************************************************************
2  complex1d.h - description
3  -------------------
4  begin : Sun Aug 27 2000
5  copyright : (C) 2000-2021 by Thies Jochimsen
6  email : thies@jochimsen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef COMPLEX1D_H
19 #define COMPLEX1D_H
20 
21 #include <qgroupbox.h>
22 
23 #include "odinqt.h"
24 
25 #define SYMBOL_MAX_NUMOF_POINTS 20
26 
27 class GuiPlot; // forward declaration
28 
29 class DetachedComplexfloatBox1D; // forward declaration
30 
34 class complexfloatBox1D : public QGroupBox {
35  Q_OBJECT
36 
37  public:
38  complexfloatBox1D(const float *data1, const float *data2, int n,QWidget *parent, const char *name, bool fixed_size, const char *xAxisLabel=0, const char *yAxisLabelLeft=0, const char *yAxisLabelRight=0, float min_x=0.0, float max_x=0.0, bool detachable=false);
39  complexfloatBox1D(const double *data1,const double *data2,int n,QWidget *parent, const char *name, bool fixed_size, const char *xAxisLabel=0, const char *yAxisLabelLeft=0, const char *yAxisLabelRight=0, float min_x=0.0, float max_x=0.0, bool detachable=false);
41 
42 
43  public slots:
44  void refresh(const float *data1,const float *data2,int n, float min_x, float max_x);
45  void refresh(const float *data1,const float *data2,int n) {refresh(data1,data2,n,0.0,0.0);}
46 
47  void refresh(const double *data1,const double *data2,int n, float min_x, float max_x);
48  void refresh(const double *data1,const double *data2,int n) {refresh(data1,data2,n,0.0,0.0);}
49 
50 
51 
52  private slots:
53  void autoscale();
54  void detach();
55 
56  void mousePressedInPlot(const QMouseEvent& qme);
57  void mouseReleasedInPlot(const QMouseEvent& qme);
58 
59 
60  private:
61  void common_init(const char *name, bool fixed_size, bool data1, bool data2, const char *xAxisLabel, const char *yAxisLabelLeft, const char *yAxisLabelRight, bool detachable);
62 
63  void create_x_cache(float min_x, float max_x, int n);
64 
65 
66  long curveid1;
67  long curveid2;
68 
69  dvector data1_cache;
70  dvector data2_cache;
71  dvector x_cache;
72  const double* data1_ptr;
73  const double* data2_ptr;
74 
75  // Use strings to cache labels since original arrays may be outdated
76  STD_string name_cache;
77  STD_string xAxisLabel_cache;
78  STD_string yAxisLabelLeft_cache;
79  STD_string yAxisLabelRight_cache;
80  float min_x_cache;
81  float max_x_cache;
82  int n_cache;
83  bool detachable_cache;
84 
85 
86  GuiGridLayout *grid;
87  GuiPlot* plotter;
88 
89  int x_pressed,y_pressed;
90 
91  DetachedComplexfloatBox1D* detached;
92 };
93 
94 
96 
97 
98 class DetachedComplexfloatBox1D : public GuiDialog {
99 
100  public:
101  DetachedComplexfloatBox1D(const double *data1,const double *data2,int n,complexfloatBox1D *parent, const char *name, bool fixed_size, const char *xAxisLabel, const char *yAxisLabelLeft, const char *yAxisLabelRight, float min_x, float max_x);
102 
103  ~DetachedComplexfloatBox1D();
104 
105  void refresh(const double *data1,const double *data2,int n, float min_x, float max_x);
106 
107  private:
108  void create_grid();
109 
110  GuiGridLayout *grid;
111  complexfloatBox1D* cfb;
112 
113 };
114 
115 #endif
Definition: plot.h:51