Version: 9.16.0
SVTK_View.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 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 SVTK_VIEW_H
24#define SVTK_VIEW_H
25
26#ifdef WIN32
27#pragma warning( disable:4251 )
28#endif
29
30#include "SVTK.h"
31
33#include <SALOME_ListIO.hxx>
34
35#include <QObject>
36
37class vtkActorCollection;
38class vtkRenderer;
39class vtkProperty;
40
41class SVTK_ViewWindow;
42class SVTK_Renderer;
43
44class SALOME_Actor;
45
46class QMouseEvent;
47class QWheelEvent;
48class QKeyEvent;
49class QContextMenuEvent;
50class QColor;
51
52
54
62{
63 Q_OBJECT
64
65public:
66 SVTK_SignalHandler(SVTK_ViewWindow* theMainWindow);
67
68 virtual
70
73 GetMainWindow();
74
75 //----------------------------------------------------------------------------
77 void
78 Repaint(bool theUpdateTrihedron = true);
79
80 //----------------------------------------------------------------------------
83 GetRenderer();
84
86 vtkRenderer*
87 getRenderer();
88
89 //----------------------------------------------------------------------------
90 public slots:
91 void onSelectionChanged();
92
93 public:
94 signals:
95 void MouseMove( QMouseEvent* );
96 void MouseButtonPressed( QMouseEvent* );
97 void MouseButtonReleased( QMouseEvent* );
98 void MouseDoubleClicked( QMouseEvent* );
99 void ButtonPressed(const QMouseEvent *event);
100 void ButtonReleased(const QMouseEvent *event);
101 void WheelMoved( QWheelEvent* );
102 void KeyPressed( QKeyEvent* );
103 void KeyReleased( QKeyEvent* );
104 void contextMenuRequested( QContextMenuEvent *e );
106
107 protected:
109};
110
111
113
119{
120 Q_OBJECT
121
122public:
123 SVTK_View(SVTK_ViewWindow* theMainWindow);
124
125 virtual
126 ~SVTK_View();
127
128 /* interactive object management */
130 void
131 highlight(const Handle(SALOME_InteractiveObject)& IObject,
132 bool highlight,
133 bool immediatly = true);
134
136 void
137 unHighlightAll();
138
141 FindIObject(const char* Entry);
142
144 bool
145 isInViewer(const Handle(SALOME_InteractiveObject)& IObject);
146
148 bool
149 isVisible(const Handle(SALOME_InteractiveObject)& IObject);
150
151 void
152 rename(const Handle(SALOME_InteractiveObject)& IObject,
153 const QString& newName);
154
155 //----------------------------------------------------------------------------
156 // Displaymode management
158 int
159 GetDisplayMode();
160
162 void
163 SetDisplayMode(int);
164
166 void
167 SetDisplayMode(const Handle(SALOME_InteractiveObject)& IObject,
168 int theMode);
169
171 void
172 ChangeRepresentationToWireframe();
173
175 void
176 ChangeRepresentationToSurface();
177
179 void
180 ChangeRepresentationToSurfaceWithEdges();
181
183 void
184 ChangeRepresentationToWireframe(vtkActorCollection* theListofActors);
185
187 void
188 ChangeRepresentationToSurface(vtkActorCollection* theListofActors);
189
191 void
192 ChangeRepresentationToSurfaceWithEdges(vtkActorCollection* theListofActors);
193
195 void
196 SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject,
197 float trans);
198
200 float
201 GetTransparency(const Handle(SALOME_InteractiveObject)& theIObject);
202
204 void
205 SetColor(const Handle(SALOME_InteractiveObject)& theIObject,
206 const QColor& theColor);
207
209 QColor
210 GetColor(const Handle(SALOME_InteractiveObject)& theIObject);
211
213 void
214 SetMaterial(const Handle(SALOME_InteractiveObject)& theIObject,
215 vtkProperty* thePropF, vtkProperty* thePropB);
216
218 vtkProperty*
219 GetFrontMaterial(const Handle(SALOME_InteractiveObject)& theIObject);
220
222 vtkProperty*
223 GetBackMaterial(const Handle(SALOME_InteractiveObject)& theIObject);
224
225 //----------------------------------------------------------------------------
226 // Erase Display functions
228 void
229 EraseAll();
230
232 void
233 DisplayAll();
234
236 void
237 RemoveAll( const bool immediatly );
238
240 void
241 Erase(const Handle(SALOME_InteractiveObject)& IObject,
242 bool immediatly = true);
243 void
244 Remove(const Handle(SALOME_InteractiveObject)& IObject,
245 bool immediatly = true);
246
248 void
249 Display(const Handle(SALOME_InteractiveObject)& IObject,
250 bool immediatly = true);
251
253 void
254 DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject);
255
257 void
258 Display(SALOME_Actor* SActor,
259 bool immediatly = true);
260
262 void
263 Erase(SALOME_Actor* SActor,
264 bool immediatly = true);
265
267 void
268 Remove(SALOME_Actor* SActor,
269 bool updateViewer = true);
270
272 void
273 GetVisible( SALOME_ListIO& theList );
274
275 //----------------------------------------------------------------------------
277 void
278 SetSelectionProp(const double& theRed = 1,
279 const double& theGreen = 1,
280 const double& theBlue = 0,
281 const int& theWidth = 5);
282
284 void
285 SetPreselectionProp(const double& theRed = 0,
286 const double& theGreen = 1,
287 const double& theBlue = 1,
288 const int& theWidth = 5);
289
291 void
292 SetSelectionTolerance(const double& theTolNodes = 0.025,
293 const double& theTolCell = 0.001,
294 const double& theTolObjects = 0.025);
295
296 protected:
298};
299
300#ifdef WIN32
301#pragma warning( default:4251 )
302#endif
303
304#endif
Handle(TDocStd_Application) CAF_Application
Get OCAF application.
Definition: CAF_Application.cxx:97
#define SVTK_EXPORT
Definition: SVTK.h:37
For more information see QT documentation.
The class is a basic one for all SALOME VTK presentation.
Definition: SALOME_Actor.h:73
Definition: SALOME_ListIO.hxx:29
Definition: SVTK_Renderer.h:66
Main purpose of the class is to provide a way to customize SVTK_ViewWindow.
Definition: SVTK_View.h:62
void MouseButtonPressed(QMouseEvent *)
SVTK_ViewWindow * myMainWindow
Definition: SVTK_View.h:108
void MouseButtonReleased(QMouseEvent *)
void contextMenuRequested(QContextMenuEvent *e)
void MouseMove(QMouseEvent *)
void ButtonPressed(const QMouseEvent *event)
void ButtonReleased(const QMouseEvent *event)
void KeyReleased(QKeyEvent *)
void WheelMoved(QWheelEvent *)
void MouseDoubleClicked(QMouseEvent *)
void KeyPressed(QKeyEvent *)
Define a container for SALOME VTK view window.
Definition: SVTK_ViewWindow.h:86
This class is introduced just for compatibility with old code.
Definition: SVTK_View.h:119
Handle(SALOME_InteractiveObject) FindIObject(const char *Entry)
Try to find a SALOME_InteractiveObject in the view that corresponds to the entry.
int myDisplayMode
Definition: SVTK_View.h:297