Salome HOME
PROJECT: POST-PROCESSOR 2005 TASK: T 1.5
[modules/kernel.git] / src / VTKViewer / VTKViewer_InteractorStyleSALOME.h
index 62438e91e2d4fd16f0af7bdcf0c7c42a57601aeb..2bb36fb4d2537e751592a194728c3321f4c001a5 100644 (file)
 #define __VTKViewer_InteractorStyleSALOME_h
 
 #include <vtkInteractorStyle.h>
+
+class vtkCell;
+class vtkRenderWindowInteractor;
+
 #include <qobject.h>
 #include <qcursor.h>
-#include "SALOME_Actor.h"
 
+#include "VTKViewer_Filter.h"
+
+class SALOME_Actor;
+class SALOME_CubeAxesActor2D;
+class VTKViewer_Actor;
 class VTKViewer_Trihedron;
+class VTKViewer_ViewFrame;
+class VTKViewer_RenderWindowInteractor;
 
 #define VTK_INTERACTOR_STYLE_CAMERA_NONE    0
 #define VTK_INTERACTOR_STYLE_CAMERA_ROTATE  1
@@ -53,11 +63,17 @@ class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyl
   // parent. This class should not normally be instantiated by application
   // programmers.
   static VTKViewer_InteractorStyleSALOME *New();
+  vtkTypeMacro(VTKViewer_InteractorStyleSALOME, vtkInteractorStyle);
 
-  void setTriedron(VTKViewer_Trihedron* theTrihedron);
+  virtual void SetInteractor(vtkRenderWindowInteractor *theInteractor);
+  void setViewFrame(VTKViewer_ViewFrame* theViewFrame);
+  void setGUIWindow(QWidget* theWindow);
 
-  vtkTypeMacro(VTKViewer_InteractorStyleSALOME, vtkObject);
-  void PrintSelf(ostream& os, vtkIndent indent);
+  void setTriedron(VTKViewer_Trihedron* theTrihedron);
+  void setCubeAxes(SALOME_CubeAxesActor2D* theCubeAxes);
+  
+  void setPreselectionProp(const double& theRed = 0, const double& theGreen = 1,
+                          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);
@@ -68,8 +84,22 @@ class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyl
   void OnRightButtonDown(int ctrl, int shift, int x, int y);
   void OnRightButtonUp  (int ctrl, int shift, int x, int y);
 
+  void OnSelectionModeChanged();
+
   void  ViewFitAll();
 
+  void                     SetFilter( const Handle(VTKViewer_Filter)& );
+  Handle(VTKViewer_Filter) GetFilter( const int );  
+  bool                     IsFilterPresent( const int );
+  void                     RemoveFilter( const int );
+  bool                     IsValid( SALOME_Actor* theActor,
+                                    const int     theId,
+                                    const bool    theIsNode = false );
+  
+  void                     IncrementalPan   ( const int incrX, const int incrY );
+  void                     IncrementalZoom  ( const int incr );
+  void                     IncrementalRotate( const int incrX, const int incrY );
+
  protected:
   VTKViewer_InteractorStyleSALOME();
   ~VTKViewer_InteractorStyleSALOME();
@@ -98,11 +128,16 @@ class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyl
   float RadianToDegree;                 // constant: for conv from deg to rad
   double myScale;
 
-  SALOME_Actor* preview;
+  SALOME_Actor* myPreViewActor;
+
+  VTKViewer_Actor* myPreSelectionActor;
+  SALOME_Actor* mySelectedActor;
+  int myElemId;
+  int myEdgeId;
+  int myNodeId;
 
-public:
+ public:
   bool eventFilter(QObject* object, QEvent* event);
-  void ControlLblSize(double aOldScale, double aNewScale);
   void startZoom();
   void startPan();
   void startGlobalPan();
@@ -110,10 +145,8 @@ public:
   void startFitArea();
   void startSpin();
   bool needsRedrawing();
-  QWidget* getGUIWindow() {return myGUIWindow;}
-  void setGUIWindow(QWidget* theWin) { myGUIWindow = theWin;}
 
-protected:
+ protected:
   void loadCursors();
   void startOperation(int operation);
   void onStartOperation();
@@ -122,27 +155,33 @@ protected:
   void onCursorMove(QPoint mousePos);
   void setCursor(const int operation);
 
-protected:
-  QCursor      myDefCursor;
-  QCursor      myPanCursor;
-  QCursor      myZoomCursor;
-  QCursor      myRotateCursor;
-  QCursor      mySpinCursor;
-  QCursor      myHandCursor;
-  QCursor      myGlobalPanCursor;
-  QPoint       myPoint;
-  QPoint       myOtherPoint;
-  bool         myCursorState;
-  bool         myShiftState;
-  int ForcedState;
-  VTKViewer_Trihedron* m_Trihedron;  
-
-  QWidget*     myGUIWindow;
+
+ protected:
+  QCursor                   myDefCursor;
+  QCursor                   myPanCursor;
+  QCursor                   myZoomCursor;
+  QCursor                   myRotateCursor;
+  QCursor                   mySpinCursor;
+  QCursor                   myHandCursor;
+  QCursor                   myGlobalPanCursor;
+  QPoint                    myPoint;
+  QPoint                    myOtherPoint;
+  bool                      myCursorState;
+  bool                      myShiftState;
+  int                       ForcedState;
+  
+  VTKViewer_RenderWindowInteractor* m_Interactor;
+  VTKViewer_ViewFrame*      m_ViewFrame;
+  VTKViewer_Trihedron*      m_Trihedron;
+  SALOME_CubeAxesActor2D*   m_CubeAxes;
+  QWidget*                  myGUIWindow;
+  
+  std::map<int, Handle(VTKViewer_Filter)> myFilters;
 
   //  members from old version
-  double DeltaElevation;
-  double DeltaAzimuth;
-  int LastPos[2];
+  double                    DeltaElevation;
+  double                    DeltaAzimuth;
+  int                       LastPos[2];
 };
 
 #endif