Salome HOME
Remove "MAC" ends of lines
[modules/geom.git] / src / EntityGUI / EntityGUI_3DSketcherDlg.h
1 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // GEOM GEOMGUI : GUI for Geometry component
21 // File   : EntityGUI_3DSketcherDlg.h
22 // Author : DMV, OCN
23 //
24 #ifndef ENTITYGUI_3DSKETCHERDLG_H
25 #define ENTITYGUI_3DSKETCHERDLG_H
26
27 #include <GEOMBase_Skeleton.h>
28
29 class QButtonGroup;
30 class QDoubleSpinBox;
31 class EntityGUI_3Spin;
32 class DlgRef_3Radio;
33
34 #ifndef COORD_MIN
35 #  define COORD_MIN -1e+15
36 #  define COORD_MAX +1e+15
37 #  define MAX_NUMBER 100000
38 #  define DBL_DIGITS_DISPLAY 16
39 #endif // COORD_MIN
40
41 //=================================================================================
42 // class    : EntityGUI_Dlg
43 // purpose  :
44 //=================================================================================
45 class EntityGUI_3DSketcherDlg : public GEOMBase_Skeleton
46
47   Q_OBJECT
48
49   struct XYZ
50   {
51     XYZ() { x = y = z = 0.0; xt = yt = zt = "0.0"; }
52     double  x,  y,  z;
53     QString xt, yt, zt;
54   };
55   typedef QList<XYZ> XYZList;
56
57 public:
58   EntityGUI_3DSketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2. );
59   ~EntityGUI_3DSketcherDlg();
60
61 protected:
62  
63   // redefined from GEOMBase_Helper
64   virtual GEOM::GEOM_IOperations_ptr createOperation();
65   virtual bool                       isValid( QString& );
66   virtual bool                       execute( ObjectList& );
67
68 private:
69   void                               Init();
70   void                               enterEvent( QEvent* );
71
72   virtual void                       displayPreview( GEOM::GEOM_Object_ptr,
73                                                      const bool = false,
74                                                      const bool = false,
75                                                      const bool = true,
76                                                      const double = -1,
77                                                      const int  = -1,
78                                                      const int  = -1);
79
80   bool                               createShapes( GEOM::GEOM_Object_ptr,
81                                                    TopoDS_Shape&,
82                                                    TopoDS_Shape& );
83
84   XYZ                                getLastPoint() const;
85   XYZ                                getCurrentPoint() const;
86
87 private:
88   XYZList                            myPointsList;
89   XYZList                            myRedoList;
90
91   EntityGUI_3Spin*                   Group3Spin;
92   DlgRef_3Radio*                     GroupType;
93   QButtonGroup*                      myTypeGroup;
94
95   int                                myMode;
96   bool                               myOK;
97   double                             myLineWidth;
98   GeometryGUI*                       myGeometryGUI;
99
100 private slots:
101   void                               ClickOnOk();
102   void                               ClickOnAddPoint();
103   bool                               ClickOnApply();
104   //  bool                               isSameAsPrevious();
105   void                               UpdateButtonsState();
106
107   void                               ClickOnUndo();
108   void                               ClickOnRedo();
109
110   void                               SelectionIntoArgument();
111   void                               DeactivateActiveDialog();
112   void                               ActivateThisDialog();
113   void                               TypeClicked( int );
114   void                               ValueChangedInSpinBox( double );
115   void                               SetDoubleSpinBoxStep( double );
116 };
117
118 #endif // ENTITYGUI_SKETCHERDLG_H