1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef VTKVIEWER_VIEWWINDOW_H
23 #define VTKVIEWER_VIEWWINDOW_H
25 #include "VTKViewer.h"
27 #include "SUIT_ViewWindow.h"
29 #include "QtxAction.h"
33 class VTKViewer_Viewer;
34 class VTKViewer_Trihedron;
35 class VTKViewer_Transform;
36 class VTKViewer_RenderWindow;
37 class VTKViewer_InteractorStyle;
38 class VTKViewer_RenderWindowInteractor;
39 class VTKViewer_Actor;
42 #pragma warning( disable:4251 )
45 class VTKVIEWER_EXPORT VTKViewer_ViewWindow : public SUIT_ViewWindow
50 VTKViewer_ViewWindow( SUIT_Desktop*, VTKViewer_Viewer*,
51 VTKViewer_InteractorStyle* = 0,
52 VTKViewer_RenderWindowInteractor* = 0 );
53 virtual ~VTKViewer_ViewWindow();
56 QToolBar* getToolBar() { return myToolBar; }
58 void setBackgroundColor( const QColor& );
59 QColor backgroundColor() const;
62 vtkRenderer* getRenderer() { return myRenderer; }
63 /*!Gets render window.*/
64 VTKViewer_RenderWindow* getRenderWindow() { return myRenderWindow; }
65 /*!Gets render window interactor.*/
66 VTKViewer_RenderWindowInteractor* getRWInteractor() { return myRWInteractor; }
67 bool isTrihedronDisplayed();
69 void Repaint( bool theUpdateTrihedron = true );
70 void onAdjustTrihedron();
71 void GetScale( double theScale[3] );
72 void SetScale( double theScale[3] );
73 void AddActor( VTKViewer_Actor*, bool update = false );
74 void RemoveActor( VTKViewer_Actor*, bool update = false);
76 virtual QString getVisualParameters();
77 virtual void setVisualParameters( const QString& parameters );
89 void activateWindowFit();
90 void activateRotation();
91 void activatePanning();
92 void activateGlobalPanning();
93 void onTrihedronShow();
99 void onKeyPressed(QKeyEvent* event);
100 void onKeyReleased(QKeyEvent* event);
101 void onMousePressed(QMouseEvent* event);
102 void onMouseDoubleClicked(QMouseEvent* event);
103 void onMouseReleased(QMouseEvent* event);
104 void onMouseMoving(QMouseEvent* event);
107 void InsertActor( VTKViewer_Actor* theActor,
108 bool theMoveInternalActors = false );
109 void MoveActor( VTKViewer_Actor* theActor );
112 enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
113 FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, TrihedronShowId };
114 typedef QMap<int, QtxAction*> ActionsMap;
116 void createActions();
117 void createToolBar();
119 VTKViewer_Viewer* myModel;
121 vtkRenderer* myRenderer;
122 VTKViewer_RenderWindow* myRenderWindow;
123 VTKViewer_RenderWindowInteractor* myRWInteractor;
125 VTKViewer_Trihedron* myTrihedron;
126 VTKViewer_Transform* myTransform;
129 ActionsMap myActionsMap;
133 friend class VTKViewer_RenderWindowInteractor;
137 #pragma warning( default:4251 )