Salome HOME
A revision of documentation changes in the new version. Very minor corrections.
[modules/gui.git] / src / OCCViewer / OCCViewer_ClippingDlg.h
index 63ee8d84fd8c065c98377fc715eee61ad1429d59..13a293f525b476320b84ab46b1c6cca32d2b62bf 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -24,6 +24,7 @@
 #define OCCVIEWER_CLIPPINGDLG_H
 
 #include "OCCViewer.h"
+#include "OCCViewer_ClipPlane.h"
 
 #include <QDialog>
 
@@ -36,63 +37,30 @@ class QPushButton;
 class QComboBox;
 class QCheckBox;
 class QtxDoubleSpinBox;
-class QtxAction;
+class QtxDoubleSpinSlider;
+class QtxIntSpinSlider;
 class QStackedLayout;
 class QSlider;
 class QMenu;
 
+class OCCViewer_Viewer;
 class OCCViewer_ViewWindow;
-
-enum Mode { Absolute, Relative };
-
-/*!
-  \class OrientedPlane
-  \brief Parameters of clipping plane in relative mode
-*/
-class OrientedPlane {
-public:
-  int Orientation;
-  double Distance;
-  double Rotation1;
-  double Rotation2;
-  OrientedPlane();
-};
-
-/*!
-  \class ClipPlane
-  \brief Parameters of clipping plane
-*/
-class ClipPlane {
-public:
-  OrientedPlane RelativeMode;
-  double X,Y,Z,Dx,Dy,Dz;
-  int Orientation;
-  bool IsActive;
-  bool IsInvert;
-  Mode PlaneMode;
-  ClipPlane();
-};
-typedef ClipPlane* Pnt_ClipPlane;
-typedef std::vector<Pnt_ClipPlane> ClipPlaneVector;
+class OCCViewer_ClipPlaneInteractor;
 
 /*!
   \class OCCViewer_ClippingDlg
   \brief Dialog allowing to assign parameters of clipping plane
 */
-class OCCViewer_ClippingDlg : public QDialog
+class OCCVIEWER_EXPORT OCCViewer_ClippingDlg : public QDialog
 {
     Q_OBJECT
-    
+
   public:
-  OCCViewer_ClippingDlg(OCCViewer_ViewWindow* , const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
+  OCCViewer_ClippingDlg(OCCViewer_ViewWindow* parrent, OCCViewer_Viewer* model);
   ~OCCViewer_ClippingDlg();
 
-  void SetAction( QtxAction* theAction ) { myAction = theAction; }
   void synchronize();
   void SetCurrentPlaneParam();
-    
-  ClipPlaneVector myClippingPlanes;
-  bool isRestore;
 
 private :
 
@@ -100,10 +68,20 @@ private :
   virtual void showEvent ( QShowEvent * );
   virtual void hideEvent ( QHideEvent * );
   void initParam();
+  void setPlaneParam( OCCViewer_ClipPlane& thePlane );
   void displayPreview();
   void erasePreview();
+  void updatePreview();
   bool isValid();
-  void updateView();
+  void updateClipping();
+  void updateControls();
+
+  OCCViewer_ClipPlane& getClipPlane( int );
+  int clipPlanesCount();
+
+  OCCViewer_ClipPlane::PlaneMode currentPlaneMode() const;
+
+private:
 
   QComboBox* ComboBoxPlanes;
   QCheckBox* isActivePlane;
@@ -122,7 +100,7 @@ private :
   QtxDoubleSpinBox* SpinBox_Y;
   QtxDoubleSpinBox* SpinBox_Z;
   QPushButton* resetButton;
-    
+
   QGroupBox* GroupAbsoluteDirection;
   QLabel* TextLabelDx;
   QLabel* TextLabelDy;
@@ -132,18 +110,15 @@ private :
   QtxDoubleSpinBox* SpinBox_Dz;
   QPushButton* invertButton;
   QComboBox* CBAbsoluteOrientation;
-    
+
   QGroupBox* GroupRelative;
   QLabel* TextLabelOrientation;
   QLabel* TextLabelDistance;
   QLabel* TextLabelRotation1;
   QLabel* TextLabelRotation2;
-  QLabel* TLValueDistance;
-  QLabel* TLValueRotation1;
-  QLabel* TLValueRotation2;
-  QSlider* SliderDistance;
-  QSlider* SliderRotation1;
-  QSlider* SliderRotation2;
+  QtxDoubleSpinSlider* SpinSliderDistance;
+  QtxIntSpinSlider* SpinSliderRotation1;
+  QtxIntSpinSlider* SpinSliderRotation2;
   QComboBox* CBRelativeOrientation;
 
   QCheckBox* PreviewCheckBox;
@@ -152,22 +127,24 @@ private :
   QPushButton* buttonOk;
   QPushButton* buttonApply;
   QPushButton* buttonClose;
-    
-  OCCViewer_ViewWindow* myView;
+
+  OCCViewer_Viewer* myModel;
   Handle(V3d_View) myView3d;
 
   std::vector<Handle(AIS_Plane)> myPreviewPlaneVector;
 
   bool myIsSelectPlane;
+  bool myIsUpdatingControls;
   bool myBusy;
+  bool myIsPlaneCreation;
 
-  Mode CurrentMode;
+  ClipPlanesList myLocalPlanes;
 
-  QtxAction* myAction;
+  OCCViewer_ClipPlaneInteractor* myInteractor;
 
 public slots:
   void onApply();
-    
+
 private slots:
 
   void ClickOnNew();
@@ -187,17 +164,13 @@ private slots:
   void onReset();
   void onInvert();
   void onOrientationAbsoluteChanged( int );
-  void onOrientationRelativeChanged (int);
+  void onOrientationRelativeChanged( int );
 
   void onPreview( bool on );
   void onAutoApply(bool);
 
-  void onViewShow();
-  void onViewHide();
-
-  void SliderDistanceHasMoved(int);
-  void SliderRotation1HasMoved(int);
-  void SliderRotation2HasMoved(int);
+  void onPlaneClicked( const Handle_AIS_Plane& thePlane );
+  void onPlaneDragged( const Handle_AIS_Plane& thePlane );
 };
 
 #endif // OCCVIEWER_CLIPPINGDLG_H