ODIN
ldrwidget.h
1 /***************************************************************************
2  ldrwidget.h - description
3  -------------------
4  begin : Mon Apr 15 2002
5  copyright : (C) 2000-2021 by Thies H. 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 LDRWIDGET_H
19 #define LDRWIDGET_H
20 
21 #include <qwidget.h>
22 
23 #include "odinqt.h"
24 
25 
26 #include <tjutils/tjarray.h>
27 #include <odinpara/ldrbase.h>
28 
30 
31 #define _MAX_SLIDER_STEPS_ 100
32 #define _MAX_LABEL_LENGTH_ 15
33 #define _FLOAT_DIGITS_ 3
34 
35 #define _INFOBOX_LINEWIDTH_ 50
36 
37 #define _MAX_SUBWIDGETS_FOR_ALIGNCENT_ 5
38 
40 
41 // forward declarations to decouple headers as far as possible
42 class LDRbase;
43 class intScientSlider;
44 class intLineBox;
45 class floatScientSlider;
46 class floatLineBox;
47 class enumBox;
48 class buttonBox;
49 class floatBox1D;
50 class floatBox3D;
51 class complexfloatBox1D;
52 class stringBox;
53 class floatLineBox3D;
54 
55 class LDRwidgetDialog;
56 class LDRblockWidget;
57 class LDReditCaller;
58 
60 
61 
67 class LDRwidget : public QWidget {
68  Q_OBJECT
69 
70  public:
71 
83  LDRwidget(LDRbase& ldr,unsigned int columns=1, QWidget *parent=0, bool doneButton=false, const char* omittext="", bool storeLoadButtons=false);
84  ~LDRwidget();
85 
86 
87  // members for 2D/3D plot
88  void write_pixmap(const char* fname, const char* format, bool dump_all=false) const;
89  void write_legend(const char* fname, const char* format) const;
90  void write_map_legend(const char* fname, const char* format) const;
91 
92 
93  signals:
97  void valueChanged();
98 
103 
104  // signals for 2D/3D plot
105  void clicked(int x, int y, int z);
106  void newProfile(const float *data, int npts, bool horizontal, int position);
107  void newMask(const float* data, int slice);
108 
109 
110  // private:
111  void updateSubWidget();
112  void deleteSubDialogs();
113 
114  void newintval(int);
115  void newfloatval(float);
116  void newenumval(int);
117  void newboolval(bool);
118  void newfloatArr1( const float*, int, float, float);
119 // void newdoubleArr1( const double*, int, float, float);
120  void newfloatArr2( const float*, float, float);
121  void newfloatArrMap(const float*, float, float, float);
122  void newcomplexArr( const float*, const float*, int, float, float);
123  void newfuncval(int);
124  void newstringval(const char*);
125  void newfilenameval(const char*);
126  void newformulaval(const char*);
127  void newtripleval(float,float,float);
128 
129 
130  public slots:
131 
135  void updateWidget();
136 
141 
142 
143  private slots:
144  void emitValueChanged();
145  void emitDone();
146  void emitClicked(int x, int y, int z) {emit clicked(x,y,z);}
147  void emitNewProfile(const float *data, int npts, bool horizontal, int position) {emit newProfile(data, npts, horizontal, position);}
148  void emitNewMask(const float *data, int slice) {emit newMask(data,slice);}
149 
150  void changeLDRint( int );
151  void changeLDRfloat( float );
152  void changeLDRenum( int );
153  void changeLDRbool ( bool );
154  void changeLDRaction();
155  void changeLDRfunction( int );
156  void changeLDRstring(const char*);
157  void changeLDRfileName(const char*);
158  void browseLDRfileName();
159  void changeLDRformula(const char*);
160  void changeLDRtriple(float,float,float);
161  void infoLDRformula();
162  void editLDRfunction();
163  void infoLDRfunction();
164 
165  public:
166  STD_string get_label() const;
167  unsigned int get_rows() const {return rows;}
168  unsigned int get_cols() const {return cols;}
169 
170  int get_current_z() const;
171 
172 
173  private:
174 
175  void set_widget(QWidget *widget, GuiGridLayout::Alignment alignment = GuiGridLayout::Default, bool override_enabled=false);
176 
177  unsigned int get_sizedfarray_size_and_factor(unsigned int& nx, unsigned int& ny, unsigned int& nz) const;
178 
179  void create_or_update_floatArrwidget(const farray& arr, bool initial);
180 
181 
182 
183  GuiGridLayout* grid;
184 
185  QWidget* widget_cache;
186 
187  LDRblockWidget* blockwidget;
188  intScientSlider* intslider;
189  intLineBox* intedit;
190  floatScientSlider* floatslider;
191  floatLineBox* floatedit;
192  enumBox* enumwidget;
193  buttonBox* boolwidget;
194  buttonBox* actionwidget;
195  QLabel* floatArrempty;
196  floatBox1D* floatArrwidget1;
197  floatLineBox* floatArredit;
198  floatBox3D* floatArrwidget2;
199  complexfloatBox1D* complexArrwidget;
200  stringBox* stringwidget;
201  stringBox* filenamewidget;
202  enumBox* funcwidget;
203  stringBox* formulawidget;
204  floatLineBox3D* triplewidget;
205 
206  // float 2D/3D stuff
207  farray sizedfarray;
208  farray mapfarray;
209  ndim oldfarraysize;
210  farray overlay_map;
211 
212  QWidget* vport;
213 
214  LDRbase& val;
215  STD_string ldrlabel;
216  STD_string ldrlabel_uncut;
217  bool label_cut;
218 
219  STD_list<LDRwidgetDialog*> subdialogs;
220 
221  unsigned int rows,cols;
222 
223 };
224 
225 
226 
227 
228 #endif
void updateWidget()
LDRwidget(LDRbase &ldr, unsigned int columns=1, QWidget *parent=0, bool doneButton=false, const char *omittext="", bool storeLoadButtons=false)
void deleteDialogs()
void doneButtonPressed()
void valueChanged()
Definition: tjarray.h:41