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