1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // GEOM GEOMGUI : GUI for Geometry component
24 // File : EntityGUI_SketcherDlg.h
25 // Author : Damien COQUERET, Open CASCADE S.A.S.
27 #ifndef ENTITYGUI_SKETCHERDLG_H
28 #define ENTITYGUI_SKETCHERDLG_H
30 #include <GEOMBase_Helper.h>
40 class SalomeApp_DoubleSpinBox;
42 class EntityGUI_2Sel1Check;
43 class EntityGUI_1Sel1Spin1Check;
44 class EntityGUI_1Spin;
45 class EntityGUI_2Spin;
46 class EntityGUI_3Spin1Check;
47 class EntityGUI_4Spin1Check;
48 class EntityGUI_Point;
51 class EntityGUI_Skeleton;
56 # define COORD_MIN -1e+15
57 # define COORD_MAX +1e+15
58 # define MAX_NUMBER 100000
59 # define DBL_DIGITS_DISPLAY 16
62 //=================================================================================
63 // class : EntityGUI_Dlg
65 //=================================================================================
66 class EntityGUI_SketcherDlg : public QDialog, GEOMBase_Helper
71 EntityGUI_SketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0,
73 ~EntityGUI_SketcherDlg();
75 bool eventFilter (QObject* object, QEvent* event);
77 bool acceptMouseEvent() const; // called by EntityGUI::OnMousePress()
78 void OnPointSelected( Qt::KeyboardModifiers, const gp_Pnt&, bool isStart = true );
81 void initSpinBox( SalomeApp_DoubleSpinBox*,
82 double, double, double = 0.1,
83 const char* quantity = "length_precision" );
85 // redefined from GEOMBase_Helper
86 virtual GEOM::GEOM_IOperations_ptr createOperation();
87 virtual bool isValid( QString& );
88 virtual bool execute( ObjectList& );
89 virtual void addSubshapesToStudy();
91 void closeEvent( QCloseEvent* );
92 void keyPressEvent( QKeyEvent* );
96 void enterEvent( QEvent* );
98 void setEnabledUndo( bool );
99 void setEnabledRedo( bool );
101 QString GetNewCommand( QString& );
103 virtual void displayPreview( GEOM::GEOM_Object_ptr,
111 void displayPntPreview( const double = 0.0,
113 bool /*append*/ = true,
114 bool /*update*/ = true
117 bool createShapes( GEOM::GEOM_Object_ptr,
120 int getPnt1ConstructorId() const;
121 int getPnt2ConstructorId() const;
128 int myConstructorDirId;
129 int myConstructorPntId;
137 QLineEdit* myEditCurrentArgument; /* Current LineEdit */
139 QStringList myCommand;
140 QStringList myUndoCommand;
142 QStringList myParameters;
143 QStringList myUndoParameters;
145 Standard_Real myX, myY, myDX, myDY;
146 Standard_Real myX1, myY1, myX2, myY2;
147 Standard_Real myXc, myYc, myDXc, myDYc;
148 Standard_Real myLength, myAngle, myRadius;
149 Standard_Real myLastX1, myLastY1;
150 Standard_Real myLastX2, myLastY2;
152 QString myXStr, myYStr, myDXStr, myDYStr;
153 QString myX1Str, myY1Str, myX2Str, myY2Str;
154 QString myXcStr, myYcStr, myDXcStr, myDYcStr;
155 QString myLengthStr, myAngleStr, myRadiusStr;
156 QString myLastX1Str, myLastY1Str;
157 QString myLastX2Str, myLastY2Str;
159 EntityGUI_Skeleton* MainWidget;
161 EntityGUI_Point* GroupPt;
162 EntityGUI_Point* GroupPt2;
163 EntityGUI_Dir1* GroupD1;
164 EntityGUI_Dir2* GroupD2;
166 EntityGUI_1Sel* Group1Sel;
167 EntityGUI_2Sel1Check* Group2Sel;
168 EntityGUI_1Sel1Spin1Check* Group1Sel1Spin;
169 EntityGUI_1Spin* Group1Spin;
170 EntityGUI_2Spin* Group2Spin;
171 EntityGUI_3Spin1Check* Group3Spin;
172 EntityGUI_4Spin1Check* Group4Spin;
173 DlgRef_4Spin* GroupRect;
177 QGroupBox* GroupBox1;
178 QComboBox* ComboBox1;
179 QPushButton* planeButton;
180 QPushButton* selButton;
182 QLineEdit* WPlaneLineEdit;
184 GeometryGUI* myGeometryGUI;
186 QString myHelpFileName;
190 QList<gp_Ax3> myLCSList;
191 GEOM::GEOM_Object_var myGlobalCS;
192 GEOM::GEOM_Object_var myWPlane;
193 QList< GEOM::GEOM_Object_var > myWPlaneList;
197 TopAbs_ShapeEnum myNeedType;
200 enum SketchState { FIRST_POINT, NEXT_POINT };
202 enum SketchType { PT_ABS, PT_RELATIVE, PT_SEL,
203 PT_ABS_RADIUS,PT_REL_RADIUS,PT_SEL_RADIUS,
204 PT_ABS_CENTER,PT_REL_CENTER,PT_SEL_CENTER,
205 DIR_ANGLE_LENGTH, DIR_ANGLE_X, DIR_ANGLE_Y,
206 DIR_PER_LENGTH, DIR_PER_X, DIR_PER_Y,
207 DIR_TAN_LENGTH, DIR_TAN_X, DIR_TAN_Y,
208 DIR_DXDY_LENGTH, DIR_DXDY_X, DIR_DXDY_Y };
212 void ClickOnCancel();
217 void LineEditReturnPressed();
218 void SelectionIntoArgument();
219 void SetEditCurrentArgument();
220 void DeactivateActiveDialog();
221 void ActivateThisDialog();
222 void TypeClicked( int );
224 void DestClicked( int );
225 void PointClicked( int );
226 void Point2Clicked( int );
227 void Dir1Clicked( int );
228 void Dir2Clicked( int );
229 void CheckBoxClicked( int );
230 void ValueChangedInSpinBox( double );
231 void SetDoubleSpinBoxStep( double );
232 void AddLocalCS( GEOM::GEOM_Object_var );
234 gp_Ax3 GetActiveLocalCS();
235 gp_Ax3 WPlaneToLCS( GEOM::GEOM_Object_var );
236 void ActivateLocalCS();
239 #endif // ENTITYGUI_SKETCHERDLG_H