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