mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-14 17:48:34 +05:00
Add function to erase an actor in current viewer or in all viewers where it is displayed (patch from vsv - PPGP dev)
This commit is contained in:
parent
5f62c18c48
commit
b398c3a304
@ -37,6 +37,9 @@
|
||||
|
||||
// SALOME GUI includes
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ViewManager.h>
|
||||
#include <SALOME_Prs.h>
|
||||
#include <SUIT_ViewWindow.h>
|
||||
#include <VTKViewer_ViewModel.h>
|
||||
#include <SALOME_Event.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
@ -575,6 +578,44 @@ void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry )
|
||||
ProcessVoidEvent(new TEvent(Mesh_Entry));
|
||||
}
|
||||
|
||||
void SMESH_Swig::EraseActor( const char* Mesh_Entry, const bool allViewers )
|
||||
{
|
||||
class TEvent: public SALOME_Event
|
||||
{
|
||||
private:
|
||||
const char* _entry;
|
||||
bool _allViewers;
|
||||
public:
|
||||
TEvent(const char* Mesh_Entry, const bool allViewers ) {
|
||||
_entry = Mesh_Entry;
|
||||
_allViewers = allViewers;
|
||||
}
|
||||
virtual void Execute() {
|
||||
SUIT_Session* aSession = SUIT_Session::session();
|
||||
SUIT_Application* anApplication = aSession->activeApplication();
|
||||
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
|
||||
SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
|
||||
ViewManagerList aManagers;
|
||||
if ( !_allViewers ) {
|
||||
aManagers << anApp->activeViewManager();
|
||||
}
|
||||
else {
|
||||
aManagers = anApp->viewManagers();
|
||||
}
|
||||
foreach( SUIT_ViewManager* aMgr, aManagers ) {
|
||||
if ( aMgr && aMgr->getType() == VTKViewer_Viewer::Type() ) {
|
||||
SALOME_View* aSalomeView = dynamic_cast<SALOME_View*>(aMgr->getViewModel());
|
||||
if (aSalomeView) {
|
||||
aDisp->Erase(_entry,true, true, aSalomeView);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ProcessVoidEvent(new TEvent(Mesh_Entry, allViewers));
|
||||
}
|
||||
|
||||
void SMESH_Swig::SetName(const char* theEntry,
|
||||
const char* theName)
|
||||
{
|
||||
|
@ -65,6 +65,8 @@ public:
|
||||
|
||||
void SetName( const char*, const char* );
|
||||
|
||||
void EraseActor( const char*, const bool allViewers = false );
|
||||
|
||||
/*!
|
||||
* \brief Set mesh icon according to compute status
|
||||
* \param Mesh_Entry - entry of a mesh
|
||||
|
@ -75,4 +75,5 @@ class SMESH_Swig
|
||||
void SetMeshIcon(const char* Mesh_Entry, const bool isComputed, const bool isEmpty);
|
||||
|
||||
void CreateAndDisplayActor( const char* Mesh_Entry );
|
||||
void EraseActor( const char* Mesh_Entry, const bool allViewers = false );
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user