Salome HOME
Merge from V5_1_4_BR 07/05/2010
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ClippingDlg.h
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File   : SMESHGUI_ClippingDlg.h
25 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
26 //
27 #ifndef SMESHGUI_CLIPPINGDLG_H
28 #define SMESHGUI_CLIPPINGDLG_H
29
30 // SMESH includes
31 #include "SMESH_SMESHGUI.hxx"
32
33 // SALOME includes
34 #include <SVTK_ViewWindow.h>
35
36 // Qt includes
37 #include <QDialog>
38
39 // VTK includes
40 #include <vtkSmartPointer.h>
41
42 // STL includes
43 #include <vector>
44
45 class QLabel;
46 class QPushButton;
47 class QCheckBox;
48 class QComboBox;
49 class LightApp_SelectionMgr;
50 class SVTK_Selector;
51 class SMESHGUI;
52 class SMESH_Actor;
53 class OrientedPlane;
54 class SMESHGUI_SpinBox;
55
56 namespace SMESH
57 {
58   typedef vtkSmartPointer<OrientedPlane> TVTKPlane;
59   typedef std::vector<TVTKPlane> TPlanes;
60   enum Orientation { XY, YZ, ZX };
61 };
62
63
64 //=================================================================================
65 // class    : SMESHGUI_ClippingDlg
66 // purpose  :
67 //=================================================================================
68 class SMESHGUI_EXPORT SMESHGUI_ClippingDlg : public QDialog
69 {
70   Q_OBJECT
71
72 public:
73   SMESHGUI_ClippingDlg( SMESHGUI* );
74   ~SMESHGUI_ClippingDlg();
75   
76   double                  getDistance() const;
77   void                    setDistance( const double );
78   double                  getRotation1() const;
79   double                  getRotation2() const;
80   void                    setRotation( const double, const double );
81   void                    Sinchronize();
82
83   // used in SMESHGUI::restoreVisualParameters() to avoid
84   // declaration of OrientedPlane outside of SMESHGUI_ClippingDlg.cxx
85   static void             AddPlane (SMESH_Actor*         theActor,
86                                     SVTK_ViewWindow*     theViewWindow,
87                                     SMESH::Orientation   theOrientation,
88                                     double               theDistance,
89                                     vtkFloatingPointType theAngle[2]);
90
91   static void             GetPlaneParam (SMESH_Actor*          theActor,
92                                          int                   thePlaneIndex,
93                                          SMESH::Orientation&   theOrientation,
94                                          double&               theDistance,
95                                          vtkFloatingPointType* theAngle);
96
97 protected:  
98   void                    keyPressEvent( QKeyEvent* );
99
100 private:
101   LightApp_SelectionMgr*  mySelectionMgr;
102   SVTK_Selector*          mySelector;
103   SMESHGUI*               mySMESHGUI;
104   SMESH_Actor*            myActor;
105   SMESH::TPlanes          myPlanes;
106   
107   QComboBox*              ComboBoxPlanes;
108   QPushButton*            buttonNew;
109   QPushButton*            buttonDelete;
110   QLabel*                 TextLabelOrientation;
111   QComboBox*              ComboBoxOrientation;
112   QLabel*                 TextLabelDistance;
113   SMESHGUI_SpinBox*       SpinBoxDistance;
114   QLabel*                 TextLabelRot1;
115   SMESHGUI_SpinBox*       SpinBoxRot1;
116   QLabel*                 TextLabelRot2;
117   SMESHGUI_SpinBox*       SpinBoxRot2;
118   QCheckBox*              PreviewCheckBox;
119   QCheckBox*              AutoApplyCheckBox;
120   QPushButton*            buttonOk;
121   QPushButton*            buttonCancel;
122   QPushButton*            buttonApply;
123   QPushButton*            buttonHelp;
124   
125   bool                    myIsSelectPlane;
126   QString                 myHelpFileName;
127
128 public slots:
129   void                    onSelectPlane( int );
130   void                    ClickOnNew();
131   void                    ClickOnDelete();
132   void                    onSelectOrientation( int );
133   void                    SetCurrentPlaneParam();
134   void                    onSelectionChanged();
135   void                    OnPreviewToggle( bool );
136   void                    ClickOnOk();
137   void                    ClickOnCancel();
138   void                    ClickOnApply();
139   void                    ClickOnHelp();
140 };
141
142 #endif // SMESHGUI_CLIPPINGDLG_H