Salome HOME
Merge remote branch 'origin/V8_5_asterstudy'
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MultiEditDlg.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 // 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   void                      onOpenView();
106   void                      onCloseView();
107
108   SMESH::NumericalFunctor_ptr getNumericalFunctor();
109
110 protected:
111   void                      enterEvent( QEvent * );
112   void                      keyPressEvent( QKeyEvent* );
113   QWidget*                  createButtonFrame( QWidget* );
114   QWidget*                  createMainFrame( QWidget*, const bool );
115   virtual bool              isValid( const bool );
116   SMESH::long_array_var     getIds(SMESH::SMESH_IDSource_var& obj);
117   void                      updateButtons();
118   virtual void              setSelectionMode();
119   virtual bool              isIdValid( const int ) const;
120   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, 
121                                      const SMESH::long_array& ,
122                                      SMESH::SMESH_IDSource_ptr obj) = 0;
123   virtual int               nbElemsInMesh() = 0;
124   int                       entityType();
125
126 protected:
127   QPushButton*              myOkBtn;
128   QPushButton*              myApplyBtn;
129   QPushButton*              myCloseBtn;
130   QPushButton*              myHelpBtn;
131   SMESH_Actor*              myActor;
132   SMESH::SMESH_Mesh_var     myMesh;
133
134   LightApp_SelectionMgr*    mySelectionMgr;
135   SVTK_Selector*            mySelector;
136   SMESHGUI*                 mySMESHGUI;
137
138   QGroupBox*                mySelGrp;
139   QGroupBox*                myCriterionGrp;
140
141   QWidget*                  myChoiceWidget;
142   QButtonGroup*             myGroupChoice;
143   QComboBox*                myComboBoxFunctor;
144
145   QListWidget*              myListBox;
146   QPushButton*              myFilterBtn;
147   QPushButton*              myAddBtn;
148   QPushButton*              myRemoveBtn;
149   QPushButton*              mySortBtn;
150
151   QCheckBox*                myToAllChk;
152   QButtonGroup*             myEntityTypeGrp;
153
154   QCheckBox*                mySubmeshChk;
155   QPushButton*              mySubmeshBtn;
156   QLineEdit*                mySubmesh;
157
158   QCheckBox*                myGroupChk;
159   QPushButton*              myGroupBtn;
160   QLineEdit*                myGroup;
161
162   SMESHGUI_FilterDlg*       myFilterDlg;
163   TColStd_MapOfInteger      myIds;
164   int                       myFilterType;
165   bool                      myBusy;
166   int                       myEntityType;
167
168   QString                   myHelpFileName;
169 };
170
171 /*!
172  * Class       : SMESHGUI_ChangeOrientationDlg
173  * Description : Modification of orientation of faces
174  */
175 class  SMESHGUI_ChangeOrientationDlg : public SMESHGUI_MultiEditDlg
176 {
177   Q_OBJECT
178
179 public:
180   SMESHGUI_ChangeOrientationDlg( SMESHGUI* );
181   virtual ~SMESHGUI_ChangeOrientationDlg();
182
183 protected:
184   virtual bool process( SMESH::SMESH_MeshEditor_ptr,
185                         const SMESH::long_array& ,
186                         SMESH::SMESH_IDSource_ptr obj);
187   virtual int  nbElemsInMesh();
188 };
189
190 /*!
191  * Class       : SMESHGUI_UnionOfTrianglesDlg
192  * Description : Construction of quadrangles by automatic association of triangles
193  */
194 class  SMESHGUI_UnionOfTrianglesDlg : public SMESHGUI_MultiEditDlg
195 {
196   Q_OBJECT
197
198 public:
199   SMESHGUI_UnionOfTrianglesDlg( SMESHGUI* );
200   virtual ~SMESHGUI_UnionOfTrianglesDlg();
201
202 protected:
203   virtual bool      isValid( const bool );
204   virtual bool      process( SMESH::SMESH_MeshEditor_ptr,
205                              const SMESH::long_array&,
206                              SMESH::SMESH_IDSource_ptr obj );
207   virtual int       nbElemsInMesh();
208
209 protected slots:
210    virtual void     onDisplaySimulation( bool );
211
212 private:
213   SMESHGUI_SpinBox* myMaxAngleSpin;
214 };
215
216 /*
217   Class       : SMESHGUI_CuttingOfQuadsDlg
218   Description : Construction of quadrangles by automatic association of triangles
219 */
220 class  SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg
221 {
222   Q_OBJECT
223
224 public:
225   SMESHGUI_CuttingOfQuadsDlg( SMESHGUI* );
226   virtual ~SMESHGUI_CuttingOfQuadsDlg();
227
228 protected:
229   virtual bool  process( SMESH::SMESH_MeshEditor_ptr,
230                          const SMESH::long_array& ,
231                          SMESH::SMESH_IDSource_ptr obj);
232   virtual int   nbElemsInMesh();
233
234 protected slots:
235   virtual void  reject();
236   void          onCriterionRB();
237   void          onPreviewChk();
238
239 private:
240   void          displayPreview();
241   void          erasePreview();
242
243 private:
244   SALOME_Actor* myPreviewActor;
245   QCheckBox*    myPreviewChk;
246 };
247
248 /*!
249  * Class       : SMESHGUI_SplitVolumesDlg
250  * Description : Split all volumes into tetrahedrons
251  */
252 class  SMESHGUI_SplitVolumesDlg : public SMESHGUI_MultiEditDlg
253 {
254   Q_OBJECT
255
256 public:
257   SMESHGUI_SplitVolumesDlg( SMESHGUI* );
258   virtual ~SMESHGUI_SplitVolumesDlg();
259
260 protected slots:
261
262   virtual void on3d2dChanged(int);
263   virtual void onSelectionDone();
264
265   void         onFacetSelection(bool);
266   void         onSetDir();
267   void         updateNormalPreview(const QString& s="");
268
269 protected:
270
271   virtual bool process( SMESH::SMESH_MeshEditor_ptr,
272                         const SMESH::long_array&,
273                         SMESH::SMESH_IDSource_ptr obj );
274   virtual int  nbElemsInMesh();
275
276   virtual void setSelectionMode();
277   void         showFacetByElement( int id );
278   bool         isIntoPrisms();
279
280   QGroupBox*        myFacetSelGrp;
281   SMESHGUI_SpinBox* myPointSpin[3];
282   SMESHGUI_SpinBox* myDirSpin  [3];
283   QPushButton*      myFacetSelBtn;
284   QPushButton*      myAxisBtn[3];
285   QCheckBox*        myAllDomainsChk;
286
287   double            myCellSize;
288 };
289
290 #endif // SMESHGUI_MULTIEDITDLG_H