]> SALOME platform Git repositories - modules/geom.git/blob - src/EntityGUI/EntityGUI_SketcherDlg.h
Salome HOME
PAL8395: Improve RemoveExtraEdges
[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 "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 "GEOM_ShapeTypeFilter.hxx"
49
50 #include <gp_Dir.hxx>
51
52 #include <qwidget.h>
53 #include <qgroupbox.h>
54 #include <qlineedit.h>
55 #include <qlayout.h>
56 #include <qradiobutton.h>
57 #include <qbuttongroup.h>
58
59 //=================================================================================
60 // class    : EntityGUI_Dlg
61 // purpose  :
62 //=================================================================================
63 class EntityGUI_SketcherDlg : public EntityGUI_Skeleton_QTD, public GEOMBase_Helper
64
65     Q_OBJECT
66
67 public:
68     EntityGUI_SketcherDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
69     ~EntityGUI_SketcherDlg();
70
71 protected:
72     // redefined from GEOMBase_Helper
73     virtual GEOM::GEOM_IOperations_ptr createOperation();
74     virtual bool isValid( QString& );
75     virtual bool execute( ObjectList& objects );
76
77     void closeEvent( QCloseEvent* e );
78
79 private :
80     void Init();
81     void enterEvent(QEvent* e);
82     void InitClick();
83     void setEnabledUndo(bool value);
84     void setEnabledRedo(bool value);
85
86     QString GetNewCommand();
87
88     int myConstructorId;
89     int myConstructorDirId;
90     int mySketchType;
91     int mySketchState;
92
93     bool myIsAllAdded;
94     
95     QLineEdit* myEditCurrentArgument;   /* Current LineEdit */
96     SALOME_Selection* mySelection;      /* User shape selection */
97     
98     QStringList myCommand;
99     QStringList myUndoCommand;
100
101     Standard_Real myX, myY, myDX, myDY;
102     Standard_Real myLength, myAngle, myRadius;
103     Standard_Real myLastX1, myLastY1;
104     Standard_Real myLastX2, myLastY2;
105
106     EntityGUI_Point_QTD* GroupPt;
107     EntityGUI_Dir1_QTD* GroupD1;
108     EntityGUI_Dir2_QTD* GroupD2;
109
110     EntityGUI_1Sel_QTD* Group1Sel;
111     EntityGUI_1Spin* Group1Spin;
112     EntityGUI_2Spin* Group2Spin;
113     EntityGUI_3Spin* Group3Spin;
114     EntityGUI_4Spin* Group4Spin;
115
116     enum SketchState {FIRST_POINT, NEXT_POINT};
117
118     enum SketchType {PT_ABS, PT_RELATIVE, PT_SEL,
119                      DIR_ANGLE_LENGTH, DIR_ANGLE_X, DIR_ANGLE_Y,
120                      DIR_PER_LENGTH, DIR_PER_X, DIR_PER_Y,
121                      DIR_TAN_LENGTH, DIR_TAN_X, DIR_TAN_Y,
122                      DIR_DXDY_LENGTH, DIR_DXDY_X, DIR_DXDY_Y};
123
124   virtual void displayPreview  ( GEOM::GEOM_Object_ptr obj,
125                                  const bool            append = false,
126                                  const bool            activate = false,
127                                  const bool            update = true,
128                                  const double          lineWidth = -1 );
129
130   bool createShapes( GEOM::GEOM_Object_ptr theObject,
131                      TopoDS_Shape&         theApplyedWire,
132                      TopoDS_Shape&         theLastSegment );
133 private slots:
134     void ClickOnEnd();
135     void ClickOnCancel();
136     bool ClickOnApply();
137     void ClickOnUndo();
138     void ClickOnRedo();
139     void LineEditReturnPressed();
140     void SelectionIntoArgument();
141     void SetEditCurrentArgument();
142     void DeactivateActiveDialog();
143     void ActivateThisDialog();
144     void TypeClicked(int constructorId);
145     void DestClicked(int constructorId);
146     void PointClicked(int constructorId);
147     void Dir1Clicked(int constructorId);
148     void Dir2Clicked(int constructorId);
149     void ValueChangedInSpinBox(double newValue);
150
151 };
152
153 #endif // ENTITYGUI_SKETCHERDLG_H