Salome HOME
NRI : 1_3_0 version.
[modules/geom.git] / src / GEOMGUI / GeometryGUI_ConeDlg.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_ConeDlg.h
25 //  Author : Lucien PIGNOLONI
26 //  Module : GEOM
27 //  $Header$
28
29 #ifndef DIALOGBOX_CONE_H
30 #define DIALOGBOX_CONE_H
31
32 #include "SALOME_Selection.h"
33 #include "GEOM_ShapeTypeFilter.hxx"
34 #include "GEOM_EdgeFilter.hxx"
35 #include "GeometryGUI_SpinBox.h"
36
37 #include <BRepPrimAPI_MakeCone.hxx>
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 QSpinBox;
52 class QLineEdit;
53 class QPushButton;
54 class QRadioButton;
55 class GeometryGUI;
56
57 //=================================================================================
58 // class    : GeometryGUI_ConeDlg
59 // purpose  :
60 //=================================================================================
61 class GeometryGUI_ConeDlg : public QDialog
62
63     Q_OBJECT
64
65 public:
66     GeometryGUI_ConeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
67     ~GeometryGUI_ConeDlg();
68
69 private:
70
71     void Init( SALOME_Selection* Sel ) ;
72     void closeEvent( QCloseEvent* e ) ;
73     void enterEvent ( QEvent * ) ;                /* mouse enter the QWidget */
74     void MakeConeSimulationAndDisplay() ;
75
76     GEOM::GEOM_Gen_var myGeom ;                /* Current GeomI object */
77     GeometryGUI*          myGeomGUI ;             /* Current GeomGUI object */
78     SALOME_Selection*     mySelection ;           /* User shape selection */ 
79     TopoDS_Shape          mySimulationTopoDs ;
80
81     gp_Pnt                myPoint1 ;              /* Topology used  */
82     gp_Dir                myDir ;
83     bool                  myOkPoint1 ;
84     bool                  myOkDir ;               /* to check when argument is defined */
85
86     Standard_Real         myRadius1 ;
87     Standard_Real         myRadius2 ; 
88     Standard_Real         myHeight ;
89     bool                  myOkRadius1 ;
90     bool                  myOkRadius2 ;
91     bool                  myOkHeight ;
92     QDoubleValidator      *myVa ;                 /* Double validator for numeric input myRadius1 */
93     QDoubleValidator      *myVb ;                 /* Double validator for numeric input myRadius2 */
94     QDoubleValidator      *myVc ;                 /* Double validator for numeric input myHeight  */
95
96     int                   myConstructorId ;       /* Current constructor id = radio button id */
97     QWidget*              myEditCurrentArgument;  /* Current LineEdit or spin box */
98     Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */
99     Handle(GEOM_EdgeFilter) myEdgeFilter ;   /* Filter selection */
100
101
102     QButtonGroup* GroupConstructors;
103     QRadioButton* Constructor1;
104     QRadioButton* Constructor2;
105     QGroupBox* GroupButtons;
106     QPushButton* buttonApply;
107     QPushButton* buttonOk;
108     QPushButton* buttonCancel;
109     QGroupBox* GroupC1;
110     QGroupBox* GroupC2;
111     QPushButton* SelectButtonC1A1;
112     QLineEdit* LineEditC1A1;
113     QLabel* TextLabelC1A1;
114     QPushButton* SelectButtonC1A2;
115     QLineEdit* LineEditC1A2;
116     QLabel* TextLabelC1A2;
117     QLabel* TextLabelC1A3;
118     GeometryGUI_SpinBox*  SpinBox_C1A3 ;
119     QLabel* TextLabelC1A4;
120     GeometryGUI_SpinBox*  SpinBox_C1A4 ;
121     QLabel* TextLabelC1A5;
122     GeometryGUI_SpinBox*  SpinBox_C1A5 ;
123
124     QLabel* TextLabel_Radius1 ;
125     QLabel* TextLabel_Radius2 ;
126     QLabel* TextLabel_Height ;
127     GeometryGUI_SpinBox*  SpinBox_Radius1 ;
128     GeometryGUI_SpinBox*  SpinBox_Radius2 ;
129     GeometryGUI_SpinBox*  SpinBox_Height  ;
130
131 private slots:
132
133     void ConstructorsClicked(int constructorId);
134     void ClickOnOk();
135     void ClickOnCancel();
136     void ClickOnApply();
137     void SetEditCurrentArgument() ;
138     void SelectionIntoArgument() ;
139     void LineEditReturnPressed() ;
140     void DeactivateActiveDialog() ;
141     void ActivateThisDialog() ;
142     void ValueChangedInSpinBox( double newValue ) ;
143   
144 protected:
145     QGridLayout* GeometryGUI_ConeDlgLayout;
146     QGridLayout* GroupConstructorsLayout;
147     QGridLayout* GroupButtonsLayout;
148     QGridLayout* GroupC1Layout;
149     QGridLayout* GroupC2Layout;
150 };
151
152 #endif // DIALOGBOX_CONE_H