]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESHGUI/SMESHGUI_ExtrusionDlg.h
Salome HOME
Merge remote branch 'origin/V7_dev' into V8_0_0_BR
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ExtrusionDlg.h
1 // Copyright (C) 2007-2015  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, or (at your option) any later version.
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
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File   : SMESHGUI_ExtrusionDlg.h
25 // Author : Michael ZORIN, Open CASCADE S.A.S.
26 //
27 #ifndef SMESHGUI_EXTRUSIONDLG_H
28 #define SMESHGUI_EXTRUSIONDLG_H
29
30 // SMESH includes
31 #include "SMESH_SMESHGUI.hxx"
32 #include "SMESHGUI_PreviewDlg.h"
33 #include "SMESHGUI_Utils.h"
34
35 // SALOME GUI includes
36 #include <SALOME_InteractiveObject.hxx>
37
38 // IDL includes
39 #include <SALOMEconfig.h>
40 #include CORBA_SERVER_HEADER(SMESH_Mesh)
41 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
42
43 class QButtonGroup;
44 class QRadioButton;
45 class QGroupBox;
46 class QLabel;
47 class QLineEdit;
48 class QCheckBox;
49 class QPushButton;
50
51 class SMESHGUI;
52 class SMESH_Actor;
53 class SMESHGUI_IdValidator;
54 class SMESHGUI_SpinBox;
55 class SMESHGUI_FilterDlg;
56 class SVTK_Selector;
57 class LightApp_SelectionMgr;
58 class SUIT_SelectionFilter;
59 class SalomeApp_IntSpinBox;
60
61 //=================================================================================
62 // class    : SMESHGUI_ExtrusionDlg
63 // purpose  : A widget used to select both nodes, edges and faces for
64 //            Extrusion and Revolution operations
65 //=================================================================================
66
67 class SMESHGUI_EXPORT SMESHGUI_3TypesSelector : public QWidget
68 {
69   Q_OBJECT
70
71     public:
72
73   SMESHGUI_3TypesSelector( QWidget * parent = 0 );
74   ~SMESHGUI_3TypesSelector();
75
76   void Clear();
77   void SetEnabled( bool enable, SMESH::ElementType type );
78   bool IsAnythingSelected( SMESH::ElementType type = SMESH::ALL );
79   SMESH::ElementType GetSelected( SMESH::ListOfIDSources & nodes,
80                                   SMESH::ListOfIDSources & edges,
81                                   SMESH::ListOfIDSources & faces );
82   SMESH::SMESH_Mesh_var GetMesh() { return myMesh; }
83   SMESH_Actor*         GetActor() { return myActor; }
84   Handle(SALOME_InteractiveObject) GetIO() { return myIO; }
85   QButtonGroup* GetButtonGroup()  { return mySelectBtnGrp; }
86
87  signals:
88
89   void selectionChanged();
90
91  private slots:
92
93   void                            selectionIntoArgument();
94   void                            onTextChange( const QString& );
95   void                            onSelectMesh( bool on );
96   void                            setFilters();
97   void                            onSelectType( int iType );
98
99  private:
100
101   void                             addTmpIdSource( SMESH::long_array_var& ids,
102                                                    int iType, int index);
103
104   QGroupBox*                       myGroups   [3];
105   QLabel*                          myLabel    [3];
106   QLineEdit*                       myLineEdit [3];
107   QCheckBox*                       myMeshChk  [3];
108   QPushButton*                     myFilterBtn[3];
109   QButtonGroup*                    mySelectBtnGrp;
110   SMESHGUI_FilterDlg*              myFilterDlg;
111   SUIT_SelectionFilter*            myFilter   [3];
112   SMESHGUI_IdValidator*            myIdValidator;
113
114   bool                             myBusy;
115   SMESH::SMESH_Mesh_var            myMesh;
116   SMESH_Actor*                     myActor;
117   Handle(SALOME_InteractiveObject) myIO;
118   SMESH::ListOfIDSources_var       myIDSource[3];
119   QList<SMESH::IDSource_wrap>      myTmpIDSourceList;
120
121   LightApp_SelectionMgr*           mySelectionMgr;
122   SVTK_Selector*                   mySelector;
123 };
124
125 //=================================================================================
126 // class    : SMESHGUI_ExtrusionDlg
127 // purpose  :
128 //=================================================================================
129
130 class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public SMESHGUI_PreviewDlg
131 {
132   Q_OBJECT
133
134     public:
135   SMESHGUI_ExtrusionDlg( SMESHGUI* );
136   ~SMESHGUI_ExtrusionDlg();
137
138 private:
139   void                             Init( bool = true );
140   void                             enterEvent( QEvent* );       /* mouse enter the QWidget */
141   void                             keyPressEvent( QKeyEvent* );
142   int                              GetConstructorId();
143   void                             getExtrusionVector(SMESH::DirStruct& aVector);
144   void                             extrusionByNormal(SMESH::SMESH_MeshEditor_ptr meshEditor,
145                                                      const bool                  makeGroups=false);
146   
147   bool                             isValid();
148   bool                             isValuesValid();
149   
150   LightApp_SelectionMgr*           mySelectionMgr;        /* User shape selection */
151   SVTK_Selector*                   mySelector;
152
153   // widgets
154   SMESHGUI_3TypesSelector*         SelectorWdg;
155   QRadioButton*                    ExtrMethod_RBut0;
156   QRadioButton*                    ExtrMethod_RBut1;
157   QRadioButton*                    ExtrMethod_RBut2;
158
159   QGroupBox*                       GroupArguments;
160   QLabel*                          TextLabelVector;
161   QLabel*                          TextLabelDistance;
162   QPushButton*                     SelectVectorButton;
163   QLabel*                          TextLabelDx;
164   SMESHGUI_SpinBox*                SpinBox_Dx;
165   QLabel*                          TextLabelDy;
166   SMESHGUI_SpinBox*                SpinBox_Dy;
167   QLabel*                          TextLabelDz;
168   SMESHGUI_SpinBox*                SpinBox_Dz;
169   QLabel*                          TextLabelVx;
170   SMESHGUI_SpinBox*                SpinBox_Vx;
171   QLabel*                          TextLabelVy;
172   SMESHGUI_SpinBox*                SpinBox_Vy;
173   QLabel*                          TextLabelVz;
174   SMESHGUI_SpinBox*                SpinBox_Vz;
175   QLabel*                          TextLabelDist;
176   SMESHGUI_SpinBox*                SpinBox_VDist;
177   QLabel*                          TextLabelNbSteps;
178   SalomeApp_IntSpinBox*            SpinBox_NbSteps;
179   QCheckBox*                       ByAverageNormalCheck;
180   QCheckBox*                       UseInputElemsOnlyCheck;
181   QCheckBox*                       MakeGroupsCheck;
182
183   QGroupBox*                       GroupButtons;
184   QPushButton*                     buttonOk;
185   QPushButton*                     buttonCancel;
186   QPushButton*                     buttonApply;
187   QPushButton*                     buttonHelp;
188
189   QString                          myHelpFileName;
190   QString                          myIDs;
191
192 protected slots:
193   virtual void                    onDisplaySimulation( bool );
194   virtual void                    reject();
195    
196 private slots:
197   void                            CheckIsEnable();
198   void                            ClickOnOk();
199   bool                            ClickOnApply();
200   void                            ClickOnHelp();
201   void                            ClickOnRadio();
202   void                            SetEditCurrentArgument();
203   void                            SelectionIntoArgument();
204   void                            DeactivateActiveDialog();
205   void                            ActivateThisDialog();
206   void                            onOpenView();
207   void                            onCloseView();
208
209 };
210
211 #endif // SMESHGUI_EXTRUSIONDLG_H