1 // Copyright (C) 2007-2016 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();
93 void onFitSelection();
95 void activateWindowFit();
96 void activateRotation();
97 void activatePanning();
98 void activateGlobalPanning();
99 void onTrihedronShow();
105 void onKeyPressed(QKeyEvent* event);
106 void onKeyReleased(QKeyEvent* event);
107 void onMousePressed(QMouseEvent* event);
108 void onMouseDoubleClicked(QMouseEvent* event);
109 void onMouseReleased(QMouseEvent* event);
110 void onMouseMoving(QMouseEvent* event);
113 void InsertActor( VTKViewer_Actor* theActor,
114 bool theMoveInternalActors = false );
115 void MoveActor( VTKViewer_Actor* theActor );
118 enum { DumpId, FitAllId, FitRectId, FitSelectionId, ZoomId, PanId, GlobalPanId, RotationId,
119 FrontId, BackId, TopId, BottomId, LeftId, RightId, ClockWiseId, AntiClockWiseId,
120 ResetId, TrihedronShowId };
121 typedef QMap<int, QtxAction*> ActionsMap;
123 void createActions();
124 void createToolBar();
126 VTKViewer_Viewer* myModel;
128 vtkRenderer* myRenderer;
129 VTKViewer_RenderWindow* myRenderWindow;
130 VTKViewer_RenderWindowInteractor* myRWInteractor;
132 VTKViewer_Trihedron* myTrihedron;
133 VTKViewer_Transform* myTransform;
136 ActionsMap myActionsMap;
139 Qtx::BackgroundData myBackground;
141 friend class VTKViewer_RenderWindowInteractor;
145 #pragma warning( default:4251 )