From: rnv Date: Thu, 27 Feb 2014 06:59:19 +0000 (+0400) Subject: Fix for the "0022466: [CEA 1047] Mesh stays selected when selection is X-Git-Tag: V7_4_0a1~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4ce7b50be7905bde9445f81243231e0031a9a26e;p=modules%2Fgui.git Fix for the "0022466: [CEA 1047] Mesh stays selected when selection is disabled in the 3D view" issue. --- diff --git a/src/LightApp/LightApp_OCCSelector.cxx b/src/LightApp/LightApp_OCCSelector.cxx index 3e8b4eb18..6f78bc76a 100644 --- a/src/LightApp/LightApp_OCCSelector.cxx +++ b/src/LightApp/LightApp_OCCSelector.cxx @@ -85,6 +85,9 @@ void LightApp_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const if ( !myViewer ) return; + if ( !myViewer->isSelectionEnabled() ) + return; + AIS_ListOfInteractive aSelList; myViewer->getSelectedObjects( aSelList ); for ( AIS_ListIteratorOfListOfInteractive anIt( aSelList ); anIt.More(); anIt.Next() ) diff --git a/src/LightApp/LightApp_VTKSelector.cxx b/src/LightApp/LightApp_VTKSelector.cxx index 015530eb9..79f9e735a 100644 --- a/src/LightApp/LightApp_VTKSelector.cxx +++ b/src/LightApp/LightApp_VTKSelector.cxx @@ -187,7 +187,11 @@ void LightApp_VTKSelector ::getSelection( SUIT_DataOwnerPtrList& aList ) const { - if(myViewer){ + if( myViewer ) { + if( SVTK_Viewer* aSViewer = dynamic_cast(myViewer) ) { + if( !aSViewer->isSelectionEnabled() ) + return; + } if(SUIT_ViewManager* aViewManager = myViewer->getViewManager()){ if(SVTK_ViewManager* aViewMgr = dynamic_cast(aViewManager)){ if(SVTK_ViewWindow* aView = dynamic_cast(aViewMgr->getActiveView())){ diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index c9e7f933a..242756b9f 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -533,6 +533,13 @@ void OCCViewer_Viewer::enableSelection(bool isEnabled) win->enableSelection( isEnabled ); } } + + + //clear current selection in the viewer + if(!isEnabled) { + myAISContext->ClearSelected( Standard_True ); + } + } /*! @@ -1015,6 +1022,11 @@ void OCCViewer_Viewer::setSelectionOptions( bool isPreselectionEnabled, bool isS { myPreselectionEnabled = isPreselectionEnabled; mySelectionEnabled = isSelectionEnabled; + //clear current selection in the viewer + + if(!mySelectionEnabled) { + myAISContext->ClearSelected( Standard_True ); + } } diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index 1e00b2cfc..2f2477e99 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.cxx @@ -504,6 +504,23 @@ void SVTK_Viewer::enableSelection(bool isEnabled) aView->SetSelectionEnabled( isEnabled ); } } + + if(!isEnabled) { + //clear current selection in the viewer + bool blocked = blockSignals( true ); + if ( SUIT_ViewManager* aViewMgr = getViewManager() ) { + if( SVTK_ViewWindow* aViewWindow = dynamic_cast( aViewMgr->getActiveView() ) ){ + if( SVTK_Selector* aSelector = aViewWindow->GetSelector() ) { + if(SVTK_View* aView = aViewWindow->getView()){ + aSelector->ClearIObjects(); + aView->onSelectionChanged(); + } + } + } + } + blockSignals( blocked ); + } + } /*!