Salome HOME
68847772b6536db491a7644e1cd35313e74bb0af
[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*, const int, const bool = false );
74   virtual ~SMESHGUI_MultiEditDlg();
75
76   void                      Init();
77
78   bool                      eventFilter( QObject*, QEvent* );
79
80 signals:
81   void                      ListContensChanged();
82
83 protected slots:
84   void                      onOk();
85   virtual bool              onApply();
86   virtual void              reject();
87   void                      onHelp();
88
89   void                      onDeactivate();
90   void                      onSelectionDone();
91
92   void                      onFilterBtn();
93   void                      onAddBtn();
94   void                      onRemoveBtn();
95   void                      onSortListBtn();
96   void                      onListSelectionChanged();
97   void                      onSubmeshChk();
98   void                      onGroupChk();
99   virtual void              onToAllChk();
100   void                      onFilterAccepted();
101   void                      on3d2dChanged(int);
102
103   SMESH::NumericalFunctor_ptr getNumericalFunctor();
104
105 protected:
106   void                      enterEvent( QEvent * );
107   void                      keyPressEvent( QKeyEvent* );
108   QWidget*                  createButtonFrame( QWidget* );
109   QWidget*                  createMainFrame( QWidget*, const bool );
110   virtual bool              isValid( const bool );
111   SMESH::long_array_var     getIds(SMESH::SMESH_IDSource_var& obj);
112   void                      updateButtons();
113   void                      setSelectionMode();
114   virtual bool              isIdValid( const int ) const;
115   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, 
116                                      const SMESH::long_array& ,
117                                      SMESH::SMESH_IDSource_ptr obj) = 0;
118   int                       entityType();
119
120 protected:
121   QPushButton*              myOkBtn;
122   QPushButton*              myApplyBtn;
123   QPushButton*              myCloseBtn;
124   QPushButton*              myHelpBtn;
125   SMESH_Actor*              myActor;
126   SMESH::SMESH_Mesh_var     myMesh;
127
128   LightApp_SelectionMgr*    mySelectionMgr;
129   SVTK_Selector*            mySelector;
130   SMESHGUI*                 mySMESHGUI;
131
132   QGroupBox*                mySelGrp;
133   QGroupBox*                myCriterionGrp;
134
135   QWidget*                  myChoiceWidget;
136   QButtonGroup*             myGroupChoice;
137   QComboBox*                myComboBoxFunctor;
138
139   QListWidget*              myListBox;
140   QPushButton*              myFilterBtn;
141   QPushButton*              myAddBtn;
142   QPushButton*              myRemoveBtn;
143   QPushButton*              mySortBtn;
144
145   QCheckBox*                myToAllChk;
146   QButtonGroup*             myEntityTypeGrp;
147
148   QCheckBox*                mySubmeshChk;
149   QPushButton*              mySubmeshBtn;
150   QLineEdit*                mySubmesh;
151
152   QCheckBox*                myGroupChk;
153   QPushButton*              myGroupBtn;
154   QLineEdit*                myGroup;
155
156   SMESHGUI_FilterDlg*       myFilterDlg;
157   TColStd_MapOfInteger      myIds;
158   int                       myFilterType;
159   bool                      myBusy;
160   int                       myEntityType;
161
162   QString                   myHelpFileName;
163 };
164
165 /*!
166  * Class       : SMESHGUI_ChangeOrientationDlg
167  * Description : Modification of orientation of faces
168  */
169 class  SMESHGUI_ChangeOrientationDlg : public SMESHGUI_MultiEditDlg
170 {
171   Q_OBJECT
172
173 public:
174   SMESHGUI_ChangeOrientationDlg( SMESHGUI* );
175   virtual ~SMESHGUI_ChangeOrientationDlg();
176
177 protected:
178   virtual bool process( SMESH::SMESH_MeshEditor_ptr,
179                         const SMESH::long_array& ,
180                         SMESH::SMESH_IDSource_ptr obj);
181 };
182
183 /*!
184  * Class       : SMESHGUI_UnionOfTrianglesDlg
185  * Description : Construction of quadrangles by automatic association of triangles
186  */
187 class  SMESHGUI_UnionOfTrianglesDlg : public SMESHGUI_MultiEditDlg
188 {
189   Q_OBJECT
190
191 public:
192   SMESHGUI_UnionOfTrianglesDlg( SMESHGUI* );
193   virtual ~SMESHGUI_UnionOfTrianglesDlg();
194
195 protected:
196   virtual bool      isValid( const bool );
197   virtual bool      process( SMESH::SMESH_MeshEditor_ptr,
198                              const SMESH::long_array&,
199                              SMESH::SMESH_IDSource_ptr obj );
200
201 protected slots:
202    virtual void     onDisplaySimulation( bool );
203
204 private:
205   SMESHGUI_SpinBox* myMaxAngleSpin;
206 };
207
208 /*
209   Class       : SMESHGUI_CuttingOfQuadsDlg
210   Description : Construction of quadrangles by automatic association of triangles
211 */
212 class  SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg
213 {
214   Q_OBJECT
215
216 public:
217   SMESHGUI_CuttingOfQuadsDlg( SMESHGUI* );
218   virtual ~SMESHGUI_CuttingOfQuadsDlg();
219
220 protected:
221   virtual bool  process( SMESH::SMESH_MeshEditor_ptr,
222                          const SMESH::long_array& ,
223                          SMESH::SMESH_IDSource_ptr obj);
224
225 protected slots:
226   virtual void  reject();
227   void          onCriterionRB();
228   void          onPreviewChk();
229
230 private:
231   void          displayPreview();
232   void          erasePreview();
233
234 private:
235   SALOME_Actor* myPreviewActor;
236   QCheckBox*    myPreviewChk;
237 };
238
239 /*!
240  * Class       : SMESHGUI_CuttingIntoTetraDlg
241  * Description : Split all volumes into tetrahedrons
242  */
243 class  SMESHGUI_CuttingIntoTetraDlg : public SMESHGUI_MultiEditDlg
244 {
245   Q_OBJECT
246
247 public:
248   SMESHGUI_CuttingIntoTetraDlg( SMESHGUI* );
249   virtual ~SMESHGUI_CuttingIntoTetraDlg();
250
251 protected:
252   virtual bool process( SMESH::SMESH_MeshEditor_ptr,
253                         const SMESH::long_array&,
254                         SMESH::SMESH_IDSource_ptr obj );
255 };
256
257 #endif // SMESHGUI_MULTIEDITDLG_H