Salome HOME
bos #20256: [CEA 18523] Porting SMESH to int 64 bits
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ExtrusionDlg.h
1 // Copyright (C) 2007-2021  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 QCheckBox;
45 class QGroupBox;
46 class QLabel;
47 class QLineEdit;
48 class QListWidget;
49 class QPushButton;
50 class QRadioButton;
51 class QToolButton;
52
53 class SMESHGUI;
54 class SMESH_Actor;
55 class SMESHGUI_IdValidator;
56 class SMESHGUI_SpinBox;
57 class SMESHGUI_FilterDlg;
58 class SVTK_Selector;
59 class LightApp_SelectionMgr;
60 class SUIT_SelectionFilter;
61 class SalomeApp_IntSpinBox;
62
63 //=================================================================================
64 // class    : SMESHGUI_3TypesSelector
65 // purpose  : A widget used to select both nodes, edges and faces for
66 //            Extrusion and Revolution operations
67 //=================================================================================
68
69 class SMESHGUI_EXPORT SMESHGUI_3TypesSelector : public QWidget
70 {
71   Q_OBJECT
72
73     public:
74
75   SMESHGUI_3TypesSelector( QWidget * parent = 0 );
76   ~SMESHGUI_3TypesSelector();
77
78   void Clear();
79   void SetEnabled( bool enable, SMESH::ElementType type );
80   bool IsAnythingSelected( SMESH::ElementType type = SMESH::ALL );
81   SMESH::ElementType GetSelected( SMESH::ListOfIDSources & nodes,
82                                   SMESH::ListOfIDSources & edges,
83                                   SMESH::ListOfIDSources & faces );
84   SMESH::SMESH_Mesh_var GetMesh() { return myMesh; }
85   SMESH_Actor*         GetActor() { return myActor; }
86   Handle(SALOME_InteractiveObject) GetIO() { return myIO; }
87   QButtonGroup* GetButtonGroup()  { return mySelectBtnGrp; }
88
89  signals:
90
91   void selectionChanged();
92
93  private slots:
94
95   void                            selectionIntoArgument();
96   void                            onTextChange( const QString& );
97   void                            onSelectMesh( bool on );
98   void                            setFilters();
99   void                            onSelectType( int iType );
100
101  private:
102
103   void                             addTmpIdSource( SMESH::smIdType_array_var& ids,
104                                                    int iType, int index);
105
106   QGroupBox*                       myGroups   [3];
107   QLabel*                          myLabel    [3];
108   QLineEdit*                       myLineEdit [3];
109   QCheckBox*                       myMeshChk  [3];
110   QPushButton*                     myFilterBtn[3];
111   QButtonGroup*                    mySelectBtnGrp;
112   SMESHGUI_FilterDlg*              myFilterDlg;
113   SUIT_SelectionFilter*            myFilter   [3];
114   SMESHGUI_IdValidator*            myIdValidator;
115
116   bool                             myBusy;
117   SMESH::SMESH_Mesh_var            myMesh;
118   SMESH_Actor*                     myActor;
119   Handle(SALOME_InteractiveObject) myIO;
120   SMESH::ListOfIDSources_var       myIDSource[3];
121   QList<SMESH::IDSource_wrap>      myTmpIDSourceList;
122
123   LightApp_SelectionMgr*           mySelectionMgr;
124   SVTK_Selector*                   mySelector;
125 };
126
127 //=================================================================================
128 // class    : SMESHGUI_ExtrusionDlg
129 // purpose  :
130 //=================================================================================
131
132 class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public SMESHGUI_PreviewDlg
133 {
134   Q_OBJECT
135
136     public:
137   SMESHGUI_ExtrusionDlg( SMESHGUI* );
138   ~SMESHGUI_ExtrusionDlg();
139
140 private:
141   void                             Init( bool = true );
142   void                             enterEvent( QEvent* );       /* mouse enter the QWidget */
143   void                             keyPressEvent( QKeyEvent* );
144   int                              GetConstructorId();
145   void                             getExtrusionVector(SMESH::DirStruct& aVector);
146   void                             extrusionByNormal(SMESH::SMESH_MeshEditor_ptr meshEditor,
147                                                      const bool                  makeGroups=false);
148   void                             getScaleParams( SMESH::double_array*& scales,
149                                                    SMESH::double_array*& basePoint,
150                                                    bool &                scalesVariation,
151                                                    SMESH::double_array*& angles,
152                                                    bool &                anglesVariation);
153   
154   bool                             isValid();
155   bool                             isValuesValid();
156   
157   LightApp_SelectionMgr*           mySelectionMgr;        /* User shape selection */
158   SVTK_Selector*                   mySelector;
159   QList<double>                    myScalesList;
160   QList<double>                    myAnglesList;
161
162   // widgets
163   SMESHGUI_3TypesSelector*         SelectorWdg;
164   QRadioButton*                    ExtrMethod_RBut0;
165   QRadioButton*                    ExtrMethod_RBut1;
166   QRadioButton*                    ExtrMethod_RBut2;
167
168   QGroupBox*                       GroupArguments;
169   QLabel*                          TextLabelVector;
170   QLabel*                          TextLabelDistance;
171   QPushButton*                     SelectVectorButton;
172   QLabel*                          TextLabelDx;
173   SMESHGUI_SpinBox*                SpinBox_Dx;
174   QLabel*                          TextLabelDy;
175   SMESHGUI_SpinBox*                SpinBox_Dy;
176   QLabel*                          TextLabelDz;
177   SMESHGUI_SpinBox*                SpinBox_Dz;
178   QLabel*                          TextLabelVx;
179   SMESHGUI_SpinBox*                SpinBox_Vx;
180   QLabel*                          TextLabelVy;
181   SMESHGUI_SpinBox*                SpinBox_Vy;
182   QLabel*                          TextLabelVz;
183   SMESHGUI_SpinBox*                SpinBox_Vz;
184   QLabel*                          TextLabelDist;
185   SMESHGUI_SpinBox*                SpinBox_VDist;
186   QLabel*                          TextLabelNbSteps;
187   SalomeApp_IntSpinBox*            SpinBox_NbSteps;
188   QCheckBox*                       ByAverageNormalCheck;
189   QCheckBox*                       UseInputElemsOnlyCheck;
190   QCheckBox*                       MakeGroupsCheck;
191
192   QGroupBox*                       BasePointGrp;
193   QPushButton*                     SelectBasePointButton;
194   SMESHGUI_SpinBox*                BasePoint_XSpin;
195   SMESHGUI_SpinBox*                BasePoint_YSpin;
196   SMESHGUI_SpinBox*                BasePoint_ZSpin;
197
198   QGroupBox*                       ScalesGrp;
199   QListWidget*                     ScalesList;
200   QToolButton*                     AddScaleButton;
201   QToolButton*                     RemoveScaleButton;
202   SMESHGUI_SpinBox*                ScaleSpin;
203   QCheckBox*                       LinearScalesCheck;
204
205   QGroupBox*                       AnglesGrp;
206   QListWidget*                     AnglesList;
207   QToolButton*                     AddAngleButton;
208   QToolButton*                     RemoveAngleButton;
209   SMESHGUI_SpinBox*                AngleSpin;
210   QCheckBox*                       LinearAnglesCheck;
211
212   QGroupBox*                       GroupButtons;
213   QPushButton*                     buttonOk;
214   QPushButton*                     buttonCancel;
215   QPushButton*                     buttonApply;
216   QPushButton*                     buttonHelp;
217
218   QString                          myHelpFileName;
219   QString                          myIDs;
220
221 protected slots:
222   virtual void                    onDisplaySimulation( bool );
223   virtual void                    reject();
224    
225 private slots:
226   void                            CheckIsEnable();
227   void                            ClickOnOk();
228   bool                            ClickOnApply();
229   void                            ClickOnHelp();
230   void                            ClickOnRadio();
231   void                            SetEditCurrentArgument();
232   void                            SelectionIntoArgument();
233   void                            DeactivateActiveDialog();
234   void                            ActivateThisDialog();
235   void                            onOpenView();
236   void                            onCloseView();
237   void                            OnScaleAdded();
238   void                            OnScaleRemoved();
239
240 };
241
242 #endif // SMESHGUI_EXTRUSIONDLG_H