Salome HOME
Python container is obsolete
[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 #include "OCCViewer_ClipPlane.h"
28
29 #include <QDialog>
30
31 #include <AIS_Plane.hxx>
32 #include <V3d_Plane.hxx>
33
34 class QGroupBox;
35 class QLabel;
36 class QPushButton;
37 class QComboBox;
38 class QCheckBox;
39 class QtxDoubleSpinBox;
40 class QStackedLayout;
41 class QSlider;
42 class QMenu;
43
44 class OCCViewer_Viewer;
45 class OCCViewer_ViewWindow;
46
47 /*!
48   \class OCCViewer_ClippingDlg
49   \brief Dialog allowing to assign parameters of clipping plane
50 */
51 class OCCVIEWER_EXPORT OCCViewer_ClippingDlg : public QDialog
52 {
53     Q_OBJECT
54
55   public:
56   OCCViewer_ClippingDlg(OCCViewer_ViewWindow* parrent, OCCViewer_Viewer* model);
57   ~OCCViewer_ClippingDlg();
58
59   void synchronize();
60   void SetCurrentPlaneParam();
61
62 private :
63
64   virtual void closeEvent( QCloseEvent* e );
65   virtual void showEvent ( QShowEvent * );
66   virtual void hideEvent ( QHideEvent * );
67   void initParam();
68   void displayPreview();
69   void erasePreview();
70   void updatePreview();
71   bool isValid();
72   void updateClipping();
73
74   OCCViewer_ClipPlane& getClipPlane (int theIndex);
75   int clipPlanesCount();
76
77   QComboBox* ComboBoxPlanes;
78   QCheckBox* isActivePlane;
79   QPushButton* buttonNew;
80   QMenu* MenuMode;
81   QPushButton* buttonDelete;
82   QPushButton* buttonDisableAll;
83
84   QStackedLayout *ModeStackedLayout;
85
86   QGroupBox* GroupAbsolutePoint;
87   QLabel* TextLabelX;
88   QLabel* TextLabelY;
89   QLabel* TextLabelZ;
90   QtxDoubleSpinBox* SpinBox_X;
91   QtxDoubleSpinBox* SpinBox_Y;
92   QtxDoubleSpinBox* SpinBox_Z;
93   QPushButton* resetButton;
94
95   QGroupBox* GroupAbsoluteDirection;
96   QLabel* TextLabelDx;
97   QLabel* TextLabelDy;
98   QLabel* TextLabelDz;
99   QtxDoubleSpinBox* SpinBox_Dx;
100   QtxDoubleSpinBox* SpinBox_Dy;
101   QtxDoubleSpinBox* SpinBox_Dz;
102   QPushButton* invertButton;
103   QComboBox* CBAbsoluteOrientation;
104
105   QGroupBox* GroupRelative;
106   QLabel* TextLabelOrientation;
107   QLabel* TextLabelDistance;
108   QLabel* TextLabelRotation1;
109   QLabel* TextLabelRotation2;
110   QLabel* TLValueDistance;
111   QLabel* TLValueRotation1;
112   QLabel* TLValueRotation2;
113   QSlider* SliderDistance;
114   QSlider* SliderRotation1;
115   QSlider* SliderRotation2;
116   QComboBox* CBRelativeOrientation;
117
118   QCheckBox* PreviewCheckBox;
119   QCheckBox* AutoApplyCheckBox;
120
121   QPushButton* buttonOk;
122   QPushButton* buttonApply;
123   QPushButton* buttonClose;
124
125   OCCViewer_Viewer* myModel;
126   Handle(V3d_View) myView3d;
127
128   Standard_Integer myCurrentClipPlaneMode;
129   std::vector<Handle(AIS_Plane)> myPreviewPlaneVector;
130
131   bool myIsSelectPlane;
132   bool myBusy;
133   bool myIsPlaneCreation;
134
135   ClipPlanesList myLocalPlanes;
136     
137 public slots:
138   void onApply();
139
140 private slots:
141
142   void ClickOnNew();
143   void ClickOnDelete();
144   void ClickOnDisableAll();
145   void ClickOnOk();
146   void ClickOnApply();
147   void ClickOnClose();
148   void ClickOnHelp();
149
150   void onModeAbsolute();
151   void onModeRelative();
152
153   void onValueChanged();
154   void onSelectPlane( int );
155
156   void onReset();
157   void onInvert();
158   void onOrientationAbsoluteChanged( int );
159   void onOrientationRelativeChanged (int);
160
161   void onPreview( bool on );
162   void onAutoApply(bool);
163
164   void SliderDistanceHasMoved(int);
165   void SliderRotation1HasMoved(int);
166   void SliderRotation2HasMoved(int);
167 };
168
169 #endif // OCCVIEWER_CLIPPINGDLG_H