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