Salome HOME
PROJECT: POST-PROCESSOR 2005 TASK: T 1.5
[modules/kernel.git] / src / VTKViewer / VTKViewer_InteractorStyleSALOME.h
index ce55fdfc8d98c4fa1a3f0297e6af914927649afe..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"
-#include "SALOME_Selection.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
@@ -55,14 +63,18 @@ 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);
+
+  virtual void SetInteractor(vtkRenderWindowInteractor *theInteractor);
+  void setViewFrame(VTKViewer_ViewFrame* theViewFrame);
+  void setGUIWindow(QWidget* theWindow);
 
   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);
 
-  vtkTypeMacro(VTKViewer_InteractorStyleSALOME, vtkObject);
-  void PrintSelf(ostream& os, vtkIndent indent);
-
   // Generic event bindings must be overridden in subclasses
   void OnMouseMove  (int ctrl, int shift, int x, int y);
   void OnLeftButtonDown(int ctrl, int shift, int x, int y);
@@ -76,10 +88,17 @@ class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyl
 
   void  ViewFitAll();
 
-  void  SetEdgeFilter( const Handle(VTKViewer_Filter)& );
-  void  SetFaceFilter( const Handle(VTKViewer_Filter)& );
-  void  RemoveFaceFilter();
-  void  RemoveEdgeFilter();
+  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();
@@ -104,19 +123,21 @@ class VTKViewer_InteractorStyleSALOME : public QObject, public vtkInteractorStyl
                const int left, const int top, 
                const int right, const int bottom);
 
-  bool isValid( SALOME_Actor* theActor, const int theCellId, const Selection_Mode theSelMode );
-
   int State;
   float MotionFactor;
   float RadianToDegree;                 // constant: for conv from deg to rad
   double myScale;
 
-  SALOME_Actor* preview;
-  vtkActor*     myPActor;
+  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();
@@ -124,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();
@@ -136,7 +155,8 @@ protected:
   void onCursorMove(QPoint mousePos);
   void setCursor(const int operation);
 
-protected:
+
+ protected:
   QCursor                   myDefCursor;
   QCursor                   myPanCursor;
   QCursor                   myZoomCursor;
@@ -150,12 +170,13 @@ protected:
   bool                      myShiftState;
   int                       ForcedState;
   
+  VTKViewer_RenderWindowInteractor* m_Interactor;
+  VTKViewer_ViewFrame*      m_ViewFrame;
   VTKViewer_Trihedron*      m_Trihedron;
-  
+  SALOME_CubeAxesActor2D*   m_CubeAxes;
   QWidget*                  myGUIWindow;
   
-  Handle(VTKViewer_Filter)  myEdgeFilter;
-  Handle(VTKViewer_Filter)  myFaceFilter;
+  std::map<int, Handle(VTKViewer_Filter)> myFilters;
 
   //  members from old version
   double                    DeltaElevation;