1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // VISU OBJECT : interactive object for VISU entities implementation
24 // File : VISU_ViewManager_i.cc
25 // Author : Alexey PETROV
28 #include "VISU_ViewManager_i.hh"
29 #include "VISU_View_i.hh"
30 #include "VISU_Prs3d_i.hh"
31 #include "VISU_Table_i.hh"
33 #include "VISU_Actor.h"
34 #include "VISU_ActorFactory.h"
36 #include "SUIT_Tools.h"
37 #include "SUIT_Session.h"
38 #include "SUIT_ViewWindow.h"
39 #include "SUIT_ViewManager.h"
41 #include "SVTK_ViewWindow.h"
42 #include "SVTK_ViewModel.h"
43 #include "VTKViewer_Algorithm.h"
44 #include "SPlot2d_Curve.h"
45 #include "SPlot2d_ViewModel.h"
46 #include "Plot2d_ViewFrame.h"
47 #include "Plot2d_ViewWindow.h"
48 #include "Plot2d_ViewModel.h"
49 #include "Plot2d_ViewManager.h"
51 #include "SalomeApp_Study.h"
52 #include "SalomeApp_Application.h"
53 #include "LightApp_SelectionMgr.h"
55 #include "SALOME_Event.h"
56 #include "SALOME_ListIO.hxx"
57 #include "SALOME_ListIteratorOfListIO.hxx"
59 #include "VTKViewer_Algorithm.h"
60 #include "SVTK_Functor.h"
62 #include <vtkCamera.h>
63 #include <vtkRenderer.h>
64 #include <vtkRenderWindow.h>
66 #include <QApplication>
71 static int MYDEBUG = 0;
73 static int MYDEBUG = 0;
78 struct TNewViewManagerEvent: public SALOME_Event
81 typedef SalomeApp_Application* TResult;
84 TNewViewManagerEvent (const int theStudyId):
85 myStudyId(theStudyId),
93 MESSAGE("Find application for study with id = : " << myStudyId);
94 SUIT_Session* aSession = SUIT_Session::session();
95 QList<SUIT_Application*> anApplications = aSession->applications();
96 QList<SUIT_Application*>::Iterator anIter = anApplications.begin();
97 while ( anIter != anApplications.end() ) {
98 SUIT_Application* anApp = *anIter;
99 if (SUIT_Study* aSStudy = anApp->activeStudy()) {
100 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
101 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
102 //if (myStudyName == aCStudy->Name()) {
103 if (myStudyId == aCStudy->StudyId()) {
104 myResult = dynamic_cast<SalomeApp_Application*>(anApp);
113 //MESSAGE("Error: application is not found for study : " << myStudyName);
114 MESSAGE("Error: application is not found for study with id = : " << myStudyId);
119 //===========================================================================
120 ViewManager_i::ViewManager_i(SALOMEDS::Study_ptr theStudy)
122 if(MYDEBUG) MESSAGE("ViewManager_i::ViewManager_i - "<<this);
124 //CORBA::String_var aStudyName = theStudy->Name();
125 //myApplication = ProcessEvent(new TNewViewManagerEvent(aStudyName.in()));
126 int aStudyID = theStudy->StudyId();
127 myApplication = ProcessEvent(new TNewViewManagerEvent(aStudyID));
131 ViewManager_i::~ViewManager_i()
133 if(MYDEBUG) MESSAGE("ViewManager_i::~ViewManager_i - "<<this);
137 struct TCurrentViewEvent: public SALOME_Event
139 SalomeApp_Application* myApplication;
140 typedef VISU::View_ptr TResult;
143 TCurrentViewEvent(SalomeApp_Application* theApplication):
144 myApplication(theApplication),
145 myResult(VISU::View::_nil())
152 VISU::View3D_i* aView = new View3D_i (myApplication);
153 if (aView->Create(0))
154 myResult = aView->_this();
158 VISU::View_ptr ViewManager_i::GetCurrentView(){
159 return ProcessEvent(new TCurrentViewEvent(myApplication));
163 template<class TViewFrame>
164 struct TCreateViewFrameEvent: public SALOME_Event
166 SalomeApp_Application* myApplication;
167 typedef typename TViewFrame::TInterface TInterface;
168 typedef typename TInterface::_ptr_type TResult;
171 TCreateViewFrameEvent (SalomeApp_Application* theApplication):
172 myApplication(theApplication),
173 myResult(TInterface::_nil())
180 //if (CheckStudy(myStudyDocument)) {
182 TViewFrame* pView = new TViewFrame (myApplication);
183 if (pView->Create(1)) {
184 myResult = pView->_this();
185 qApp->processEvents(); // Fix for bug 9929
192 VISU::View3D_ptr ViewManager_i::Create3DView()
194 if (MYDEBUG) MESSAGE("ViewManager_i::Create3DView");
195 return ProcessEvent(new TCreateViewFrameEvent<View3D_i>(myApplication));
198 VISU::XYPlot_ptr ViewManager_i::CreateXYPlot()
200 if (MYDEBUG) MESSAGE("ViewManager_i::CreateXYPlot");
201 return ProcessEvent(new TCreateViewFrameEvent<XYPlot_i>(myApplication));
204 class TCreateViewEvent: public SALOME_Event
207 TCreateViewEvent (SalomeApp_Application* theApplication)
208 : myApplication(theApplication)
211 SalomeApp_Application* myApplication;
214 class TCreateTableViewFrameEvent: public TCreateViewEvent
218 TCreateTableViewFrameEvent (SalomeApp_Application* theApplication,
220 TCreateViewEvent(theApplication),
222 myResult(VISU::TableView::_nil())
225 virtual void Execute()
227 //if (CheckStudy(myStudyDocument)) {
228 VISU::TableView_i* pView = new TableView_i (myApplication);
229 if (pView->Create(myTable) != NULL)
230 myResult = pView->_this();
233 typedef VISU::TableView_ptr TResult;
237 VISU::TableView_ptr ViewManager_i::CreateTableView (VISU::Table_ptr theTable)
239 if (MYDEBUG) MESSAGE("ViewManager_i::CreateTableView");
240 //return ProcessEvent(new TCreateViewFrameEvent<TableView_i>(myApplication));
241 return ProcessEvent(new TCreateTableViewFrameEvent (myApplication, theTable));
244 void ViewManager_i::Destroy (View_ptr theView)
246 class TEvent: public SALOME_Event {
249 TEvent(View_ptr theView):
252 virtual void Execute(){
253 if (!CORBA::is_nil(myView)) {
254 if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(myView).in())) {
256 pView->_remove_ref();
262 if (MYDEBUG) MESSAGE("ViewManager_i::Destroy - " << theView->_is_nil());
263 ProcessVoidEvent(new TEvent(theView));
266 //===========================================================================
267 // VISU namespace functions
268 //===========================================================================
269 vtkRenderer* GetRenderer (SUIT_ViewWindow* theViewWindow)
271 if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(theViewWindow))
272 return vw->getRenderer();
276 vtkCamera* GetCamera (SUIT_ViewWindow* theViewWindow)
278 return GetRenderer(theViewWindow)->GetActiveCamera();
281 void RepaintView (SUIT_ViewWindow* theViewWindow)
283 if (SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(theViewWindow)) {
284 vf->getRenderer()->ResetCameraClippingRange();
285 vf->getRenderWindow()->Render();
289 VISU_Actor* UpdateViewer (SUIT_ViewWindow* theViewWindow, int theDisplaing, Prs3d_i* thePrs)
291 SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(theViewWindow);
292 if (!vf) return NULL;
293 if(MYDEBUG) MESSAGE("UpdateViewer - theDisplaing = "<<theDisplaing<<"; thePrs = "<<thePrs);
294 vtkRenderer *aRen = vf->getRenderer();
295 VTK::ActorCollectionCopy aCopy(aRen->GetActors());
296 vtkActorCollection* anActColl = aCopy.GetActors();
298 VISU_Actor *anVISUActor = NULL, *aResActor = NULL;
299 for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL;){
300 if(anActor->IsA("VISU_Actor")){
301 anVISUActor = VISU_Actor::SafeDownCast(anActor);
302 if (thePrs == anVISUActor->GetPrs3d()) {
303 aResActor = anVISUActor;
304 if(theDisplaing < eErase)
305 aResActor->VisibilityOn();
307 aResActor->VisibilityOff();
309 if(theDisplaing == eEraseAll || theDisplaing == eDisplayOnly)
310 anVISUActor->VisibilityOff();
311 else if ( theDisplaing == eDisplayAll )
312 anVISUActor->VisibilityOn();
317 RepaintView(theViewWindow);
320 if(thePrs != NULL && theDisplaing < eErase){
322 anVISUActor = thePrs->CreateActor();
323 vf->AddActor(anVISUActor);
324 }catch(std::exception& exc){
325 if(MYDEBUG) INFOS(exc.what());
328 if(MYDEBUG) INFOS("Unknown exception was occured!!!");
332 RepaintView(theViewWindow);
336 struct TUpdatePlot2dEvent: public SALOME_Event
341 TUpdatePlot2dEvent (Curve_i* theCurve, const int theDisplaying):
343 myDisplaying(theDisplaying)
346 virtual void Execute()
348 SalomeApp_Application* anApp = NULL;
349 CORBA::String_var studyName = myCurve->GetStudyDocument()->Name();
350 std::string aStudyName = studyName.in();
351 SUIT_Session* aSession = SUIT_Session::session();
352 QList<SUIT_Application*> anApplications = aSession->applications();
353 QList<SUIT_Application*>::Iterator anIter = anApplications.begin();
354 while (anIter != anApplications.end()) {
355 SUIT_Application* aSUITApp = *anIter;
356 if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
357 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
358 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
359 if (aStudyName == aCStudy->Name()) {
360 anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
371 ViewManagerList aViewManagerList;
372 anApp->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
373 SUIT_ViewManager* aViewManager;
374 foreach( aViewManager, aViewManagerList ) {
375 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
376 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel())) {
377 if (Plot2d_ViewFrame* aViewFrame = aViewer->getActiveViewFrame()) {
378 UpdatePlot2d(myCurve, myDisplaying, aViewFrame);
386 void UpdatePlot2d (Curve_i* theCurve, int theDisplaying, Plot2d_ViewFrame* theView)
388 if(MYDEBUG) MESSAGE("UpdatePlot2d - theDisplaying = " << theDisplaying);
391 ProcessVoidEvent(new TUpdatePlot2dEvent(theCurve, theDisplaying));
394 QList<Plot2d_Curve*> clist;
395 theView->getCurves(clist);
396 if (theDisplaying == eEraseAll) {
397 for (int i = 0; i < clist.count(); i++) {
398 if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing all : curve - " << clist.at(i));
399 theView->eraseCurve(clist.at(i));
401 } else if (theDisplaying == eErase) {
403 for (int i = 0; i < clist.count(); i++) {
404 SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
405 if (aSPlot2dC->hasIO() &&
406 !strcmp(theCurve->GetEntry().c_str(), aSPlot2dC->getIO()->getEntry())) {
407 if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing : curve - " << aSPlot2dC);
408 theView->eraseCurve(aSPlot2dC);
412 } else if (theDisplaying == eDisplay ||
413 theDisplaying == eDisplayOnly ||
414 theDisplaying == eUpdateData) {
417 for (int i = 0; i < clist.count(); i++) {
418 SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
419 if (aSPlot2dC->hasIO() &&
420 !strcmp(theCurve->GetEntry().c_str(), aSPlot2dC->getIO()->getEntry())) {
421 if (theDisplaying == eUpdateData) {
422 if(MYDEBUG) MESSAGE("UpdatePlot2d - updating data : curve - " << aSPlot2dC);
425 if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve - " << aSPlot2dC);
430 int nbPoints = theCurve->GetData( xList, yList, zList );
431 if (nbPoints > 0 && xList && yList) {
432 aSPlot2dC->setData( xList, yList, nbPoints, zList );
434 if (theDisplaying == eUpdateData) {
435 theView->updateCurve(aSPlot2dC, true);
437 aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() );
438 aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() );
439 aSPlot2dC->setHorUnits( theCurve->GetHorUnits().c_str() );
440 aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() );
441 if (!theCurve->IsAuto()) {
442 aSPlot2dC->setLine((Plot2d::LineType)theCurve->GetLine(),
443 theCurve->GetLineWidth());
444 aSPlot2dC->setMarker((Plot2d::MarkerType)theCurve->GetMarker());
445 SALOMEDS::Color color = theCurve->GetColor();
446 aSPlot2dC->setColor(QColor((int)(color.R*255.),
448 (int)(color.B*255.)));
450 aSPlot2dC->setAutoAssign(theCurve->IsAuto());
451 theView->displayCurve(aSPlot2dC);
454 } else if (theDisplaying == eDisplayOnly) {
455 theView->eraseCurve(aSPlot2dC);
458 if (!bFound && theDisplaying != eUpdateData) {
459 Plot2d_Curve* crv = theCurve->CreatePresentation();
460 if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve (new) - "<<crv );
462 theView->displayCurve( crv );
463 theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
464 theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
465 SALOMEDS::Color newColor;
466 newColor.R = crv->getColor().red()/255.;
467 newColor.G = crv->getColor().green()/255.;
468 newColor.B = crv->getColor().blue()/255.;
469 theCurve->SetColor( newColor );
470 crv->setAutoAssign( theCurve->IsAuto() );
478 //----------------------------------------------------------------------------
481 VISU::Prs3d_i* myPrs3d;
483 TIsSamePrs3d(VISU::Prs3d_i* thePrs3d):
488 operator()(VISU_Actor* theActor)
490 return theActor->GetPrs3d() == myPrs3d;
495 //----------------------------------------------------------------------------
497 FindActor(SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs3d)
502 vtkRenderer* aRenderer = theViewWindow->getRenderer();
503 VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
504 vtkActorCollection* anActors = aCopy.GetActors();
505 return SVTK::Find<VISU_Actor>(anActors, VISU::TIsSamePrs3d(thePrs3d));
509 //----------------------------------------------------------------------------
512 VISU::TActorFactory* myActor;
514 TIsSameActor(VISU::TActorFactory* theActor):
519 operator()(VISU_ActorBase* theActor)
521 return theActor->GetFactory() == myActor;
525 //----------------------------------------------------------------------------
527 FindActorBase(SVTK_ViewWindow* theViewWindow, VISU::TActorFactory* theActor)
532 vtkRenderer* aRenderer = theViewWindow->getRenderer();
533 VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
534 vtkActorCollection* anActors = aCopy.GetActors();
535 return SVTK::Find<VISU_ActorBase>(anActors, VISU::TIsSameActor(theActor));
539 //----------------------------------------------------------------------------
540 struct TDeleteActorsEvent: public SALOME_Event
542 VISU::Curve_i* myPrs;
544 TDeleteActorsEvent (VISU::Curve_i* thePrs):
554 // 1. Find appropriate application (code like in TNewViewManagerEvent::Execute())
555 SALOMEDS::Study_var myStudyDocument = myPrs->GetStudyDocument();
556 SalomeApp_Application* anApp = NULL;
557 CORBA::String_var studyName = myStudyDocument->Name();
558 std::string aStudyName = studyName.in();
559 SUIT_Session* aSession = SUIT_Session::session();
560 QList<SUIT_Application*> anApplications = aSession->applications();
561 QList<SUIT_Application*>::Iterator anIter = anApplications.begin();
562 while ( anIter != anApplications.end() ) {
563 SUIT_Application* aSUITApp = *anIter;
564 if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
565 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
566 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
567 if (aStudyName == aCStudy->Name()) {
568 anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
579 // 2. Remove corresponding IO from selection
580 SALOMEDS::SObject_var aSObject = myPrs->GetSObject();
581 CORBA::String_var anEntry = aSObject->GetID();
583 LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
584 SALOME_ListIO aListIO, aNewListIO;
585 aSelectionMgr->selectedObjects(aListIO);
587 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
588 if (it.Value()->hasEntry()) {
589 std::string aCurEntry (it.Value()->getEntry());
590 if (aCurEntry != std::string( anEntry.in() ) ) {
591 aNewListIO.Append(it.Value());
596 aSelectionMgr->setSelectedObjects(aNewListIO);
599 ViewManagerList aViewManagerList;
600 anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
601 QList<SUIT_ViewManager*>::Iterator anVMIter = aViewManagerList.begin();
602 for (; anVMIter != aViewManagerList.end(); anVMIter++ ) {
603 SUIT_ViewManager* aViewManager = *anVMIter;
604 QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
605 for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
606 if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
607 if (Plot2d_ViewWindow* vw = dynamic_cast<Plot2d_ViewWindow*>(aViewWindow)) {
608 Plot2d_ViewFrame* vf = vw->getViewFrame();
609 QList<Plot2d_Curve*> clist;
610 vf->getCurves(clist);
611 for (int i = 0; i < clist.count(); i++) {
612 if (SPlot2d_Curve* cu = dynamic_cast<SPlot2d_Curve*>(clist.at(i))) {
614 strcmp(myPrs->GetEntry().c_str(), cu->getIO()->getEntry())) {
620 //jfa tmp:aViewFrame->unHighlightAll();
628 void DeleteActors (VISU::Curve_i* thePrs)
631 ProcessVoidEvent(new TDeleteActorsEvent (thePrs));
633 /* // 1. Find appropriate application (code like in TNewViewManagerEvent::Execute())
634 SALOMEDS::Study_var myStudyDocument = thePrs->GetStudyDocument();
635 SalomeApp_Application* anApp = NULL;
636 CORBA::String_var studyName = myStudyDocument->Name();
637 std::string aStudyName = studyName.in();
638 SUIT_Session* aSession = SUIT_Session::session();
639 QPtrList<SUIT_Application> anApplications = aSession->applications();
640 QPtrListIterator<SUIT_Application> anIter (anApplications);
641 while (SUIT_Application* aSUITApp = anIter.current()) {
643 if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
644 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
645 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
646 if (aStudyName == aCStudy->Name()) {
647 anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
657 // 2. Remove corresponding IO from selection
658 SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
659 CORBA::String_var anEntry = aSObject->GetID();
661 LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
662 SALOME_ListIO aListIO, aNewListIO;
663 aSelectionMgr->selectedObjects(aListIO);
665 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
666 if (it.Value()->hasEntry()) {
667 std::string aCurEntry (it.Value()->getEntry());
668 if (aCurEntry != std::string( anEntry.in() ) ) {
669 aNewListIO.Append(it.Value());
674 aSelectionMgr->setSelectedObjects(aNewListIO);
677 ViewManagerList aViewManagerList;
678 anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
679 QPtrListIterator<SUIT_ViewManager> anVMIter (aViewManagerList);
680 for (; anVMIter.current(); ++anVMIter) {
681 SUIT_ViewManager* aViewManager = anVMIter.current();
682 QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
683 for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
684 if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
685 if (Plot2d_ViewWindow* vw = dynamic_cast<Plot2d_ViewWindow*>(aViewWindow)) {
686 Plot2d_ViewFrame* vf = vw->getViewFrame();
687 QList<Plot2d_Curve> clist;
688 vf->getCurves(clist);
689 for (int i = 0; i < clist.count(); i++) {
690 if (SPlot2d_Curve* cu = dynamic_cast<SPlot2d_Curve*>(clist.at(i))) {
692 strcmp(cu->getIO()->getEntry(), thePrs->GetEntry()) == 0) {
698 //jfa tmp:aViewFrame->unHighlightAll();
705 void DeleteActors (VISU::Prs3d_i* thePrs)
709 // 1. Find appropriate application (code like in TNewViewManagerEvent::Execute())
710 SALOMEDS::Study_var myStudyDocument = thePrs->GetStudyDocument();
711 SalomeApp_Application* anApp = NULL;
712 CORBA::String_var studyName = myStudyDocument->Name();
713 std::string aStudyName = studyName.in();
714 SUIT_Session* aSession = SUIT_Session::session();
715 QList<SUIT_Application*> anApplications = aSession->applications();
716 QList<SUIT_Application*>::Iterator anIter = anApplications.begin();
717 while (anIter != anApplications.end()) {
718 SUIT_Application* aSUITApp = *anIter;
719 if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
720 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
721 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
722 if (aStudyName == aCStudy->Name()) {
723 anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
734 // 2. Remove corresponding IO from selection
735 SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
736 CORBA::String_var anEntry = aSObject->GetID();
738 LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
739 SALOME_ListIO aListIO, aNewListIO;
740 aSelectionMgr->selectedObjects(aListIO);
742 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
743 if (it.Value()->hasEntry()) {
744 std::string aCurEntry (it.Value()->getEntry());
745 if (aCurEntry != std::string( anEntry.in() ) ) {
746 aNewListIO.Append(it.Value());
751 aSelectionMgr->setSelectedObjects(aNewListIO);
754 ViewManagerList aViewManagerList;
755 anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
756 QList<SUIT_ViewManager*>::Iterator anVMIter = aViewManagerList.begin();
757 for (; anVMIter != aViewManagerList.end(); anVMIter++ ) {
758 SUIT_ViewManager* aViewManager = *anVMIter;
759 QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
760 for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
761 if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
762 if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
763 VISU_Actor* anActor = NULL;
764 VTK::ActorCollectionCopy aCopy(vw->getRenderer()->GetActors());
765 vtkActorCollection *anActColl = aCopy.GetActors();
766 anActColl->InitTraversal();
767 vtkActor *aVTKActor = anActColl->GetNextActor();
768 for (; !anActor && aVTKActor; aVTKActor = anActColl->GetNextActor()) {
769 if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(aVTKActor)) {
770 if (thePrs == anVISUActor->GetPrs3d()) {
771 anActor = anVISUActor;
776 vw->RemoveActor(anActor);