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