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