Salome HOME
Redesign SALOME documentation: update link to youtube channel
[modules/gui.git] / src / VTKViewer / VTKViewer_InteractorStyle.h
index ed3f08d99fd1ec5bcd8d30b5c0de6b3996f6ece2..810ac3bb7f8acda8ee81e9dec33eae49ec96f74f 100644 (file)
@@ -1,30 +1,30 @@
-//  SALOME VTKViewer : build VTK viewer into Salome desktop
+// Copyright (C) 2007-2016  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
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  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. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
 //  File   : VTKViewer_InteractorStyle.h
 //  Author : Christophe ATTANASIO
 //  Module : SALOME
-
+//
 #ifndef __VTKViewer_InteractorStyle_h
 #define __VTKViewer_InteractorStyle_h
 
 
 class vtkCell;
 class vtkRenderWindowInteractor;
+class vtkTDxInteractorStyle;
 
-#include <qobject.h>
-#include <qcursor.h>
+#include <QObject>
+#include <QCursor>
+
+class QRubberBand;
 
 #include <map>
 
@@ -56,6 +59,10 @@ class VTKViewer_RenderWindowInteractor;
 #define VTK_INTERACTOR_STYLE_CAMERA_SELECT     6
 #define VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN 7
 
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
 /*! Description:\n
  * This class must be supplied with a vtkRenderWindowInteractor wrapper or\n
  * parent. This class should not normally be instantiated by application\n
@@ -73,7 +80,7 @@ class VTKVIEWER_EXPORT VTKViewer_InteractorStyle : public QObject, public vtkInt
 
   void setTriedron(VTKViewer_Trihedron* theTrihedron);
   void setPreselectionProp(const double& theRed = 0, const double& theGreen = 1,
-                          const double& theBlue = 1, const int& theWidth = 5);
+                           const double& theBlue = 1, const int& theWidth = 5);
 
   // Generic event bindings must be overridden in subclasses
   void OnMouseMove  (int ctrl, int shift, int x, int y);
@@ -86,7 +93,8 @@ class VTKVIEWER_EXPORT VTKViewer_InteractorStyle : public QObject, public vtkInt
 
   void OnSelectionModeChanged();
 
-  void  ViewFitAll();
+  void ViewFitAll();
+  void ViewFitSelection();
 
   void                     SetFilter( const Handle( VTKViewer_Filter)& );
   Handle(VTKViewer_Filter) GetFilter( const int );  
@@ -116,18 +124,18 @@ class VTKVIEWER_EXPORT VTKViewer_InteractorStyle : public QObject, public vtkInt
   void Place(const int theX, const int theY);
   void TranslateView(int toX, int toY, int fromX, int fromY);
   bool IsInRect(vtkActor* theActor, 
-               const int left, const int top, 
-               const int right, const int bottom);
+                const int left, const int top, 
+                const int right, const int bottom);
   bool IsInRect(vtkCell* theCell, 
-               const int left, const int top, 
-               const int right, const int bottom);
-  bool IsInRect(float* thePoint, 
-               const int left, const int top, 
-               const int right, const int bottom);
+                const int left, const int top, 
+                const int right, const int bottom);
+  bool IsInRect(double* thePoint, 
+                const int left, const int top, 
+                const int right, const int bottom);
 
   int State;
-  float MotionFactor;
-  float RadianToDegree;                 // constant: for conv from deg to rad
+  double MotionFactor;
+  double RadianToDegree;                 // constant: for conv from deg to rad
   double myScale;
 
   VTKViewer_Actor *myPreViewActor, *myPreSelectionActor, *mySelectedActor;
@@ -144,6 +152,7 @@ class VTKVIEWER_EXPORT VTKViewer_InteractorStyle : public QObject, public vtkInt
   void startRotate();
   void startFitArea();
   void startSpin();
+  void SetTDxStyle(vtkTDxInteractorStyle *tdxStyle) {}
   bool needsRedrawing();
 
  protected:
@@ -155,6 +164,8 @@ class VTKVIEWER_EXPORT VTKViewer_InteractorStyle : public QObject, public vtkInt
   virtual void onCursorMove(QPoint mousePos);
   virtual void setCursor(const int operation);
 
+  void drawRect();
+  void endDrawRect();
 
  protected:
   QCursor                   myDefCursor;
@@ -177,6 +188,8 @@ class VTKVIEWER_EXPORT VTKViewer_InteractorStyle : public QObject, public vtkInt
   
   std::map<int, Handle(VTKViewer_Filter) > myFilters;
 
+  QRubberBand* myRectBand; //!< selection rectangle rubber band
+
   /**  @name members from old version*/
   //@{
   double                    DeltaElevation;
@@ -185,4 +198,8 @@ class VTKVIEWER_EXPORT VTKViewer_InteractorStyle : public QObject, public vtkInt
   //@}
 };
 
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
 #endif