Salome HOME
ea23178c90457a521555fa2c692f6afb2303a900
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MultiEditDlg.h
1 //  Copyright (C) 2007-2008  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 // File   : SMESHGUI_MultiEditDlg.h
23 // Author : Sergey LITONIN, Open CASCADE S.A.S.
24 //
25 #ifndef SMESHGUI_MULTIEDITDLG_H
26 #define SMESHGUI_MULTIEDITDLG_H
27
28 // SMESH includes
29 #include "SMESH_SMESHGUI.hxx"
30
31 // Qt includes 
32 #include <QDialog>
33
34 // OCCT includes
35 #include <TColStd_MapOfInteger.hxx>
36
37 // IDL includes
38 #include <SALOMEconfig.h>
39 #include CORBA_SERVER_HEADER(SMESH_Mesh)
40 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
41
42 class SMESHGUI;
43 class SMESHGUI_FilterDlg;
44 class SMESHGUI_SpinBox;
45
46 class SMESH_Actor;
47
48 class LightApp_SelectionMgr;
49 class SALOME_Actor;
50 class SVTK_Selector;
51
52 class QListWidget;
53 class QComboBox;
54 class QCheckBox;
55 class QGroupBox;
56 class QLineEdit;
57 class QPushButton;
58 class QButtonGroup;
59
60 /*!
61  * Class       : SMESHGUI_MultiEditDlg
62  * Description : Base class for dialogs of diagonal inversion and
63  *               union of two neighboring triangles
64  */
65
66 class SMESHGUI_EXPORT SMESHGUI_MultiEditDlg : public QDialog
67 {
68   Q_OBJECT
69
70 public:
71   SMESHGUI_MultiEditDlg( SMESHGUI*, const int, const bool = false );
72   virtual ~SMESHGUI_MultiEditDlg();
73
74   void                      Init();
75
76   bool                      eventFilter( QObject*, QEvent* );
77
78 signals:
79   void                      ListContensChanged();
80
81 protected slots:
82   void                      onOk();
83   virtual bool              onApply();
84   virtual void              onClose();
85   void                      onHelp();
86
87   void                      onDeactivate();
88   void                      onSelectionDone();
89
90   void                      onFilterBtn();
91   void                      onAddBtn();
92   void                      onRemoveBtn();
93   void                      onSortListBtn();
94   void                      onListSelectionChanged();
95   void                      onSubmeshChk();
96   void                      onGroupChk();
97   virtual void              onToAllChk();
98   void                      onFilterAccepted();
99   void                      on3d2dChanged(int);
100
101   SMESH::NumericalFunctor_ptr getNumericalFunctor();
102
103 protected:
104   void                      closeEvent( QCloseEvent* );
105   void                      enterEvent( QEvent * );
106   void                      hideEvent( QHideEvent* );                        /* ESC key */
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 private:
202   SMESHGUI_SpinBox* myMaxAngleSpin;
203 };
204
205 /*
206   Class       : SMESHGUI_CuttingOfQuadsDlg
207   Description : Construction of quadrangles by automatic association of triangles
208 */
209 class  SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg
210 {
211   Q_OBJECT
212
213 public:
214   SMESHGUI_CuttingOfQuadsDlg( SMESHGUI* );
215   virtual ~SMESHGUI_CuttingOfQuadsDlg();
216
217 protected:
218   virtual bool  process( SMESH::SMESH_MeshEditor_ptr,
219                          const SMESH::long_array& ,
220                          SMESH::SMESH_IDSource_ptr obj);
221
222 protected slots:
223   virtual void  onClose();
224   void          onCriterionRB();
225   void          onPreviewChk();
226
227 private:
228   void          displayPreview();
229   void          erasePreview();
230
231 private:
232   SALOME_Actor* myPreviewActor;
233   QCheckBox*    myPreviewChk;
234 };
235
236 /*!
237  * Class       : SMESHGUI_CuttingIntoTetraDlg
238  * Description : Split all volumes into tetrahedrons
239  */
240 class  SMESHGUI_CuttingIntoTetraDlg : public SMESHGUI_MultiEditDlg
241 {
242   Q_OBJECT
243
244 public:
245   SMESHGUI_CuttingIntoTetraDlg( SMESHGUI* );
246   virtual ~SMESHGUI_CuttingIntoTetraDlg();
247
248 protected:
249   virtual bool process( SMESH::SMESH_MeshEditor_ptr,
250                         const SMESH::long_array&,
251                         SMESH::SMESH_IDSource_ptr obj );
252 };
253
254 #endif // SMESHGUI_MULTIEDITDLG_H