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