-// File : VTKViewer_InteractorStyleSALOME.h
-// Created : Wed Mar 20 11:36:07 2002
-// Author : Christophe ATTANASIO
-// Project : SALOME
-// Module : VTKViewer
-// Copyright : Open CASCADE 2002
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// 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
+//
+//
+//
+// File : VTKViewer_InteractorStyleSALOME.h
+// Author : Christophe ATTANASIO
+// Module : SALOME
// $Header$
-
#ifndef __VTKViewer_InteractorStyleSALOME_h
#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
// parent. This class should not normally be instantiated by application
// programmers.
static VTKViewer_InteractorStyleSALOME *New();
+ vtkTypeMacro(VTKViewer_InteractorStyleSALOME, vtkInteractorStyle);
- void setTriedron( vtkActorCollection* triedron );
+ 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);
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();
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 startZoom();
void startPan();
void startSpin();
bool needsRedrawing();
-protected:
+ protected:
void loadCursors();
void startOperation(int operation);
void onStartOperation();
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;
- vtkActorCollection* m_Triedron;
+
+ 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];
};
#endif