]> SALOME platform Git repositories - modules/visu.git/blob - src/VISUGUI/VisuGUI_ClippingDlg.h
Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[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/ or email : webmaster.salome@opencascade.com
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 SALOME_Actor;
49
50 class QtxDblSpinBox;
51
52 class SVTK_ViewWindow;
53
54 class LightApp_SelectionMgr;
55
56 class VisuGUI;
57
58 class vtkPlaneSource;
59 class vtkDataSetMapper;
60
61 class OrientedPlane;
62
63 namespace VISU {
64   class Prs3d_i;
65
66   typedef vtkSmartPointer<OrientedPlane> TVTKPlane;
67   typedef std::vector<TVTKPlane> TPlanes;
68   enum Orientation {XY, YZ, ZX};
69 };
70
71 //=================================================================================
72 //class    : OrientedPlane
73 //purpose  :
74 //=================================================================================
75 class OrientedPlane: public vtkPlane
76 {
77   SVTK_ViewWindow* myViewWindow;
78   vtkDataSetMapper* myMapper;
79
80 public:
81   static OrientedPlane* New();
82   static OrientedPlane* New (SVTK_ViewWindow* vw);
83
84   vtkTypeMacro(OrientedPlane, vtkPlane);
85
86   VISU::Orientation myOrientation;
87   float myDistance;
88   double myAngle[2];
89
90   vtkPlaneSource* myPlaneSource;
91   SALOME_Actor* myActor;
92
93   void SetOrientation(VISU::Orientation theOrientation);
94   VISU::Orientation GetOrientation();
95
96   void SetDistance(float theDistance);
97   float GetDistance();
98
99   void ShallowCopy(OrientedPlane* theOrientedPlane);
100
101 protected:
102   OrientedPlane();
103   OrientedPlane(SVTK_ViewWindow* vw);
104   ~OrientedPlane();
105
106   void Init();
107
108 private:
109   OrientedPlane(const OrientedPlane&);
110   void operator=(const OrientedPlane&);
111 };
112
113 //=================================================================================
114 // class    : VisuGUI_ClippingDlg
115 // purpose  :
116 //=================================================================================
117 class VisuGUI_ClippingDlg : public QDialog
118 {
119     Q_OBJECT
120
121 public:
122     VisuGUI_ClippingDlg( VisuGUI* theModule,
123                          const char* name = 0,
124                          bool modal = false,
125                          WFlags fl = 0 );
126
127     float  getDistance()  { return (float)SpinBoxDistance->value(); }
128     void   setDistance(const float theDistance) { SpinBoxDistance->setValue(theDistance); }
129     double getRotation1() { return SpinBoxRot1->value(); }
130     double getRotation2() { return SpinBoxRot2->value(); }
131     void   setRotation(const double theRot1, const double theRot2);
132     void Sinchronize();
133
134     ~VisuGUI_ClippingDlg();
135
136 private:
137
138     LightApp_SelectionMgr* mySelectionMgr;
139     Handle(SALOME_InteractiveObject) myIO;
140
141     VisuGUI       * myVisuGUI;
142     VISU::Prs3d_i * myPrs3d;
143     VISU::TPlanes   myPlanes;
144
145     QComboBox*        ComboBoxPlanes;
146     QPushButton*      buttonNew;
147     QPushButton*      buttonDelete;
148
149     QLabel*           TextLabelOrientation;
150     QLabel*           TextLabelDistance;
151     QLabel*           TextLabelRot1;
152     QLabel*           TextLabelRot2;
153
154     QTabWidget*       TabPane;
155
156     QComboBox*        ComboBoxOrientation;
157     QtxDblSpinBox*    SpinBoxDistance;
158     QtxDblSpinBox*    SpinBoxRot1;
159     QtxDblSpinBox*    SpinBoxRot2;
160
161     QWidget*          WidgetIJKTab;
162     QHButtonGroup*    ButtonGroupIJKAxis;
163     QLabel*           TextLabelIJKIndex;
164     QSpinBox*         SpinBoxIJKIndex;
165     QCheckBox*        CheckBoxIJKPlaneReverse;
166
167     QCheckBox*        PreviewCheckBox;
168     QCheckBox*        AutoApplyCheckBox;
169
170     QPushButton*      buttonOk;
171     QPushButton*      buttonCancel;
172     QPushButton*      buttonApply;
173     QPushButton*      buttonHelp;
174
175     bool myIsSelectPlane;
176
177 protected:
178     QWidget* createParamsTab();
179     QWidget* createIJKParamsTab();
180     void setIJKByNonStructured();
181     bool isStructured() const;
182
183 public slots:
184
185     void onSelectPlane(int theIndex);
186     void ClickOnNew();
187     void ClickOnDelete();
188     void onSelectOrientation(int theItem);
189     void SetCurrentPlaneParam();
190     void SetCurrentPlaneIJKParam();
191     void onIJKAxisChanged(int axis);
192     void onTabChanged(QWidget* newTab);
193     void onSelectionChanged();
194     void OnPreviewToggle(bool theIsToggled);
195     void ClickOnOk();
196     void ClickOnCancel();
197     void ClickOnApply();
198     void ClickOnHelp();
199 };
200
201 #endif // DIALOGBOX_TRANSPARENCYDLG_H