Salome HOME
PAL6938
[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 );
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   Handle(SALOME_InteractiveObject) myIO;
147 };
148
149 /*
150   Class       : SMESHGUI_ChangeOrientationDlg
151   Description : Modification of orientation of faces
152 */
153 class  SMESHGUI_ChangeOrientationDlg : public SMESHGUI_MultiEditDlg
154
155   Q_OBJECT
156
157 public:
158                             SMESHGUI_ChangeOrientationDlg( QWidget*,
159                                                            SALOME_Selection*,
160                                                            const char* = 0 );
161   virtual                   ~SMESHGUI_ChangeOrientationDlg();
162
163 protected:
164
165   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
166 };
167
168 /*
169   Class       : SMESHGUI_UnionOfTrianglesDlg
170   Description : Construction of quadrangles by automatic association of triangles
171 */
172 class  SMESHGUI_UnionOfTrianglesDlg : public SMESHGUI_MultiEditDlg
173 {
174   Q_OBJECT
175
176 public:
177                             SMESHGUI_UnionOfTrianglesDlg( QWidget*,
178                                                           SALOME_Selection*,
179                                                           const char* = 0 );
180   virtual                   ~SMESHGUI_UnionOfTrianglesDlg();
181
182 protected:
183
184   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
185 };
186
187 /*
188   Class       : SMESHGUI_CuttingOfQuadsDlg
189   Description : Construction of quadrangles by automatic association of triangles
190 */
191 class  SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg
192 {
193   Q_OBJECT
194
195 public:
196                             SMESHGUI_CuttingOfQuadsDlg( QWidget*,
197                                                         SALOME_Selection*,
198                                                         const char* = 0 );
199   virtual                   ~SMESHGUI_CuttingOfQuadsDlg();
200
201 protected:
202   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
203   
204 protected slots:
205   virtual void              onClose();
206   void                      onPreviewChk();
207
208 private:
209   void                      displayPreview();
210   void                      erasePreview();
211   
212 private:
213   QCheckBox*                myUseDiagChk;
214   SALOME_Actor*             myPreviewActor;
215   QCheckBox*                myPreviewChk;
216 };
217
218 #endif