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