1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef VTKVIEWER_VIEWWINDOW_H
20 #define VTKVIEWER_VIEWWINDOW_H
22 #include "VTKViewer.h"
24 #include "SUIT_ViewWindow.h"
26 #include "QtxAction.h"
30 class VTKViewer_Viewer;
31 class VTKViewer_Trihedron;
32 class VTKViewer_Transform;
33 class VTKViewer_RenderWindow;
34 class VTKViewer_InteractorStyle;
35 class VTKViewer_RenderWindowInteractor;
36 class VTKViewer_Actor;
39 #pragma warning( disable:4251 )
42 class VTKVIEWER_EXPORT VTKViewer_ViewWindow : public SUIT_ViewWindow
47 VTKViewer_ViewWindow( SUIT_Desktop*, VTKViewer_Viewer*,
48 VTKViewer_InteractorStyle* = 0,
49 VTKViewer_RenderWindowInteractor* = 0 );
50 virtual ~VTKViewer_ViewWindow();
53 QToolBar* getToolBar() { return myToolBar; }
55 void setBackgroundColor( const QColor& );
56 QColor backgroundColor() const;
59 vtkRenderer* getRenderer() { return myRenderer; }
60 /*!Gets render window.*/
61 VTKViewer_RenderWindow* getRenderWindow() { return myRenderWindow; }
62 /*!Gets render window interactor.*/
63 VTKViewer_RenderWindowInteractor* getRWInteractor() { return myRWInteractor; }
64 bool isTrihedronDisplayed();
66 void Repaint( bool theUpdateTrihedron = true );
67 void onAdjustTrihedron();
68 void GetScale( double theScale[3] );
69 void SetScale( double theScale[3] );
70 void AddActor( VTKViewer_Actor*, bool update = false );
71 void RemoveActor( VTKViewer_Actor*, bool update = false);
73 virtual QString getVisualParameters();
74 virtual void setVisualParameters( const QString& parameters );
86 void activateWindowFit();
87 void activateRotation();
88 void activatePanning();
89 void activateGlobalPanning();
90 void onTrihedronShow();
96 void onKeyPressed(QKeyEvent* event);
97 void onKeyReleased(QKeyEvent* event);
98 void onMousePressed(QMouseEvent* event);
99 void onMouseDoubleClicked(QMouseEvent* event);
100 void onMouseReleased(QMouseEvent* event);
101 void onMouseMoving(QMouseEvent* event);
104 void InsertActor( VTKViewer_Actor* theActor,
105 bool theMoveInternalActors = false );
106 void MoveActor( VTKViewer_Actor* theActor );
109 enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
110 FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, TrihedronShowId };
111 typedef QMap<int, QtxAction*> ActionsMap;
113 void createActions();
114 void createToolBar();
116 VTKViewer_Viewer* myModel;
118 vtkRenderer* myRenderer;
119 VTKViewer_RenderWindow* myRenderWindow;
120 VTKViewer_RenderWindowInteractor* myRWInteractor;
122 VTKViewer_Trihedron* myTrihedron;
123 VTKViewer_Transform* myTransform;
126 ActionsMap myActionsMap;
130 friend class VTKViewer_RenderWindowInteractor;
134 #pragma warning( default:4251 )