]> SALOME platform Git repositories - modules/geom.git/blob - src/EntityGUI/EntityGUI_SketcherDlg.h
Salome HOME
NPAL18111: Bad shape build by partition.
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : EntityGUI_SketcherDlg.h
25 //  Author : Damine COQUERET
26 //  Module : GEOM
27
28 #ifndef ENTITYGUI_SKETCHERDLG_H
29 #define ENTITYGUI_SKETCHERDLG_H
30
31 #include "GEOMBase_Helper.h"
32
33 #include "EntityGUI_Skeleton_QTD.h"
34 #include "EntityGUI_Point_QTD.h"
35 #include "EntityGUI_Dir1_QTD.h"
36 #include "EntityGUI_Dir2_QTD.h"
37
38 #include "EntityGUI_1Sel_QTD.h"
39 #include "EntityGUI_1Spin.h"
40 #include "EntityGUI_2Spin.h"
41 #include "EntityGUI_3Spin.h"
42 #include "EntityGUI_4Spin.h"
43
44 #include "EntityGUI.h"
45 #include "GeometryGUI.h"
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, public GEOMBase_Helper
61 {
62     Q_OBJECT
63
64 public:
65     EntityGUI_SketcherDlg(GeometryGUI* GUI, QWidget* parent = 0,
66                           const char* name = 0, bool modal = FALSE, WFlags fl = 0,
67                           const double lineWidth = 2.);
68     ~EntityGUI_SketcherDlg();
69
70     bool eventFilter (QObject* object, QEvent* event);
71
72 protected:
73     // redefined from GEOMBase_Helper
74     virtual GEOM::GEOM_IOperations_ptr createOperation();
75     virtual bool isValid( QString& );
76     virtual bool execute( ObjectList& objects );
77
78     void closeEvent( QCloseEvent* e );
79     void keyPressEvent( QKeyEvent* e );
80
81 private :
82     void Init();
83     void enterEvent(QEvent* e);
84     void InitClick();
85     void setEnabledUndo(bool value);
86     void setEnabledRedo(bool value);
87
88     QString GetNewCommand();
89
90     int myConstructorId;
91     int myConstructorDirId;
92     int mySketchType;
93     int mySketchState;
94
95     bool myIsAllAdded;
96
97     QLineEdit* myEditCurrentArgument;   /* Current LineEdit */
98
99     QStringList myCommand;
100     QStringList myUndoCommand;
101
102     Standard_Real myX, myY, myDX, myDY;
103     Standard_Real myLength, myAngle, myRadius;
104     Standard_Real myLastX1, myLastY1;
105     Standard_Real myLastX2, myLastY2;
106
107     EntityGUI_Point_QTD* GroupPt;
108     EntityGUI_Dir1_QTD* GroupD1;
109     EntityGUI_Dir2_QTD* GroupD2;
110
111     EntityGUI_1Sel_QTD* Group1Sel;
112     EntityGUI_1Spin* Group1Spin;
113     EntityGUI_2Spin* Group2Spin;
114     EntityGUI_3Spin* Group3Spin;
115     EntityGUI_4Spin* Group4Spin;
116
117     GeometryGUI*  myGeometryGUI;
118
119     QString myHelpFileName;
120
121     enum SketchState {FIRST_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   double myLineWidth;
130   virtual void displayPreview  ( GEOM::GEOM_Object_ptr obj,
131                                  const bool            append = false,
132                                  const bool            activate = false,
133                                  const bool            update = true,
134                                  const double          lineWidth = -1 );
135
136   bool createShapes( GEOM::GEOM_Object_ptr theObject,
137                      TopoDS_Shape&         theApplyedWire,
138                      TopoDS_Shape&         theLastSegment );
139
140 private slots:
141     void ClickOnEnd();
142     void ClickOnCancel();
143     bool ClickOnApply();
144     void ClickOnUndo();
145     void ClickOnRedo();
146     void ClickOnHelp();
147     void LineEditReturnPressed();
148     void SelectionIntoArgument();
149     void SetEditCurrentArgument();
150     void DeactivateActiveDialog();
151     void ActivateThisDialog();
152     void TypeClicked(int constructorId);
153     void DestClicked(int constructorId);
154     void PointClicked(int constructorId);
155     void Dir1Clicked(int constructorId);
156     void Dir2Clicked(int constructorId);
157     void ValueChangedInSpinBox(double newValue);
158 };
159
160 #endif // ENTITYGUI_SKETCHERDLG_H