Salome HOME
Enable setting of Numeric Functors as criteria in Split Quadrangles and Union Triangl...
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MultiEditDlg.h
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 //
4 //  This library is free software; you can redistribute it and/or
5 //  modify it under the terms of the GNU Lesser General Public
6 //  License as published by the Free Software Foundation; either
7 //  version 2.1 of the License.
8 //
9 //  This library is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 //  Lesser General Public License for more details.
13 //
14 //  You should have received a copy of the GNU Lesser General Public
15 //  License along with this library; if not, write to the Free Software
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
19 //
20 //
21 //
22 //  File   : SMESHGUI_MultiEditDlg.h
23 //  Author : Sergey LITONIN
24 //  Module : SMESH
25
26
27 #ifndef SMESHGUI_MultiEditDlg_H
28 #define SMESHGUI_MultiEditDlg_H
29
30 #include <qdialog.h>
31
32 #include "SUIT_SelectionFilter.h"
33
34 #include <TColStd_MapOfInteger.hxx>
35
36 #include <SALOMEconfig.h>
37 #include CORBA_SERVER_HEADER(SMESH_Mesh)
38 #include CORBA_SERVER_HEADER(SMESH_Filter)
39
40 class SMESHGUI;
41 class SMESHGUI_FilterDlg;
42 class SMESHGUI_SpinBox;
43
44 class SMESH_Actor;
45
46 class SalomeApp_SelectionMgr;
47 class SALOME_Actor;
48 class SVTK_Selector;
49 class SVTK_ViewWindow;
50
51 class QFrame;
52 class QObject;
53 class QListBox;
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_MultiEditDlg : public QDialog
68 {
69   Q_OBJECT
70
71 public:
72                             SMESHGUI_MultiEditDlg(SMESHGUI* theModule,
73                                                   const int,
74                                                   const bool = false,
75                                                   const char* = 0 );
76   virtual                   ~SMESHGUI_MultiEditDlg();
77
78   void                      Init();
79
80   bool                      eventFilter( QObject* object, QEvent* event );
81
82 signals:
83   void                      ListContensChanged();
84
85 protected slots:
86   void                      onOk();
87   virtual bool              onApply();
88   virtual void              onClose();
89
90   void                      onDeactivate();
91   void                      onSelectionDone();
92
93   void                      onFilterBtn();
94   void                      onAddBtn();
95   void                      onRemoveBtn();
96   void                      onSortListBtn();
97   void                      onListSelectionChanged();
98   void                      onSubmeshChk();
99   void                      onGroupChk();
100   virtual void              onToAllChk();
101   void                      onFilterAccepted();
102   void                      on3d2dChanged(int);
103
104   SMESH::NumericalFunctor_ptr getNumericalFunctor();
105
106 protected:
107   void                      closeEvent( QCloseEvent* e ) ;
108   void                      enterEvent ( QEvent * ) ;
109   void                      hideEvent ( QHideEvent * );                        /* ESC key */
110   QFrame*                   createButtonFrame( QWidget* );
111   QFrame*                   createMainFrame  ( QWidget*, const bool );
112   bool                      isValid( const bool ) const;
113   SMESH::long_array_var     getIds();
114   void                      updateButtons();
115   void                      setSelectionMode();
116   virtual bool              isIdValid( const int theID ) const;
117   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& ) = 0;
118   int                       entityType();
119
120 protected:
121   QPushButton*              myOkBtn;
122   QPushButton*              myApplyBtn;
123   QPushButton*              myCloseBtn;
124   SMESH_Actor*              myActor;
125   SMESH::SMESH_Mesh_var     myMesh;
126
127   SalomeApp_SelectionMgr*   mySelectionMgr;
128   SVTK_Selector*            mySelector;
129   SMESHGUI*                 mySMESHGUI;
130
131   QGroupBox*                mySelGrp;
132   QGroupBox*                myCriterionGrp;
133
134   QButtonGroup*             myGroupChoice;
135   QComboBox*                myComboBoxFunctor;
136
137   QListBox*                 myListBox;
138   QPushButton*              myFilterBtn;
139   QPushButton*              myAddBtn;
140   QPushButton*              myRemoveBtn;
141   QPushButton*              mySortBtn;
142
143   QCheckBox*                myToAllChk;
144   QButtonGroup*             myEntityTypeGrp;
145
146   QCheckBox*                mySubmeshChk;
147   QPushButton*              mySubmeshBtn;
148   QLineEdit*                mySubmesh;
149
150   QCheckBox*                myGroupChk;
151   QPushButton*              myGroupBtn;
152   QLineEdit*                myGroup;
153
154   SMESHGUI_FilterDlg*       myFilterDlg;
155   TColStd_MapOfInteger      myIds;
156   int                       myFilterType;
157   bool                      myBusy;
158   int                       myEntityType;
159 };
160
161 /*!
162  * Class       : SMESHGUI_ChangeOrientationDlg
163  * Description : Modification of orientation of faces
164  */
165 class  SMESHGUI_ChangeOrientationDlg : public SMESHGUI_MultiEditDlg
166 {
167   Q_OBJECT
168
169 public:
170                SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule,
171                                              const char* = 0);
172   virtual      ~SMESHGUI_ChangeOrientationDlg();
173
174 protected:
175   virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
176 };
177
178 /*!
179  * Class       : SMESHGUI_UnionOfTrianglesDlg
180  * Description : Construction of quadrangles by automatic association of triangles
181  */
182 class  SMESHGUI_UnionOfTrianglesDlg : public SMESHGUI_MultiEditDlg
183 {
184   Q_OBJECT
185
186 public:
187                SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule,
188                                             const char* = 0);
189   virtual      ~SMESHGUI_UnionOfTrianglesDlg();
190
191 protected:
192   virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
193
194 private:
195   SMESHGUI_SpinBox* myMaxAngleSpin;
196 };
197
198 /*
199   Class       : SMESHGUI_CuttingOfQuadsDlg
200   Description : Construction of quadrangles by automatic association of triangles
201 */
202 class  SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg
203 {
204   Q_OBJECT
205
206 public:
207                 SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule,
208                                            const char* = 0);
209   virtual       ~SMESHGUI_CuttingOfQuadsDlg();
210
211 protected:
212   virtual bool  process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
213
214 protected slots:
215   virtual void  onClose();
216   void          onCriterionRB();
217   void          onPreviewChk();
218
219 private:
220   void          displayPreview();
221   void          erasePreview();
222
223 private:
224   SALOME_Actor* myPreviewActor;
225   QCheckBox*    myPreviewChk;
226 };
227
228 #endif