Salome HOME
2da62fe81c441f57872bbc5fdea858df5507f707
[modules/geom.git] / src / EntityGUI / EntityGUI_SketcherDlg.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   : EntityGUI_SketcherDlg.h
25 //  Author : Damine COQUERET
26 //  Module : GEOM
27 //  $Header: 
28
29 #ifndef ENTITYGUI_SKETCHERDLG_H
30 #define ENTITYGUI_SKETCHERDLG_H
31
32 #include "EntityGUI_Skeleton_QTD.h"
33 #include "EntityGUI_Point_QTD.h"
34 #include "EntityGUI_Dir1_QTD.h"
35 #include "EntityGUI_Dir2_QTD.h"
36
37 #include "EntityGUI_1Sel_QTD.h"
38 #include "EntityGUI_1Spin.h"
39 #include "EntityGUI_2Spin.h"
40 #include "EntityGUI_3Spin.h"
41 #include "EntityGUI_4Spin.h"
42
43 #include "EntityGUI.h"
44
45 #include "GEOM_ShapeTypeFilter.hxx"
46
47 #include <gp_Dir.hxx>
48
49 #include <qwidget.h>
50 #include <qgroupbox.h>
51 #include <qlineedit.h>
52 #include <qlayout.h>
53 #include <qradiobutton.h>
54 #include <qbuttongroup.h>
55
56 //=================================================================================
57 // class    : EntityGUI_Dlg
58 // purpose  :
59 //=================================================================================
60 class EntityGUI_SketcherDlg : public EntityGUI_Skeleton_QTD
61
62     Q_OBJECT
63
64 public:
65     EntityGUI_SketcherDlg(QWidget* parent = 0, const char* name = 0, EntityGUI* theEntityGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
66     ~EntityGUI_SketcherDlg();
67
68 private :
69     void Init();
70     void enterEvent(QEvent* e);
71     void closeEvent(QCloseEvent* e);
72     void InitClick();
73     void MakeSimulationAndDisplay();
74     QString GetNewCommand();
75
76     EntityGUI* myEntityGUI;
77
78     double step;
79     int myConstructorId;
80     int myConstructorDirId;
81     int mySketchType;
82     int mySketchState;
83     Handle(GEOM_ShapeTypeFilter) myVertexFilter;
84
85     TopoDS_Shape mySimulationTopoDs1;    /* Shape used for simulation display */
86     TopoDS_Shape mySimulationTopoDs2;    /* Shape used for simulation display */
87     QLineEdit* myEditCurrentArgument;   /* Current LineEdit */
88     SALOME_Selection* mySelection;      /* User shape selection */
89     GEOM::GEOM_Gen_var myGeom;          /* Current GeomI object */
90     GEOMBase* myGeomBase;
91     GEOMContext* myGeomGUI;  /* Current GeomGUI object */
92
93     int myLastOp;
94     QString myCommand;
95     QString myLastCommand;
96     TopoDS_Shape myShape;
97     gp_Dir myLastDir;
98
99     Standard_Real myX;
100     Standard_Real myY;
101     Standard_Real myDX;
102     Standard_Real myDY;
103     Standard_Real myLastX1;
104     Standard_Real myLastY1;
105     Standard_Real myLastX2;
106     Standard_Real myLastY2;
107     Standard_Real myLength;
108     Standard_Real myAngle;
109     Standard_Real myRadius;
110
111     EntityGUI_Point_QTD* GroupPt;
112     EntityGUI_Dir1_QTD* GroupD1;
113     EntityGUI_Dir2_QTD* GroupD2;
114
115     EntityGUI_1Sel_QTD* Group1Sel;
116     EntityGUI_1Spin* Group1Spin;
117     EntityGUI_2Spin* Group2Spin;
118     EntityGUI_3Spin* Group3Spin;
119     EntityGUI_4Spin* Group4Spin;
120
121     enum SketchState {FIRST_POINT, SECOND_POINT, NEXT_POINT};
122
123     enum SketchType {PT_ABS, PT_RELATIVE, PT_SEL,
124                      DIR_ANGLE_LENGTH, DIR_ANGLE_X, DIR_ANGLE_Y,
125                      DIR_PER_LENGTH, DIR_PER_X, DIR_PER_Y,
126                      DIR_TAN_LENGTH, DIR_TAN_X, DIR_TAN_Y,
127                      DIR_DXDY_LENGTH, DIR_DXDY_X, DIR_DXDY_Y};
128
129 private slots:
130     void ClickOnEnd();
131     void ClickOnClose();
132     void ClickOnCancel();
133     void ClickOnApply();
134     void ClickOnUndo();
135     void LineEditReturnPressed();
136     void SelectionIntoArgument();
137     void SetEditCurrentArgument();
138     void DeactivateActiveDialog();
139     void ActivateThisDialog();
140     void TypeClicked(int constructorId);
141     void DestClicked(int constructorId);
142     void PointClicked(int constructorId);
143     void Dir1Clicked(int constructorId);
144     void Dir2Clicked(int constructorId);
145     void ValueChangedInSpinBox(double newValue);
146
147 };
148
149 #endif // ENTITYGUI_SKETCHERDLG_H