ldrwidget.h
1 /***************************************************************************
2  ldrwidget.h - description
3  -------------------
4  begin : Mon Apr 15 2002
5  copyright : (C) 2000-2015 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 
102  void doneButtonPressed();
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 
140  void deleteDialogs();
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 
171  private:
172 
173  void set_widget(QWidget *widget, GuiGridLayout::Alignment alignment = GuiGridLayout::Default, bool override_enabled=false);
174 
175  unsigned int get_sizedfarray_size_and_factor(unsigned int& nx, unsigned int& ny, unsigned int& nz) const;
176 
177  void create_or_update_floatArrwidget(const farray& arr, bool initial);
178 
179 
180 
181  GuiGridLayout* grid;
182 
183  QWidget* widget_cache;
184 
185  LDRblockWidget* blockwidget;
186  intScientSlider* intslider;
187  intLineBox* intedit;
188  floatScientSlider* floatslider;
189  floatLineBox* floatedit;
190  enumBox* enumwidget;
191  buttonBox* boolwidget;
192  buttonBox* actionwidget;
193  QLabel* floatArrempty;
194  floatBox1D* floatArrwidget1;
195  floatLineBox* floatArredit;
196  floatBox3D* floatArrwidget2;
197  complexfloatBox1D* complexArrwidget;
198  stringBox* stringwidget;
199  stringBox* filenamewidget;
200  enumBox* funcwidget;
201  stringBox* formulawidget;
202  floatLineBox3D* triplewidget;
203 
204  // float 2D/3D stuff
205  farray sizedfarray;
206  farray mapfarray;
207  ndim oldfarraysize;
208  farray overlay_map;
209 
210  QWidget* vport;
211 
212  LDRbase& val;
213  STD_string ldrlabel;
214  STD_string ldrlabel_uncut;
215  bool label_cut;
216 
217  STD_list<LDRwidgetDialog*> subdialogs;
218 
219  unsigned int rows,cols;
220 
221 };
222 
223 
224 
225 
226 #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()
Definition: tjarray.h:41
void valueChanged()