Version: 9.12.0
VTKViewer_ViewWindow.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, 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
const QString const bool const double theScale
Definition: OCCViewer_ViewModel.cxx:954
#define VTKVIEWER_EXPORT
Definition: VTKViewer.h:33
Stores background data.
Definition: Qtx.h:178
Definition: SUIT_Desktop.h:47
Definition: SUIT_ViewWindow.h:42
virtual void setVisualParameters(const QString &parameters)
Definition: SUIT_ViewWindow.cxx:259
virtual QString getVisualParameters()
Definition: SUIT_ViewWindow.cxx:250
virtual QImage dumpView()
Definition: SUIT_ViewWindow.cxx:92
QMap< int, QList< QtxMultiAction * > > ActionsMap
Definition: SUIT_ViewWindow.h:120
Definition: VTKViewer_Actor.h:79
Definition: VTKViewer_InteractorStyle.h:72
Definition: VTKViewer_RenderWindowInteractor.h:58
Definition: VTKViewer_RenderWindow.h:33
Describes linear transformations via a 4x4 matrix.
Definition: VTKViewer_Transform.h:34
Definition: VTKViewer_Trihedron.h:145
Definition: VTKViewer_ViewWindow.h:47
VTKViewer_Transform * myTransform
Definition: VTKViewer_ViewWindow.h:133
VTKViewer_RenderWindow * getRenderWindow()
Definition: VTKViewer_ViewWindow.h:67
QMap< int, QtxAction * > ActionsMap
Definition: VTKViewer_ViewWindow.h:121
Qtx::BackgroundData myBackground
Definition: VTKViewer_ViewWindow.h:139
@ AntiClockWiseId
Definition: VTKViewer_ViewWindow.h:119
@ ResetId
Definition: VTKViewer_ViewWindow.h:120
@ DumpId
Definition: VTKViewer_ViewWindow.h:118
vtkRenderer * myRenderer
Definition: VTKViewer_ViewWindow.h:128
VTKViewer_Viewer * myModel
Definition: VTKViewer_ViewWindow.h:126
ActionsMap myActionsMap
Definition: VTKViewer_ViewWindow.h:136
QToolBar * getToolBar()
Definition: VTKViewer_ViewWindow.h:57
VTKViewer_RenderWindowInteractor * getRWInteractor()
Definition: VTKViewer_ViewWindow.h:69
QToolBar * myToolBar
Definition: VTKViewer_ViewWindow.h:135
vtkRenderer * getRenderer()
Definition: VTKViewer_ViewWindow.h:65
VTKViewer_RenderWindowInteractor * myRWInteractor
Definition: VTKViewer_ViewWindow.h:130
VTKViewer_RenderWindow * myRenderWindow
Definition: VTKViewer_ViewWindow.h:129
VTKViewer_Trihedron * myTrihedron
Definition: VTKViewer_ViewWindow.h:132
double myCurScale
Definition: VTKViewer_ViewWindow.h:138
Definition: VTKViewer_ViewModel.h:38