1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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
23 #ifndef VTKVIEWER_VIEWWINDOW_H
24 #define VTKVIEWER_VIEWWINDOW_H
26 #include "VTKViewer.h"
28 #include "SUIT_ViewWindow.h"
30 #include "QtxAction.h"
34 class VTKViewer_Viewer;
35 class VTKViewer_Trihedron;
36 class VTKViewer_Transform;
37 class VTKViewer_RenderWindow;
38 class VTKViewer_InteractorStyle;
39 class VTKViewer_RenderWindowInteractor;
40 class VTKViewer_Actor;
43 #pragma warning( disable:4251 )
46 class VTKVIEWER_EXPORT VTKViewer_ViewWindow : public SUIT_ViewWindow
51 VTKViewer_ViewWindow( SUIT_Desktop*, VTKViewer_Viewer*,
52 VTKViewer_InteractorStyle* = 0,
53 VTKViewer_RenderWindowInteractor* = 0 );
54 virtual ~VTKViewer_ViewWindow();
57 QToolBar* getToolBar() { return myToolBar; }
59 void setBackgroundColor( const QColor& ); // obsolete
60 QColor backgroundColor() const; // obsolete
61 void setBackground( const Qtx::BackgroundData& );
62 Qtx::BackgroundData background() const;
65 vtkRenderer* getRenderer() { return myRenderer; }
66 /*!Gets render window.*/
67 VTKViewer_RenderWindow* getRenderWindow() { return myRenderWindow; }
68 /*!Gets render window interactor.*/
69 VTKViewer_RenderWindowInteractor* getRWInteractor() { return myRWInteractor; }
70 bool isTrihedronDisplayed();
72 void Repaint( bool theUpdateTrihedron = true );
73 void onAdjustTrihedron();
74 void GetScale( double theScale[3] );
75 void SetScale( double theScale[3] );
76 void AddActor( VTKViewer_Actor*, bool update = false );
77 void RemoveActor( VTKViewer_Actor*, bool update = false);
79 virtual QString getVisualParameters();
80 virtual void setVisualParameters( const QString& parameters );
89 void onClockWiseView();
90 void onAntiClockWiseView();
94 void activateWindowFit();
95 void activateRotation();
96 void activatePanning();
97 void activateGlobalPanning();
98 void onTrihedronShow();
104 void onKeyPressed(QKeyEvent* event);
105 void onKeyReleased(QKeyEvent* event);
106 void onMousePressed(QMouseEvent* event);
107 void onMouseDoubleClicked(QMouseEvent* event);
108 void onMouseReleased(QMouseEvent* event);
109 void onMouseMoving(QMouseEvent* event);
112 void InsertActor( VTKViewer_Actor* theActor,
113 bool theMoveInternalActors = false );
114 void MoveActor( VTKViewer_Actor* theActor );
117 enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
118 FrontId, BackId, TopId, BottomId, LeftId, RightId, ClockWiseId, AntiClockWiseId,
119 ResetId, TrihedronShowId };
120 typedef QMap<int, QtxAction*> ActionsMap;
122 void createActions();
123 void createToolBar();
125 VTKViewer_Viewer* myModel;
127 vtkRenderer* myRenderer;
128 VTKViewer_RenderWindow* myRenderWindow;
129 VTKViewer_RenderWindowInteractor* myRWInteractor;
131 VTKViewer_Trihedron* myTrihedron;
132 VTKViewer_Transform* myTransform;
135 ActionsMap myActionsMap;
138 Qtx::BackgroundData myBackground;
140 friend class VTKViewer_RenderWindowInteractor;
144 #pragma warning( default:4251 )