Salome HOME
b539eee98b38d95dc562cb97229a5f97421e6cf5
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ExtrusionDlg.h
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  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, or (at your option) any later version.
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File   : SMESHGUI_ExtrusionDlg.h
25 // Author : Michael ZORIN, Open CASCADE S.A.S.
26 //
27 #ifndef SMESHGUI_EXTRUSIONDLG_H
28 #define SMESHGUI_EXTRUSIONDLG_H
29
30 // SMESH includes
31 #include "SMESH_SMESHGUI.hxx"
32 #include "SMESHGUI_PreviewDlg.h"
33 #include "SMESHGUI_Utils.h"
34
35 // SALOME GUI includes
36 #include <SALOME_InteractiveObject.hxx>
37
38 // IDL includes
39 #include <SALOMEconfig.h>
40 #include CORBA_SERVER_HEADER(SMESH_Mesh)
41 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
42
43 class QButtonGroup;
44 class QCheckBox;
45 class QGroupBox;
46 class QLabel;
47 class QLineEdit;
48 class QListWidget;
49 class QPushButton;
50 class QRadioButton;
51 class QToolButton;
52
53 class SMESHGUI;
54 class SMESH_Actor;
55 class SMESHGUI_IdValidator;
56 class SMESHGUI_SpinBox;
57 class SMESHGUI_FilterDlg;
58 class SVTK_Selector;
59 class LightApp_SelectionMgr;
60 class SUIT_SelectionFilter;
61 class SalomeApp_IntSpinBox;
62
63 //=================================================================================
64 // class    : SMESHGUI_3TypesSelector
65 // purpose  : A widget used to select both nodes, edges and faces for
66 //            Extrusion and Revolution operations
67 //=================================================================================
68
69 class SMESHGUI_EXPORT SMESHGUI_3TypesSelector : public QWidget
70 {
71   Q_OBJECT
72
73     public:
74
75   SMESHGUI_3TypesSelector( QWidget * parent = 0 );
76   ~SMESHGUI_3TypesSelector();
77
78   void Clear();
79   void SetEnabled( bool enable, SMESH::ElementType type );
80   bool IsAnythingSelected( SMESH::ElementType type = SMESH::ALL );
81   SMESH::ElementType GetSelected( SMESH::ListOfIDSources & nodes,
82                                   SMESH::ListOfIDSources & edges,
83                                   SMESH::ListOfIDSources & faces );
84   SMESH::SMESH_Mesh_var GetMesh() { return myMesh; }
85   SMESH_Actor*         GetActor() { return myActor; }
86   Handle(SALOME_InteractiveObject) GetIO() { return myIO; }
87   QButtonGroup* GetButtonGroup()  { return mySelectBtnGrp; }
88
89  signals:
90
91   void selectionChanged();
92
93  private slots:
94
95   void                            selectionIntoArgument();
96   void                            onTextChange( const QString& );
97   void                            onSelectMesh( bool on );
98   void                            setFilters();
99   void                            onSelectType( int iType );
100
101  private:
102
103   void                             addTmpIdSource( SMESH::long_array_var& ids,
104                                                    int iType, int index);
105
106   QGroupBox*                       myGroups   [3];
107   QLabel*                          myLabel    [3];
108   QLineEdit*                       myLineEdit [3];
109   QCheckBox*                       myMeshChk  [3];
110   QPushButton*                     myFilterBtn[3];
111   QButtonGroup*                    mySelectBtnGrp;
112   SMESHGUI_FilterDlg*              myFilterDlg;
113   SUIT_SelectionFilter*            myFilter   [3];
114   SMESHGUI_IdValidator*            myIdValidator;
115
116   bool                             myBusy;
117   SMESH::SMESH_Mesh_var            myMesh;
118   SMESH_Actor*                     myActor;
119   Handle(SALOME_InteractiveObject) myIO;
120   SMESH::ListOfIDSources_var       myIDSource[3];
121   QList<SMESH::IDSource_wrap>      myTmpIDSourceList;
122
123   LightApp_SelectionMgr*           mySelectionMgr;
124   SVTK_Selector*                   mySelector;
125 };
126
127 //=================================================================================
128 // class    : SMESHGUI_ExtrusionDlg
129 // purpose  :
130 //=================================================================================
131
132 class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public SMESHGUI_PreviewDlg
133 {
134   Q_OBJECT
135
136     public:
137   SMESHGUI_ExtrusionDlg( SMESHGUI* );
138   ~SMESHGUI_ExtrusionDlg();
139
140 private:
141   void                             Init( bool = true );
142   void                             enterEvent( QEvent* );       /* mouse enter the QWidget */
143   void                             keyPressEvent( QKeyEvent* );
144   int                              GetConstructorId();
145   void                             getExtrusionVector(SMESH::DirStruct& aVector);
146   void                             extrusionByNormal(SMESH::SMESH_MeshEditor_ptr meshEditor,
147                                                      const bool                  makeGroups=false);
148   bool                             getScaleParams( SMESH::double_array*& scales,
149                                                    SMESH::double_array*& basePoint );
150   
151   bool                             isValid();
152   bool                             isValuesValid();
153   
154   LightApp_SelectionMgr*           mySelectionMgr;        /* User shape selection */
155   SVTK_Selector*                   mySelector;
156   QList<double>                    myScalesList;
157
158   // widgets
159   SMESHGUI_3TypesSelector*         SelectorWdg;
160   QRadioButton*                    ExtrMethod_RBut0;
161   QRadioButton*                    ExtrMethod_RBut1;
162   QRadioButton*                    ExtrMethod_RBut2;
163
164   QGroupBox*                       GroupArguments;
165   QLabel*                          TextLabelVector;
166   QLabel*                          TextLabelDistance;
167   QPushButton*                     SelectVectorButton;
168   QLabel*                          TextLabelDx;
169   SMESHGUI_SpinBox*                SpinBox_Dx;
170   QLabel*                          TextLabelDy;
171   SMESHGUI_SpinBox*                SpinBox_Dy;
172   QLabel*                          TextLabelDz;
173   SMESHGUI_SpinBox*                SpinBox_Dz;
174   QLabel*                          TextLabelVx;
175   SMESHGUI_SpinBox*                SpinBox_Vx;
176   QLabel*                          TextLabelVy;
177   SMESHGUI_SpinBox*                SpinBox_Vy;
178   QLabel*                          TextLabelVz;
179   SMESHGUI_SpinBox*                SpinBox_Vz;
180   QLabel*                          TextLabelDist;
181   SMESHGUI_SpinBox*                SpinBox_VDist;
182   QLabel*                          TextLabelNbSteps;
183   SalomeApp_IntSpinBox*            SpinBox_NbSteps;
184   QCheckBox*                       ByAverageNormalCheck;
185   QCheckBox*                       UseInputElemsOnlyCheck;
186   QCheckBox*                       MakeGroupsCheck;
187
188   QGroupBox*                       BasePointGrp;
189   QPushButton*                     SelectBasePointButton;
190   SMESHGUI_SpinBox*                BasePoint_XSpin;
191   SMESHGUI_SpinBox*                BasePoint_YSpin;
192   SMESHGUI_SpinBox*                BasePoint_ZSpin;
193
194   QGroupBox*                       ScalesGrp;
195   QListWidget*                     ScalesList;
196   QToolButton*                     AddScaleButton;
197   QToolButton*                     RemoveScaleButton;
198   SMESHGUI_SpinBox*                ScaleSpin;
199   QCheckBox*                       LinearScalesCheck;
200
201   QGroupBox*                       GroupButtons;
202   QPushButton*                     buttonOk;
203   QPushButton*                     buttonCancel;
204   QPushButton*                     buttonApply;
205   QPushButton*                     buttonHelp;
206
207   QString                          myHelpFileName;
208   QString                          myIDs;
209
210 protected slots:
211   virtual void                    onDisplaySimulation( bool );
212   virtual void                    reject();
213    
214 private slots:
215   void                            CheckIsEnable();
216   void                            ClickOnOk();
217   bool                            ClickOnApply();
218   void                            ClickOnHelp();
219   void                            ClickOnRadio();
220   void                            SetEditCurrentArgument();
221   void                            SelectionIntoArgument();
222   void                            DeactivateActiveDialog();
223   void                            ActivateThisDialog();
224   void                            onOpenView();
225   void                            onCloseView();
226   void                            OnScaleAdded();
227   void                            OnScaleRemoved();
228
229 };
230
231 #endif // SMESHGUI_EXTRUSIONDLG_H