Salome HOME
initial implementation of automatic rotation in SHAPER's OCC viewer
[modules/gui.git] / src / OCCViewer / OCCViewer_ViewPort3d.h
old mode 100755 (executable)
new mode 100644 (file)
index 9942848..834f061
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 #ifndef OCCVIEWER_VIEWPORT3D_H
 #define OCCVIEWER_VIEWPORT3D_H
 
-#include <Basics_OCCTVersion.hxx>
-
 #include "OCCViewer_ViewPort.h"
 #include "Qtx.h"
 
 #include <V3d_View.hxx>
 #include <V3d_Viewer.hxx>
 
+#include <gp_Ax1.hxx>
+
 class QColor;
 class QString;
 class QRect;
@@ -65,11 +65,6 @@ public:
 //   void         setActive( V3d_TypeOfView );
   virtual bool          syncronize( const OCCViewer_ViewPort3d* );
 
-#if OCC_VERSION_LARGE <= 0x07000000
-  double                getZSize() const;
-  void                  setZSize( double );
-#endif
-
   void                  getAxialScale( double&, double&, double& );
 
   virtual void          onUpdate();
@@ -88,6 +83,12 @@ public:
   virtual void          startRotation( int, int, int, const gp_Pnt& );
   virtual void          rotate( int, int, int, const gp_Pnt& );
   virtual void          endRotation();
+
+  // Set the rotation axis and start automatic rotation
+  void                  setRotationAxis(const gp_Vec& theAxis, double theAngle, double theZAngle);
+  // Stop the automatic rotation
+  void                  stopRotation();
+
   bool                  isBusy() {return myBusy;} // check that View Port is fully initialized
 
   void                  setAdvancedZoomingEnabled( const bool theState ) { myIsAdvancedZoomingEnabled = theState; }
@@ -102,11 +103,13 @@ signals:
   void                  vpChangeBackground( const Qtx::BackgroundData& );
   void                  vpClosed(OCCViewer_ViewPort3d*);
   void                  vpMapped(OCCViewer_ViewPort3d*);
+  void                  vpResizeEvent( QResizeEvent* );
 
 public slots:
   virtual bool          synchronize( OCCViewer_ViewPort* );
 
 private slots:
+  void                  updateRotation();
   void                  repaintViewAfterMove();
 
 protected:
@@ -128,10 +131,6 @@ private:
   
 private:
   Handle(V3d_View)      myActiveView;
-#if OCC_VERSION_LARGE <= 0x06070100
-  Handle(V3d_View)      myOrthoView;
-  Handle(V3d_View)      myPerspView;
-#endif
   bool                  myBusy;
   double                myScale;
   bool                  myIsAdvancedZoomingEnabled;
@@ -139,6 +138,12 @@ private:
   int                   myBgImgHeight;
   int                   myBgImgWidth;
   QCursor*              myCursor;
+  // Fields for automatic rotation
+  gp_Ax1                myRotAxis;    // The rotation axis
+  double                myRotAngle;   // The angular rotation speed
+  bool                  myIsRotating; // Whether rotation animation is active
+  qint64                myLastRender; // Timestamp of last paint event
+  QTimer*               myRotTimer;   // Rotation timer
 };
 
 #ifdef WIN32