Salome HOME
Implementation of the "22390: [CEA 967] Latency enhancement after a selection of... BR_imps_2013 V7_3_0a1
authorrnv <rnv@opencascade.com>
Wed, 27 Nov 2013 12:19:53 +0000 (12:19 +0000)
committerrnv <rnv@opencascade.com>
Wed, 27 Nov 2013 12:19:53 +0000 (12:19 +0000)
src/LightApp/LightApp_VTKSelector.cxx
src/SVTK/SVTK_ViewWindow.cxx

index 005b6b644d7bc6e4e0884a96d074bb7b2bb7cde7..50b63f6c6b9bb2b24fef5a9de4fd5eab312dc22f 100644 (file)
@@ -33,6 +33,7 @@
   #include "SVTK_Functor.h"
   #include "VTKViewer_Algorithm.h"
   #include <vtkRenderer.h>
+  #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<SVTK_Viewer*>(myViewer);
+  if(myViewer && aViewer && aViewer->isSelectionEnabled()){
     if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){
       if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){
         if(SVTK_Selector* aSelector = aView->GetSelector()){
index fba7c6f7637c19b03d2c310ef553c0fd12360c62..51d68610e9fd3558cef161067f7cc4be5167c15d 100755 (executable)
@@ -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<QtxActionGroup*>( 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<QtxActionGroup*>( getAction( PreselectionId ) );
-  if ( aPreselectionGroup )
-    aPreselectionGroup->setEnabled( on );
+  SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>(myModel);
+  if(aViewer)
+    aViewer->enableSelection(on);  
 }
 
 /*!