Salome HOME
f1499681442c854118c3833abfdd9caabe86c506
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MultiEditDlg.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : SMESHGUI_MultiEditDlg.h
23 // Author : Sergey LITONIN, Open CASCADE S.A.S.
24 //
25 #ifndef SMESHGUI_MULTIEDITDLG_H
26 #define SMESHGUI_MULTIEDITDLG_H
27
28 // SMESH includes
29 #include "SMESH_SMESHGUI.hxx"
30
31 // Qt includes 
32 #include <QDialog>
33
34 // OCCT includes
35 #include <TColStd_MapOfInteger.hxx>
36
37 // IDL includes
38 #include <SALOMEconfig.h>
39 #include CORBA_SERVER_HEADER(SMESH_Mesh)
40 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
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
52 class QListWidget;
53 class QComboBox;
54 class QCheckBox;
55 class QGroupBox;
56 class QLineEdit;
57 class QPushButton;
58 class QButtonGroup;
59
60 /*!
61  * Class       : SMESHGUI_MultiEditDlg
62  * Description : Base class for dialogs of diagonal inversion and
63  *               union of two neighboring triangles
64  */
65
66 class SMESHGUI_EXPORT SMESHGUI_MultiEditDlg : public QDialog
67 {
68   Q_OBJECT
69
70 public:
71   SMESHGUI_MultiEditDlg( SMESHGUI*, const int, const bool = false );
72   virtual ~SMESHGUI_MultiEditDlg();
73
74   void                      Init();
75
76   bool                      eventFilter( QObject*, QEvent* );
77
78 signals:
79   void                      ListContensChanged();
80
81 protected slots:
82   void                      onOk();
83   virtual bool              onApply();
84   virtual void              onClose();
85   void                      onHelp();
86
87   void                      onDeactivate();
88   void                      onSelectionDone();
89
90   void                      onFilterBtn();
91   void                      onAddBtn();
92   void                      onRemoveBtn();
93   void                      onSortListBtn();
94   void                      onListSelectionChanged();
95   void                      onSubmeshChk();
96   void                      onGroupChk();
97   virtual void              onToAllChk();
98   void                      onFilterAccepted();
99   void                      on3d2dChanged(int);
100
101   SMESH::NumericalFunctor_ptr getNumericalFunctor();
102
103 protected:
104   void                      closeEvent( QCloseEvent* );
105   void                      enterEvent( QEvent * );
106   void                      hideEvent( QHideEvent* );                        /* ESC key */
107   void                      keyPressEvent( QKeyEvent* );
108   QWidget*                  createButtonFrame( QWidget* );
109   QWidget*                  createMainFrame( QWidget*, const bool );
110   virtual bool              isValid( const bool );
111   SMESH::long_array_var     getIds();
112   void                      updateButtons();
113   void                      setSelectionMode();
114   virtual bool              isIdValid( const int ) const;
115   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, 
116                                      const SMESH::long_array& ) = 0;
117   int                       entityType();
118
119 protected:
120   QPushButton*              myOkBtn;
121   QPushButton*              myApplyBtn;
122   QPushButton*              myCloseBtn;
123   QPushButton*              myHelpBtn;
124   SMESH_Actor*              myActor;
125   SMESH::SMESH_Mesh_var     myMesh;
126
127   LightApp_SelectionMgr*    mySelectionMgr;
128   SVTK_Selector*            mySelector;
129   SMESHGUI*                 mySMESHGUI;
130
131   QGroupBox*                mySelGrp;
132   QGroupBox*                myCriterionGrp;
133
134   QWidget*                  myChoiceWidget;
135   QButtonGroup*             myGroupChoice;
136   QComboBox*                myComboBoxFunctor;
137
138   QListWidget*              myListBox;
139   QPushButton*              myFilterBtn;
140   QPushButton*              myAddBtn;
141   QPushButton*              myRemoveBtn;
142   QPushButton*              mySortBtn;
143
144   QCheckBox*                myToAllChk;
145   QButtonGroup*             myEntityTypeGrp;
146
147   QCheckBox*                mySubmeshChk;
148   QPushButton*              mySubmeshBtn;
149   QLineEdit*                mySubmesh;
150
151   QCheckBox*                myGroupChk;
152   QPushButton*              myGroupBtn;
153   QLineEdit*                myGroup;
154
155   SMESHGUI_FilterDlg*       myFilterDlg;
156   TColStd_MapOfInteger      myIds;
157   int                       myFilterType;
158   bool                      myBusy;
159   int                       myEntityType;
160
161   QString                   myHelpFileName;
162 };
163
164 /*!
165  * Class       : SMESHGUI_ChangeOrientationDlg
166  * Description : Modification of orientation of faces
167  */
168 class  SMESHGUI_ChangeOrientationDlg : public SMESHGUI_MultiEditDlg
169 {
170   Q_OBJECT
171
172 public:
173   SMESHGUI_ChangeOrientationDlg( SMESHGUI* );
174   virtual ~SMESHGUI_ChangeOrientationDlg();
175
176 protected:
177   virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
178 };
179
180 /*!
181  * Class       : SMESHGUI_UnionOfTrianglesDlg
182  * Description : Construction of quadrangles by automatic association of triangles
183  */
184 class  SMESHGUI_UnionOfTrianglesDlg : public SMESHGUI_MultiEditDlg
185 {
186   Q_OBJECT
187
188 public:
189   SMESHGUI_UnionOfTrianglesDlg( SMESHGUI* );
190   virtual ~SMESHGUI_UnionOfTrianglesDlg();
191
192 protected:
193   virtual bool      isValid( const bool );
194   virtual bool      process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
195
196 private:
197   SMESHGUI_SpinBox* myMaxAngleSpin;
198 };
199
200 /*
201   Class       : SMESHGUI_CuttingOfQuadsDlg
202   Description : Construction of quadrangles by automatic association of triangles
203 */
204 class  SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg
205 {
206   Q_OBJECT
207
208 public:
209   SMESHGUI_CuttingOfQuadsDlg( SMESHGUI* );
210   virtual ~SMESHGUI_CuttingOfQuadsDlg();
211
212 protected:
213   virtual bool  process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
214
215 protected slots:
216   virtual void  onClose();
217   void          onCriterionRB();
218   void          onPreviewChk();
219
220 private:
221   void          displayPreview();
222   void          erasePreview();
223
224 private:
225   SALOME_Actor* myPreviewActor;
226   QCheckBox*    myPreviewChk;
227 };
228
229 #endif // SMESHGUI_MULTIEDITDLG_H