1 // Copyright (C) 2007-2013 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 // SMESH SMESHGUI : GUI for SMESH component
24 // File : SMESHGUI_ClippingDlg.h
25 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
27 #ifndef SMESHGUI_CLIPPINGDLG_H
28 #define SMESHGUI_CLIPPINGDLG_H
31 #include "SMESH_SMESHGUI.hxx"
34 #include <SVTK_ViewWindow.h>
42 #include <vtkSmartPointer.h>
54 class QListWidgetItem;
58 class SMESHGUI_SpinBox;
60 class vtkDataSetMapper;
65 enum Orientation { XY, YZ, ZX };
67 class OrientedPlane: public vtkPlane
69 QPointer<SVTK_ViewWindow> myViewWindow;
70 vtkDataSetMapper* myMapper;
73 static OrientedPlane *New();
74 static OrientedPlane *New(SVTK_ViewWindow* theViewWindow);
75 vtkTypeMacro (OrientedPlane, vtkPlane);
77 SMESH::Orientation myOrientation;
81 vtkPlaneSource* myPlaneSource;
82 SALOME_Actor *myActor;
84 void SetOrientation (SMESH::Orientation theOrientation) { myOrientation = theOrientation; }
85 SMESH::Orientation GetOrientation() { return myOrientation; }
87 void SetDistance (float theDistance) { myDistance = theDistance; }
88 float GetDistance() { return myDistance; }
90 void ShallowCopy (OrientedPlane* theOrientedPlane);
93 OrientedPlane(SVTK_ViewWindow* theViewWindow);
101 OrientedPlane (const OrientedPlane&);
102 void operator= (const OrientedPlane&);
105 typedef vtkSmartPointer<OrientedPlane> TPlane;
106 typedef std::list<vtkActor*> TActorList;
110 TPlaneData( TPlane thePlane,
111 TActorList theActorList )
114 ActorList = theActorList;
117 TActorList ActorList;
120 typedef std::vector<TPlane> TPlaneVector;
121 typedef std::vector<TPlaneData> TPlaneDataVector;
124 //=================================================================================
125 // class : SMESHGUI_ClippingDlg
127 //=================================================================================
128 class SMESHGUI_EXPORT SMESHGUI_ClippingDlg : public QDialog
133 SMESHGUI_ClippingDlg( SMESHGUI*, SVTK_ViewWindow* );
134 ~SMESHGUI_ClippingDlg();
136 double getDistance() const;
137 void setDistance( const double );
138 double getRotation1() const;
139 double getRotation2() const;
140 void setRotation( const double, const double );
142 // used in SMESHGUI::restoreVisualParameters() to avoid
143 // declaration of OrientedPlane outside of SMESHGUI_ClippingDlg.cxx
144 static SMESH::OrientedPlane* AddPlane (SMESH::TActorList theActorList,
145 SVTK_ViewWindow* theViewWindow,
146 SMESH::Orientation theOrientation,
148 const vtkFloatingPointType theAngle[2]);
151 void keyPressEvent( QKeyEvent* );
154 void initializePlaneData();
158 void updateActorList();
159 SMESH::TActorList getCurrentActors();
161 void updateActorItem( QListWidgetItem* theItem,
162 bool theUpdateSelectAll,
163 bool theUpdateClippingPlaneMap );
165 void dumpPlaneData() const;
168 SMESHGUI* mySMESHGUI;
169 SVTK_ViewWindow* myViewWindow;
170 SMESH::TPlaneDataVector myPlanes;
172 QComboBox* ComboBoxPlanes;
173 QPushButton* buttonNew;
174 QPushButton* buttonDelete;
175 QListWidget* ActorList;
176 QCheckBox* SelectAllCheckBox;
177 QLabel* TextLabelOrientation;
178 QComboBox* ComboBoxOrientation;
179 QLabel* TextLabelDistance;
180 SMESHGUI_SpinBox* SpinBoxDistance;
181 QLabel* TextLabelRot1;
182 SMESHGUI_SpinBox* SpinBoxRot1;
183 QLabel* TextLabelRot2;
184 SMESHGUI_SpinBox* SpinBoxRot2;
185 QCheckBox* PreviewCheckBox;
186 QCheckBox* AutoApplyCheckBox;
187 QPushButton* buttonOk;
188 QPushButton* buttonCancel;
189 QPushButton* buttonApply;
190 QPushButton* buttonHelp;
192 bool myIsSelectPlane;
193 QString myHelpFileName;
196 virtual void reject();
199 void onSelectPlane( int );
201 void ClickOnDelete();
202 void onActorItemChanged( QListWidgetItem* );
203 void onSelectAll( int );
204 void onSelectOrientation( int );
205 void SetCurrentPlaneParam();
206 void OnPreviewToggle( bool );
207 void onAutoApply(bool);
213 #endif // SMESHGUI_CLIPPINGDLG_H