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