Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VTKViewer_ViewWindow.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 #ifndef VTKVIEWER_VIEWWINDOW_H
24 #define VTKVIEWER_VIEWWINDOW_H
25 
26 #include "VTKViewer.h"
27 
28 #include "SUIT_ViewWindow.h"
29 
30 #include "QtxAction.h"
31 
32 class vtkRenderer;
33 class SUIT_Desktop;
34 class VTKViewer_Viewer;
40 class VTKViewer_Actor;
41 
42 #ifdef WIN32
43 #pragma warning( disable:4251 )
44 #endif
45 
47 {
48  Q_OBJECT
49 
50 public:
54  virtual ~VTKViewer_ViewWindow();
55 
57  QToolBar* getToolBar() { return myToolBar; }
58 
59  void setBackgroundColor( const QColor& ); // obsolete
60  QColor backgroundColor() const; // obsolete
61  void setBackground( const Qtx::BackgroundData& );
62  Qtx::BackgroundData background() const;
63 
65  vtkRenderer* getRenderer() { return myRenderer; }
67  VTKViewer_RenderWindow* getRenderWindow() { return myRenderWindow; }
69  VTKViewer_RenderWindowInteractor* getRWInteractor() { return myRWInteractor; }
70  bool isTrihedronDisplayed();
71 
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);
78 
79  virtual QString getVisualParameters();
80  virtual void setVisualParameters( const QString& parameters );
81 
82 public slots:
83  void onFrontView();
84  void onBackView();
85  void onTopView();
86  void onBottomView();
87  void onLeftView();
88  void onRightView();
89  void onClockWiseView();
90  void onAntiClockWiseView();
91  void onResetView();
92  void onFitAll();
93  void onFitSelection();
94  void activateZoom();
95  void activateWindowFit();
96  void activateRotation();
97  void activatePanning();
98  void activateGlobalPanning();
99  void onTrihedronShow();
100 
101 protected:
102  QImage dumpView();
103 
104 protected slots:
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);
111 
112 private:
113  void InsertActor( VTKViewer_Actor* theActor,
114  bool theMoveInternalActors = false );
115  void MoveActor( VTKViewer_Actor* theActor );
116 
117 private:
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;
122 
123  void createActions();
124  void createToolBar();
125 
127 
128  vtkRenderer* myRenderer;
131 
134 
137 
138  double myCurScale;
140 
142 };
143 
144 #ifdef WIN32
145 #pragma warning( default:4251 )
146 #endif
147 
148 #endif