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 "SPlot2d_Curve.h"
43 #include "Plot2d_ViewFrame.h"
44 #include "Plot2d_ViewWindow.h"
45 #include "Plot2d_ViewModel.h"
47 #include "SalomeApp_Study.h"
48 #include "SalomeApp_Application.h"
49 #include "LightApp_SelectionMgr.h"
51 #include "SALOME_Event.h"
52 #include "SALOME_ListIO.hxx"
53 #include "SALOME_ListIteratorOfListIO.hxx"
55 #include "VTKViewer_Algorithm.h"
56 #include "SVTK_Functor.h"
58 #include <vtkCamera.h>
59 #include <vtkRenderer.h>
60 #include <vtkRenderWindow.h>
62 #include <QApplication>
67 static int MYDEBUG = 0;
69 static int MYDEBUG = 0;
74 struct TNewViewManagerEvent: public SALOME_Event
77 typedef SalomeApp_Application* TResult;
80 TNewViewManagerEvent (const int theStudyId):
81 myStudyId(theStudyId),
89 MESSAGE("Find application for study with id = : " << myStudyId);
90 SUIT_Session* aSession = SUIT_Session::session();
91 QList<SUIT_Application*> anApplications = aSession->applications();
92 QList<SUIT_Application*>::Iterator anIter = anApplications.begin();
93 while ( anIter != anApplications.end() ) {
94 SUIT_Application* anApp = *anIter;
95 if (SUIT_Study* aSStudy = anApp->activeStudy()) {
96 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
97 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
98 //if (myStudyName == aCStudy->Name()) {
99 if (myStudyId == aCStudy->StudyId()) {
100 myResult = dynamic_cast<SalomeApp_Application*>(anApp);
109 //MESSAGE("Error: application is not found for study : " << myStudyName);
110 MESSAGE("Error: application is not found for study with id = : " << myStudyId);
115 //===========================================================================
116 ViewManager_i::ViewManager_i(SALOMEDS::Study_ptr theStudy)
118 if(MYDEBUG) MESSAGE("ViewManager_i::ViewManager_i - "<<this);
120 //CORBA::String_var aStudyName = theStudy->Name();
121 //myApplication = ProcessEvent(new TNewViewManagerEvent(aStudyName.in()));
122 int aStudyID = theStudy->StudyId();
123 myApplication = ProcessEvent(new TNewViewManagerEvent(aStudyID));
127 ViewManager_i::~ViewManager_i()
129 if(MYDEBUG) MESSAGE("ViewManager_i::~ViewManager_i - "<<this);
133 struct TCurrentViewEvent: public SALOME_Event
135 SalomeApp_Application* myApplication;
136 typedef VISU::View_ptr TResult;
139 TCurrentViewEvent(SalomeApp_Application* theApplication):
140 myApplication(theApplication),
141 myResult(VISU::View::_nil())
148 VISU::View3D_i* aView = new View3D_i (myApplication);
149 if (aView->Create(0))
150 myResult = aView->_this();
154 VISU::View_ptr ViewManager_i::GetCurrentView(){
155 return ProcessEvent(new TCurrentViewEvent(myApplication));
159 template<class TViewFrame>
160 struct TCreateViewFrameEvent: public SALOME_Event
162 SalomeApp_Application* myApplication;
163 typedef typename TViewFrame::TInterface TInterface;
164 typedef typename TInterface::_ptr_type TResult;
167 TCreateViewFrameEvent (SalomeApp_Application* theApplication):
168 myApplication(theApplication),
169 myResult(TInterface::_nil())
176 //if (CheckStudy(myStudyDocument)) {
178 TViewFrame* pView = new TViewFrame (myApplication);
179 if (pView->Create(1)) {
180 myResult = pView->_this();
181 qApp->processEvents(); // Fix for bug 9929
188 VISU::View3D_ptr ViewManager_i::Create3DView()
190 if (MYDEBUG) MESSAGE("ViewManager_i::Create3DView");
191 return ProcessEvent(new TCreateViewFrameEvent<View3D_i>(myApplication));
194 VISU::XYPlot_ptr ViewManager_i::CreateXYPlot()
196 if (MYDEBUG) MESSAGE("ViewManager_i::CreateXYPlot");
197 return ProcessEvent(new TCreateViewFrameEvent<XYPlot_i>(myApplication));
200 class TCreateViewEvent: public SALOME_Event
203 TCreateViewEvent (SalomeApp_Application* theApplication)
204 : myApplication(theApplication)
207 SalomeApp_Application* myApplication;
210 class TCreateTableViewFrameEvent: public TCreateViewEvent
214 TCreateTableViewFrameEvent (SalomeApp_Application* theApplication,
216 TCreateViewEvent(theApplication),
218 myResult(VISU::TableView::_nil())
221 virtual void Execute()
223 //if (CheckStudy(myStudyDocument)) {
224 VISU::TableView_i* pView = new TableView_i (myApplication);
225 if (pView->Create(myTable) != NULL)
226 myResult = pView->_this();
229 typedef VISU::TableView_ptr TResult;
233 VISU::TableView_ptr ViewManager_i::CreateTableView (VISU::Table_ptr theTable)
235 if (MYDEBUG) MESSAGE("ViewManager_i::CreateTableView");
236 //return ProcessEvent(new TCreateViewFrameEvent<TableView_i>(myApplication));
237 return ProcessEvent(new TCreateTableViewFrameEvent (myApplication, theTable));
240 void ViewManager_i::Destroy (View_ptr theView)
242 class TEvent: public SALOME_Event {
245 TEvent(View_ptr theView):
248 virtual void Execute(){
249 if (!CORBA::is_nil(myView)) {
250 if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(myView).in())) {
252 pView->_remove_ref();
258 if (MYDEBUG) MESSAGE("ViewManager_i::Destroy - " << theView->_is_nil());
259 ProcessVoidEvent(new TEvent(theView));
262 //===========================================================================
263 // VISU namespace functions
264 //===========================================================================
265 vtkRenderer* GetRenderer (SUIT_ViewWindow* theViewWindow)
267 if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(theViewWindow))
268 return vw->getRenderer();
272 vtkCamera* GetCamera (SUIT_ViewWindow* theViewWindow)
274 return GetRenderer(theViewWindow)->GetActiveCamera();
277 void RepaintView (SUIT_ViewWindow* theViewWindow)
279 if (SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(theViewWindow)) {
280 vf->getRenderer()->ResetCameraClippingRange();
281 vf->getRenderWindow()->Render();
285 VISU_Actor* UpdateViewer (SUIT_ViewWindow* theViewWindow, int theDisplaing, Prs3d_i* thePrs)
287 SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(theViewWindow);
288 if (!vf) return NULL;
289 if(MYDEBUG) MESSAGE("UpdateViewer - theDisplaing = "<<theDisplaing<<"; thePrs = "<<thePrs);
290 vtkRenderer *aRen = vf->getRenderer();
291 vtkActorCollection *anActColl = aRen->GetActors();
293 VISU_Actor *anVISUActor = NULL, *aResActor = NULL;
294 for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL;){
295 if(anActor->IsA("VISU_Actor")){
296 anVISUActor = VISU_Actor::SafeDownCast(anActor);
297 if (thePrs == anVISUActor->GetPrs3d()) {
298 aResActor = anVISUActor;
299 if(theDisplaing < eErase)
300 aResActor->VisibilityOn();
302 aResActor->VisibilityOff();
304 if(theDisplaing > eDisplay)
305 anVISUActor->VisibilityOff();
307 anVISUActor->VisibilityOn();
312 RepaintView(theViewWindow);
315 if(thePrs != NULL && theDisplaing < eErase){
317 anVISUActor = thePrs->CreateActor();
318 vf->AddActor(anVISUActor);
319 }catch(std::exception& exc){
320 if(MYDEBUG) INFOS(exc.what());
323 if(MYDEBUG) INFOS("Unknown exception was occured!!!");
327 RepaintView(theViewWindow);
331 void UpdatePlot2d (Plot2d_ViewFrame *theView,int theDisplaying, Curve_i* theCurve)
333 if(MYDEBUG) MESSAGE("UpdatePlot2d - theDisplaying = " << theDisplaying);
336 QList<Plot2d_Curve*> clist;
337 theView->getCurves(clist);
338 if (theDisplaying == eEraseAll) {
339 for (int i = 0; i < clist.count(); i++) {
340 if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing all : curve - " << clist.at(i));
341 theView->eraseCurve(clist.at(i));
343 } else if (theDisplaying == eErase) {
345 for (int i = 0; i < clist.count(); i++) {
346 SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
347 if (aSPlot2dC->hasIO() &&
348 !strcmp(theCurve->GetEntry().c_str(), aSPlot2dC->getIO()->getEntry())) {
349 if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing : curve - " << aSPlot2dC);
350 theView->eraseCurve(aSPlot2dC);
354 } else if (theDisplaying == eDisplay) {
357 for (int i = 0; i < clist.count(); i++) {
358 SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
359 if (aSPlot2dC->hasIO() &&
360 !strcmp(theCurve->GetEntry().c_str(), aSPlot2dC->getIO()->getEntry())) {
361 if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve - " << aSPlot2dC);
362 aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() );
363 aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() );
364 aSPlot2dC->setHorUnits( theCurve->GetHorUnits().c_str() );
365 aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() );
369 int nbPoints = theCurve->GetData( xList, yList, zList );
370 if (nbPoints > 0 && xList && yList) {
371 aSPlot2dC->setData( xList, yList, nbPoints, zList );
373 if (!theCurve->IsAuto()) {
374 aSPlot2dC->setLine((Plot2d::LineType)theCurve->GetLine(),
375 theCurve->GetLineWidth());
376 aSPlot2dC->setMarker((Plot2d::MarkerType)theCurve->GetMarker());
377 SALOMEDS::Color color = theCurve->GetColor();
378 aSPlot2dC->setColor(QColor((int)(color.R*255.),
380 (int)(color.B*255.)));
382 aSPlot2dC->setAutoAssign(theCurve->IsAuto());
383 theView->displayCurve(aSPlot2dC);
388 Plot2d_Curve* crv = theCurve->CreatePresentation();
389 if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve (new) - "<<crv );
391 theView->displayCurve( crv );
392 theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
393 theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
394 SALOMEDS::Color newColor;
395 newColor.R = crv->getColor().red()/255.;
396 newColor.G = crv->getColor().green()/255.;
397 newColor.B = crv->getColor().blue()/255.;
398 theCurve->SetColor( newColor );
399 crv->setAutoAssign( theCurve->IsAuto() );
403 } else if (theDisplaying == eDisplayOnly) {
406 for (int i = 0; i < clist.count(); i++) {
407 SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
408 if (aSPlot2dC->hasIO() &&
409 !strcmp(theCurve->GetEntry().c_str(), aSPlot2dC->getIO()->getEntry())) {
410 if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve - " << aSPlot2dC);
411 aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() );
412 aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() );
413 aSPlot2dC->setHorUnits( theCurve->GetHorUnits().c_str() );
414 aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() );
418 int nbPoints = theCurve->GetData( xList, yList, zList );
419 if ( nbPoints > 0 && xList && yList ) {
420 aSPlot2dC->setData( xList, yList, nbPoints, zList );
422 if ( !theCurve->IsAuto() ) {
423 aSPlot2dC->setLine((Plot2d::LineType)theCurve->GetLine(), theCurve->GetLineWidth());
424 aSPlot2dC->setMarker((Plot2d::MarkerType)theCurve->GetMarker());
425 SALOMEDS::Color color = theCurve->GetColor();
426 aSPlot2dC->setColor(QColor((int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.)));
428 aSPlot2dC->setAutoAssign(theCurve->IsAuto());
429 theView->displayCurve(aSPlot2dC);
432 theView->eraseCurve(aSPlot2dC);
436 Plot2d_Curve* crv = theCurve->CreatePresentation();
437 if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve (new) - " << crv);
439 theView->displayCurve(crv);
440 theCurve->SetLine((VISU::Curve::LineType)crv->getLine(), crv->getLineWidth());
441 theCurve->SetMarker((VISU::Curve::MarkerType)crv->getMarker());
442 SALOMEDS::Color newColor;
443 newColor.R = crv->getColor().red()/255.;
444 newColor.G = crv->getColor().green()/255.;
445 newColor.B = crv->getColor().blue()/255.;
446 theCurve->SetColor(newColor);
447 crv->setAutoAssign(theCurve->IsAuto());
455 //----------------------------------------------------------------------------
458 VISU::Prs3d_i* myPrs3d;
460 TIsSamePrs3d(VISU::Prs3d_i* thePrs3d):
465 operator()(VISU_Actor* theActor)
467 return theActor->GetPrs3d() == myPrs3d;
472 //----------------------------------------------------------------------------
474 FindActor(SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs3d)
479 vtkRenderer* aRenderer = theViewWindow->getRenderer();
480 vtkActorCollection* anActors = aRenderer->GetActors();
481 return SVTK::Find<VISU_Actor>(anActors, VISU::TIsSamePrs3d(thePrs3d));
485 //----------------------------------------------------------------------------
488 VISU::TActorFactory* myActor;
490 TIsSameActor(VISU::TActorFactory* theActor):
495 operator()(VISU_ActorBase* theActor)
497 return theActor->GetFactory() == myActor;
501 //----------------------------------------------------------------------------
503 FindActorBase(SVTK_ViewWindow* theViewWindow, VISU::TActorFactory* theActor)
508 vtkRenderer* aRenderer = theViewWindow->getRenderer();
509 vtkActorCollection* anActors = aRenderer->GetActors();
510 return SVTK::Find<VISU_ActorBase>(anActors, VISU::TIsSameActor(theActor));
514 //----------------------------------------------------------------------------
515 struct TDeleteActorsEvent: public SALOME_Event
517 VISU::Curve_i* myPrs;
519 TDeleteActorsEvent (VISU::Curve_i* thePrs):
529 // 1. Find appropriate application (code like in TNewViewManagerEvent::Execute())
530 SALOMEDS::Study_var myStudyDocument = myPrs->GetStudyDocument();
531 SalomeApp_Application* anApp = NULL;
532 CORBA::String_var studyName = myStudyDocument->Name();
533 std::string aStudyName = studyName.in();
534 SUIT_Session* aSession = SUIT_Session::session();
535 QList<SUIT_Application*> anApplications = aSession->applications();
536 QList<SUIT_Application*>::Iterator anIter = anApplications.begin();
537 while ( anIter != anApplications.end() ) {
538 SUIT_Application* aSUITApp = *anIter;
539 if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
540 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
541 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
542 if (aStudyName == aCStudy->Name()) {
543 anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
554 // 2. Remove corresponding IO from selection
555 SALOMEDS::SObject_var aSObject = myPrs->GetSObject();
556 CORBA::String_var anEntry = aSObject->GetID();
558 LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
559 SALOME_ListIO aListIO, aNewListIO;
560 aSelectionMgr->selectedObjects(aListIO);
562 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
563 if (it.Value()->hasEntry()) {
564 std::string aCurEntry (it.Value()->getEntry());
565 if (aCurEntry != std::string( anEntry.in() ) ) {
566 aNewListIO.Append(it.Value());
571 aSelectionMgr->setSelectedObjects(aNewListIO);
574 ViewManagerList aViewManagerList;
575 anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
576 QList<SUIT_ViewManager*>::Iterator anVMIter = aViewManagerList.begin();
577 for (; anVMIter != aViewManagerList.end(); anVMIter++ ) {
578 SUIT_ViewManager* aViewManager = *anVMIter;
579 QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
580 for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
581 if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
582 if (Plot2d_ViewWindow* vw = dynamic_cast<Plot2d_ViewWindow*>(aViewWindow)) {
583 Plot2d_ViewFrame* vf = vw->getViewFrame();
584 QList<Plot2d_Curve*> clist;
585 vf->getCurves(clist);
586 for (int i = 0; i < clist.count(); i++) {
587 if (SPlot2d_Curve* cu = dynamic_cast<SPlot2d_Curve*>(clist.at(i))) {
589 strcmp(myPrs->GetEntry().c_str(), cu->getIO()->getEntry())) {
595 //jfa tmp:aViewFrame->unHighlightAll();
603 void DeleteActors (VISU::Curve_i* thePrs)
606 ProcessVoidEvent(new TDeleteActorsEvent (thePrs));
608 /* // 1. Find appropriate application (code like in TNewViewManagerEvent::Execute())
609 SALOMEDS::Study_var myStudyDocument = thePrs->GetStudyDocument();
610 SalomeApp_Application* anApp = NULL;
611 CORBA::String_var studyName = myStudyDocument->Name();
612 std::string aStudyName = studyName.in();
613 SUIT_Session* aSession = SUIT_Session::session();
614 QPtrList<SUIT_Application> anApplications = aSession->applications();
615 QPtrListIterator<SUIT_Application> anIter (anApplications);
616 while (SUIT_Application* aSUITApp = anIter.current()) {
618 if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
619 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
620 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
621 if (aStudyName == aCStudy->Name()) {
622 anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
632 // 2. Remove corresponding IO from selection
633 SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
634 CORBA::String_var anEntry = aSObject->GetID();
636 LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
637 SALOME_ListIO aListIO, aNewListIO;
638 aSelectionMgr->selectedObjects(aListIO);
640 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
641 if (it.Value()->hasEntry()) {
642 std::string aCurEntry (it.Value()->getEntry());
643 if (aCurEntry != std::string( anEntry.in() ) ) {
644 aNewListIO.Append(it.Value());
649 aSelectionMgr->setSelectedObjects(aNewListIO);
652 ViewManagerList aViewManagerList;
653 anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
654 QPtrListIterator<SUIT_ViewManager> anVMIter (aViewManagerList);
655 for (; anVMIter.current(); ++anVMIter) {
656 SUIT_ViewManager* aViewManager = anVMIter.current();
657 QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
658 for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
659 if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
660 if (Plot2d_ViewWindow* vw = dynamic_cast<Plot2d_ViewWindow*>(aViewWindow)) {
661 Plot2d_ViewFrame* vf = vw->getViewFrame();
662 QList<Plot2d_Curve> clist;
663 vf->getCurves(clist);
664 for (int i = 0; i < clist.count(); i++) {
665 if (SPlot2d_Curve* cu = dynamic_cast<SPlot2d_Curve*>(clist.at(i))) {
667 strcmp(cu->getIO()->getEntry(), thePrs->GetEntry()) == 0) {
673 //jfa tmp:aViewFrame->unHighlightAll();
680 void DeleteActors (VISU::Prs3d_i* thePrs)
684 // 1. Find appropriate application (code like in TNewViewManagerEvent::Execute())
685 SALOMEDS::Study_var myStudyDocument = thePrs->GetStudyDocument();
686 SalomeApp_Application* anApp = NULL;
687 CORBA::String_var studyName = myStudyDocument->Name();
688 std::string aStudyName = studyName.in();
689 SUIT_Session* aSession = SUIT_Session::session();
690 QList<SUIT_Application*> anApplications = aSession->applications();
691 QList<SUIT_Application*>::Iterator anIter = anApplications.begin();
692 while (anIter != anApplications.end()) {
693 SUIT_Application* aSUITApp = *anIter;
694 if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
695 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
696 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
697 if (aStudyName == aCStudy->Name()) {
698 anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
709 // 2. Remove corresponding IO from selection
710 SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
711 CORBA::String_var anEntry = aSObject->GetID();
713 LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
714 SALOME_ListIO aListIO, aNewListIO;
715 aSelectionMgr->selectedObjects(aListIO);
717 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
718 if (it.Value()->hasEntry()) {
719 std::string aCurEntry (it.Value()->getEntry());
720 if (aCurEntry != std::string( anEntry.in() ) ) {
721 aNewListIO.Append(it.Value());
726 aSelectionMgr->setSelectedObjects(aNewListIO);
729 ViewManagerList aViewManagerList;
730 anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
731 QList<SUIT_ViewManager*>::Iterator anVMIter = aViewManagerList.begin();
732 for (; anVMIter != aViewManagerList.end(); anVMIter++ ) {
733 SUIT_ViewManager* aViewManager = *anVMIter;
734 QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
735 for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
736 if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
737 if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
738 VISU_Actor* anActor = NULL;
739 vtkActorCollection *anActColl = vw->getRenderer()->GetActors();
740 anActColl->InitTraversal();
741 vtkActor *aVTKActor = anActColl->GetNextActor();
742 for (; !anActor && aVTKActor; aVTKActor = anActColl->GetNextActor()) {
743 if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(aVTKActor)) {
744 if (thePrs == anVISUActor->GetPrs3d()) {
745 anActor = anVISUActor;
750 vw->RemoveActor(anActor);