]> SALOME platform Git repositories - modules/geom.git/blob - src/EntityGUI/EntityGUI_3DSketcherDlg.h
Salome HOME
EDF 2281 : small fixes
[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 class SOCC_Prs;
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  
65   // redefined from GEOMBase_Helper
66   virtual GEOM::GEOM_IOperations_ptr createOperation();
67   virtual bool                       isValid( QString& );
68   virtual bool                       execute( ObjectList& );
69
70 private:
71   void                               Init();
72   void                               enterEvent( QEvent* );
73
74   virtual void                       displayPreview( GEOM::GEOM_Object_ptr,
75                                                      const bool = false,
76                                                      const bool = false,
77                                                      const bool = true,
78                                                      const double = -1,
79                                                      const int  = -1,
80                                                      const int  = -1);
81   
82   void                               displayTrihedron( int );
83   
84   void                               displayAngle( double, double, double, int, bool store = false );
85
86   bool                               createShapes( GEOM::GEOM_Object_ptr,
87                                                    TopoDS_Shape&,
88                                                    TopoDS_Shape& );
89
90   XYZ                                getLastPoint() const;
91   XYZ                                getCurrentPoint() const;
92
93 private:
94   XYZList                            myPointsList;
95   XYZList                            myRedoList;
96
97   EntityGUI_3Spin*                   Group3Spin;
98   EntityGUI_Angles*                  GroupAngles;
99   DlgRef_3Radio*                     GroupType;
100   QButtonGroup*                      myTypeGroup;
101
102   int                                myMode;
103   int                                myOrientation;
104   bool                               myOK;
105   double                             myLineWidth;
106   GeometryGUI*                       myGeometryGUI;
107   SOCC_Prs*                          myAnglePrs;
108
109 private slots:
110   void                               ClickOnOk();
111   void                               ClickOnAddPoint();
112   bool                               ClickOnApply();
113   //  bool                               isSameAsPrevious();
114   void                               UpdateButtonsState();
115
116   void                               ClickOnUndo();
117   void                               ClickOnRedo();
118
119   void                               SelectionIntoArgument();
120   void                               DeactivateActiveDialog();
121   void                               ActivateThisDialog();
122   void                               TypeClicked( int );
123   void                               ValueChangedInSpinBox( double );
124   void                               ButtonClicked( bool );
125   void                               AngleChecked ( bool );
126   void                               SetDoubleSpinBoxStep( double );
127 };
128
129 #endif // ENTITYGUI_SKETCHERDLG_H