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