Salome HOME
Updated copyright comment
[modules/gui.git] / src / OCCViewer / OCCViewer_ClippingDlg.h
1 // Copyright (C) 2007-2024  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 #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 QtxDoubleSpinSlider;
41 class QtxIntSpinSlider;
42 class QStackedLayout;
43 class QSlider;
44 class QMenu;
45
46 class OCCViewer_Viewer;
47 class OCCViewer_ViewWindow;
48 class OCCViewer_ClipPlaneInteractor;
49
50 /*!
51   \class OCCViewer_ClippingDlg
52   \brief Dialog allowing to assign parameters of clipping plane
53 */
54 class OCCVIEWER_EXPORT OCCViewer_ClippingDlg : public QDialog
55 {
56     Q_OBJECT
57
58   public:
59   OCCViewer_ClippingDlg(OCCViewer_ViewWindow* parrent, OCCViewer_Viewer* model);
60   ~OCCViewer_ClippingDlg();
61
62   void synchronize();
63   void SetCurrentPlaneParam();
64
65 private :
66
67   virtual void closeEvent( QCloseEvent* e );
68   virtual void showEvent ( QShowEvent * );
69   virtual void hideEvent ( QHideEvent * );
70   void initParam();
71   void setPlaneParam( OCCViewer_ClipPlane& thePlane );
72   void displayPreview();
73   void erasePreview();
74   void updatePreview();
75   bool isValid();
76   void updateClipping();
77   void updateControls();
78
79   OCCViewer_ClipPlane& getClipPlane( int );
80   int clipPlanesCount();
81
82   OCCViewer_ClipPlane::PlaneMode currentPlaneMode() const;
83
84 private:
85
86   QComboBox* ComboBoxPlanes;
87   QCheckBox* isActivePlane;
88   QPushButton* buttonNew;
89   QMenu* MenuMode;
90   QPushButton* buttonDelete;
91   QPushButton* buttonDisableAll;
92
93   QStackedLayout *ModeStackedLayout;
94
95   QGroupBox* GroupAbsolutePoint;
96   QLabel* TextLabelX;
97   QLabel* TextLabelY;
98   QLabel* TextLabelZ;
99   QtxDoubleSpinBox* SpinBox_X;
100   QtxDoubleSpinBox* SpinBox_Y;
101   QtxDoubleSpinBox* SpinBox_Z;
102   QPushButton* resetButton;
103
104   QGroupBox* GroupAbsoluteDirection;
105   QLabel* TextLabelDx;
106   QLabel* TextLabelDy;
107   QLabel* TextLabelDz;
108   QtxDoubleSpinBox* SpinBox_Dx;
109   QtxDoubleSpinBox* SpinBox_Dy;
110   QtxDoubleSpinBox* SpinBox_Dz;
111   QPushButton* invertButton;
112   QComboBox* CBAbsoluteOrientation;
113
114   QGroupBox* GroupRelative;
115   QLabel* TextLabelOrientation;
116   QLabel* TextLabelDistance;
117   QLabel* TextLabelRotation1;
118   QLabel* TextLabelRotation2;
119   QtxDoubleSpinSlider* SpinSliderDistance;
120   QtxIntSpinSlider* SpinSliderRotation1;
121   QtxIntSpinSlider* SpinSliderRotation2;
122   QComboBox* CBRelativeOrientation;
123
124   QCheckBox* PreviewCheckBox;
125   QCheckBox* AutoApplyCheckBox;
126
127   QPushButton* buttonOk;
128   QPushButton* buttonApply;
129   QPushButton* buttonClose;
130
131   OCCViewer_Viewer* myModel;
132   Handle(V3d_View) myView3d;
133
134   std::vector<Handle(AIS_Plane)> myPreviewPlaneVector;
135
136   bool myIsSelectPlane;
137   bool myIsUpdatingControls;
138   bool myBusy;
139   bool myIsPlaneCreation;
140
141   ClipPlanesList myLocalPlanes;
142
143   OCCViewer_ClipPlaneInteractor* myInteractor;
144
145 public slots:
146   void onApply();
147
148 private slots:
149
150   void ClickOnNew();
151   void ClickOnDelete();
152   void ClickOnDisableAll();
153   void ClickOnOk();
154   void ClickOnApply();
155   void ClickOnClose();
156   void ClickOnHelp();
157
158   void onModeAbsolute();
159   void onModeRelative();
160
161   void onValueChanged();
162   void onSelectPlane( int );
163
164   void onReset();
165   void onInvert();
166   void onOrientationAbsoluteChanged( int );
167   void onOrientationRelativeChanged( int );
168
169   void onPreview( bool on );
170   void onAutoApply(bool);
171
172   void onPlaneClicked( const Handle_AIS_Plane& thePlane );
173   void onPlaneDragged( const Handle_AIS_Plane& thePlane );
174 };
175
176 #endif // OCCVIEWER_CLIPPINGDLG_H