Salome HOME
SMH: Preparation version 3.0.0 - merge (HEAD+POLYWORK)
[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_ViewWindow*          myViewWindow;
128   SVTK_Selector*            mySelector;
129   SMESHGUI*                 mySMESHGUI;
130
131   QGroupBox*                mySelGrp;
132   
133   QListBox*                 myListBox;
134   QPushButton*              myFilterBtn;
135   QPushButton*              myAddBtn;
136   QPushButton*              myRemoveBtn;
137   QPushButton*              mySortBtn;
138   
139   QCheckBox*                myToAllChk;
140   QButtonGroup*             myEntityTypeGrp;
141   
142   QCheckBox*                mySubmeshChk;
143   QPushButton*              mySubmeshBtn;
144   QLineEdit*                mySubmesh;
145   
146   QCheckBox*                myGroupChk;
147   QPushButton*              myGroupBtn;
148   QLineEdit*                myGroup;
149   
150   SMESHGUI_FilterDlg*       myFilterDlg;
151   TColStd_MapOfInteger      myIds;
152   int                       myFilterType;
153   bool                      myBusy;
154   int                       myEntityType;
155 };
156
157 /*
158   Class       : SMESHGUI_ChangeOrientationDlg
159   Description : Modification of orientation of faces
160 */
161 class  SMESHGUI_ChangeOrientationDlg : public SMESHGUI_MultiEditDlg
162
163   Q_OBJECT
164
165 public:
166                             SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule,
167                                                           const char* = 0);
168   virtual                   ~SMESHGUI_ChangeOrientationDlg();
169
170 protected:
171
172   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
173 };
174
175 /*
176   Class       : SMESHGUI_UnionOfTrianglesDlg
177   Description : Construction of quadrangles by automatic association of triangles
178 */
179 class  SMESHGUI_UnionOfTrianglesDlg : public SMESHGUI_MultiEditDlg
180 {
181   Q_OBJECT
182
183 public:
184                             SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule,
185                                                          const char* = 0);
186   virtual                   ~SMESHGUI_UnionOfTrianglesDlg();
187
188 protected:
189
190   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
191 };
192
193 /*
194   Class       : SMESHGUI_CuttingOfQuadsDlg
195   Description : Construction of quadrangles by automatic association of triangles
196 */
197 class  SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg
198 {
199   Q_OBJECT
200
201 public:
202                             SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule,
203                                                        const char* = 0);
204   virtual                   ~SMESHGUI_CuttingOfQuadsDlg();
205
206 protected:
207   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
208   
209 protected slots:
210   virtual void              onClose();
211   void                      onPreviewChk();
212
213 private:
214   void                      displayPreview();
215   void                      erasePreview();
216   
217 private:
218   QCheckBox*                myUseDiagChk;
219   SALOME_Actor*             myPreviewActor;
220   QCheckBox*                myPreviewChk;
221 };
222
223 #endif