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