Salome HOME
09134549338501707bdb0cc7ea885e0d0fd8d8e7
[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
39 class SMESHGUI_FilterDlg;
40 class QCheckBox;
41 class QGroupBox;
42 class QListBox;
43 class QFrame;
44 class QLineEdit;
45 class SMESHGUI_SpinBox;
46 class QPushButton;
47 class QButtonGroup;
48 class QObject;
49
50 class SMESH_Actor;
51 class SALOME_Actor;
52 class SalomeApp_SelectionMgr;
53
54 class SMESHGUI;
55 class SMESH_Actor;
56 class SVTK_Selector;
57 class SVTK_ViewWindow;
58
59 /*
60   Class       : SMESHGUI_MultiEditDlg
61   Description : Base class for dialogs of diagonal inversion and 
62                 union of two neighboring triangles
63 */
64
65 class SMESHGUI_MultiEditDlg : public QDialog
66
67   Q_OBJECT
68
69 public:
70                             SMESHGUI_MultiEditDlg(SMESHGUI* theModule,
71                                                   const int,
72                                                   const bool = false,
73                                                   const char* = 0 );
74   virtual                   ~SMESHGUI_MultiEditDlg();
75
76   void                      Init() ;
77
78   bool                      eventFilter( QObject* object, QEvent* event );
79
80 signals:
81   void                      ListContensChanged();
82
83 protected slots:
84
85   void                      onOk();
86   virtual bool              onApply();
87   virtual void              onClose();
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 protected:
104
105   void                      closeEvent( QCloseEvent* e ) ;
106   void                      enterEvent ( QEvent * ) ;            
107   void                      hideEvent ( QHideEvent * );                        /* ESC key */
108   QFrame*                   createButtonFrame( QWidget* );
109   QFrame*                   createMainFrame  ( QWidget*, const bool );
110   bool                      isValid( const bool ) const;
111   SMESH::long_array_var     getIds();
112   void                      updateButtons();
113   void                      setSelectionMode();
114   virtual bool              isIdValid( const int theID ) const;
115   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& ) = 0;
116   int                       entityType();
117   
118 protected:
119
120   QPushButton*              myOkBtn;
121   QPushButton*              myApplyBtn;
122   QPushButton*              myCloseBtn;
123   SMESH_Actor*              myActor;
124   SMESH::SMESH_Mesh_var     myMesh;
125   
126   SalomeApp_SelectionMgr*   mySelectionMgr;
127   SVTK_Selector*            mySelector;
128   SMESHGUI*                 mySMESHGUI;
129
130   QGroupBox*                mySelGrp;
131   
132   QListBox*                 myListBox;
133   QPushButton*              myFilterBtn;
134   QPushButton*              myAddBtn;
135   QPushButton*              myRemoveBtn;
136   QPushButton*              mySortBtn;
137   
138   QCheckBox*                myToAllChk;
139   QButtonGroup*             myEntityTypeGrp;
140   
141   QCheckBox*                mySubmeshChk;
142   QPushButton*              mySubmeshBtn;
143   QLineEdit*                mySubmesh;
144   
145   QCheckBox*                myGroupChk;
146   QPushButton*              myGroupBtn;
147   QLineEdit*                myGroup;
148   
149   SMESHGUI_FilterDlg*       myFilterDlg;
150   TColStd_MapOfInteger      myIds;
151   int                       myFilterType;
152   bool                      myBusy;
153   int                       myEntityType;
154 };
155
156 /*
157   Class       : SMESHGUI_ChangeOrientationDlg
158   Description : Modification of orientation of faces
159 */
160 class  SMESHGUI_ChangeOrientationDlg : public SMESHGUI_MultiEditDlg
161
162   Q_OBJECT
163
164 public:
165                             SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule,
166                                                           const char* = 0);
167   virtual                   ~SMESHGUI_ChangeOrientationDlg();
168
169 protected:
170
171   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
172 };
173
174 /*
175   Class       : SMESHGUI_UnionOfTrianglesDlg
176   Description : Construction of quadrangles by automatic association of triangles
177 */
178 class  SMESHGUI_UnionOfTrianglesDlg : public SMESHGUI_MultiEditDlg
179 {
180   Q_OBJECT
181
182 public:
183                             SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule,
184                                                          const char* = 0);
185   virtual                   ~SMESHGUI_UnionOfTrianglesDlg();
186
187 protected:
188
189   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
190 };
191
192 /*
193   Class       : SMESHGUI_CuttingOfQuadsDlg
194   Description : Construction of quadrangles by automatic association of triangles
195 */
196 class  SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg
197 {
198   Q_OBJECT
199
200 public:
201                             SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule,
202                                                        const char* = 0);
203   virtual                   ~SMESHGUI_CuttingOfQuadsDlg();
204
205 protected:
206   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
207   
208 protected slots:
209   virtual void              onClose();
210   void                      onPreviewChk();
211
212 private:
213   void                      displayPreview();
214   void                      erasePreview();
215   
216 private:
217   QCheckBox*                myUseDiagChk;
218   SALOME_Actor*             myPreviewActor;
219   QCheckBox*                myPreviewChk;
220 };
221
222 #endif