1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // VISU VISUGUI : GUI of VISU component
24 // File : VisuGUI_Prs3dDlg.h
25 // Author : Laurent CORNABE & Hubert ROLLAND
28 #ifndef VISUGUI_PRS3DDLG_H
29 #define VISUGUI_PRS3DDLG_H
33 #include "SALOME_GenericObjPointer.hh"
34 #include "VISU_ColoredPrs3d_i.hh"
47 class SalomeApp_DoubleSpinBox;
49 class SalomeApp_Module;
50 class SalomeApp_IntSpinBox;
51 class SVTK_FontWidget;
52 class VISU_ScalarMapAct;
53 class VISU_ScalarMapPL;
62 //----------------------------------------------------------------------------
63 class VisuGUI_TextPrefDlg: public QDialog
68 VisuGUI_TextPrefDlg (QWidget* parent);
69 ~VisuGUI_TextPrefDlg() {};
71 QString getTitleText();
72 void setTitleText( const QString& theText);
74 void setTitleVisible( bool isVisible );
76 void storeBeginValues();
79 void keyPressEvent( QKeyEvent* e );
82 SVTK_FontWidget* myTitleFont;
83 SVTK_FontWidget* myLabelFont;
91 QLineEdit* myTitleEdt;
99 //----------------------------------------------------------------------------
100 class VisuGUI_BarPrefDlg: public QDialog
105 VisuGUI_BarPrefDlg (QWidget* parent);
106 ~VisuGUI_BarPrefDlg() {};
108 void setRatios(int titleRatioSize, int labelRatioWidth,
109 int barRatioWidth, int barRatioHeight);
110 void getRatios(int& titleRatioSize, int& labelRatioWidth,
111 int& barRatioWidth, int& barRatioHeight);
113 void setUnitsVisible(bool isVisible);
114 bool isUnitsVisible();
116 void setLabelsPrecision( const int p );
117 int getLabelsPrecision() const;
119 void setOrientation( const int ori );
120 int getOrientation() const;
124 void keyPressEvent( QKeyEvent* e );
127 void updatePreview();
135 SalomeApp_IntSpinBox* myTitleSizeSpin;
136 SalomeApp_IntSpinBox* myLabelSizeSpin;
137 SalomeApp_IntSpinBox* myBarWidthSpin;
138 SalomeApp_IntSpinBox* myBarHeightSpin;
139 QCheckBox* myUnitsChk;
140 SalomeApp_IntSpinBox* myPrecisionSpin;
152 //----------------------------------------------------------------------------
153 class VisuGUI_ScalarBarPane : public QWidget//QVBox
158 VisuGUI_ScalarBarPane(QWidget* parent, bool theIsDisplayGaussMetric = false, bool thePreview = FALSE);
159 ~VisuGUI_ScalarBarPane();
161 void setRange( double imin, double imax, bool sbRange );
162 void setDefaultRange(double imin, double imax);
163 int getOrientation();
164 void setPosAndSize( double x, double y, double w, double h, bool vert );
165 void setScalarBarData( int colors, int labels );
175 bool isLogarithmic();
176 void setLogarithmic( bool on );
177 bool isShowDistribution();
178 void setShowDistribution( bool on );
181 void storeToResources();
182 void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs);
184 int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
189 QButtonGroup* RangeGroup;
190 QRadioButton* RBFrange;
191 QRadioButton* RBIrange;
195 QRadioButton* RBhori;
196 QRadioButton* RBvert;
198 SalomeApp_DoubleSpinBox* XSpin;
199 SalomeApp_DoubleSpinBox* YSpin;
201 SalomeApp_DoubleSpinBox* WidthSpin;
202 SalomeApp_DoubleSpinBox* HeightSpin;
204 SalomeApp_IntSpinBox* ColorSpin;
205 SalomeApp_IntSpinBox* LabelSpin;
210 QCheckBox* myHideBar;
213 QComboBox* myModeCombo;
214 QLabel* myGaussMetricLabel;
215 QComboBox* myGaussMetric;
216 QPushButton* myTextBtn;
217 QPushButton* myBarBtn;
218 VisuGUI_TextPrefDlg* myTextDlg;
219 VisuGUI_BarPrefDlg* myBarDlg;
221 double myHorX, myHorY, myHorW, myHorH;
222 double myVerX, myVerY, myVerW, myVerH;
223 int myHorTS, myHorLS, myHorBW, myHorBH;
224 int myVerTS, myVerTH, myVerLS, myVerBW, myVerBH;
225 bool myIsStoreTextProp;
228 void changeDefaults( int );
229 void changeRange( int );
230 void onFieldRange( bool );
231 void onImposedRange( bool );
232 void XYChanged( double );
233 void changeScalarMode( int );
234 void changeGaussMetric( int );
237 void onPreviewCheck(bool thePreview);
238 void updatePreview();
239 void onShowDistribution(bool);
242 void createScalarBar();
243 void deleteScalarBar();
245 QCheckBox* myPreviewCheck;
246 VISU_ScalarMapAct* myPreviewActor;
247 VISU::ScalarMap_i* myScalarMap;
248 VISU_ScalarMapPL* myScalarMapPL;
252 bool myIsDisplayGaussMetric;
256 //----------------------------------------------------------------------------
257 class VisuGUI_Prs3dDlg : public QDialog
262 VisuGUI_Prs3dDlg( SalomeApp_Module* theModule );
263 ~VisuGUI_Prs3dDlg() {}
265 virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
268 virtual int storeToPrsObject( VISU::ColoredPrs3d_i* thePrs ) = 0;
271 virtual QString GetContextHelpFilePath() = 0;
277 void keyPressEvent( QKeyEvent* e );
281 //----------------------------------------------------------------------------
282 class VisuGUI_ScalarBarBaseDlg : public VisuGUI_Prs3dDlg
287 VisuGUI_ScalarBarBaseDlg( SalomeApp_Module* theModule, bool theIsDisplayGaussMetric = false, bool thePreview = FALSE );
288 ~VisuGUI_ScalarBarBaseDlg();
290 virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
297 VisuGUI_ScalarBarPane* GetScalarPane();
300 VisuGUI_ScalarBarPane* myScalarPane;
304 //----------------------------------------------------------------------------