From 415c05527a7d93f2a505fa3173422f4bca73e6fc Mon Sep 17 00:00:00 2001 From: rnv Date: Wed, 27 Nov 2013 12:19:53 +0000 Subject: [PATCH] Implementation of the "22390: [CEA 967] Latency enhancement after a selection of a displayed object" issue. --- src/LightApp/LightApp_VTKSelector.cxx | 4 +++- src/SVTK/SVTK_ViewWindow.cxx | 23 ++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/LightApp/LightApp_VTKSelector.cxx b/src/LightApp/LightApp_VTKSelector.cxx index 005b6b644..50b63f6c6 100644 --- a/src/LightApp/LightApp_VTKSelector.cxx +++ b/src/LightApp/LightApp_VTKSelector.cxx @@ -33,6 +33,7 @@ #include "SVTK_Functor.h" #include "VTKViewer_Algorithm.h" #include + #include "SVTK_ViewModel.h" #endif #ifndef DISABLE_SALOMEOBJECT @@ -212,7 +213,8 @@ void LightApp_VTKSelector ::setSelection( const SUIT_DataOwnerPtrList& theList ) { - if(myViewer){ + SVTK_Viewer* aViewer = dynamic_cast(myViewer); + if(myViewer && aViewer && aViewer->isSelectionEnabled()){ if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){ if(SVTK_ViewWindow* aView = dynamic_cast(aViewMgr->getActiveView())){ if(SVTK_Selector* aSelector = aView->GetSelector()){ diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index fba7c6f76..51d68610e 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -148,6 +148,7 @@ SVTK_ViewWindow::SVTK_ViewWindow(SUIT_Desktop* theDesktop): */ void SVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel) { + myModel = theModel; myInteractor = new SVTK_RenderWindowInteractor(this,"SVTK_RenderWindowInteractor"); SVTK_Selector* aSelector = SVTK_Selector::New(); @@ -912,7 +913,14 @@ void SVTK_ViewWindow::SetPreSelectionMode( Preselection_Mode theMode ) */ void SVTK_ViewWindow::SetSelectionEnabled( bool theEnable ) { - onEnableSelection( theEnable ); + GetSelector()->SetSelectionEnabled( theEnable ); + QtxAction* a = getAction( EnableSelectionId ); + if ( a->isChecked() != theEnable) + a->setChecked( theEnable ); + QtxActionGroup* aPreselectionGroup = + dynamic_cast( getAction( PreselectionId ) ); + if ( aPreselectionGroup ) + aPreselectionGroup->setEnabled( theEnable ); } /*! @@ -982,16 +990,9 @@ void SVTK_ViewWindow::onSwitchPreSelectionMode( int theMode ) */ void SVTK_ViewWindow::onEnableSelection( bool on ) { - GetSelector()->SetSelectionEnabled( on ); - - // update action state if method is called outside - QtxAction* a = getAction( EnableSelectionId ); - if ( a->isChecked() != on ) - a->setChecked( on ); - QtxActionGroup* aPreselectionGroup = - dynamic_cast( getAction( PreselectionId ) ); - if ( aPreselectionGroup ) - aPreselectionGroup->setEnabled( on ); + SVTK_Viewer* aViewer = dynamic_cast(myModel); + if(aViewer) + aViewer->enableSelection(on); } /*! -- 2.39.2