Version: 9.12.0
EntityGUI_SketcherDlg.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, 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, or (at your option) any later version.
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 // GEOM GEOMGUI : GUI for Geometry component
24 // File : EntityGUI_SketcherDlg.h
25 // Author : Damien COQUERET, Open CASCADE S.A.S.
26 //
27 #ifndef ENTITYGUI_SKETCHERDLG_H
28 #define ENTITYGUI_SKETCHERDLG_H
29 
30 #include <GEOMBase_Helper.h>
31 
32 #include <QGroupBox>
33 #include <QComboBox>
34 #include <QDialog>
35 #include <QLabel>
36 
37 #include <gp_Ax3.hxx>
38 
39 class QLineEdit;
40 class SalomeApp_DoubleSpinBox;
41 class EntityGUI_1Sel;
44 class EntityGUI_1Spin;
45 class EntityGUI_2Spin;
48 class EntityGUI_Point;
49 class EntityGUI_Dir1;
50 class EntityGUI_Dir2;
51 class EntityGUI_Skeleton;
52 class DlgRef_4Spin;
53 class GeometryGUI;
54 
55 #ifndef COORD_MIN
56 # define COORD_MIN -1e+15
57 # define COORD_MAX +1e+15
58 # define MAX_NUMBER 100000
59 # define DBL_DIGITS_DISPLAY 16
60 #endif // COORD_MIN
61 
62 //=================================================================================
63 // class : EntityGUI_Dlg
64 // purpose :
65 //=================================================================================
67 {
68  Q_OBJECT
69 
70 public:
71  EntityGUI_SketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0,
72  const double = -1 );
74 
75  bool eventFilter (QObject* object, QEvent* event);
76 
77  bool acceptMouseEvent() const; // called by EntityGUI::OnMousePress()
78  void OnPointSelected( Qt::KeyboardModifiers, const gp_Pnt&, bool isStart = true );
79 
80 protected:
81  void initSpinBox( SalomeApp_DoubleSpinBox*,
82  double, double, double = 0.1,
83  const char* quantity = "length_precision" );
84 
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();
90 
91  void closeEvent( QCloseEvent* );
92  void keyPressEvent( QKeyEvent* );
93 
94 private:
95  void Init();
96  void enterEvent( QEvent* );
97  void InitClick();
98  void setEnabledUndo( bool );
99  void setEnabledRedo( bool );
100 
101  QString GetNewCommand( QString& );
102 
103  virtual void displayPreview( GEOM::GEOM_Object_ptr,
104  const bool = false,
105  const bool = false,
106  const bool = true,
107  const double = -1,
108  const int = -1,
109  const int = -1);
110 
111  void displayPntPreview( const double = 0.0,
112  const double = 0.0,
113  bool /*append*/ = true,
114  bool /*update*/ = true
115  );
116 
117  bool createShapes( GEOM::GEOM_Object_ptr,
118  TopoDS_Shape&,
119  TopoDS_Shape& );
120  int getPnt1ConstructorId() const;
121  int getPnt2ConstructorId() const;
122  void OnFirstPoint();
123  void OnNextPoint();
124 
125 
126 private:
132 
134  bool myIsApply;
135  bool autoApply;
136 
137  QLineEdit* myEditCurrentArgument; /* Current LineEdit */
138 
139  QStringList myCommand;
140  QStringList myUndoCommand;
141 
142  QStringList myParameters;
143  QStringList myUndoParameters;
144 
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;
151 
158 
160 
165 
174 
175  QLabel* myErrLabel;
176 
178  QComboBox* ComboBox1;
179  QPushButton* planeButton;
180  QPushButton* selButton;
181 
182  QLineEdit* WPlaneLineEdit;
183 
185 
186  QString myHelpFileName;
187 
188  double myLineWidth;
189 
190  QList<gp_Ax3> myLCSList;
191  GEOM::GEOM_Object_var myGlobalCS;
192  GEOM::GEOM_Object_var myWPlane;
193  QList< GEOM::GEOM_Object_var > myWPlaneList;
194 
196 
197  TopAbs_ShapeEnum myNeedType;
198 
199 private:
201 
209 
210 private slots:
211  void ClickOnEnd();
212  void ClickOnCancel();
213  bool ClickOnApply();
214  void ClickOnUndo();
215  void ClickOnRedo();
216  void ClickOnHelp();
217  void LineEditReturnPressed();
218  void SelectionIntoArgument();
219  void SetEditCurrentArgument();
220  void DeactivateActiveDialog();
221  void ActivateThisDialog();
222  void TypeClicked( int );
223  void RectClicked();
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 );
233  void FindLocalCS();
234  gp_Ax3 GetActiveLocalCS();
235  gp_Ax3 WPlaneToLCS( GEOM::GEOM_Object_var );
236  void ActivateLocalCS();
237 };
238 
239 #endif // ENTITYGUI_SKETCHERDLG_H
std::list< GEOM::GEOM_Object_ptr > ObjectList
Definition: GEOMBase_Helper.h:46
Definition: DlgRef.h:885
Definition: EntityGUI_Widgets.h:67
Definition: EntityGUI_Widgets.h:34
Definition: EntityGUI_Widgets.h:83
Definition: EntityGUI_Widgets.h:50
Definition: EntityGUI_Widgets.h:99
Definition: EntityGUI_Widgets.h:147
Definition: EntityGUI_Widgets.h:163
Definition: EntityGUI_Widgets.h:179
Definition: EntityGUI_Widgets.h:197
Definition: EntityGUI_Widgets.h:215
Definition: EntityGUI_Widgets.h:283
Definition: EntityGUI_SketcherDlg.h:67
QString myY2Str
Definition: EntityGUI_SketcherDlg.h:153
Standard_Real myRadius
Definition: EntityGUI_SketcherDlg.h:148
QString myXStr
Definition: EntityGUI_SketcherDlg.h:152
EntityGUI_2Spin * Group2Spin
Definition: EntityGUI_SketcherDlg.h:170
Standard_Real myYc
Definition: EntityGUI_SketcherDlg.h:147
EntityGUI_4Spin1Check * Group4Spin
Definition: EntityGUI_SketcherDlg.h:172
QComboBox * ComboBox1
Definition: EntityGUI_SketcherDlg.h:178
Standard_Real myXc
Definition: EntityGUI_SketcherDlg.h:147
QString myYcStr
Definition: EntityGUI_SketcherDlg.h:154
void Init()
Definition: EntityGUI_SketcherDlg.cxx:444
int myCheckFlag
Definition: EntityGUI_SketcherDlg.h:195
void OnNextPoint()
Definition: EntityGUI_SketcherDlg.cxx:1789
QString myRadiusStr
Definition: EntityGUI_SketcherDlg.h:155
QString myX2Str
Definition: EntityGUI_SketcherDlg.h:153
void ClickOnCancel()
Definition: EntityGUI_SketcherDlg.cxx:1125
TopAbs_ShapeEnum myNeedType
Definition: EntityGUI_SketcherDlg.h:197
SketchState
Definition: EntityGUI_SketcherDlg.h:200
@ NEXT_POINT
Definition: EntityGUI_SketcherDlg.h:200
@ FIRST_POINT
Definition: EntityGUI_SketcherDlg.h:200
virtual void addSubshapesToStudy()
Definition: EntityGUI_SketcherDlg.cxx:2865
void AddLocalCS(GEOM::GEOM_Object_var)
Definition: EntityGUI_SketcherDlg.cxx:2706
void DestClicked(int)
Definition: EntityGUI_SketcherDlg.cxx:656
QString myDYStr
Definition: EntityGUI_SketcherDlg.h:152
void displayPntPreview(const double=0.0, const double=0.0, bool=true, bool=true)
Definition: EntityGUI_SketcherDlg.cxx:2550
int myConstructorId
Definition: EntityGUI_SketcherDlg.h:127
Standard_Real myLastY2
Definition: EntityGUI_SketcherDlg.h:150
bool myIsAllAdded
Definition: EntityGUI_SketcherDlg.h:133
Standard_Real myX1
Definition: EntityGUI_SketcherDlg.h:146
void setEnabledUndo(bool)
Definition: EntityGUI_SketcherDlg.cxx:1328
GEOM::GEOM_Object_var myGlobalCS
Definition: EntityGUI_SketcherDlg.h:191
void CheckBoxClicked(int)
Definition: EntityGUI_SketcherDlg.cxx:1113
EntityGUI_1Sel1Spin1Check * Group1Sel1Spin
Definition: EntityGUI_SketcherDlg.h:168
int mySketchState
Definition: EntityGUI_SketcherDlg.h:131
void LineEditReturnPressed()
Definition: EntityGUI_SketcherDlg.cxx:1583
QString myDXcStr
Definition: EntityGUI_SketcherDlg.h:154
QGroupBox * GroupBox1
Definition: EntityGUI_SketcherDlg.h:177
DlgRef_4Spin * GroupRect
Definition: EntityGUI_SketcherDlg.h:173
int myConstructorPntId
Definition: EntityGUI_SketcherDlg.h:129
bool eventFilter(QObject *object, QEvent *event)
Definition: EntityGUI_SketcherDlg.cxx:404
virtual GEOM::GEOM_IOperations_ptr createOperation()
Definition: EntityGUI_SketcherDlg.cxx:2272
Standard_Real myY
Definition: EntityGUI_SketcherDlg.h:145
double myLineWidth
Definition: EntityGUI_SketcherDlg.h:188
void DeactivateActiveDialog()
Definition: EntityGUI_SketcherDlg.cxx:1613
EntityGUI_1Sel * Group1Sel
Definition: EntityGUI_SketcherDlg.h:166
Standard_Real myX
Definition: EntityGUI_SketcherDlg.h:145
QString myXcStr
Definition: EntityGUI_SketcherDlg.h:154
virtual void displayPreview(GEOM::GEOM_Object_ptr, const bool=false, const bool=false, const bool=true, const double=-1, const int=-1, const int=-1)
Definition: EntityGUI_SketcherDlg.cxx:2490
QList< GEOM::GEOM_Object_var > myWPlaneList
Definition: EntityGUI_SketcherDlg.h:193
int getPnt1ConstructorId() const
Definition: EntityGUI_SketcherDlg.cxx:2817
QString myDXStr
Definition: EntityGUI_SketcherDlg.h:152
QStringList myUndoParameters
Definition: EntityGUI_SketcherDlg.h:143
QStringList myParameters
Definition: EntityGUI_SketcherDlg.h:142
QString myLastY1Str
Definition: EntityGUI_SketcherDlg.h:156
QString GetNewCommand(QString &)
Definition: EntityGUI_SketcherDlg.cxx:2118
EntityGUI_Dir1 * GroupD1
Definition: EntityGUI_SketcherDlg.h:163
gp_Ax3 GetActiveLocalCS()
Definition: EntityGUI_SketcherDlg.cxx:2839
void Dir2Clicked(int)
Definition: EntityGUI_SketcherDlg.cxx:908
QString myY1Str
Definition: EntityGUI_SketcherDlg.h:153
QStringList myCommand
Definition: EntityGUI_SketcherDlg.h:139
int mySketchType
Definition: EntityGUI_SketcherDlg.h:130
void closeEvent(QCloseEvent *)
Definition: EntityGUI_SketcherDlg.cxx:1680
void setEnabledRedo(bool)
Definition: EntityGUI_SketcherDlg.cxx:1343
bool ClickOnApply()
Definition: EntityGUI_SketcherDlg.cxx:1191
Standard_Real myY2
Definition: EntityGUI_SketcherDlg.h:146
void FindLocalCS()
Definition: EntityGUI_SketcherDlg.cxx:2733
gp_Ax3 WPlaneToLCS(GEOM::GEOM_Object_var)
Definition: EntityGUI_SketcherDlg.cxx:2785
void ClickOnUndo()
Definition: EntityGUI_SketcherDlg.cxx:1273
EntityGUI_SketcherDlg(GeometryGUI *, QWidget *=0, bool=false, Qt::WindowFlags=0, const double=-1)
Definition: EntityGUI_SketcherDlg.cxx:82
EntityGUI_Skeleton * MainWidget
Definition: EntityGUI_SketcherDlg.h:159
Standard_Real myLastY1
Definition: EntityGUI_SketcherDlg.h:149
EntityGUI_2Sel1Check * Group2Sel
Definition: EntityGUI_SketcherDlg.h:167
bool myIsApply
Definition: EntityGUI_SketcherDlg.h:134
void ClickOnEnd()
Definition: EntityGUI_SketcherDlg.cxx:1135
void TypeClicked(int)
Definition: EntityGUI_SketcherDlg.cxx:553
EntityGUI_1Spin * Group1Spin
Definition: EntityGUI_SketcherDlg.h:169
bool autoApply
Definition: EntityGUI_SketcherDlg.h:135
SketchType
Definition: EntityGUI_SketcherDlg.h:202
@ DIR_PER_LENGTH
Definition: EntityGUI_SketcherDlg.h:206
@ PT_REL_RADIUS
Definition: EntityGUI_SketcherDlg.h:203
@ DIR_TAN_X
Definition: EntityGUI_SketcherDlg.h:207
@ DIR_ANGLE_X
Definition: EntityGUI_SketcherDlg.h:205
@ PT_RELATIVE
Definition: EntityGUI_SketcherDlg.h:202
@ DIR_ANGLE_LENGTH
Definition: EntityGUI_SketcherDlg.h:205
@ DIR_PER_Y
Definition: EntityGUI_SketcherDlg.h:206
@ DIR_ANGLE_Y
Definition: EntityGUI_SketcherDlg.h:205
@ DIR_DXDY_X
Definition: EntityGUI_SketcherDlg.h:208
@ PT_ABS_CENTER
Definition: EntityGUI_SketcherDlg.h:204
@ PT_REL_CENTER
Definition: EntityGUI_SketcherDlg.h:204
@ DIR_PER_X
Definition: EntityGUI_SketcherDlg.h:206
@ DIR_DXDY_Y
Definition: EntityGUI_SketcherDlg.h:208
@ PT_ABS_RADIUS
Definition: EntityGUI_SketcherDlg.h:203
@ PT_SEL_CENTER
Definition: EntityGUI_SketcherDlg.h:204
@ PT_ABS
Definition: EntityGUI_SketcherDlg.h:202
@ DIR_TAN_LENGTH
Definition: EntityGUI_SketcherDlg.h:207
@ DIR_DXDY_LENGTH
Definition: EntityGUI_SketcherDlg.h:208
@ PT_SEL
Definition: EntityGUI_SketcherDlg.h:202
@ PT_SEL_RADIUS
Definition: EntityGUI_SketcherDlg.h:203
@ DIR_TAN_Y
Definition: EntityGUI_SketcherDlg.h:207
Standard_Real myLength
Definition: EntityGUI_SketcherDlg.h:148
void enterEvent(QEvent *)
Definition: EntityGUI_SketcherDlg.cxx:1669
QString myAngleStr
Definition: EntityGUI_SketcherDlg.h:155
QString myYStr
Definition: EntityGUI_SketcherDlg.h:152
EntityGUI_Point * GroupPt2
Definition: EntityGUI_SketcherDlg.h:162
void ClickOnRedo()
Definition: EntityGUI_SketcherDlg.cxx:1304
bool acceptMouseEvent() const
Definition: EntityGUI_SketcherDlg.cxx:2628
Standard_Real myAngle
Definition: EntityGUI_SketcherDlg.h:148
void initSpinBox(SalomeApp_DoubleSpinBox *, double, double, double=0.1, const char *quantity="length_precision")
Definition: EntityGUI_SketcherDlg.cxx:2657
void ActivateLocalCS()
Definition: EntityGUI_SketcherDlg.cxx:2855
QString myLastX2Str
Definition: EntityGUI_SketcherDlg.h:157
QLineEdit * WPlaneLineEdit
Definition: EntityGUI_SketcherDlg.h:182
GEOM::GEOM_Object_var myWPlane
Definition: EntityGUI_SketcherDlg.h:192
void PointClicked(int)
Definition: EntityGUI_SketcherDlg.cxx:695
Standard_Real myDYc
Definition: EntityGUI_SketcherDlg.h:147
void SetDoubleSpinBoxStep(double)
Definition: EntityGUI_SketcherDlg.cxx:2684
EntityGUI_3Spin1Check * Group3Spin
Definition: EntityGUI_SketcherDlg.h:171
Standard_Real myDX
Definition: EntityGUI_SketcherDlg.h:145
void ClickOnHelp()
Definition: EntityGUI_SketcherDlg.cxx:1249
GeometryGUI * myGeometryGUI
Definition: EntityGUI_SketcherDlg.h:184
void SelectionIntoArgument()
Definition: EntityGUI_SketcherDlg.cxx:1358
QStringList myUndoCommand
Definition: EntityGUI_SketcherDlg.h:140
EntityGUI_Dir2 * GroupD2
Definition: EntityGUI_SketcherDlg.h:164
void InitClick()
Definition: EntityGUI_SketcherDlg.cxx:530
EntityGUI_Point * GroupPt
Definition: EntityGUI_SketcherDlg.h:161
QString myLastY2Str
Definition: EntityGUI_SketcherDlg.h:157
QPushButton * planeButton
Definition: EntityGUI_SketcherDlg.h:179
QString myLastX1Str
Definition: EntityGUI_SketcherDlg.h:156
QString myX1Str
Definition: EntityGUI_SketcherDlg.h:153
void ActivateThisDialog()
Definition: EntityGUI_SketcherDlg.cxx:1628
QString myLengthStr
Definition: EntityGUI_SketcherDlg.h:155
Standard_Real myDY
Definition: EntityGUI_SketcherDlg.h:145
int myConstructorDirId
Definition: EntityGUI_SketcherDlg.h:128
virtual bool isValid(QString &)
Definition: EntityGUI_SketcherDlg.cxx:2281
void OnFirstPoint()
Definition: EntityGUI_SketcherDlg.cxx:1778
int getPnt2ConstructorId() const
Definition: EntityGUI_SketcherDlg.cxx:2828
Standard_Real myLastX2
Definition: EntityGUI_SketcherDlg.h:150
virtual bool execute(ObjectList &)
Definition: EntityGUI_SketcherDlg.cxx:2318
Standard_Real myLastX1
Definition: EntityGUI_SketcherDlg.h:149
bool createShapes(GEOM::GEOM_Object_ptr, TopoDS_Shape &, TopoDS_Shape &)
Definition: EntityGUI_SketcherDlg.cxx:2585
Standard_Real myX2
Definition: EntityGUI_SketcherDlg.h:146
void OnPointSelected(Qt::KeyboardModifiers, const gp_Pnt &, bool isStart=true)
Definition: EntityGUI_SketcherDlg.cxx:1693
QString myHelpFileName
Definition: EntityGUI_SketcherDlg.h:186
void RectClicked()
Definition: EntityGUI_SketcherDlg.cxx:627
QString myDYcStr
Definition: EntityGUI_SketcherDlg.h:154
Standard_Real myDXc
Definition: EntityGUI_SketcherDlg.h:147
QList< gp_Ax3 > myLCSList
Definition: EntityGUI_SketcherDlg.h:190
QPushButton * selButton
Definition: EntityGUI_SketcherDlg.h:180
Standard_Real myY1
Definition: EntityGUI_SketcherDlg.h:146
void keyPressEvent(QKeyEvent *)
Definition: EntityGUI_SketcherDlg.cxx:2641
void Dir1Clicked(int)
Definition: EntityGUI_SketcherDlg.cxx:890
void ValueChangedInSpinBox(double)
Definition: EntityGUI_SketcherDlg.cxx:1800
QLineEdit * myEditCurrentArgument
Definition: EntityGUI_SketcherDlg.h:137
void SetEditCurrentArgument()
Definition: EntityGUI_SketcherDlg.cxx:1541
QLabel * myErrLabel
Definition: EntityGUI_SketcherDlg.h:175
~EntityGUI_SketcherDlg()
Definition: EntityGUI_SketcherDlg.cxx:391
void Point2Clicked(int)
Definition: EntityGUI_SketcherDlg.cxx:714
Definition: GEOMBase_Helper.h:62
Definition: GeometryGUI.h:74