+ //================================================================================
+ /*!
+ * \brief Remove VisualObj and its actor from all views
+ */
+ //================================================================================
+
+ void RemoveVisualObjectWithActors( const char* theEntry )
+ {
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
+ ( SUIT_Session::session()->activeApplication() );
+ SUIT_ViewManager* aViewManager =
+ app ? app->getViewManager(SVTK_Viewer::Type(), true) : 0;
+ if ( aViewManager ) {
+ QPtrVector<SUIT_ViewWindow> views = aViewManager->getViews();
+ for ( int iV = 0; iV < views.count(); ++iV ) {
+ if ( SMESH_Actor* actor = FindActorByEntry( views[iV], theEntry)) {
+ if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV]))
+ vtkWnd->RemoveActor(actor);
+ actor->Delete();
+ }
+ }
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( aViewManager->study() );
+ int aStudyId = aStudy->id();
+ TVisualObjCont::key_type aKey(aStudyId,theEntry);
+ TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
+ if(anIter != VISUAL_OBJ_CONT.end()) {
+ // for unknown reason, object destructor is not called, so clear object manually
+ anIter->second->GetUnstructuredGrid()->SetCells(0,0,0);
+ anIter->second->GetUnstructuredGrid()->SetPoints(0);
+ }
+ VISUAL_OBJ_CONT.erase(aKey);
+ }
+ }
+ //================================================================================
+ /*!
+ * \brief Remove all VisualObjs and their actors from all views
+ */
+ //================================================================================
+
+ void RemoveAllObjectsWithActors()
+ {
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
+ ( SUIT_Session::session()->activeApplication() );
+ SUIT_ViewManager* aViewManager =
+ app ? app->getViewManager(SVTK_Viewer::Type(), true) : 0;
+ if ( aViewManager ) {
+ QPtrVector<SUIT_ViewWindow> views = aViewManager->getViews();
+ for ( int iV = 0; iV < views.count(); ++iV ) {
+ if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) {
+ vtkRenderer *aRenderer = vtkWnd->getRenderer();
+ vtkActorCollection *aCollection = aRenderer->GetActors();
+ aCollection->InitTraversal();
+ while(vtkActor *anAct = aCollection->GetNextActor()){
+ if(SMESH_Actor *actor = dynamic_cast<SMESH_Actor*>(anAct)){
+ vtkWnd->RemoveActor(actor);
+ actor->Delete();
+ }
+ }
+ }
+ }
+ TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.begin();
+ for ( ; anIter != VISUAL_OBJ_CONT.end(); ++anIter ) {
+ // for unknown reason, object destructor is not called, so clear object manually
+ anIter->second->GetUnstructuredGrid()->SetCells(0,0,0);
+ anIter->second->GetUnstructuredGrid()->SetPoints(0);
+ }
+ VISUAL_OBJ_CONT.clear();
+ }
+ }
+ //================================================================================
+ /*!
+ * \brief Notify the user on problems during visualization
+ */
+ //================================================================================
+
+ void OnVisuException()
+ {
+ SUIT_MessageBox::warn1 (SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_VISU_PROBLEM"),
+ QObject::tr("SMESH_BUT_OK"));
+ }
+ //================================================================================
+ /*!
+ * \brief Returns an updated visual object
+ */
+ //================================================================================
+