1 // Copyright (C) 2007-2008 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
22 // VISU VISUGUI : GUI of VISU component
23 // File : VisuGUI_Prs3dDlg.h
24 // Author : Laurent CORNABE & Hubert ROLLAND
27 #ifndef VISUGUI_PRS3DDLG_H
28 #define VISUGUI_PRS3DDLG_H
32 #include "SALOME_GenericObjPointer.hh"
33 #include "VISU_ColoredPrs3d_i.hh"
47 class QtxDoubleSpinBox;
49 class SalomeApp_Module;
50 class SVTK_FontWidget;
51 class VISU_ScalarMapAct;
52 class VISU_ScalarMapPL;
61 //----------------------------------------------------------------------------
62 class VisuGUI_TextPrefDlg: public QDialog
67 VisuGUI_TextPrefDlg (QWidget* parent);
68 ~VisuGUI_TextPrefDlg() {};
70 QString getTitleText();
71 void setTitleText( const QString& theText);
73 void setTitleVisible( bool isVisible );
75 void storeBeginValues();
78 void keyPressEvent( QKeyEvent* e );
81 SVTK_FontWidget* myTitleFont;
82 SVTK_FontWidget* myLabelFont;
90 QLineEdit* myTitleEdt;
98 //----------------------------------------------------------------------------
99 class VisuGUI_BarPrefDlg: public QDialog
104 VisuGUI_BarPrefDlg (QWidget* parent);
105 ~VisuGUI_BarPrefDlg() {};
107 void setRatios(int titleRatioSize, int labelRatioWidth,
108 int barRatioWidth, int barRatioHeight);
109 void getRatios(int& titleRatioSize, int& labelRatioWidth,
110 int& barRatioWidth, int& barRatioHeight);
112 void setUnitsVisible(bool isVisible);
113 bool isUnitsVisible();
115 void setLabelsPrecision( const int p );
116 int getLabelsPrecision() const;
118 void setOrientation( const int ori );
119 int getOrientation() const;
123 void keyPressEvent( QKeyEvent* e );
126 void updatePreview();
134 QSpinBox* myTitleSizeSpin;
135 QSpinBox* myLabelSizeSpin;
136 QSpinBox* myBarWidthSpin;
137 QSpinBox* myBarHeightSpin;
138 QCheckBox* myUnitsChk;
139 QSpinBox* myPrecisionSpin;
151 //----------------------------------------------------------------------------
152 class VisuGUI_ScalarBarPane : public QWidget//QVBox
157 VisuGUI_ScalarBarPane(QWidget* parent, bool thePreview = FALSE);
158 ~VisuGUI_ScalarBarPane();
160 void setRange( double imin, double imax, bool sbRange );
161 void setDefaultRange(double imin, double imax);
162 int getOrientation();
163 void setPosAndSize( double x, double y, double w, double h, bool vert );
164 void setScalarBarData( int colors, int labels );
174 bool isLogarithmic();
175 void setLogarithmic( bool on );
176 bool isShowDistribution();
177 void setShowDistribution( bool on );
180 void storeToResources();
181 void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs);
183 int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
188 QButtonGroup* RangeGroup;
189 QRadioButton* RBFrange;
190 QRadioButton* RBIrange;
194 QRadioButton* RBhori;
195 QRadioButton* RBvert;
197 QtxDoubleSpinBox* XSpin;
198 QtxDoubleSpinBox* YSpin;
200 QtxDoubleSpinBox* WidthSpin;
201 QtxDoubleSpinBox* HeightSpin;
209 QCheckBox* myHideBar;
212 QComboBox* myModeCombo;
213 QPushButton* myTextBtn;
214 QPushButton* myBarBtn;
215 VisuGUI_TextPrefDlg* myTextDlg;
216 VisuGUI_BarPrefDlg* myBarDlg;
218 double myHorX, myHorY, myHorW, myHorH;
219 double myVerX, myVerY, myVerW, myVerH;
220 int myHorTS, myHorLS, myHorBW, myHorBH;
221 int myVerTS, myVerTH, myVerLS, myVerBW, myVerBH;
222 bool myIsStoreTextProp;
225 void changeDefaults( int );
226 void changeRange( int );
227 void onFieldRange( bool );
228 void onImposedRange( bool );
229 void XYChanged( double );
230 void changeScalarMode( int );
233 void onPreviewCheck(bool thePreview);
234 void updatePreview();
235 void onShowDistribution(bool);
238 void createScalarBar();
239 void deleteScalarBar();
241 QCheckBox* myPreviewCheck;
242 VISU_ScalarMapAct* myPreviewActor;
243 VISU::ScalarMap_i* myScalarMap;
244 VISU_ScalarMapPL* myScalarMapPL;
251 //----------------------------------------------------------------------------
252 class VisuGUI_Prs3dDlg : public QDialog
257 VisuGUI_Prs3dDlg( SalomeApp_Module* theModule );
258 ~VisuGUI_Prs3dDlg() {}
260 virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
263 virtual int storeToPrsObject( VISU::ColoredPrs3d_i* thePrs ) = 0;
266 virtual QString GetContextHelpFilePath() = 0;
272 void keyPressEvent( QKeyEvent* e );
276 //----------------------------------------------------------------------------
277 class VisuGUI_ScalarBarBaseDlg : public VisuGUI_Prs3dDlg
282 VisuGUI_ScalarBarBaseDlg( SalomeApp_Module* theModule, bool thePreview = FALSE );
283 ~VisuGUI_ScalarBarBaseDlg();
285 virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
292 VisuGUI_ScalarBarPane* GetScalarPane();
295 VisuGUI_ScalarBarPane* myScalarPane;
299 //----------------------------------------------------------------------------