Salome HOME
Implementation of the issue 0020151 (SALOME: Light Python module):
[modules/geom.git] / src / EntityGUI / EntityGUI_3DSketcherDlg.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 // File   : EntityGUI_3DSketcherDlg.h
23 // Author : DMV, OCN
24 //
25
26 #ifndef ENTITYGUI_3DSKETCHERDLG_H
27 #define ENTITYGUI_3DSKETCHERDLG_H
28
29 #include <GEOMBase_Skeleton.h>
30
31 class QDoubleSpinBox;
32 class EntityGUI_3Spin;
33 class DlgRef_3Radio;
34
35 #ifndef COORD_MIN
36 #  define COORD_MIN -1e+15
37 #  define COORD_MAX +1e+15
38 #  define MAX_NUMBER 100000
39 #  define DBL_DIGITS_DISPLAY 16
40 #endif // COORD_MIN
41
42 //=================================================================================
43 // class    : EntityGUI_Dlg
44 // purpose  :
45 //=================================================================================
46 class EntityGUI_3DSketcherDlg : public GEOMBase_Skeleton
47
48   Q_OBJECT
49
50 public:
51   EntityGUI_3DSketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2. );
52   ~EntityGUI_3DSketcherDlg();
53
54 protected:
55   void                               initSpinBox( QDoubleSpinBox*, 
56                                                   double, double, double = 0.1, 
57                                                   int = 3 );
58
59   // redefined from GEOMBase_Helper
60   virtual GEOM::GEOM_IOperations_ptr createOperation();
61   virtual bool                       isValid( QString& );
62   virtual bool                       execute( ObjectList& );
63
64 private:
65   void                               Init();
66   void                               enterEvent( QEvent* );
67
68   virtual void                       displayPreview( GEOM::GEOM_Object_ptr,
69                                                      const bool = false,
70                                                      const bool = false,
71                                                      const bool = true,
72                                                      const double = -1,
73                                                      const int  = -1,
74                                                      const int  = -1);
75
76   bool                               createShapes( GEOM::GEOM_Object_ptr,
77                                                    TopoDS_Shape&,
78                                                    TopoDS_Shape& );
79
80 private:
81   QList<double>                      myPointsList;
82   QList<double>                      myRedoList;
83
84   EntityGUI_3Spin*                   Group3Spin;
85   DlgRef_3Radio*                     GroupType;
86
87   bool                               myOK;
88   double                             myLineWidth;
89   GeometryGUI*                       myGeometryGUI;
90
91 private slots:
92   void                               ClickOnOk();
93   void                               ClickOnAddPoint();
94   bool                               ClickOnApply();
95   //  bool                               isSameAsPrevious();
96   void                               UpdateButtonsState();
97   void                               GetLastPoints(double&, double&, double&);
98   void                               GetCurrentPoints(double&, double&, double&);
99
100   void                               ClickOnUndo();
101   void                               ClickOnRedo();
102
103   void                               SelectionIntoArgument();
104   void                               DeactivateActiveDialog();
105   void                               ActivateThisDialog();
106   void                               TypeClicked();
107   void                               ValueChangedInSpinBox( double );
108   void                               SetDoubleSpinBoxStep( double );
109 };
110
111 #endif // ENTITYGUI_SKETCHERDLG_H