1 #ifndef SVTK_VIEWWINDOW_H
2 #define SVTK_VIEWWINDOW_H
5 #pragma warning( disable:4251 )
9 #include "SUIT_ViewWindow.h"
11 #include "SVTK_Selection.h"
12 #include "SALOME_InteractiveObject.hxx"
19 class VTKViewer_Trihedron;
20 class VTKViewer_Transform;
27 class SVTK_RenderWindow;
28 class SVTK_InteractorStyle;
29 class SVTK_RenderWindowInteractor;
31 class SVTK_EXPORT SVTK_ViewWindow : public SUIT_ViewWindow
36 SVTK_ViewWindow( SUIT_Desktop*, SVTK_Viewer* );
37 virtual ~SVTK_ViewWindow();
39 QToolBar* getToolBar() { return myToolBar; }
41 void setBackgroundColor( const QColor& );
42 QColor backgroundColor() const;
44 vtkRenderer* getRenderer() {return myRenderer;}
45 SVTK_Selector* GetSelector() {return mySelector;}
46 SVTK_RenderWindow* getRenderWindow() {return myRenderWindow;}
47 SVTK_RenderWindowInteractor* getRWInteractor() {return myRWInteractor;}
48 Selection_Mode SelectionMode() const;
49 void SetSelectionMode(Selection_Mode theMode);
51 bool isTrihedronDisplayed();
53 /* interactive object management */
54 void highlight( const Handle(SALOME_InteractiveObject)& IObject,
55 bool highlight, bool immediatly = true );
56 void unHighlightAll();
57 bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
58 bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
61 Handle(SALOME_InteractiveObject) FindIObject(const char* Entry);
64 void Display( const Handle(SALOME_InteractiveObject)& IObject,
65 bool immediatly = true );
66 void DisplayOnly( const Handle(SALOME_InteractiveObject)& IObject );
67 void Erase( const Handle(SALOME_InteractiveObject)& IObject,
68 bool immediatly = true );
71 void Repaint( bool theUpdateTrihedron );
72 void Repaint() { Repaint(true); }
74 //apply existing transformation on adding SALOME_Actor
75 void SetScale( double theScale[3] );
76 void GetScale( double theScale[3] );
77 void AddActor( SALOME_Actor*, bool update = false );
78 void RemoveActor(SALOME_Actor*, bool update = false);
80 void AdjustTrihedrons( const bool forced );
81 bool ComputeTrihedronSize( double& theNewSize,
84 int GetTrihedronSize() const;
85 void SetTrihedronSize( const int );
88 void onSelectionChanged();
91 void selectionChanged();
104 void onViewTrihedron();
105 void onAdjustTrihedron();
114 void onRotateRight();
119 void activateWindowFit();
120 void activateRotation();
121 void activatePanning();
122 void activateGlobalPanning();
128 void onKeyPressed(QKeyEvent* event);
129 void onKeyReleased(QKeyEvent* event);
130 void onMousePressed(QMouseEvent* event);
131 void onMouseDoubleClicked(QMouseEvent* event);
132 void onMouseReleased(QMouseEvent* event);
133 void onMouseMoving(QMouseEvent* event);
137 void InsertActor( SALOME_Actor* theActor,
138 bool theMoveInternalActors = false );
139 void MoveActor( SALOME_Actor* theActor );
142 enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
143 FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, ViewTrihedronId };
144 typedef QMap<int, QtxAction*> ActionsMap;
146 void createActions();
147 void createToolBar();
149 vtkRenderer* myRenderer;
151 SVTK_Viewer* myModel;
152 SVTK_Selector* mySelector;
154 SVTK_RenderWindow* myRenderWindow;
155 SVTK_RenderWindowInteractor* myRWInteractor;
157 VTKViewer_Transform* myTransform;
158 VTKViewer_Trihedron* myTrihedron;
162 ActionsMap myActionsMap;
166 friend class SVTK_RenderWindowInteractor;
170 #pragma warning( default:4251 )