]> SALOME platform Git repositories - modules/geom.git/blob - src/EntityGUI/EntityGUI_SketcherDlg.h
Salome HOME
Delete comments in UI files, leads to crash on opening in UI designer.
[modules/geom.git] / src / EntityGUI / EntityGUI_SketcherDlg.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  GEOM GEOMGUI : GUI for Geometry component
23 //  File   : EntityGUI_SketcherDlg.h
24 //  Author : Damine COQUERET
25 //  Module : GEOM
26 //
27 #ifndef ENTITYGUI_SKETCHERDLG_H
28 #define ENTITYGUI_SKETCHERDLG_H
29
30 #include "GEOM_EntityGUI.hxx"
31
32 #include "GEOMBase_Helper.h"
33
34 #include "EntityGUI_Skeleton_QTD.h"
35 #include "EntityGUI_Point_QTD.h"
36 #include "EntityGUI_Dir1_QTD.h"
37 #include "EntityGUI_Dir2_QTD.h"
38
39 #include "EntityGUI_1Sel_QTD.h"
40 #include "EntityGUI_1Spin.h"
41 #include "EntityGUI_2Spin.h"
42 #include "EntityGUI_3Spin.h"
43 #include "EntityGUI_4Spin.h"
44
45 #include "EntityGUI.h"
46 #include "GeometryGUI.h"
47
48 #include <gp_Dir.hxx>
49
50 #include <qwidget.h>
51 #include <qgroupbox.h>
52 #include <qlineedit.h>
53 #include <qlayout.h>
54 #include <qradiobutton.h>
55 #include <qbuttongroup.h>
56
57 //=================================================================================
58 // class    : EntityGUI_Dlg
59 // purpose  :
60 //=================================================================================
61 class GEOM_ENTITYGUI_EXPORT EntityGUI_SketcherDlg : public EntityGUI_Skeleton_QTD, public GEOMBase_Helper
62
63     Q_OBJECT
64
65 public:
66     EntityGUI_SketcherDlg(GeometryGUI* GUI, QWidget* parent = 0,
67                           const char* name = 0, bool modal = FALSE, WFlags fl = 0,
68                           const double lineWidth = 2.);
69     ~EntityGUI_SketcherDlg();
70
71     bool eventFilter (QObject* object, QEvent* event);
72
73 protected:
74     // redefined from GEOMBase_Helper
75     virtual GEOM::GEOM_IOperations_ptr createOperation();
76     virtual bool isValid( QString& );
77     virtual bool execute( ObjectList& objects );
78
79     void closeEvent( QCloseEvent* e );
80     void keyPressEvent( QKeyEvent* e );
81
82 private :
83     void Init();
84     void enterEvent(QEvent* e);
85     void InitClick();
86     void setEnabledUndo(bool value);
87     void setEnabledRedo(bool value);
88
89     QString GetNewCommand();
90
91     int myConstructorId;
92     int myConstructorDirId;
93     int mySketchType;
94     int mySketchState;
95
96     bool myIsAllAdded;
97
98     QLineEdit* myEditCurrentArgument;   /* Current LineEdit */
99
100     QStringList myCommand;
101     QStringList myUndoCommand;
102
103     Standard_Real myX, myY, myDX, myDY;
104     Standard_Real myLength, myAngle, myRadius;
105     Standard_Real myLastX1, myLastY1;
106     Standard_Real myLastX2, myLastY2;
107
108     EntityGUI_Point_QTD* GroupPt;
109     EntityGUI_Dir1_QTD* GroupD1;
110     EntityGUI_Dir2_QTD* GroupD2;
111
112     EntityGUI_1Sel_QTD* Group1Sel;
113     EntityGUI_1Spin* Group1Spin;
114     EntityGUI_2Spin* Group2Spin;
115     EntityGUI_3Spin* Group3Spin;
116     EntityGUI_4Spin* Group4Spin;
117
118     GeometryGUI*  myGeometryGUI;
119
120     QString myHelpFileName;
121
122     enum SketchState {FIRST_POINT, NEXT_POINT};
123
124     enum SketchType {PT_ABS, PT_RELATIVE, PT_SEL,
125                      DIR_ANGLE_LENGTH, DIR_ANGLE_X, DIR_ANGLE_Y,
126                      DIR_PER_LENGTH, DIR_PER_X, DIR_PER_Y,
127                      DIR_TAN_LENGTH, DIR_TAN_X, DIR_TAN_Y,
128                      DIR_DXDY_LENGTH, DIR_DXDY_X, DIR_DXDY_Y};
129
130   double myLineWidth;
131   virtual void displayPreview  ( GEOM::GEOM_Object_ptr obj,
132                                  const bool            append = false,
133                                  const bool            activate = false,
134                                  const bool            update = true,
135                                  const double          lineWidth = -1,
136                                  const int             displayMode = -1,
137                                  const int             color = -1);
138
139   bool createShapes( GEOM::GEOM_Object_ptr theObject,
140                      TopoDS_Shape&         theApplyedWire,
141                      TopoDS_Shape&         theLastSegment );
142
143 private slots:
144     void ClickOnEnd();
145     void ClickOnCancel();
146     bool ClickOnApply();
147     void ClickOnUndo();
148     void ClickOnRedo();
149     void ClickOnHelp();
150     void LineEditReturnPressed();
151     void SelectionIntoArgument();
152     void SetEditCurrentArgument();
153     void DeactivateActiveDialog();
154     void ActivateThisDialog();
155     void TypeClicked(int constructorId);
156     void DestClicked(int constructorId);
157     void PointClicked(int constructorId);
158     void Dir1Clicked(int constructorId);
159     void Dir2Clicked(int constructorId);
160     void ValueChangedInSpinBox(double newValue);
161 };
162
163 #endif // ENTITYGUI_SKETCHERDLG_H