]> SALOME platform Git repositories - modules/visu.git/blob - src/VISUGUI/VisuGUI_ScalarBarDlg.h
Salome HOME
Fix for bug PAL9160 ( No shading on visualizations ).
[modules/visu.git] / src / VISUGUI / VisuGUI_ScalarBarDlg.h
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //
24 //  File   : VisuGUI_ScalarBarDlg.h
25 //  Author : Laurent CORNABE & Hubert ROLLAND
26 //  Module : VISU
27 //  $Header$
28
29 #ifndef VISUGUI_SCALARBARDLG_H
30 #define VISUGUI_SCALARBARDLG_H
31
32 #include <qdialog.h>
33 #include <qbuttongroup.h>
34 #include <qgroupbox.h>
35 #include <qlabel.h>
36 #include <qradiobutton.h>
37 #include <qcheckbox.h>
38 #include <qpushbutton.h>
39 #include <qspinbox.h>
40 #include <qlineedit.h>
41 #include <qcombobox.h>
42 #include <qvbox.h>
43 #include <qtoolbutton.h>
44
45 #include "QtxDblSpinBox.h"
46
47 #include "VISU_ScalarMap_i.hh"
48
49 class QButtonGroup;
50 class QGroupBox;
51 class QLabel;
52 class QRadioButton;
53 class QCheckBox;
54 class QPushButton;
55 class QSpinBox;
56 class QLineEdit;
57 class QComboBox;
58 class QVBox;
59 class QToolButton;
60
61 class QtxDblSpinBox;
62 class SalomeApp_Module;
63 class VisuGUI_FontWg;
64 class VISU_ScalarMapAct;
65
66 class VisuGUI_TextPrefDlg: public QDialog
67 {
68   Q_OBJECT;
69
70  public:
71   VisuGUI_TextPrefDlg (QWidget* parent);
72   ~VisuGUI_TextPrefDlg() {};
73
74   QString getTitleText() { return myTitleEdt->text(); }
75   void setTitleText(QString theText) { myTitleEdt->setText(theText); }
76
77   void setTitleVisible (bool isVisible)
78     { (isVisible)? myTitleEdt->show() : myTitleEdt->hide(); }
79
80  public:
81   VisuGUI_FontWg* myTitleFont;
82   VisuGUI_FontWg* myLabelFont;
83
84  private:
85   QLineEdit* myTitleEdt;
86 };
87
88
89 class VisuGUI_ScalarBarPane : public QVBox
90 {
91   Q_OBJECT;
92
93  public:
94   VisuGUI_ScalarBarPane(QWidget* parent, bool SetPref);
95   ~VisuGUI_ScalarBarPane() {};
96
97   void    setRange( double imin, double imax, /*double fmin, double fmax,*/ bool sbRange );
98   bool    isIRange() {return RBIrange->isChecked();}
99   double  getMin() {return MinEdit->text().toDouble();}
100   double  getMax() {return MaxEdit->text().toDouble();}
101   int     getOrientation();
102   void    setPosAndSize( double x, double y, double w, double h, bool vert );
103   double  getX() {return XSpin->value();}
104   double  getY() {return YSpin->value();}
105   double  getWidth() {return WidthSpin->value();}
106   double  getHeight() {return HeightSpin->value();}
107   void    setScalarBarData( int colors, int labels );
108   int     getNbColors() {return ColorSpin->value();}
109   int     getNbLabels() {return LabelSpin->value();}
110   bool    isLogarithmic() {return CBLog->isChecked();}
111   void    setLogarithmic( bool on ) {CBLog->setChecked( on );}
112   bool    isToSave() {return CBSave ? CBSave->isChecked() : false;}
113
114   void initFromResources();
115   void storeToResources();
116
117   void initFromPrsObject(VISU::ScalarMap_i* thePrs);
118   int storeToPrsObject(VISU::ScalarMap_i* thePrs);
119
120   bool check();
121   void deletePreview();
122
123  protected:
124   QButtonGroup*   RangeGroup;
125   QRadioButton*   RBFrange;
126   QRadioButton*   RBIrange;
127   QLineEdit*      MinEdit;
128   QLineEdit*      MaxEdit;
129
130   QRadioButton*   RBhori;
131   QRadioButton*   RBvert;
132
133   QtxDblSpinBox* XSpin;
134   QtxDblSpinBox* YSpin;
135
136   QtxDblSpinBox* WidthSpin;
137   QtxDblSpinBox* HeightSpin;
138
139   QSpinBox*       ColorSpin;
140   QSpinBox*       LabelSpin;
141
142   QCheckBox*      CBSave;
143   QCheckBox*      CBLog;
144   QLabel*         myModeLbl;
145   QComboBox*      myModeCombo;
146   QPushButton*    myTextBtn;
147   VisuGUI_TextPrefDlg* myTextDlg;
148
149   double          Imin,   Imax,  /* Fmin,   Fmax,*/   Rmin,   Rmax;
150   double          myHorX, myHorY, myHorW, myHorH;
151   double          myVerX, myVerY, myVerW, myVerH;
152   int             myRangeMode;
153   bool myIsStoreTextProp;
154
155  private slots:
156   void changeDefaults( int );
157   void changeRange( int );
158   void XYChanged( double );
159   void onTextPref();
160   void onPreviewCheck(bool thePreview);
161   void updatePreview();
162
163  private:
164   void createScalarBar();
165   void deleteScalarBar();
166
167   QCheckBox* myPreviewCheck;
168   VISU_ScalarMapAct* myPreviewActor;
169   VISU::ScalarMap_i* myScalarMap;
170 };
171
172
173 class VisuGUI_ScalarBarDlg : public QDialog
174 {
175   Q_OBJECT;
176
177  public:
178   VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
179   ~VisuGUI_ScalarBarDlg() {};
180
181   bool isToSave() {return myScalarPane->isToSave();}
182
183   void initFromResources() {myScalarPane->initFromResources();}
184   void storeToResources() {myScalarPane->storeToResources();}
185
186   void initFromPrsObject(VISU::ScalarMap_i* thePrs) {myScalarPane->initFromPrsObject(thePrs);}
187   int storeToPrsObject(VISU::ScalarMap_i* thePrs) {return myScalarPane->storeToPrsObject(thePrs);}
188
189  protected slots:
190   void accept();
191   void reject();
192
193  protected:
194   VisuGUI_ScalarBarPane* myScalarPane;
195 };
196
197 #endif // VISUGUI_SCALARBARDLG_H