Version: 9.16.0
SMESHGUI_VTKUtils.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// SMESH SMESHGUI : GUI for SMESH component
24// File : SMESHGUI_VTKUtils.h
25// Author : Open CASCADE S.A.S.
26//
27#ifndef SMESHGUI_VTKUTILS_H
28#define SMESHGUI_VTKUTILS_H
29
30// SMESH includes
31#include "SMESH_SMESHGUI.hxx"
32
33#include "SMESHGUI_Utils.h"
34#include <SMESH_Object.h>
35
36// SALOME KERNEL includes
37#include <SALOMEDSClient_definitions.hxx>
38
39// SALOME GUI includes
40#include <SALOME_InteractiveObject.hxx>
41#include <VTKViewer_Filter.h>
42
43// OCCT includes
44#include <TColStd_IndexedMapOfInteger.hxx>
45
46class SALOMEDSClient_Study;
47
48class SUIT_ViewWindow;
49class SUIT_ViewManager;
50
51class SVTK_ViewWindow;
52class SVTK_Selector;
53
54class LightApp_SelectionMgr;
56
57class SMESHGUI;
58class SMESH_Actor;
59class SALOME_Actor;
60
61class vtkActor;
62
63namespace SMESH
64{
65 //----------------------------------------------------------------------------
66
68 TVisualObjPtr GetVisualObj( const char*, bool nulData =false );
70 void OnVisuException(); // PAL16631
71
72 //----------------------------------------------------------------------------
74 SVTK_ViewWindow* GetViewWindow( const SalomeApp_Module* = 0,
75 bool = false );
77 SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager*, SUIT_ViewWindow* );
79 SVTK_ViewWindow* GetVtkViewWindow( SUIT_ViewWindow* );
80
82 SVTK_ViewWindow* GetCurrentVtkView();
83
84 //----------------------------------------------------------------------------
86 void RepaintCurrentView();
88 void RepaintViewWindow( SVTK_ViewWindow* );
90 void RenderViewWindow( SVTK_ViewWindow* );
92 void FitAll();
93
94 //----------------------------------------------------------------------------
96 SMESH_Actor* FindActorByEntry( SUIT_ViewWindow*, const char* );
98 SMESH_Actor* FindActorByEntry( const char* );
99
101 SMESH_Actor* FindActorByObject( CORBA::Object_ptr );
102
103 //----------------------------------------------------------------------------
105 SMESH_Actor* CreateActor( const char*, int = false );
107 void DisplayActor( SUIT_ViewWindow*, SMESH_Actor* );
109 void RemoveActor( SUIT_ViewWindow*, SMESH_Actor* );
111 void RemoveVisuData();
112
113 //----------------------------------------------------------------------------
115
117 bool UpdateView( SUIT_ViewWindow*, EDisplaing, const char* = "" );
119 bool UpdateView( EDisplaing, const char* = "" );
120
122 void UpdateView( bool withChildrenOfSelected = false );
123
125 bool UpdateNulData( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay);
126
128 bool Update( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay);
129
130 //----------------------------------------------------------------------------
132 void SetPointRepresentation( bool );
133
135 void SetPickable( SMESH_Actor* = 0 );
136
139
141 void UpdateFontProp( SMESHGUI* );
142
143 //----------------------------------------------------------------------------
145 SVTK_Selector* GetSelector( SUIT_ViewWindow* = GetActiveWindow() );
146
148 void SetFilter( const Handle(VTKViewer_Filter)&, SVTK_Selector* = GetSelector() );
150 Handle(VTKViewer_Filter) GetFilter( int, SVTK_Selector* = GetSelector() );
152 bool IsFilterPresent( int, SVTK_Selector* = GetSelector() );
154 void RemoveFilter( int, SVTK_Selector* = GetSelector() );
155
157 void RemoveFilters( SVTK_Selector* = GetSelector());
158
160 bool IsValid( SALOME_Actor*, int, SVTK_Selector* = GetSelector() );
161
162 //----------------------------------------------------------------------------
164 int GetNameOfSelectedNodes( SVTK_Selector*,
165 const Handle(SALOME_InteractiveObject)&,
166 QString& );
168 int GetNameOfSelectedElements( SVTK_Selector*,
169 const Handle(SALOME_InteractiveObject)&,
170 QString& );
172 int GetEdgeNodes( SVTK_Selector*, const TVisualObjPtr&, ::smIdType&, ::smIdType& );
173
174 //----------------------------------------------------------------------------
176 int GetNameOfSelectedNodes( LightApp_SelectionMgr*,
177 const Handle(SALOME_InteractiveObject)&,
178 QString& );
180 int GetNameOfSelectedNodes( LightApp_SelectionMgr*, QString& );
182 int GetNameOfSelectedElements( LightApp_SelectionMgr*,
183 const Handle(SALOME_InteractiveObject)&,
184 QString& );
186 int GetNameOfSelectedElements( LightApp_SelectionMgr*, QString& );
188 int GetSelected( LightApp_SelectionMgr*, TColStd_IndexedMapOfInteger&,
189 const bool = true );
190
192 int GetEdgeNodes( LightApp_SelectionMgr*, ::smIdType&, ::smIdType& );
193
195 void SetControlsPrecision( const long );
196
197#ifndef DISABLE_PLOT2DVIEWER
199 void ClearPlot2Viewers( SUIT_ViewWindow* theWindow );
200#endif
201
202 //----------------------------------------------------------------------------
204 bool ComputeClippingPlaneParameters( std::list<vtkActor*> theActorList,
205 double theNormal[3],
206 double theDist,
207 double theBounds[6],
208 double theOrigin[3] );
209
210 bool ComputeBounds( std::list<vtkActor*> theActorList,
211 double theBounds[6]);
212
213 void PositionToDistance( double theBounds[6],
214 double theDirection[3],
215 double thePos[3],
216 double& theDist );
218 void RemoveVisualObjectWithActors( const char* theEntry, bool fromAllViews = false );
219
221 void UpdateActorsAfterUpdateStudy( SUIT_ViewWindow* wnd );
222
225
227 bool NoSmeshActors(SUIT_ViewWindow *theWnd=nullptr);
228
229}
230
231#endif // SMESHGUI_VTKUTILS_H
boost::shared_ptr< SMESH_VisualObj > TVisualObjPtr
Definition: SMESH_Object.h:88
#define SMESHGUI_EXPORT
Definition: SMESH_SMESHGUI.hxx:36
Definition: SMESHGUI.h:84
Definition: SMESH_Actor.h:56
Definition: SMESH_ControlsClassifier.cxx:39
void RenderViewWindow(SVTK_ViewWindow *theWindow)
Definition: SMESHGUI_VTKUtils.cxx:563
SUIT_ViewWindow * GetActiveWindow()
Definition: SMESHGUI_Utils.cxx:104
bool UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char *theEntry)
Definition: SMESHGUI_VTKUtils.cxx:745
Handle(VTKViewer_Filter) GetFilter(int theId
bool ComputeClippingPlaneParameters(std::list< vtkActor * > theActorList, double theNormal[3], double theDist, double theBounds[6], double theOrigin[3])
Definition: SMESHGUI_VTKUtils.cxx:1473
void ClearPlot2Viewers(SUIT_ViewWindow *theWindow)
Find all SMESH_Actor's in the View Window.
Definition: SMESHGUI_VTKUtils.cxx:1523
SVTK_Selector * GetSelector(SUIT_ViewWindow *theWindow)
Definition: SMESHGUI_VTKUtils.cxx:1107
SVTK_ViewWindow * GetCurrentVtkView()
Definition: SMESHGUI_VTKUtils.cxx:529
void PositionToDistance(double theBounds[6], double theDirection[3], double thePos[3], double &theDist)
Definition: SMESHGUI_VTKUtils.cxx:1462
void OnVisuException()
Notify the user on problems during visualization.
Definition: SMESHGUI_VTKUtils.cxx:321
void SetControlsPrecision(const long theVal)
Definition: SMESHGUI_VTKUtils.cxx:1382
void SetFilter(const Handle(VTKViewer_Filter)&theFilter, SVTK_Selector *theSelector)
Definition: SMESHGUI_VTKUtils.cxx:1115
SMESH_Actor * FindActorByObject(CORBA::Object_ptr theObject)
Definition: SMESHGUI_VTKUtils.cxx:619
void RepaintCurrentView()
Definition: SMESHGUI_VTKUtils.cxx:534
void SetPickable(SMESH_Actor *theActor)
Definition: SMESHGUI_VTKUtils.cxx:1170
void RemoveActor(SUIT_ViewWindow *theWnd, SMESH_Actor *theActor)
Definition: SMESHGUI_VTKUtils.cxx:707
EDisplaing
Definition: SMESHGUI_VTKUtils.h:114
@ eDisplayAll
Definition: SMESHGUI_VTKUtils.h:114
@ eEraseAll
Definition: SMESHGUI_VTKUtils.h:114
@ eDisplayOnly
Definition: SMESHGUI_VTKUtils.h:114
@ eDisplay
Definition: SMESHGUI_VTKUtils.h:114
@ eErase
Definition: SMESHGUI_VTKUtils.h:114
bool NoSmeshActors(SUIT_ViewWindow *theWnd)
Return true if there are no SMESH actors in a view.
Definition: SMESHGUI_VTKUtils.cxx:730
SVTK_ViewWindow * FindVtkViewWindow(SUIT_ViewManager *theMgr, SUIT_ViewWindow *theWindow)
Definition: SMESHGUI_VTKUtils.cxx:500
bool ComputeBounds(std::list< vtkActor * > theActorList, double theBounds[6])
Definition: SMESHGUI_VTKUtils.cxx:1490
void FitAll()
Definition: SMESHGUI_VTKUtils.cxx:576
void RemoveFilter(int theId, SVTK_Selector *theSelector)
Definition: SMESHGUI_VTKUtils.cxx:1132
SVTK_ViewWindow * GetViewWindow(const SalomeApp_Module *theModule, bool createIfNotFound)
Return active view window, if it instantiates SVTK_ViewWindow class, otherwise find or create corresp...
Definition: SMESHGUI_VTKUtils.cxx:471
void RemoveFilters(SVTK_Selector *theSelector)
Definition: SMESHGUI_VTKUtils.cxx:1137
void UpdateFontProp(SMESHGUI *theModule)
Definition: SMESHGUI_VTKUtils.cxx:1030
SVTK_ViewWindow * GetVtkViewWindow(SUIT_ViewWindow *theWindow)
Definition: SMESHGUI_VTKUtils.cxx:513
TVisualObjPtr GetVisualObj(const char *theEntry, bool nulData)
Returns an updated visual object.
Definition: SMESHGUI_VTKUtils.cxx:351
bool IsValid(SALOME_Actor *theActor, int theCellId, SVTK_Selector *theSelector)
Definition: SMESHGUI_VTKUtils.cxx:1143
void RemoveVisuData()
Remove all VisualObjs of a study.
Definition: SMESHGUI_VTKUtils.cxx:199
void UpdateActorsAfterUpdateStudy(SUIT_ViewWindow *theWindow)
Remove/update actors while module activation.
Definition: SMESHGUI_VTKUtils.cxx:247
int GetNameOfSelectedElements(SVTK_Selector *theSelector, const Handle(SALOME_InteractiveObject)&theIO, QString &theName)
Definition: SMESHGUI_VTKUtils.cxx:1207
int GetEdgeNodes(SVTK_Selector *theSelector, const TVisualObjPtr &theVisualObject, ::smIdType &theId1, ::smIdType &theId2)
Definition: SMESHGUI_VTKUtils.cxx:1228
int GetSelected(LightApp_SelectionMgr *theMgr, TColStd_IndexedMapOfInteger &theMap, const bool)
Definition: SMESHGUI_VTKUtils.cxx:1329
int GetNameOfSelectedNodes(SVTK_Selector *theSelector, const Handle(SALOME_InteractiveObject)&theIO, QString &theName)
Definition: SMESHGUI_VTKUtils.cxx:1193
void RemoveVisualObjectWithActors(const char *theEntry, bool fromAllViews)
Remove VisualObj and its actor from all views.
Definition: SMESHGUI_VTKUtils.cxx:106
void RepaintViewWindow(SVTK_ViewWindow *theWindow)
Definition: SMESHGUI_VTKUtils.cxx:550
bool IsFilterPresent(int theId, SVTK_Selector *theSelector)
Definition: SMESHGUI_VTKUtils.cxx:1127
void UpdateSelectionProp(SMESHGUI *theModule)
Definition: SMESHGUI_VTKUtils.cxx:951
bool UpdateNulData(const Handle(SALOME_InteractiveObject)&theIO, bool theDisplay)
Definition: SMESHGUI_VTKUtils.cxx:940
void DisplayActor(SUIT_ViewWindow *theWnd, SMESH_Actor *theActor)
Definition: SMESHGUI_VTKUtils.cxx:690
SMESH_Actor * FindActorByEntry(SUIT_ViewWindow *theWindow, const char *theEntry)
Definition: SMESHGUI_VTKUtils.cxx:591
bool Update(const Handle(SALOME_InteractiveObject)&theIO, bool theDisplay)
Definition: SMESHGUI_VTKUtils.cxx:929
SMESH_Actor * CreateActor(const char *theEntry, int theIsClear)
Definition: SMESHGUI_VTKUtils.cxx:637
void SetPointRepresentation(bool theIsVisible)
Definition: SMESHGUI_VTKUtils.cxx:1151