1 // Copyright (C) 2007-2008 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
22 // VISU OBJECT : interactive object for VISU entities implementation
23 // File : VISU_ViewManager_i.cc
24 // Author : Alexey PETROV
27 #include "VISU_ViewManager_i.hh"
28 #include "VISU_View_i.hh"
29 #include "VISU_Prs3d_i.hh"
30 #include "VISU_Table_i.hh"
32 #include "VISU_Actor.h"
33 #include "VISU_ActorFactory.h"
35 #include "SUIT_Tools.h"
36 #include "SUIT_Session.h"
37 #include "SUIT_ViewWindow.h"
38 #include "SUIT_ViewManager.h"
40 #include "SVTK_ViewWindow.h"
41 #include "SVTK_ViewModel.h"
42 #include "VTKViewer_Algorithm.h"
43 #include "SPlot2d_Curve.h"
44 #include "Plot2d_ViewFrame.h"
45 #include "Plot2d_ViewWindow.h"
46 #include "Plot2d_ViewModel.h"
48 #include "SalomeApp_Study.h"
49 #include "SalomeApp_Application.h"
50 #include "LightApp_SelectionMgr.h"
52 #include "SALOME_Event.h"
53 #include "SALOME_ListIO.hxx"
54 #include "SALOME_ListIteratorOfListIO.hxx"
56 #include "VTKViewer_Algorithm.h"
57 #include "SVTK_Functor.h"
59 #include <vtkCamera.h>
60 #include <vtkRenderer.h>
61 #include <vtkRenderWindow.h>
63 #include <QApplication>
68 static int MYDEBUG = 0;
70 static int MYDEBUG = 0;
75 struct TNewViewManagerEvent: public SALOME_Event
78 typedef SalomeApp_Application* TResult;
81 TNewViewManagerEvent (const int theStudyId):
82 myStudyId(theStudyId),
90 MESSAGE("Find application for study with id = : " << myStudyId);
91 SUIT_Session* aSession = SUIT_Session::session();
92 QList<SUIT_Application*> anApplications = aSession->applications();
93 QList<SUIT_Application*>::Iterator anIter = anApplications.begin();
94 while ( anIter != anApplications.end() ) {
95 SUIT_Application* anApp = *anIter;
96 if (SUIT_Study* aSStudy = anApp->activeStudy()) {
97 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
98 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
99 //if (myStudyName == aCStudy->Name()) {
100 if (myStudyId == aCStudy->StudyId()) {
101 myResult = dynamic_cast<SalomeApp_Application*>(anApp);
110 //MESSAGE("Error: application is not found for study : " << myStudyName);
111 MESSAGE("Error: application is not found for study with id = : " << myStudyId);
116 //===========================================================================
117 ViewManager_i::ViewManager_i(SALOMEDS::Study_ptr theStudy)
119 if(MYDEBUG) MESSAGE("ViewManager_i::ViewManager_i - "<<this);
121 //CORBA::String_var aStudyName = theStudy->Name();
122 //myApplication = ProcessEvent(new TNewViewManagerEvent(aStudyName.in()));
123 int aStudyID = theStudy->StudyId();
124 myApplication = ProcessEvent(new TNewViewManagerEvent(aStudyID));
128 ViewManager_i::~ViewManager_i()
130 if(MYDEBUG) MESSAGE("ViewManager_i::~ViewManager_i - "<<this);
134 struct TCurrentViewEvent: public SALOME_Event
136 SalomeApp_Application* myApplication;
137 typedef VISU::View_ptr TResult;
140 TCurrentViewEvent(SalomeApp_Application* theApplication):
141 myApplication(theApplication),
142 myResult(VISU::View::_nil())
149 VISU::View3D_i* aView = new View3D_i (myApplication);
150 if (aView->Create(0))
151 myResult = aView->_this();
155 VISU::View_ptr ViewManager_i::GetCurrentView(){
156 return ProcessEvent(new TCurrentViewEvent(myApplication));
160 template<class TViewFrame>
161 struct TCreateViewFrameEvent: public SALOME_Event
163 SalomeApp_Application* myApplication;
164 typedef typename TViewFrame::TInterface TInterface;
165 typedef typename TInterface::_ptr_type TResult;
168 TCreateViewFrameEvent (SalomeApp_Application* theApplication):
169 myApplication(theApplication),
170 myResult(TInterface::_nil())
177 //if (CheckStudy(myStudyDocument)) {
179 TViewFrame* pView = new TViewFrame (myApplication);
180 if (pView->Create(1)) {
181 myResult = pView->_this();
182 qApp->processEvents(); // Fix for bug 9929
189 VISU::View3D_ptr ViewManager_i::Create3DView()
191 if (MYDEBUG) MESSAGE("ViewManager_i::Create3DView");
192 return ProcessEvent(new TCreateViewFrameEvent<View3D_i>(myApplication));
195 VISU::XYPlot_ptr ViewManager_i::CreateXYPlot()
197 if (MYDEBUG) MESSAGE("ViewManager_i::CreateXYPlot");
198 return ProcessEvent(new TCreateViewFrameEvent<XYPlot_i>(myApplication));
201 class TCreateViewEvent: public SALOME_Event
204 TCreateViewEvent (SalomeApp_Application* theApplication)
205 : myApplication(theApplication)
208 SalomeApp_Application* myApplication;
211 class TCreateTableViewFrameEvent: public TCreateViewEvent
215 TCreateTableViewFrameEvent (SalomeApp_Application* theApplication,
217 TCreateViewEvent(theApplication),
219 myResult(VISU::TableView::_nil())
222 virtual void Execute()
224 //if (CheckStudy(myStudyDocument)) {
225 VISU::TableView_i* pView = new TableView_i (myApplication);
226 if (pView->Create(myTable) != NULL)
227 myResult = pView->_this();
230 typedef VISU::TableView_ptr TResult;
234 VISU::TableView_ptr ViewManager_i::CreateTableView (VISU::Table_ptr theTable)
236 if (MYDEBUG) MESSAGE("ViewManager_i::CreateTableView");
237 //return ProcessEvent(new TCreateViewFrameEvent<TableView_i>(myApplication));
238 return ProcessEvent(new TCreateTableViewFrameEvent (myApplication, theTable));
241 void ViewManager_i::Destroy (View_ptr theView)
243 class TEvent: public SALOME_Event {
246 TEvent(View_ptr theView):
249 virtual void Execute(){
250 if (!CORBA::is_nil(myView)) {
251 if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(myView).in())) {
253 pView->_remove_ref();
259 if (MYDEBUG) MESSAGE("ViewManager_i::Destroy - " << theView->_is_nil());
260 ProcessVoidEvent(new TEvent(theView));
263 //===========================================================================
264 // VISU namespace functions
265 //===========================================================================
266 vtkRenderer* GetRenderer (SUIT_ViewWindow* theViewWindow)
268 if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(theViewWindow))
269 return vw->getRenderer();
273 vtkCamera* GetCamera (SUIT_ViewWindow* theViewWindow)
275 return GetRenderer(theViewWindow)->GetActiveCamera();
278 void RepaintView (SUIT_ViewWindow* theViewWindow)
280 if (SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(theViewWindow)) {
281 vf->getRenderer()->ResetCameraClippingRange();
282 vf->getRenderWindow()->Render();
286 VISU_Actor* UpdateViewer (SUIT_ViewWindow* theViewWindow, int theDisplaing, Prs3d_i* thePrs)
288 SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(theViewWindow);
289 if (!vf) return NULL;
290 if(MYDEBUG) MESSAGE("UpdateViewer - theDisplaing = "<<theDisplaing<<"; thePrs = "<<thePrs);
291 vtkRenderer *aRen = vf->getRenderer();
292 VTK::ActorCollectionCopy aCopy(aRen->GetActors());
293 vtkActorCollection* anActColl = aCopy.GetActors();
295 VISU_Actor *anVISUActor = NULL, *aResActor = NULL;
296 for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL;){
297 if(anActor->IsA("VISU_Actor")){
298 anVISUActor = VISU_Actor::SafeDownCast(anActor);
299 if (thePrs == anVISUActor->GetPrs3d()) {
300 aResActor = anVISUActor;
301 if(theDisplaing < eErase)
302 aResActor->VisibilityOn();
304 aResActor->VisibilityOff();
306 if(theDisplaing > eDisplay)
307 anVISUActor->VisibilityOff();
308 else if ( theDisplaing < eDisplay )
309 anVISUActor->VisibilityOn();
314 RepaintView(theViewWindow);
317 if(thePrs != NULL && theDisplaing < eErase){
319 anVISUActor = thePrs->CreateActor();
320 vf->AddActor(anVISUActor);
321 }catch(std::exception& exc){
322 if(MYDEBUG) INFOS(exc.what());
325 if(MYDEBUG) INFOS("Unknown exception was occured!!!");
329 RepaintView(theViewWindow);
333 void UpdatePlot2d (Plot2d_ViewFrame *theView,int theDisplaying, Curve_i* theCurve)
335 if(MYDEBUG) MESSAGE("UpdatePlot2d - theDisplaying = " << theDisplaying);
338 QList<Plot2d_Curve*> clist;
339 theView->getCurves(clist);
340 if (theDisplaying == eEraseAll) {
341 for (int i = 0; i < clist.count(); i++) {
342 if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing all : curve - " << clist.at(i));
343 theView->eraseCurve(clist.at(i));
345 } else if (theDisplaying == eErase) {
347 for (int i = 0; i < clist.count(); i++) {
348 SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
349 if (aSPlot2dC->hasIO() &&
350 !strcmp(theCurve->GetEntry().c_str(), aSPlot2dC->getIO()->getEntry())) {
351 if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing : curve - " << aSPlot2dC);
352 theView->eraseCurve(aSPlot2dC);
356 } else if (theDisplaying == eDisplay) {
359 for (int i = 0; i < clist.count(); i++) {
360 SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
361 if (aSPlot2dC->hasIO() &&
362 !strcmp(theCurve->GetEntry().c_str(), aSPlot2dC->getIO()->getEntry())) {
363 if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve - " << aSPlot2dC);
364 aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() );
365 aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() );
366 aSPlot2dC->setHorUnits( theCurve->GetHorUnits().c_str() );
367 aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() );
371 int nbPoints = theCurve->GetData( xList, yList, zList );
372 if (nbPoints > 0 && xList && yList) {
373 aSPlot2dC->setData( xList, yList, nbPoints, zList );
375 if (!theCurve->IsAuto()) {
376 aSPlot2dC->setLine((Plot2d::LineType)theCurve->GetLine(),
377 theCurve->GetLineWidth());
378 aSPlot2dC->setMarker((Plot2d::MarkerType)theCurve->GetMarker());
379 SALOMEDS::Color color = theCurve->GetColor();
380 aSPlot2dC->setColor(QColor((int)(color.R*255.),
382 (int)(color.B*255.)));
384 aSPlot2dC->setAutoAssign(theCurve->IsAuto());
385 theView->displayCurve(aSPlot2dC);
390 Plot2d_Curve* crv = theCurve->CreatePresentation();
391 if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve (new) - "<<crv );
393 theView->displayCurve( crv );
394 theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
395 theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
396 SALOMEDS::Color newColor;
397 newColor.R = crv->getColor().red()/255.;
398 newColor.G = crv->getColor().green()/255.;
399 newColor.B = crv->getColor().blue()/255.;
400 theCurve->SetColor( newColor );
401 crv->setAutoAssign( theCurve->IsAuto() );
405 } else if (theDisplaying == eDisplayOnly) {
408 for (int i = 0; i < clist.count(); i++) {
409 SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
410 if (aSPlot2dC->hasIO() &&
411 !strcmp(theCurve->GetEntry().c_str(), aSPlot2dC->getIO()->getEntry())) {
412 if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve - " << aSPlot2dC);
413 aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() );
414 aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() );
415 aSPlot2dC->setHorUnits( theCurve->GetHorUnits().c_str() );
416 aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() );
420 int nbPoints = theCurve->GetData( xList, yList, zList );
421 if ( nbPoints > 0 && xList && yList ) {
422 aSPlot2dC->setData( xList, yList, nbPoints, zList );
424 if ( !theCurve->IsAuto() ) {
425 aSPlot2dC->setLine((Plot2d::LineType)theCurve->GetLine(), theCurve->GetLineWidth());
426 aSPlot2dC->setMarker((Plot2d::MarkerType)theCurve->GetMarker());
427 SALOMEDS::Color color = theCurve->GetColor();
428 aSPlot2dC->setColor(QColor((int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.)));
430 aSPlot2dC->setAutoAssign(theCurve->IsAuto());
431 theView->displayCurve(aSPlot2dC);
434 theView->eraseCurve(aSPlot2dC);
438 Plot2d_Curve* crv = theCurve->CreatePresentation();
439 if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve (new) - " << crv);
441 theView->displayCurve(crv);
442 theCurve->SetLine((VISU::Curve::LineType)crv->getLine(), crv->getLineWidth());
443 theCurve->SetMarker((VISU::Curve::MarkerType)crv->getMarker());
444 SALOMEDS::Color newColor;
445 newColor.R = crv->getColor().red()/255.;
446 newColor.G = crv->getColor().green()/255.;
447 newColor.B = crv->getColor().blue()/255.;
448 theCurve->SetColor(newColor);
449 crv->setAutoAssign(theCurve->IsAuto());
457 //----------------------------------------------------------------------------
460 VISU::Prs3d_i* myPrs3d;
462 TIsSamePrs3d(VISU::Prs3d_i* thePrs3d):
467 operator()(VISU_Actor* theActor)
469 return theActor->GetPrs3d() == myPrs3d;
474 //----------------------------------------------------------------------------
476 FindActor(SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs3d)
481 vtkRenderer* aRenderer = theViewWindow->getRenderer();
482 VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
483 vtkActorCollection* anActors = aCopy.GetActors();
484 return SVTK::Find<VISU_Actor>(anActors, VISU::TIsSamePrs3d(thePrs3d));
488 //----------------------------------------------------------------------------
491 VISU::TActorFactory* myActor;
493 TIsSameActor(VISU::TActorFactory* theActor):
498 operator()(VISU_ActorBase* theActor)
500 return theActor->GetFactory() == myActor;
504 //----------------------------------------------------------------------------
506 FindActorBase(SVTK_ViewWindow* theViewWindow, VISU::TActorFactory* theActor)
511 vtkRenderer* aRenderer = theViewWindow->getRenderer();
512 VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
513 vtkActorCollection* anActors = aCopy.GetActors();
514 return SVTK::Find<VISU_ActorBase>(anActors, VISU::TIsSameActor(theActor));
518 //----------------------------------------------------------------------------
519 struct TDeleteActorsEvent: public SALOME_Event
521 VISU::Curve_i* myPrs;
523 TDeleteActorsEvent (VISU::Curve_i* thePrs):
533 // 1. Find appropriate application (code like in TNewViewManagerEvent::Execute())
534 SALOMEDS::Study_var myStudyDocument = myPrs->GetStudyDocument();
535 SalomeApp_Application* anApp = NULL;
536 CORBA::String_var studyName = myStudyDocument->Name();
537 std::string aStudyName = studyName.in();
538 SUIT_Session* aSession = SUIT_Session::session();
539 QList<SUIT_Application*> anApplications = aSession->applications();
540 QList<SUIT_Application*>::Iterator anIter = anApplications.begin();
541 while ( anIter != anApplications.end() ) {
542 SUIT_Application* aSUITApp = *anIter;
543 if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
544 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
545 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
546 if (aStudyName == aCStudy->Name()) {
547 anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
558 // 2. Remove corresponding IO from selection
559 SALOMEDS::SObject_var aSObject = myPrs->GetSObject();
560 CORBA::String_var anEntry = aSObject->GetID();
562 LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
563 SALOME_ListIO aListIO, aNewListIO;
564 aSelectionMgr->selectedObjects(aListIO);
566 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
567 if (it.Value()->hasEntry()) {
568 std::string aCurEntry (it.Value()->getEntry());
569 if (aCurEntry != std::string( anEntry.in() ) ) {
570 aNewListIO.Append(it.Value());
575 aSelectionMgr->setSelectedObjects(aNewListIO);
578 ViewManagerList aViewManagerList;
579 anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
580 QList<SUIT_ViewManager*>::Iterator anVMIter = aViewManagerList.begin();
581 for (; anVMIter != aViewManagerList.end(); anVMIter++ ) {
582 SUIT_ViewManager* aViewManager = *anVMIter;
583 QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
584 for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
585 if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
586 if (Plot2d_ViewWindow* vw = dynamic_cast<Plot2d_ViewWindow*>(aViewWindow)) {
587 Plot2d_ViewFrame* vf = vw->getViewFrame();
588 QList<Plot2d_Curve*> clist;
589 vf->getCurves(clist);
590 for (int i = 0; i < clist.count(); i++) {
591 if (SPlot2d_Curve* cu = dynamic_cast<SPlot2d_Curve*>(clist.at(i))) {
593 strcmp(myPrs->GetEntry().c_str(), cu->getIO()->getEntry())) {
599 //jfa tmp:aViewFrame->unHighlightAll();
607 void DeleteActors (VISU::Curve_i* thePrs)
610 ProcessVoidEvent(new TDeleteActorsEvent (thePrs));
612 /* // 1. Find appropriate application (code like in TNewViewManagerEvent::Execute())
613 SALOMEDS::Study_var myStudyDocument = thePrs->GetStudyDocument();
614 SalomeApp_Application* anApp = NULL;
615 CORBA::String_var studyName = myStudyDocument->Name();
616 std::string aStudyName = studyName.in();
617 SUIT_Session* aSession = SUIT_Session::session();
618 QPtrList<SUIT_Application> anApplications = aSession->applications();
619 QPtrListIterator<SUIT_Application> anIter (anApplications);
620 while (SUIT_Application* aSUITApp = anIter.current()) {
622 if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
623 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
624 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
625 if (aStudyName == aCStudy->Name()) {
626 anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
636 // 2. Remove corresponding IO from selection
637 SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
638 CORBA::String_var anEntry = aSObject->GetID();
640 LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
641 SALOME_ListIO aListIO, aNewListIO;
642 aSelectionMgr->selectedObjects(aListIO);
644 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
645 if (it.Value()->hasEntry()) {
646 std::string aCurEntry (it.Value()->getEntry());
647 if (aCurEntry != std::string( anEntry.in() ) ) {
648 aNewListIO.Append(it.Value());
653 aSelectionMgr->setSelectedObjects(aNewListIO);
656 ViewManagerList aViewManagerList;
657 anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
658 QPtrListIterator<SUIT_ViewManager> anVMIter (aViewManagerList);
659 for (; anVMIter.current(); ++anVMIter) {
660 SUIT_ViewManager* aViewManager = anVMIter.current();
661 QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
662 for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
663 if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
664 if (Plot2d_ViewWindow* vw = dynamic_cast<Plot2d_ViewWindow*>(aViewWindow)) {
665 Plot2d_ViewFrame* vf = vw->getViewFrame();
666 QList<Plot2d_Curve> clist;
667 vf->getCurves(clist);
668 for (int i = 0; i < clist.count(); i++) {
669 if (SPlot2d_Curve* cu = dynamic_cast<SPlot2d_Curve*>(clist.at(i))) {
671 strcmp(cu->getIO()->getEntry(), thePrs->GetEntry()) == 0) {
677 //jfa tmp:aViewFrame->unHighlightAll();
684 void DeleteActors (VISU::Prs3d_i* thePrs)
688 // 1. Find appropriate application (code like in TNewViewManagerEvent::Execute())
689 SALOMEDS::Study_var myStudyDocument = thePrs->GetStudyDocument();
690 SalomeApp_Application* anApp = NULL;
691 CORBA::String_var studyName = myStudyDocument->Name();
692 std::string aStudyName = studyName.in();
693 SUIT_Session* aSession = SUIT_Session::session();
694 QList<SUIT_Application*> anApplications = aSession->applications();
695 QList<SUIT_Application*>::Iterator anIter = anApplications.begin();
696 while (anIter != anApplications.end()) {
697 SUIT_Application* aSUITApp = *anIter;
698 if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
699 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
700 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
701 if (aStudyName == aCStudy->Name()) {
702 anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
713 // 2. Remove corresponding IO from selection
714 SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
715 CORBA::String_var anEntry = aSObject->GetID();
717 LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
718 SALOME_ListIO aListIO, aNewListIO;
719 aSelectionMgr->selectedObjects(aListIO);
721 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
722 if (it.Value()->hasEntry()) {
723 std::string aCurEntry (it.Value()->getEntry());
724 if (aCurEntry != std::string( anEntry.in() ) ) {
725 aNewListIO.Append(it.Value());
730 aSelectionMgr->setSelectedObjects(aNewListIO);
733 ViewManagerList aViewManagerList;
734 anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
735 QList<SUIT_ViewManager*>::Iterator anVMIter = aViewManagerList.begin();
736 for (; anVMIter != aViewManagerList.end(); anVMIter++ ) {
737 SUIT_ViewManager* aViewManager = *anVMIter;
738 QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
739 for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
740 if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
741 if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
742 VISU_Actor* anActor = NULL;
743 VTK::ActorCollectionCopy aCopy(vw->getRenderer()->GetActors());
744 vtkActorCollection *anActColl = aCopy.GetActors();
745 anActColl->InitTraversal();
746 vtkActor *aVTKActor = anActColl->GetNextActor();
747 for (; !anActor && aVTKActor; aVTKActor = anActColl->GetNextActor()) {
748 if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(aVTKActor)) {
749 if (thePrs == anVISUActor->GetPrs3d()) {
750 anActor = anVISUActor;
755 vw->RemoveActor(anActor);