Salome HOME
First executable version
[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 "SMESH_SMESHGUI.hxx"
31
32 #include <qdialog.h>
33
34 #include "SUIT_SelectionFilter.h"
35
36 #include <TColStd_MapOfInteger.hxx>
37
38 #include <SALOMEconfig.h>
39 #include CORBA_SERVER_HEADER(SMESH_Mesh)
40 #include CORBA_SERVER_HEADER(SMESH_Filter)
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 class SVTK_ViewWindow;
52
53 class QFrame;
54 class QObject;
55 class QListBox;
56 class QComboBox;
57 class QCheckBox;
58 class QGroupBox;
59 class QLineEdit;
60 class QPushButton;
61 class QButtonGroup;
62
63 /*!
64  * Class       : SMESHGUI_MultiEditDlg
65  * Description : Base class for dialogs of diagonal inversion and
66  *               union of two neighboring triangles
67  */
68
69 class SMESHGUI_EXPORT SMESHGUI_MultiEditDlg : public QDialog
70 {
71   Q_OBJECT
72
73 public:
74                             SMESHGUI_MultiEditDlg(SMESHGUI* theModule,
75                                                   const int,
76                                                   const bool = false,
77                                                   const char* = 0 );
78   virtual                   ~SMESHGUI_MultiEditDlg();
79
80   void                      Init();
81
82   bool                      eventFilter( QObject* object, QEvent* event );
83
84 signals:
85   void                      ListContensChanged();
86
87 protected slots:
88   void                      onOk();
89   virtual bool              onApply();
90   virtual void              onClose();
91
92   void                      onDeactivate();
93   void                      onSelectionDone();
94
95   void                      onFilterBtn();
96   void                      onAddBtn();
97   void                      onRemoveBtn();
98   void                      onSortListBtn();
99   void                      onListSelectionChanged();
100   void                      onSubmeshChk();
101   void                      onGroupChk();
102   virtual void              onToAllChk();
103   void                      onFilterAccepted();
104   void                      on3d2dChanged(int);
105
106   SMESH::NumericalFunctor_ptr getNumericalFunctor();
107
108 protected:
109   void                      closeEvent( QCloseEvent* e ) ;
110   void                      enterEvent ( QEvent * ) ;
111   void                      hideEvent ( QHideEvent * );                        /* ESC key */
112   QFrame*                   createButtonFrame( QWidget* );
113   QFrame*                   createMainFrame  ( QWidget*, const bool );
114   bool                      isValid( const bool ) const;
115   SMESH::long_array_var     getIds();
116   void                      updateButtons();
117   void                      setSelectionMode();
118   virtual bool              isIdValid( const int theID ) const;
119   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& ) = 0;
120   int                       entityType();
121
122 protected:
123   QPushButton*              myOkBtn;
124   QPushButton*              myApplyBtn;
125   QPushButton*              myCloseBtn;
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   QButtonGroup*             myGroupChoice;
137   QComboBox*                myComboBoxFunctor;
138
139   QListBox*                 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
163 /*!
164  * Class       : SMESHGUI_ChangeOrientationDlg
165  * Description : Modification of orientation of faces
166  */
167 class  SMESHGUI_ChangeOrientationDlg : public SMESHGUI_MultiEditDlg
168 {
169   Q_OBJECT
170
171 public:
172                SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule,
173                                              const char* = 0);
174   virtual      ~SMESHGUI_ChangeOrientationDlg();
175
176 protected:
177   virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
178 };
179
180 /*!
181  * Class       : SMESHGUI_UnionOfTrianglesDlg
182  * Description : Construction of quadrangles by automatic association of triangles
183  */
184 class  SMESHGUI_UnionOfTrianglesDlg : public SMESHGUI_MultiEditDlg
185 {
186   Q_OBJECT
187
188 public:
189                SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule,
190                                             const char* = 0);
191   virtual      ~SMESHGUI_UnionOfTrianglesDlg();
192
193 protected:
194   virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
195
196 private:
197   SMESHGUI_SpinBox* myMaxAngleSpin;
198 };
199
200 /*
201   Class       : SMESHGUI_CuttingOfQuadsDlg
202   Description : Construction of quadrangles by automatic association of triangles
203 */
204 class  SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg
205 {
206   Q_OBJECT
207
208 public:
209                 SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule,
210                                            const char* = 0);
211   virtual       ~SMESHGUI_CuttingOfQuadsDlg();
212
213 protected:
214   virtual bool  process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
215
216 protected slots:
217   virtual void  onClose();
218   void          onCriterionRB();
219   void          onPreviewChk();
220
221 private:
222   void          displayPreview();
223   void          erasePreview();
224
225 private:
226   SALOME_Actor* myPreviewActor;
227   QCheckBox*    myPreviewChk;
228 };
229
230 #endif