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