1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef DIALOGBOX_CLIPPING_H
24 #define DIALOGBOX_CLIPPING_H
26 #include "SALOME_InteractiveObject.hxx"
28 #include "SalomeApp_DoubleSpinBox.h"
35 #include <vtkSmartPointer.h>
52 class SVTK_ViewWindow;
54 class LightApp_SelectionMgr;
56 class SalomeApp_IntSpinBox;
60 class vtkDataSetMapper;
68 typedef vtkSmartPointer<OrientedPlane> TVTKPlane;
69 typedef std::vector<TVTKPlane> TPlanes;
70 enum Orientation {XY, YZ, ZX};
73 //=================================================================================
74 //class : OrientedPlane
76 //=================================================================================
77 class OrientedPlane: public vtkPlane
79 QPointer<SVTK_ViewWindow> myViewWindow;
80 vtkDataSetMapper* myMapper;
83 static OrientedPlane* New();
84 static OrientedPlane* New (SVTK_ViewWindow* vw);
86 vtkTypeMacro(OrientedPlane, vtkPlane);
88 VISU::Orientation myOrientation;
92 vtkPlaneSource* myPlaneSource;
93 SALOME_Actor* myActor;
95 void SetOrientation(VISU::Orientation theOrientation);
96 VISU::Orientation GetOrientation();
98 void SetDistance(float theDistance);
101 void ShallowCopy(OrientedPlane* theOrientedPlane);
105 OrientedPlane(SVTK_ViewWindow* vw);
111 OrientedPlane(const OrientedPlane&);
112 void operator=(const OrientedPlane&);
115 //=================================================================================
116 // class : VisuGUI_ClippingDlg
118 //=================================================================================
119 class VisuGUI_ClippingDlg : public QDialog
124 VisuGUI_ClippingDlg( VisuGUI* theModule,
125 bool modal = false );
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);
134 ~VisuGUI_ClippingDlg();
137 void keyPressEvent( QKeyEvent* e );
139 void SetPrs3d(VISU::Prs3d_i* thePrs);
141 VISU_Actor* getSelectedActor();
143 void applyLocalPlanes();
145 void removeAllClippingPlanes(VISU::Prs3d_i* thePrs);
149 LightApp_SelectionMgr* mySelectionMgr;
150 Handle(SALOME_InteractiveObject) myIO;
153 VISU::Prs3d_i * myPrs3d;
154 VISU::TPlanes myPlanes;
156 QComboBox* ComboBoxPlanes;
157 QPushButton* buttonNew;
158 QPushButton* buttonDelete;
160 QLabel* TextLabelOrientation;
161 QLabel* TextLabelDistance;
162 QLabel* TextLabelRot1;
163 QLabel* TextLabelRot2;
167 QComboBox* ComboBoxOrientation;
168 SalomeApp_DoubleSpinBox* SpinBoxDistance;
169 SalomeApp_DoubleSpinBox* SpinBoxRot1;
170 SalomeApp_DoubleSpinBox* SpinBoxRot2;
172 QWidget* WidgetIJKTab;
173 QButtonGroup* ButtonGroupIJKAxis;
174 QGroupBox* GroupBoxIJKAxis;
175 QLabel* TextLabelIJKIndex;
176 SalomeApp_IntSpinBox* SpinBoxIJKIndex;
177 QCheckBox* CheckBoxIJKPlaneReverse;
179 QCheckBox* PreviewCheckBox;
180 QCheckBox* AutoApplyCheckBox;
182 QPushButton* buttonOk;
183 QPushButton* buttonCancel;
184 QPushButton* buttonApply;
185 QPushButton* buttonHelp;
187 bool myIsSelectPlane;
189 VISU_Actor* myDSActor;
190 QList<PreviewPlane*> myPreviewList;
193 QWidget* createParamsTab();
194 QWidget* createIJKParamsTab();
195 void setIJKByNonStructured();
196 bool isStructured() const;
200 void onSelectPlane(int theIndex);
202 void ClickOnDelete();
203 void onSelectOrientation(int theItem);
204 void SetCurrentPlaneParam();
205 void SetCurrentPlaneIJKParam();
206 void onIJKAxisChanged(int axis);
207 void onTabChanged(QWidget* newTab);
208 void onSelectionChanged();
209 void OnPreviewToggle(bool theIsToggled);
211 void ClickOnCancel();
216 #endif // DIALOGBOX_TRANSPARENCYDLG_H