Salome HOME
22316: EDF 2719 SMESH: Split hexas into prisms
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MultiEditDlg.h
1 // Copyright (C) 2007-2013  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.
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 // File   : SMESHGUI_MultiEditDlg.h
24 // Author : Sergey LITONIN, Open CASCADE S.A.S.
25 //
26 #ifndef SMESHGUI_MULTIEDITDLG_H
27 #define SMESHGUI_MULTIEDITDLG_H
28
29 // SMESH includes
30 #include "SMESH_SMESHGUI.hxx"
31 #include "SMESHGUI_PreviewDlg.h"
32
33 // Qt includes 
34 #include <QDialog>
35
36 // OCCT includes
37 #include <TColStd_MapOfInteger.hxx>
38
39 // IDL includes
40 #include <SALOMEconfig.h>
41 #include CORBA_SERVER_HEADER(SMESH_Mesh)
42 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
43
44 class SMESHGUI;
45 class SMESHGUI_FilterDlg;
46 class SMESHGUI_SpinBox;
47
48 class SMESH_Actor;
49
50 class LightApp_SelectionMgr;
51 class SALOME_Actor;
52 class SVTK_Selector;
53
54 class QListWidget;
55 class QComboBox;
56 class QCheckBox;
57 class QGroupBox;
58 class QLineEdit;
59 class QPushButton;
60 class QButtonGroup;
61
62 /*!
63  * Class       : SMESHGUI_MultiEditDlg
64  * Description : Base class for dialogs of diagonal inversion and
65  *               union of two neighboring triangles
66  */
67
68 class SMESHGUI_EXPORT SMESHGUI_MultiEditDlg : public SMESHGUI_PreviewDlg
69 {
70   Q_OBJECT
71
72 public:
73   SMESHGUI_MultiEditDlg( SMESHGUI*  theModule,
74                          const int  theMode,
75                          const bool the3d2d = false,
76                          bool       theDoInit = true );
77   virtual ~SMESHGUI_MultiEditDlg();
78
79   void                      Init();
80
81   bool                      eventFilter( QObject*, QEvent* );
82
83 signals:
84   void                      ListContensChanged();
85
86 protected slots:
87   void                      onOk();
88   virtual bool              onApply();
89   virtual void              reject();
90   void                      onHelp();
91
92   void                      onDeactivate();
93   virtual void              onSelectionDone();
94
95   void                      onFilterBtn();
96   void                      onAddBtn();
97   void                      onRemoveBtn();
98   void                      onSortListBtn();
99   void                      onListSelectionChanged();
100   void                      onSubmeshChk();
101   void                      onGroupChk();
102   virtual void              onToAllChk();
103   void                      onFilterAccepted();
104   virtual void              on3d2dChanged(int);
105
106   SMESH::NumericalFunctor_ptr getNumericalFunctor();
107
108 protected:
109   void                      enterEvent( QEvent * );
110   void                      keyPressEvent( QKeyEvent* );
111   QWidget*                  createButtonFrame( QWidget* );
112   QWidget*                  createMainFrame( QWidget*, const bool );
113   virtual bool              isValid( const bool );
114   SMESH::long_array_var     getIds(SMESH::SMESH_IDSource_var& obj);
115   void                      updateButtons();
116   virtual void              setSelectionMode();
117   virtual bool              isIdValid( const int ) const;
118   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, 
119                                      const SMESH::long_array& ,
120                                      SMESH::SMESH_IDSource_ptr obj) = 0;
121   virtual int               nbElemsInMesh() = 0;
122   int                       entityType();
123
124 protected:
125   QPushButton*              myOkBtn;
126   QPushButton*              myApplyBtn;
127   QPushButton*              myCloseBtn;
128   QPushButton*              myHelpBtn;
129   SMESH_Actor*              myActor;
130   SMESH::SMESH_Mesh_var     myMesh;
131
132   LightApp_SelectionMgr*    mySelectionMgr;
133   SVTK_Selector*            mySelector;
134   SMESHGUI*                 mySMESHGUI;
135
136   QGroupBox*                mySelGrp;
137   QGroupBox*                myCriterionGrp;
138
139   QWidget*                  myChoiceWidget;
140   QButtonGroup*             myGroupChoice;
141   QComboBox*                myComboBoxFunctor;
142
143   QListWidget*              myListBox;
144   QPushButton*              myFilterBtn;
145   QPushButton*              myAddBtn;
146   QPushButton*              myRemoveBtn;
147   QPushButton*              mySortBtn;
148
149   QCheckBox*                myToAllChk;
150   QButtonGroup*             myEntityTypeGrp;
151
152   QCheckBox*                mySubmeshChk;
153   QPushButton*              mySubmeshBtn;
154   QLineEdit*                mySubmesh;
155
156   QCheckBox*                myGroupChk;
157   QPushButton*              myGroupBtn;
158   QLineEdit*                myGroup;
159
160   SMESHGUI_FilterDlg*       myFilterDlg;
161   TColStd_MapOfInteger      myIds;
162   int                       myFilterType;
163   bool                      myBusy;
164   int                       myEntityType;
165
166   QString                   myHelpFileName;
167 };
168
169 /*!
170  * Class       : SMESHGUI_ChangeOrientationDlg
171  * Description : Modification of orientation of faces
172  */
173 class  SMESHGUI_ChangeOrientationDlg : public SMESHGUI_MultiEditDlg
174 {
175   Q_OBJECT
176
177 public:
178   SMESHGUI_ChangeOrientationDlg( SMESHGUI* );
179   virtual ~SMESHGUI_ChangeOrientationDlg();
180
181 protected:
182   virtual bool process( SMESH::SMESH_MeshEditor_ptr,
183                         const SMESH::long_array& ,
184                         SMESH::SMESH_IDSource_ptr obj);
185   virtual int  nbElemsInMesh();
186 };
187
188 /*!
189  * Class       : SMESHGUI_UnionOfTrianglesDlg
190  * Description : Construction of quadrangles by automatic association of triangles
191  */
192 class  SMESHGUI_UnionOfTrianglesDlg : public SMESHGUI_MultiEditDlg
193 {
194   Q_OBJECT
195
196 public:
197   SMESHGUI_UnionOfTrianglesDlg( SMESHGUI* );
198   virtual ~SMESHGUI_UnionOfTrianglesDlg();
199
200 protected:
201   virtual bool      isValid( const bool );
202   virtual bool      process( SMESH::SMESH_MeshEditor_ptr,
203                              const SMESH::long_array&,
204                              SMESH::SMESH_IDSource_ptr obj );
205   virtual int       nbElemsInMesh();
206
207 protected slots:
208    virtual void     onDisplaySimulation( bool );
209
210 private:
211   SMESHGUI_SpinBox* myMaxAngleSpin;
212 };
213
214 /*
215   Class       : SMESHGUI_CuttingOfQuadsDlg
216   Description : Construction of quadrangles by automatic association of triangles
217 */
218 class  SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg
219 {
220   Q_OBJECT
221
222 public:
223   SMESHGUI_CuttingOfQuadsDlg( SMESHGUI* );
224   virtual ~SMESHGUI_CuttingOfQuadsDlg();
225
226 protected:
227   virtual bool  process( SMESH::SMESH_MeshEditor_ptr,
228                          const SMESH::long_array& ,
229                          SMESH::SMESH_IDSource_ptr obj);
230   virtual int   nbElemsInMesh();
231
232 protected slots:
233   virtual void  reject();
234   void          onCriterionRB();
235   void          onPreviewChk();
236
237 private:
238   void          displayPreview();
239   void          erasePreview();
240
241 private:
242   SALOME_Actor* myPreviewActor;
243   QCheckBox*    myPreviewChk;
244 };
245
246 /*!
247  * Class       : SMESHGUI_SplitVolumesDlg
248  * Description : Split all volumes into tetrahedrons
249  */
250 class  SMESHGUI_SplitVolumesDlg : public SMESHGUI_MultiEditDlg
251 {
252   Q_OBJECT
253
254 public:
255   SMESHGUI_SplitVolumesDlg( SMESHGUI* );
256   virtual ~SMESHGUI_SplitVolumesDlg();
257
258 protected slots:
259
260   virtual void on3d2dChanged(int);
261   virtual void onSelectionDone();
262
263   void         onFacetSelection(bool);
264   void         onSetDir();
265   void         updateNormalPreview(const QString& s="");
266
267 protected:
268
269   virtual bool process( SMESH::SMESH_MeshEditor_ptr,
270                         const SMESH::long_array&,
271                         SMESH::SMESH_IDSource_ptr obj );
272   virtual int  nbElemsInMesh();
273
274   virtual void setSelectionMode();
275   void         showFacetByElement( int id );
276   bool         isIntoPrisms();
277
278   QGroupBox*        myFacetSelGrp;
279   SMESHGUI_SpinBox* myPointSpin[3];
280   SMESHGUI_SpinBox* myDirSpin  [3];
281   QPushButton*      myFacetSelBtn;
282   QPushButton*      myAxisBtn[3];
283   QCheckBox*        myAllDomainsChk;
284
285   double            myCellSize;
286 };
287
288 #endif // SMESHGUI_MULTIEDITDLG_H