]> SALOME platform Git repositories - modules/gui.git/blob - src/OCCViewer/OCCViewer_ClippingDlg.h
Salome HOME
Porting python light modules to WIN32 platform.
[modules/gui.git] / src / OCCViewer / OCCViewer_ClippingDlg.h
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, 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.
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 #ifndef OCCVIEWER_CLIPPINGDLG_H
24 #define OCCVIEWER_CLIPPINGDLG_H
25
26 #include "OCCViewer.h"
27
28 #include <QDialog>
29
30 #include <AIS_Plane.hxx>
31 #include <V3d_Plane.hxx>
32
33 class QGroupBox;
34 class QLabel;
35 class QPushButton;
36 class QComboBox;
37 class QCheckBox;
38 class QtxDoubleSpinBox;
39 class QtxAction;
40 class QStackedLayout;
41 class QSlider;
42 class QMenu;
43
44 class OCCViewer_ViewWindow;
45
46 enum Mode { Absolute, Relative };
47
48 /*!
49   \class OrientedPlane
50   \brief Parameters of clipping plane in relative mode
51 */
52 class OrientedPlane {
53 public:
54   int Orientation;
55   double Distance;
56   double Rotation1;
57   double Rotation2;
58   OrientedPlane();
59 };
60
61 /*!
62   \class ClipPlane
63   \brief Parameters of clipping plane
64 */
65 class ClipPlane {
66 public:
67   OrientedPlane RelativeMode;
68   double X,Y,Z,Dx,Dy,Dz;
69   int Orientation;
70   bool IsActive;
71   bool IsInvert;
72   Mode PlaneMode;
73   ClipPlane();
74 };
75 typedef ClipPlane* Pnt_ClipPlane;
76 typedef std::vector<Pnt_ClipPlane> ClipPlaneVector;
77
78 /*!
79   \class OCCViewer_ClippingDlg
80   \brief Dialog allowing to assign parameters of clipping plane
81 */
82 class OCCViewer_ClippingDlg : public QDialog
83 {
84     Q_OBJECT
85     
86   public:
87   OCCViewer_ClippingDlg(OCCViewer_ViewWindow* , const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
88   ~OCCViewer_ClippingDlg();
89
90   void SetAction( QtxAction* theAction ) { myAction = theAction; }
91   void synchronize();
92   void SetCurrentPlaneParam();
93     
94   ClipPlaneVector myClippingPlanes;
95   bool isRestore;
96
97 private :
98
99   virtual void closeEvent( QCloseEvent* e );
100   virtual void showEvent ( QShowEvent * );
101   virtual void hideEvent ( QHideEvent * );
102   void initParam();
103   void displayPreview();
104   void erasePreview();
105   bool isValid();
106   void updateView();
107
108   QComboBox* ComboBoxPlanes;
109   QCheckBox* isActivePlane;
110   QPushButton* buttonNew;
111   QMenu* MenuMode;
112   QPushButton* buttonDelete;
113   QPushButton* buttonDisableAll;
114
115   QStackedLayout *ModeStackedLayout;
116
117   QGroupBox* GroupAbsolutePoint;
118   QLabel* TextLabelX;
119   QLabel* TextLabelY;
120   QLabel* TextLabelZ;
121   QtxDoubleSpinBox* SpinBox_X;
122   QtxDoubleSpinBox* SpinBox_Y;
123   QtxDoubleSpinBox* SpinBox_Z;
124   QPushButton* resetButton;
125     
126   QGroupBox* GroupAbsoluteDirection;
127   QLabel* TextLabelDx;
128   QLabel* TextLabelDy;
129   QLabel* TextLabelDz;
130   QtxDoubleSpinBox* SpinBox_Dx;
131   QtxDoubleSpinBox* SpinBox_Dy;
132   QtxDoubleSpinBox* SpinBox_Dz;
133   QPushButton* invertButton;
134   QComboBox* CBAbsoluteOrientation;
135     
136   QGroupBox* GroupRelative;
137   QLabel* TextLabelOrientation;
138   QLabel* TextLabelDistance;
139   QLabel* TextLabelRotation1;
140   QLabel* TextLabelRotation2;
141   QLabel* TLValueDistance;
142   QLabel* TLValueRotation1;
143   QLabel* TLValueRotation2;
144   QSlider* SliderDistance;
145   QSlider* SliderRotation1;
146   QSlider* SliderRotation2;
147   QComboBox* CBRelativeOrientation;
148
149   QCheckBox* PreviewCheckBox;
150   QCheckBox* AutoApplyCheckBox;
151
152   QPushButton* buttonOk;
153   QPushButton* buttonApply;
154   QPushButton* buttonClose;
155     
156   OCCViewer_ViewWindow* myView;
157   Handle(V3d_View) myView3d;
158
159   std::vector<Handle(AIS_Plane)> myPreviewPlaneVector;
160
161   bool myIsSelectPlane;
162   bool myBusy;
163
164   Mode CurrentMode;
165
166   QtxAction* myAction;
167
168 public slots:
169   void onApply();
170     
171 private slots:
172
173   void ClickOnNew();
174   void ClickOnDelete();
175   void ClickOnDisableAll();
176   void ClickOnOk();
177   void ClickOnApply();
178   void ClickOnClose();
179   void ClickOnHelp();
180
181   void onModeAbsolute();
182   void onModeRelative();
183
184   void onValueChanged();
185   void onSelectPlane( int );
186
187   void onReset();
188   void onInvert();
189   void onOrientationAbsoluteChanged( int );
190   void onOrientationRelativeChanged (int);
191
192   void onPreview( bool on );
193   void onAutoApply(bool);
194
195   void onViewShow();
196   void onViewHide();
197
198   void SliderDistanceHasMoved(int);
199   void SliderRotation1HasMoved(int);
200   void SliderRotation2HasMoved(int);
201 };
202
203 #endif // OCCVIEWER_CLIPPINGDLG_H