Salome HOME
Fix for Bug IPAL8945
[modules/visu.git] / src / VISUGUI / VisuGUI_ClippingDlg.h
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/
19 //
20
21 #ifndef DIALOGBOX_CLIPPING_H
22 #define DIALOGBOX_CLIPPING_H
23
24 #include "SALOME_InteractiveObject.hxx"
25
26 #include "QtxDblSpinBox.h"
27
28 // QT Includes
29 #include <qdialog.h>
30 #include <qtable.h>
31
32 // VTK Includes
33 #include <vtkSmartPointer.h>
34 #include <vtkPlane.h>
35
36 // STL Includes
37 #include <vector>
38
39 class QLabel;
40 class QPushButton;
41 class QTable;
42 class QCheckBox;
43 class QComboBox;
44 class QHButtonGroup;
45 class QSpinBox;
46 class QTabWidget;
47
48 class QtxDblSpinBox;
49
50 class LightApp_SelectionMgr;
51
52 class VisuGUI;
53
54 class OrientedPlane;
55
56 namespace VISU {
57   class Prs3d_i;
58
59   typedef vtkSmartPointer<OrientedPlane> TVTKPlane;
60   typedef std::vector<TVTKPlane> TPlanes;
61   enum Orientation {XY, YZ, ZX};
62 };
63
64
65 //=================================================================================
66 // class    : VisuGUI_ClippingDlg
67 // purpose  :
68 //=================================================================================
69 class VisuGUI_ClippingDlg : public QDialog
70 {
71     Q_OBJECT
72
73 public:
74     VisuGUI_ClippingDlg( VisuGUI* theModule,
75                          const char* name = 0,
76                          bool modal = false,
77                          WFlags fl = 0 );
78
79     float  getDistance()  { return (float)SpinBoxDistance->value(); }
80     void   setDistance(const float theDistance) { SpinBoxDistance->setValue(theDistance); }
81     double getRotation1() { return SpinBoxRot1->value(); }
82     double getRotation2() { return SpinBoxRot2->value(); }
83     void   setRotation(const double theRot1, const double theRot2);
84     void Sinchronize();
85
86     ~VisuGUI_ClippingDlg();
87
88 private:
89
90     LightApp_SelectionMgr* mySelectionMgr;
91     Handle(SALOME_InteractiveObject) myIO;
92
93     VisuGUI       * myVisuGUI;
94     VISU::Prs3d_i * myPrs3d;
95     VISU::TPlanes   myPlanes;
96
97     QComboBox*        ComboBoxPlanes;
98     QPushButton*      buttonNew;
99     QPushButton*      buttonDelete;
100
101     QLabel*           TextLabelOrientation;
102     QLabel*           TextLabelDistance;
103     QLabel*           TextLabelRot1;
104     QLabel*           TextLabelRot2;
105
106     QTabWidget*       TabPane;
107
108     QComboBox*        ComboBoxOrientation;
109     QtxDblSpinBox*    SpinBoxDistance;
110     QtxDblSpinBox*    SpinBoxRot1;
111     QtxDblSpinBox*    SpinBoxRot2;
112
113     QWidget*          WidgetIJKTab;
114     QHButtonGroup*    ButtonGroupIJKAxis;
115     QLabel*           TextLabelIJKIndex;
116     QSpinBox*         SpinBoxIJKIndex;
117     QCheckBox*        CheckBoxIJKPlaneReverse;
118
119     QCheckBox*        PreviewCheckBox;
120     QCheckBox*        AutoApplyCheckBox;
121
122     QPushButton*      buttonOk;
123     QPushButton*      buttonCancel;
124     QPushButton*      buttonApply;
125
126     bool myIsSelectPlane;
127
128 protected:
129     QWidget* createParamsTab();
130     QWidget* createIJKParamsTab();
131     void setIJKByNonStructured();
132     bool isStructured() const;
133
134 public slots:
135
136     void onSelectPlane(int theIndex);
137     void ClickOnNew();
138     void ClickOnDelete();
139     void onSelectOrientation(int theItem);
140     void SetCurrentPlaneParam();
141     void SetCurrentPlaneIJKParam();
142     void onIJKAxisChanged(int axis);
143     void onTabChanged(QWidget* newTab);
144     void onSelectionChanged();
145     void OnPreviewToggle(bool theIsToggled);
146     void ClickOnOk();
147     void ClickOnCancel();
148     void ClickOnApply();
149 };
150
151 #endif // DIALOGBOX_TRANSPARENCYDLG_H