Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
EntityGUI_SketcherDlg.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, 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