Salome HOME
fafab604e192b469b5b045b5fd20c959f4fb0093
[modules/geom.git] / src / GEOMGUI / GeometryGUI_CylinderDlg.h
1 //  GEOM GEOMGUI : GUI for Geometry component
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : GeometryGUI_CylinderDlg.h
25 //  Author : Lucien PIGNOLONI
26 //  Module : GEOM
27 //  $Header$
28
29 #ifndef DIALOGBOX_CYLINDER_H
30 #define DIALOGBOX_CYLINDER_H
31
32 #include "SALOME_Selection.h"
33
34 #include "GEOM_ShapeTypeFilter.hxx"
35 #include "GEOM_EdgeFilter.hxx"
36 #include "GeometryGUI_SpinBox.h"
37
38 #include <BRepPrimAPI_MakeCylinder.hxx>
39 #include <Precision.hxx>
40
41 #include <qvariant.h>
42 #include <qdialog.h>
43 #include <qvalidator.h>
44
45 class QVBoxLayout; 
46 class QHBoxLayout; 
47 class QGridLayout; 
48 class QButtonGroup;
49 class QGroupBox;
50 class QLabel;
51 class QLineEdit;
52 class QPushButton;
53 class QSpinBox;
54 class QRadioButton;
55 class GeometryGUI;
56
57
58 //=================================================================================
59 // class    : GeometryGUI_CylinderDlg
60 // purpose  :
61 //=================================================================================
62 class GeometryGUI_CylinderDlg : public QDialog
63
64     Q_OBJECT
65
66 public:
67     GeometryGUI_CylinderDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0,  bool modal = FALSE, WFlags fl = 0 );
68     ~GeometryGUI_CylinderDlg();
69
70 private:
71
72     void Init( SALOME_Selection* Sel ) ;
73     void closeEvent( QCloseEvent* e ) ;
74     void enterEvent ( QEvent * ) ;                /* mouse enter the QWidget */
75     void MakeCylinderSimulationAndDisplay() ;
76
77     GEOM::GEOM_Gen_var myGeom ;                /* Current GeomI object */
78     GeometryGUI*          myGeomGUI ;             /* Current GeomGUI object */
79     TopoDS_Shape          mySimulationTopoDs ;
80     SALOME_Selection*     mySelection ;           /* User shape selection */
81     
82     gp_Pnt                myPoint1 ;              /* topology used  */
83     gp_Dir                myDir ;
84
85     Standard_Real         myRadius ;
86     Standard_Real         myHeight ;
87     bool                  myOkRadius ;
88     bool                  myOkHeight ;
89     QDoubleValidator      *myVa ;                  /* Double validator for numeric input */
90     QDoubleValidator      *myVb ;                  /* Double validator for numeric input */
91
92     bool                  myOkPoint1 ;
93     bool                  myOkDir ;               /* to check when arguments is defined */
94     int                   myConstructorId ;       /* Current constructor id = radio button id */
95     QWidget*              myEditCurrentArgument;  /* Current LineEdit or spin box */
96     Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */
97     Handle(GEOM_EdgeFilter) myEdgeFilter ;        /* Filter selection */
98
99     QGroupBox* GroupButtons;
100     QPushButton* buttonApply;
101     QPushButton* buttonOk;
102     QPushButton* buttonCancel;
103     QButtonGroup* GroupConstructors;
104     QRadioButton* Constructor1;
105     QRadioButton* Constructor2;
106     QGroupBox* GroupC1;
107     QGroupBox* GroupC2;
108     QPushButton* SelectButtonC1A1;
109     QLineEdit* LineEditC1A1;
110     QLabel* TextLabelC1A1;
111     QPushButton* SelectButtonC1A2;
112     QLineEdit* LineEditC1A2;
113     QLabel* TextLabelC1A2;
114
115     QLabel* TextLabelC1A3;
116     GeometryGUI_SpinBox*  SpinBox_C1A3 ;
117     QLabel* TextLabelC1A4 ;
118     GeometryGUI_SpinBox*  SpinBox_C1A4 ;
119
120     QLabel* TextLabel_Radius ;
121     GeometryGUI_SpinBox*  SpinBox_Radius ;
122     QLabel* TextLabel_Height ;
123     GeometryGUI_SpinBox*  SpinBox_Height ;
124
125 private slots:
126
127     void ConstructorsClicked(int constructorId);
128     void ClickOnOk();
129     void ClickOnCancel();
130     void ClickOnApply();
131     void SetEditCurrentArgument() ;
132     void SelectionIntoArgument() ;
133     void LineEditReturnPressed() ;
134     void DeactivateActiveDialog() ;
135     void ActivateThisDialog() ;
136     void ValueChangedInSpinBox( double newValue ) ;
137   
138 protected:
139     QGridLayout* GeometryGUI_CylinderDlgLayout;
140     QGridLayout* GroupButtonsLayout;
141     QGridLayout* GroupConstructorsLayout;
142     QGridLayout* GroupC1Layout;
143     QGridLayout* GroupC2Layout;
144 };
145
146 #endif // DIALOGBOX_CYLINDER_H