Version: 9.16.0
SMESHGUI_ClippingDlg.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
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, or (at your option) any later version.
10//
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.
15//
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
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23// SMESH SMESHGUI : GUI for SMESH component
24// File : SMESHGUI_ClippingDlg.h
25// Author : Nicolas REJNERI, Open CASCADE S.A.S.
26//
27#ifndef SMESHGUI_CLIPPINGDLG_H
28#define SMESHGUI_CLIPPINGDLG_H
29
30// SMESH includes
31#include "SMESH_SMESHGUI.hxx"
32
33// SALOME includes
34#include <SVTK_ViewWindow.h>
35
36// Qt includes
37#include <QDialog>
38#include <QPointer>
39
40// VTK includes
41#include <vtkPlane.h>
42#include <vtkSmartPointer.h>
43
44// STL includes
45#include <list>
46#include <map>
47#include <vector>
48
49class QGroupBox;
50class QLabel;
51class QPushButton;
52class QCheckBox;
53class QComboBox;
54class QListWidget;
55class QListWidgetItem;
56class QStackedLayout;
57class QSlider;
58class QMenu;
59class SALOME_Actor;
60class SMESHGUI;
61class SMESH_Actor;
62class QtxDoubleSpinBox;
63class QtxDoubleSpinSlider;
64class QtxIntSpinSlider;
65class vtkActor;
66class vtkDataSetMapper;
67class vtkPlaneSource;
68class vtkCallbackCommand;
69class vtkObject;
70class vtkImplicitPlaneWidget;
71
72namespace SMESH
73{
75 enum Orientation { XY, YZ, ZX };
76
77 class OrientedPlane: public vtkPlane
78 {
79 vtkDataSetMapper* myMapper;
80
81 public:
82 static OrientedPlane *New();
83 static OrientedPlane *New(SVTK_ViewWindow* theViewWindow);
85
86 QPointer<SVTK_ViewWindow> myViewWindow;
89 double myAngle[2];
90 double X, Y, Z, Dx, Dy, Dz;
95
96 vtkPlaneSource* myPlaneSource;
98
99 void SetOrientation (SMESH::Orientation theOrientation) { myRelativeOrientation = theOrientation; }
101
102 void SetDistance (float theDistance) { myDistance = theDistance; }
103 float GetDistance() { return myDistance; }
104
105 void ShallowCopy (OrientedPlane* theOrientedPlane);
107
108 protected:
109 OrientedPlane(SVTK_ViewWindow* theViewWindow);
111
112 void Init();
113
115 private:
116 // Not implemented.
119 };
120
122 typedef std::list<vtkActor*> TActorList;
123
125 {
127 TActorList theActorList )
128 {
129 Plane = thePlane;
130 ActorList = theActorList;
131 }
134 };
135
136 typedef std::vector<TPlane> TPlaneVector;
137 typedef std::vector<TPlaneData> TPlaneDataVector;
138}
139
140//=================================================================================
141// class : SMESHGUI_ClippingDlg
142// purpose :
143//=================================================================================
145{
146 Q_OBJECT
147
148public:
149 SMESHGUI_ClippingDlg( SMESHGUI*, SVTK_ViewWindow* );
151
152 static bool AddPlane ( SMESH::TActorList theActorList,
153 SMESH::OrientedPlane* thePlane );
154protected:
155 void keyPressEvent( QKeyEvent* );
156 static void ProcessEvents( vtkObject* theObject,
157 unsigned long theEvent,
158 void* theClientData,
159 void* theCallData);
160private:
161 double getDistance() const;
162 void setDistance( const double );
163 double getRotation1() const;
164 double getRotation2() const;
165 void setRotation( const double, const double );
166
167 void setOrigin(double theVal[3]);
168 void setDirection(double theVal[3]);
169
170 void initializePlaneData();
171 void initParam();
172 void synchronize();
173 void updateActorList();
174 void updateActorItem( QListWidgetItem* theItem,
175 bool theUpdateSelectAll,
176 bool theUpdateClippingPlaneMap );
177 SMESH::TActorList getCurrentActors();
178
179 void dumpPlaneData() const;
180 void absolutePlaneToRelative ( double theOrigin[3], double theDir[3] );
181 void setBoundsForPreviewWidget();
182 vtkImplicitPlaneWidget* createPreviewWidget();
183
184
185private:
187 SVTK_ViewWindow* myViewWindow;
189
190 vtkCallbackCommand* myCallback;
191 vtkImplicitPlaneWidget* myPreviewWidget;
192 double myBounds[6];
193
196 QPushButton* buttonNew;
197 QMenu* MenuMode;
198 QPushButton* buttonDelete;
199
200 QListWidget* ActorList;
202
203 QStackedLayout* ModeStackedLayout;
204
209 QtxDoubleSpinBox* SpinBox_X;
210 QtxDoubleSpinBox* SpinBox_Y;
211 QtxDoubleSpinBox* SpinBox_Z;
212 QPushButton* resetButton;
213
218 QtxDoubleSpinBox* SpinBox_Dx;
219 QtxDoubleSpinBox* SpinBox_Dy;
220 QtxDoubleSpinBox* SpinBox_Dz;
221 QPushButton* invertButton;
223
229 QtxDoubleSpinSlider* SpinSliderDistance;
230 QtxIntSpinSlider* SpinSliderRotation1;
231 QtxIntSpinSlider* SpinSliderRotation2;
233
234 QCheckBox* PreviewCheckBox;
236
237 QPushButton* buttonOk;
238 QPushButton* buttonCancel;
239 QPushButton* buttonApply;
240 QPushButton* buttonHelp;
241
245
247
248protected slots:
249 virtual void reject();
250
251public slots:
252 void onModeAbsolute();
253 void onModeRelative();
254 void ClickOnNew();
255 void ClickOnDelete();
256 void onSelectPlane( int );
257 void onSelectAll( int );
258 void onActorItemChanged( QListWidgetItem* );
259 void SetCurrentPlaneParam();
260
261 void onIsOpenGLClipping(bool);
262 void OnPreviewToggle( bool );
263 void onAutoApply(bool);
264 void ClickOnOk();
265 void ClickOnApply();
266 void ClickOnHelp();
267
268 void onSelectAbsoluteOrientation( int );
269 void onSelectRelativeOrientation( int );
270 void onReset();
271 void onInvert();
272};
273
274#endif // SMESHGUI_CLIPPINGDLG_H
#define SMESHGUI_EXPORT
Definition: SMESH_SMESHGUI.hxx:36
Definition: SMESHGUI_ClippingDlg.h:145
QPushButton * buttonApply
Definition: SMESHGUI_ClippingDlg.h:239
QPushButton * buttonCancel
Definition: SMESHGUI_ClippingDlg.h:238
QCheckBox * SelectAllCheckBox
Definition: SMESHGUI_ClippingDlg.h:201
QCheckBox * AutoApplyCheckBox
Definition: SMESHGUI_ClippingDlg.h:235
QtxIntSpinSlider * SpinSliderRotation2
Definition: SMESHGUI_ClippingDlg.h:231
QLabel * TextLabelZ
Definition: SMESHGUI_ClippingDlg.h:208
QLabel * TextLabelOrientation
Definition: SMESHGUI_ClippingDlg.h:225
QtxDoubleSpinBox * SpinBox_Y
Definition: SMESHGUI_ClippingDlg.h:210
QComboBox * ComboBoxPlanes
Definition: SMESHGUI_ClippingDlg.h:194
SMESHGUI * mySMESHGUI
Definition: SMESHGUI_ClippingDlg.h:186
SVTK_ViewWindow * myViewWindow
Definition: SMESHGUI_ClippingDlg.h:187
QtxDoubleSpinBox * SpinBox_Dz
Definition: SMESHGUI_ClippingDlg.h:220
QGroupBox * GroupAbsolutePoint
Definition: SMESHGUI_ClippingDlg.h:205
SMESH::TPlaneDataVector myPlanes
Definition: SMESHGUI_ClippingDlg.h:188
vtkCallbackCommand * myCallback
Definition: SMESHGUI_ClippingDlg.h:190
QPushButton * buttonNew
Definition: SMESHGUI_ClippingDlg.h:196
vtkImplicitPlaneWidget * myPreviewWidget
Definition: SMESHGUI_ClippingDlg.h:191
QStackedLayout * ModeStackedLayout
Definition: SMESHGUI_ClippingDlg.h:203
QLabel * TextLabelX
Definition: SMESHGUI_ClippingDlg.h:206
bool myIsPreviewMoved
Definition: SMESHGUI_ClippingDlg.h:243
QtxDoubleSpinBox * SpinBox_Dx
Definition: SMESHGUI_ClippingDlg.h:218
QtxIntSpinSlider * SpinSliderRotation1
Definition: SMESHGUI_ClippingDlg.h:230
bool myIsSelectPlane
Definition: SMESHGUI_ClippingDlg.h:242
QLabel * TextLabelRotation2
Definition: SMESHGUI_ClippingDlg.h:228
QtxDoubleSpinBox * SpinBox_X
Definition: SMESHGUI_ClippingDlg.h:209
QLabel * TextLabelDx
Definition: SMESHGUI_ClippingDlg.h:215
QPushButton * invertButton
Definition: SMESHGUI_ClippingDlg.h:221
QtxDoubleSpinBox * SpinBox_Z
Definition: SMESHGUI_ClippingDlg.h:211
QString myHelpFileName
Definition: SMESHGUI_ClippingDlg.h:244
QLabel * TextLabelDz
Definition: SMESHGUI_ClippingDlg.h:217
QPushButton * resetButton
Definition: SMESHGUI_ClippingDlg.h:212
QCheckBox * isOpenGLClipping
Definition: SMESHGUI_ClippingDlg.h:195
SMESH::Mode CurrentMode
Definition: SMESHGUI_ClippingDlg.h:246
QGroupBox * GroupRelative
Definition: SMESHGUI_ClippingDlg.h:224
QComboBox * CBRelativeOrientation
Definition: SMESHGUI_ClippingDlg.h:232
QtxDoubleSpinSlider * SpinSliderDistance
Definition: SMESHGUI_ClippingDlg.h:229
QLabel * TextLabelY
Definition: SMESHGUI_ClippingDlg.h:207
QPushButton * buttonDelete
Definition: SMESHGUI_ClippingDlg.h:198
QLabel * TextLabelDistance
Definition: SMESHGUI_ClippingDlg.h:226
QPushButton * buttonOk
Definition: SMESHGUI_ClippingDlg.h:237
QPushButton * buttonHelp
Definition: SMESHGUI_ClippingDlg.h:240
QMenu * MenuMode
Definition: SMESHGUI_ClippingDlg.h:197
QGroupBox * GroupAbsoluteDirection
Definition: SMESHGUI_ClippingDlg.h:214
QListWidget * ActorList
Definition: SMESHGUI_ClippingDlg.h:200
QtxDoubleSpinBox * SpinBox_Dy
Definition: SMESHGUI_ClippingDlg.h:219
QComboBox * CBAbsoluteOrientation
Definition: SMESHGUI_ClippingDlg.h:222
QCheckBox * PreviewCheckBox
Definition: SMESHGUI_ClippingDlg.h:234
QLabel * TextLabelDy
Definition: SMESHGUI_ClippingDlg.h:216
QLabel * TextLabelRotation1
Definition: SMESHGUI_ClippingDlg.h:227
Definition: SMESHGUI.h:84
Definition: SMESHGUI_ClippingDlg.h:78
double Z
Definition: SMESHGUI_ClippingDlg.h:90
bool IsOpenGLClipping
Definition: SMESHGUI_ClippingDlg.h:93
~OrientedPlane()
Destructor of class OrientedPlane.
Definition: SMESHGUI_ClippingDlg.cxx:220
float myDistance
Definition: SMESHGUI_ClippingDlg.h:88
SMESH::Orientation myRelativeOrientation
Definition: SMESHGUI_ClippingDlg.h:87
vtkDataSetMapper * myMapper
Definition: SMESHGUI_ClippingDlg.h:79
int myAbsoluteOrientation
Definition: SMESHGUI_ClippingDlg.h:91
double myAngle[2]
Definition: SMESHGUI_ClippingDlg.h:89
OrientedPlane * InvertPlane()
Invert current clipping plane in contrary direction.
Definition: SMESHGUI_ClippingDlg.cxx:141
bool IsInvert
Definition: SMESHGUI_ClippingDlg.h:92
SALOME_Actor * myActor
Definition: SMESHGUI_ClippingDlg.h:97
OrientedPlane()
Constructor of class OrientedPlane.
Definition: SMESHGUI_ClippingDlg.cxx:165
void SetOrientation(SMESH::Orientation theOrientation)
Definition: SMESHGUI_ClippingDlg.h:99
double Dz
Definition: SMESHGUI_ClippingDlg.h:90
void operator=(const OrientedPlane &)
static OrientedPlane * New()
Create new object of class OrientedPlane.
Definition: SMESHGUI_ClippingDlg.cxx:92
void Init()
Initialize parameters of class OrientedPlane.
Definition: SMESHGUI_ClippingDlg.cxx:174
vtkTypeMacro(OrientedPlane, vtkPlane) QPointer< SVTK_ViewWindow > myViewWindow
void ShallowCopy(OrientedPlane *theOrientedPlane)
Copy the object of class OrientedPlane.
Definition: SMESHGUI_ClippingDlg.cxx:108
OrientedPlane(const OrientedPlane &)
SMESH::Orientation GetOrientation()
Definition: SMESHGUI_ClippingDlg.h:100
double Y
Definition: SMESHGUI_ClippingDlg.h:90
void SetDistance(float theDistance)
Definition: SMESHGUI_ClippingDlg.h:102
double X
Definition: SMESHGUI_ClippingDlg.h:90
Mode PlaneMode
Definition: SMESHGUI_ClippingDlg.h:94
float GetDistance()
Definition: SMESHGUI_ClippingDlg.h:103
double Dy
Definition: SMESHGUI_ClippingDlg.h:90
double Dx
Definition: SMESHGUI_ClippingDlg.h:90
vtkPlaneSource * myPlaneSource
Definition: SMESHGUI_ClippingDlg.h:96
Definition: SMESH_Actor.h:56
Definition: SMESH_ControlsClassifier.cxx:39
std::list< vtkActor * > TActorList
Definition: SMESHGUI_ClippingDlg.h:122
Mode
Definition: SMESHGUI_ClippingDlg.h:74
@ Relative
Definition: SMESHGUI_ClippingDlg.h:74
@ Absolute
Definition: SMESHGUI_ClippingDlg.h:74
Orientation
Definition: SMESHGUI_ClippingDlg.h:75
@ YZ
Definition: SMESHGUI_ClippingDlg.h:75
@ XY
Definition: SMESHGUI_ClippingDlg.h:75
@ ZX
Definition: SMESHGUI_ClippingDlg.h:75
vtkSmartPointer< OrientedPlane > TPlane
Definition: SMESHGUI_ClippingDlg.h:121
std::vector< TPlaneData > TPlaneDataVector
Definition: SMESHGUI_ClippingDlg.h:137
std::vector< TPlane > TPlaneVector
Definition: SMESHGUI_ClippingDlg.h:136
Definition: SMESHGUI_ClippingDlg.h:125
TActorList ActorList
Definition: SMESHGUI_ClippingDlg.h:133
TPlane Plane
Definition: SMESHGUI_ClippingDlg.h:132
TPlaneData(TPlane thePlane, TActorList theActorList)
Definition: SMESHGUI_ClippingDlg.h:126