1 // Copyright (C) 2007-2011 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;
55 # define COORD_MIN -1e+15
56 # define COORD_MAX +1e+15
57 # define MAX_NUMBER 100000
58 # define DBL_DIGITS_DISPLAY 16
61 //=================================================================================
62 // class : EntityGUI_Dlg
64 //=================================================================================
65 class EntityGUI_SketcherDlg : public QDialog, GEOMBase_Helper
70 EntityGUI_SketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0,
72 ~EntityGUI_SketcherDlg();
74 bool eventFilter (QObject* object, QEvent* event);
76 bool acceptMouseEvent() const { return ( getPnt1ConstructorId() == 1
77 || getPnt1ConstructorId() == 0 ); } //accept mouse event only on absolute and relative selection mode
78 void OnPointSelected( Qt::KeyboardModifiers, const gp_Pnt& ); // called by EntityGUI::OnMousePress()
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& );
90 void closeEvent( QCloseEvent* );
91 void keyPressEvent( QKeyEvent* );
95 void enterEvent( QEvent* );
97 void setEnabledUndo( bool );
98 void setEnabledRedo( bool );
100 QString GetNewCommand( QString& );
102 virtual void displayPreview( GEOM::GEOM_Object_ptr,
110 void displayPntPreview( const double = 0.0,
112 bool /*append*/ = true,
113 bool /*update*/ = true
116 bool createShapes( GEOM::GEOM_Object_ptr,
119 int getPnt1ConstructorId() const;
120 int getPnt2ConstructorId() const;
124 int myConstructorDirId;
125 int myConstructorPntId;
133 QLineEdit* myEditCurrentArgument; /* Current LineEdit */
135 QStringList myCommand;
136 QStringList myUndoCommand;
138 QStringList myParameters;
139 QStringList myUndoParameters;
141 Standard_Real myX, myY, myDX, myDY;
142 Standard_Real myXc, myYc, myDXc, myDYc;
143 Standard_Real myLength, myAngle, myRadius;
144 Standard_Real myLastX1, myLastY1;
145 Standard_Real myLastX2, myLastY2;
147 QString myXStr, myYStr, myDXStr, myDYStr;
148 QString myXcStr, myYcStr, myDXcStr, myDYcStr;
149 QString myLengthStr, myAngleStr, myRadiusStr;
150 QString myLastX1Str, myLastY1Str;
151 QString myLastX2Str, myLastY2Str;
153 EntityGUI_Skeleton* MainWidget;
155 EntityGUI_Point* GroupPt;
156 EntityGUI_Point* GroupPt2;
157 EntityGUI_Dir1* GroupD1;
158 EntityGUI_Dir2* GroupD2;
160 EntityGUI_1Sel* Group1Sel;
161 EntityGUI_2Sel1Check* Group2Sel;
162 EntityGUI_1Sel1Spin1Check* Group1Sel1Spin;
163 EntityGUI_1Spin* Group1Spin;
164 EntityGUI_2Spin* Group2Spin;
165 EntityGUI_3Spin1Check* Group3Spin;
166 EntityGUI_4Spin1Check* Group4Spin;
170 QGroupBox* GroupBox1;
171 QComboBox* ComboBox1;
172 QPushButton* planeButton;
174 GeometryGUI* myGeometryGUI;
176 QString myHelpFileName;
180 QList<gp_Ax3> myLCSList;
184 TopAbs_ShapeEnum myNeedType;
187 enum SketchState { FIRST_POINT, NEXT_POINT };
189 enum SketchType { PT_ABS, PT_RELATIVE, PT_SEL,
190 PT_ABS_RADIUS,PT_REL_RADIUS,PT_SEL_RADIUS,
191 PT_ABS_CENTER,PT_REL_CENTER,PT_SEL_CENTER,
192 DIR_ANGLE_LENGTH, DIR_ANGLE_X, DIR_ANGLE_Y,
193 DIR_PER_LENGTH, DIR_PER_X, DIR_PER_Y,
194 DIR_TAN_LENGTH, DIR_TAN_X, DIR_TAN_Y,
195 DIR_DXDY_LENGTH, DIR_DXDY_X, DIR_DXDY_Y };
199 void ClickOnCancel();
204 void LineEditReturnPressed();
205 void SelectionIntoArgument();
206 void SetEditCurrentArgument();
207 void DeactivateActiveDialog();
208 void ActivateThisDialog();
209 void TypeClicked( int );
210 void DestClicked( int );
211 void PointClicked( int );
212 void Point2Clicked( int );
213 void Dir1Clicked( int );
214 void Dir2Clicked( int );
215 void CheckBoxClicked( int );
216 void ValueChangedInSpinBox( double );
217 void SetDoubleSpinBoxStep( double );
219 gp_Ax3 GetActiveLocalCS();
220 void ActivateLocalCS();
223 #endif // ENTITYGUI_SKETCHERDLG_H