Salome HOME
sources v1.2
[modules/geom.git] / src / GEOMGUI / GeometryGUI_PointDlg.h
1 //  File      : GeometryGUI_PointDlg.h
2 //  Created   :
3 //  Author    : Lucien PIGNOLONI
4 //  Project   : SALOME
5 //  Module    : GeometryGUI
6 //  Copyright : OPEN CASCADE
7 //  $Header$
8
9
10 #ifndef DIALOGBOX_POINT_H
11 #define DIALOGBOX_POINT_H
12
13 #include "SALOME_Selection.h"
14 #include "GEOM_ShapeTypeFilter.hxx"
15 #include "GeometryGUI_SpinBox.h"
16
17 #include <gp_Pnt.hxx>
18 #include <TopoDS_Edge.hxx>
19
20 #include <qvariant.h>
21 #include <qdialog.h>
22
23 class QVBoxLayout; 
24 class QHBoxLayout; 
25 class QGridLayout; 
26 class QButtonGroup;
27 class QFrame;
28 class QGroupBox;
29 class QLabel;
30 class QSpinBox;
31 class QPushButton;
32 class QRadioButton;
33 class GeometryGUI;
34
35 #include <AIS_Shape.hxx>
36 #include <AIS_InteractiveObject.hxx>
37 #include <AIS_InteractiveContext.hxx>
38 #include <AIS_ListIteratorOfListOfInteractive.hxx>
39 #include <AIS_Drawer.hxx>
40
41
42 //=================================================================================
43 // class    : GeometryGUI_PointDlg
44 // purpose  :
45 //=================================================================================
46 class GeometryGUI_PointDlg : public QDialog
47
48     Q_OBJECT
49
50 public:
51     GeometryGUI_PointDlg( QWidget* parent = 0, const char* name = 0,
52                           SALOME_Selection* Sel = 0,
53                           const Handle(AIS_InteractiveContext)& ic = 0,
54                           bool modal = FALSE,
55                           WFlags fl = 0 );
56
57     ~GeometryGUI_PointDlg();
58     
59 private :
60
61     SALOME_Selection*  mySelection ;        /* Current selection */   
62     TopoDS_Shape       mySimulationTopoDs;  /* Shape used to display a simulation */
63     gp_Pnt             myPoint ;            /* Is 'mySimulationTopoDs'  */
64     GeometryGUI*       myGeomGUI ;          /* Current GeomGUI object */
65     GEOM::GEOM_Gen_var myGeom ;             /* Current GeomI object */
66
67     /* Interactive and local context management see also : bool UseLocalContext() */
68     Handle (AIS_InteractiveContext) myIC ;                 /* Interactive context from IAPP */
69     Standard_Integer                myLocalContextId ;     /* identify a local context for this method */
70     TopAbs_ShapeEnum                myLocalContextMode ;   /* identify a selection mode into local context */
71     bool                            myUseLocalContext ;    /* true when method as opened a local context  */
72
73     int                             myConstructorId ;      /* Current constructor id = radio button id */
74     double                          myParameter ;          /* Parameter used to create a vertex on edge (point on curve) */
75     bool                            myOkEdge ;             /* true when an edge is selected by user */
76
77     Handle(GEOM_ShapeTypeFilter)    myEdgeFilter;          /* filter for selection */
78     
79     void Init(SALOME_Selection* Sel, const Handle(AIS_InteractiveContext)& ic) ; /* Initialize dialog */ 
80     void enterEvent(QEvent* e);
81     void closeEvent(QCloseEvent* e) ;
82
83     QButtonGroup* GroupConstructors;
84     QRadioButton* Constructor1;
85     QRadioButton* Constructor2;
86
87     QGroupBox* GroupCoordinates;
88     QLabel*    TextLabel_X;
89     QLabel*    TextLabel_Y;
90     QLabel*    TextLabel_Z;
91
92     GeometryGUI_SpinBox* SpinBox_X ;
93     GeometryGUI_SpinBox* SpinBox_Y ;
94     GeometryGUI_SpinBox* SpinBox_Z ;
95
96     QGroupBox*           GroupWithEdge;
97     QLabel*              TextLabel_Edge;
98     QPushButton*         SelectButton_Edge;
99     QLineEdit*           LineEdit_Edge;
100     QLabel*              TextLabel_Parameter;
101     GeometryGUI_SpinBox* SpinBox_Parameter;
102
103     QGroupBox* GroupButtons;
104     QPushButton* buttonApply;
105     QPushButton* buttonOk;
106     QPushButton* buttonCancel;
107
108 private slots:
109
110     void ConstructorsClicked(int constructorId);
111     void ClickOnOk();
112     void ClickOnCancel();
113     void ClickOnApply();
114     void SetEditCurrentArgument() ;
115     void LineEditReturnPressed() ;
116     void SelectionIntoArgument() ;
117     void DeactivateActiveDialog() ;
118     void ActivateThisDialog() ;
119     void ValueChangedInSpinBox( double newValue ) ;
120     bool CalculateVertexOnCurve(const TopoDS_Edge& anEdge, const Standard_Real aParameter, TopoDS_Shape& resultVertex) ;
121
122 public:   
123     void PointIntoCoordinates(gp_Pnt P, bool displayPoint) ;
124     bool UseLocalContext() ; /* return true if method has opened a local context */
125
126 protected:
127     QGridLayout* GeometryGUI_PointDlgLayout;    
128     QGridLayout* GroupConstructorsLayout;
129     QGridLayout* GroupCoordinatesLayout;
130     QGridLayout* GroupWithEdgeLayout;   
131     QGridLayout* GroupButtonsLayout;
132 };
133
134 #endif // DIALOGBOX_POINT_H