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