]> SALOME platform Git repositories - modules/geom.git/blob - src/EntityGUI/EntityGUI_3DSketcherDlg.h
Salome HOME
EDF 1337: Angles management in the 3D sketcher
[modules/geom.git] / src / EntityGUI / EntityGUI_3DSketcherDlg.h
1 // Copyright (C) 2007-2012  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 EntityGUI_Angles;
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   struct XYZ
51   {
52     XYZ() { x = y = z = 0.0; xt = yt = zt = "0.0"; }
53     double  x,  y,  z;
54     QString xt, yt, zt;
55   };
56   typedef QList<XYZ> XYZList;
57
58 public:
59   EntityGUI_3DSketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2. );
60   ~EntityGUI_3DSketcherDlg();
61
62 protected:
63  
64   // redefined from GEOMBase_Helper
65   virtual GEOM::GEOM_IOperations_ptr createOperation();
66   virtual bool                       isValid( QString& );
67   virtual bool                       execute( ObjectList& );
68
69 private:
70   void                               Init();
71   void                               enterEvent( QEvent* );
72
73   virtual void                       displayPreview( GEOM::GEOM_Object_ptr,
74                                                      const bool = false,
75                                                      const bool = false,
76                                                      const bool = true,
77                                                      const double = -1,
78                                                      const int  = -1,
79                                                      const int  = -1);
80   
81   void                               displayTrihedron( int );
82   
83   void                               displayAngle( double, double, double, int );
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   EntityGUI_Angles*                  GroupAngles;
98   DlgRef_3Radio*                     GroupType;
99   QButtonGroup*                      myTypeGroup;
100
101   int                                myMode;
102   int                                myOrientation;
103   bool                               myOK;
104   double                             myLineWidth;
105   GeometryGUI*                       myGeometryGUI;
106
107 private slots:
108   void                               ClickOnOk();
109   void                               ClickOnAddPoint();
110   bool                               ClickOnApply();
111   //  bool                               isSameAsPrevious();
112   void                               UpdateButtonsState();
113
114   void                               ClickOnUndo();
115   void                               ClickOnRedo();
116
117   void                               SelectionIntoArgument();
118   void                               DeactivateActiveDialog();
119   void                               ActivateThisDialog();
120   void                               TypeClicked( int );
121   void                               ValueChangedInSpinBox( double );
122   void                               ButtonClicked( bool );
123   void                               AngleChecked ( bool );
124   void                               SetDoubleSpinBoxStep( double );
125 };
126
127 #endif // ENTITYGUI_SKETCHERDLG_H