Salome HOME
2bda30ac14989fc594d9ccc743d8655d13d64735
[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 QButtonGroup;
32 class QDoubleSpinBox;
33 class EntityGUI_3Spin;
34 class DlgRef_3Radio;
35
36 #ifndef COORD_MIN
37 #  define COORD_MIN -1e+15
38 #  define COORD_MAX +1e+15
39 #  define MAX_NUMBER 100000
40 #  define DBL_DIGITS_DISPLAY 16
41 #endif // COORD_MIN
42
43 //=================================================================================
44 // class    : EntityGUI_Dlg
45 // purpose  :
46 //=================================================================================
47 class EntityGUI_3DSketcherDlg : public GEOMBase_Skeleton
48
49   Q_OBJECT
50
51   struct XYZ
52   {
53     XYZ() { x = y = z = 0.0; xt = yt = zt = "0.0"; }
54     double  x,  y,  z;
55     QString xt, yt, zt;
56   };
57   typedef QList<XYZ> XYZList;
58
59 public:
60   EntityGUI_3DSketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2. );
61   ~EntityGUI_3DSketcherDlg();
62
63 protected:
64   void                               initSpinBox( QDoubleSpinBox*, 
65                                                   double, double, double = 0.1, 
66                                                   int = 3 );
67
68   // redefined from GEOMBase_Helper
69   virtual GEOM::GEOM_IOperations_ptr createOperation();
70   virtual bool                       isValid( QString& );
71   virtual bool                       execute( ObjectList& );
72
73 private:
74   void                               Init();
75   void                               enterEvent( QEvent* );
76
77   virtual void                       displayPreview( GEOM::GEOM_Object_ptr,
78                                                      const bool = false,
79                                                      const bool = false,
80                                                      const bool = true,
81                                                      const double = -1,
82                                                      const int  = -1,
83                                                      const int  = -1);
84
85   bool                               createShapes( GEOM::GEOM_Object_ptr,
86                                                    TopoDS_Shape&,
87                                                    TopoDS_Shape& );
88
89   XYZ                                getLastPoint() const;
90   XYZ                                getCurrentPoint() const;
91
92 private:
93   XYZList                            myPointsList;
94   XYZList                            myRedoList;
95
96   EntityGUI_3Spin*                   Group3Spin;
97   DlgRef_3Radio*                     GroupType;
98   QButtonGroup*                      myTypeGroup;
99
100   int                                myMode;
101   bool                               myOK;
102   double                             myLineWidth;
103   GeometryGUI*                       myGeometryGUI;
104
105 private slots:
106   void                               ClickOnOk();
107   void                               ClickOnAddPoint();
108   bool                               ClickOnApply();
109   //  bool                               isSameAsPrevious();
110   void                               UpdateButtonsState();
111
112   void                               ClickOnUndo();
113   void                               ClickOnRedo();
114
115   void                               SelectionIntoArgument();
116   void                               DeactivateActiveDialog();
117   void                               ActivateThisDialog();
118   void                               TypeClicked( int );
119   void                               ValueChangedInSpinBox( double );
120   void                               SetDoubleSpinBoxStep( double );
121 };
122
123 #endif // ENTITYGUI_SKETCHERDLG_H