]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0021883 [CEA 674] Deactivate pre-selection in OCC and VTK viewer
authorvsr <vsr@opencascade.com>
Fri, 9 Aug 2013 08:55:09 +0000 (08:55 +0000)
committervsr <vsr@opencascade.com>
Fri, 9 Aug 2013 08:55:09 +0000 (08:55 +0000)
0022174 [CEA 793] De-activate entirely selection in order to have a fast view usage

23 files changed:
doc/salome/gui/images/vtkviewer_toolbar.png
doc/salome/gui/input/vtk_3d_viewer.doc
src/LightApp/LightApp_Application.cxx
src/LightApp/resources/LightApp.xml
src/Qtx/QtxActionGroup.cxx
src/Qtx/QtxActionGroup.h
src/SVTK/SALOME_Actor.cxx
src/SVTK/SVTK_InteractorStyle.cxx
src/SVTK/SVTK_Selection.h
src/SVTK/SVTK_Selector.cxx
src/SVTK/SVTK_Selector.h
src/SVTK/SVTK_SelectorDef.h
src/SVTK/SVTK_ViewModel.cxx
src/SVTK/SVTK_ViewModel.h
src/SVTK/SVTK_ViewWindow.cxx
src/SVTK/SVTK_ViewWindow.h
src/SVTK/resources/SVTK_images.ts
src/SVTK/resources/SVTK_msg_en.ts
src/SVTK/resources/SVTK_msg_fr.ts
src/SVTK/resources/vtk_view_highlight_dyn.png [new file with mode: 0755]
src/SVTK/resources/vtk_view_highlight_off.png [new file with mode: 0755]
src/SVTK/resources/vtk_view_highlight_std.png [new file with mode: 0755]
src/SVTK/resources/vtk_view_selection.png [new file with mode: 0644]

index 460794973adcd0fc51257e24efdd993d305da502..e97246d60d4cf7b3e076661fb78483fb337b94b9 100644 (file)
Binary files a/doc/salome/gui/images/vtkviewer_toolbar.png and b/doc/salome/gui/images/vtkviewer_toolbar.png differ
index 1774bf1f5173cd6b7ea32ead5ea1499b51781a1e..e3838531e637032b1431d513bc06afa114639e8f 100644 (file)
@@ -35,12 +35,20 @@ only for parallel (non-perspective) view's mode.
 
 \image html vtk_view_highlight.png
 
-<b>Dynamic pre-selection switch</b> - allows to switch on/off dynamic
-pre-selection of objects. When the dynamic pre-selection is switched
-on, an objects can be selected by clicking the point/cell belonging to
+These buttons allow to switch between three pre-selection modes.
+Possible choices:
+- <b>Standard preselection mode</b> - pre-selection is enabled in a standard mode;
+- <b>Dynamic preselection mode</b> - when the dynamic pre-selection is chosen, 
+an objects can be selected by clicking the point/cell belonging to
 this object, with some performance loss. Switch dynamic pre-selection
-off to have a good performance on big objects (for example, huge
-meshes).
+off to have a good performance on big objects (for example, huge meshes);
+- <b>Disable preselection</b> - pre-selection is disabled.
+
+<hr>
+
+\image html vtk_view_selection.png
+
+<b>Enable/Disable selection</b> - enables or disables selection in the view.
 <hr>
 
 \image html vtk_view_triedre.png
index 7059f2474c34fcb6171e23a7231c411a6ff370d2..eebf92b7b9aa07a047b48f275848ec14510633e5 100644 (file)
@@ -1491,7 +1491,8 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType
       vm->setStaticTrihedronVisible( resMgr->booleanValue( "3DViewer", "show_static_trihedron", vm->isStaticTrihedronVisible() ) );
       vm->setInteractionStyle( resMgr->integerValue( "3DViewer", "navigation_mode", vm->interactionStyle() ) );
       vm->setZoomingStyle( resMgr->integerValue( "3DViewer", "zooming_mode", vm->zoomingStyle() ) );
-      vm->setDynamicPreSelection( resMgr->booleanValue( "VTKViewer", "dynamic_preselection", vm->dynamicPreSelection() ) );
+      vm->setPreSelectionMode(resMgr->integerValue( "VTKViewer", "preselection", vm->preSelectionMode() ) );
+      vm->enableSelection( resMgr->booleanValue( "VTKViewer", "enable_selection", vm->isSelectionEnabled() ) );
       vm->setIncrementalSpeed( resMgr->integerValue( "VTKViewer", "speed_value", vm->incrementalSpeed() ),
                                resMgr->integerValue( "VTKViewer", "speed_mode", vm->incrementalSpeedMode() ) );
       vm->setSpacemouseButtons( resMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", vm->spacemouseBtn(1) ),
@@ -2273,8 +2274,23 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref )
   anIndicesList << 0                     << 1;
   pref->setItemProperty( "strings", aValuesList,   vtkSpeedMode );
   pref->setItemProperty( "indexes", anIndicesList, vtkSpeedMode );
-  // .... -> dynamic pre-selection
-  pref->addPreference( tr( "PREF_DYNAMIC_PRESELECTION" ),  vtkGen, LightApp_Preferences::Bool, "VTKViewer", "dynamic_preselection" );
+
+  // ... "Selection" group <<start>>
+  int vtkSelectionGroup = pref->addPreference( tr( "PREF_GROUP_SELECTION" ), vtkGroup );
+  pref->setItemProperty( "columns", 2, vtkSelectionGroup );
+  // .... -> preselection
+  int vtkPreselection = pref->addPreference( tr( "PREF_PRESELECTION" ),  vtkSelectionGroup, 
+                                             LightApp_Preferences::Selector, "VTKViewer", "preselection" );
+  aValuesList.clear();
+  anIndicesList.clear();
+  aValuesList   << tr("PREF_PRESELECTION_STANDARD") << tr("PREF_PRESELECTION_DYNAMIC") << tr("PREF_PRESELECTION_DISABLED");
+  anIndicesList << 0 << 1 << 2;
+  pref->setItemProperty( "strings", aValuesList,   vtkPreselection );
+  pref->setItemProperty( "indexes", anIndicesList, vtkPreselection );
+  // .... -> enable selection
+  pref->addPreference( tr( "PREF_ENABLE_SELECTION" ), vtkSelectionGroup, LightApp_Preferences::Bool, "VTKViewer", "enable_selection" );
+  // ... "Selection" group <<end>>
+
   // ... -> empty frame (for layout) <<end>>
 
   // ... space mouse sub-group <<start>>
@@ -2729,9 +2745,30 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
 #endif
 
 #ifndef DISABLE_VTKVIEWER
-  if ( sec == QString( "VTKViewer" ) && param == QString( "dynamic_preselection" ) )
+  if ( sec == QString( "VTKViewer" ) && param == QString( "preselection" ) )
+  {
+    int mode = resMgr->integerValue( "VTKViewer", "preselection", 0 );
+    QList<SUIT_ViewManager*> lst;
+#ifndef DISABLE_SALOMEOBJECT
+    viewManagers( SVTK_Viewer::Type(), lst );
+    QListIterator<SUIT_ViewManager*> it( lst );
+    while ( it.hasNext() )
+    {
+      SUIT_ViewModel* vm = it.next()->getViewModel();
+      if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
+        continue;
+
+      SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
+      if( vtkVM ) vtkVM->setPreSelectionMode( mode );
+    }
+#endif
+  }
+#endif
+
+#ifndef DISABLE_VTKVIEWER
+  if ( sec == QString( "VTKViewer" ) && param == QString( "enable_selection" ) )
   {
-    bool mode = resMgr->booleanValue( "VTKViewer", "dynamic_preselection", true );
+    bool isToEnableSelection = resMgr->booleanValue( "VTKViewer", "enable_selection", true );
     QList<SUIT_ViewManager*> lst;
 #ifndef DISABLE_SALOMEOBJECT
     viewManagers( SVTK_Viewer::Type(), lst );
@@ -2743,7 +2780,7 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
         continue;
 
       SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
-      if( vtkVM ) vtkVM->setDynamicPreSelection( mode );
+      if( vtkVM ) vtkVM->enableSelection( isToEnableSelection );
     }
 #endif
   }
index a1a6eb82e83abbe2664a7ff7e0fbb7def877ae34..078a2185d07087c8afb8f8c2a9898bb7ed0ddf49 100644 (file)
     <!-- VTK viewer preferences -->
     <parameter name="background"                       value="0, 0, 0"/>
     <parameter name="projection_mode"                  value="0"/>
-    <parameter name="dynamic_preselection"             value="false"/>
+    <parameter name="preselection"                     value="0"/>
+    <parameter name="enable_selection"                 value="true"/>
     <parameter name="speed_value"                      value="10"/>
     <parameter name="speed_mode"                       value="0"/>
     <parameter name="spacemouse_func1_btn"             value="1"/>
index 420f329bc0fb8605f7ad2a51c8a95dcabc24aeb6..52e3bf688773e30b89d823ee06482f3dedaf9d25 100644 (file)
@@ -208,6 +208,15 @@ void QtxActionGroup::onTriggered( QAction* a )
   emit selected( a );
 }
 
+/*!
+  \brief Enable/disable action group
+*/
+void QtxActionGroup::setEnabled( bool on )
+{
+  QtxActionSet::setEnabled( on );
+  myActionGroup->setEnabled( on );
+}
+
 /*!
   \brief Update action group for the specified widget.
   \param w a widget this action group is added to
index f1c333bf69a18435407e8c42ca1102e539933ab6..e62a4f9503775dc64ccd619075f57a3a4b19743b 100644 (file)
@@ -46,6 +46,8 @@ public:
 
   void             add( QAction* );
 
+  void             setEnabled( bool );
+
 public slots:
   void             setExclusive( const bool );
   void             setUsesDropDown( const bool );
index 5f74dd561981327aa0d1d1357db50bbdd173310e..6a229199621a2194e0accd14d9d935c029fb2e64 100644 (file)
@@ -431,7 +431,7 @@ SALOME_Actor
 {
   mySelector = theSelector;
 }
-
+  
 /*!
   To map current selection to VTK representation
 */
@@ -500,7 +500,7 @@ SALOME_Actor
                SVTK_SelectionEvent* theSelectionEvent,
                bool theIsHighlight)
 {
-  if ( !GetPickable() )
+  if ( !GetPickable() || !mySelector->IsPreSelectionEnabled() )
     return false;
       
   vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
@@ -655,7 +655,7 @@ SALOME_Actor
             SVTK_SelectionEvent* theSelectionEvent,
             bool theIsHighlight)
 {
-  if ( !GetPickable() || !mySelector )
+  if ( !GetPickable() || !mySelector || !mySelector->IsSelectionEnabled() )
     return false;
 
   myOutlineActor->SetVisibility( false );
index ea8c11bd3a30d85a7a09ef3c9b86a6e79a53f384..831110451d9aeb7c7db6995775059556a55869d1 100644 (file)
@@ -1298,6 +1298,9 @@ void SVTK_InteractorStyle::onOperation(QPoint mousePos)
 */
 void SVTK_InteractorStyle::onCursorMove(QPoint mousePos) 
 {
+  if ( !GetSelector()->IsPreSelectionEnabled() ) 
+    return;
+
   // processing highlighting
   SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY();
   this->FindPokedRenderer(aSelectionEvent->myX,aSelectionEvent->myY);
index b4586d07645c6995393a9debb0aef4dc36830805..4dd1f8aef4cd3c28430ba47e4a4a101d7724e435 100644 (file)
@@ -41,5 +41,11 @@ const Selection_Mode ActorSelection = 6;
 const Selection_Mode Elem0DSelection = 7;
 const Selection_Mode BallSelection = 8;
 
+//! Preselection modes 
+typedef int Preselection_Mode; 
+
+const Preselection_Mode Standard_Preselection = 0;
+const Preselection_Mode Dynamic_Preselection = 1;
+const Preselection_Mode Preselection_Disabled = 2;
 
 #endif
index 5c9fb105996fc9e0fa054b0692cbd1cf0165f90c..8af1ef2b18d7473df70c8bf8b43b3ed270e2ba41 100644 (file)
@@ -61,6 +61,8 @@ SVTK_SelectorDef
 {
   mySelectionMode = ActorSelection;
   myDynamicPreselection = true;
+  myPreselectionEnabled = true;
+  mySelectionEnabled = true;
 
   myPicker->Delete();
   myCellPicker->Delete();
@@ -573,3 +575,31 @@ SVTK_SelectorDef
 {
   return myDynamicPreselection;
 }
+
+void
+SVTK_SelectorDef
+::SetPreSelectionEnabled( bool theEnabled )
+{
+  myPreselectionEnabled = theEnabled;
+}
+
+bool
+SVTK_SelectorDef
+::IsPreSelectionEnabled() const
+{
+  return mySelectionEnabled && myPreselectionEnabled;
+}
+
+void
+SVTK_SelectorDef
+::SetSelectionEnabled( bool theEnabled )
+{
+  mySelectionEnabled = theEnabled;
+}
+
+bool
+SVTK_SelectorDef
+::IsSelectionEnabled() const
+{
+  return mySelectionEnabled;
+}
index a745648a0058be483460058323005b669491bd5f..801ea715b0b7243fc7c41af55fe89e806cec1296 100644 (file)
@@ -224,6 +224,22 @@ public:
   virtual
   bool
   GetDynamicPreSelection() const = 0;
+
+  virtual
+  void
+  SetPreSelectionEnabled( bool theEnabled ) = 0;
+
+  virtual
+  bool
+  IsPreSelectionEnabled() const = 0;
+
+  virtual
+  void
+  SetSelectionEnabled( bool theEnabled ) = 0;
+
+  virtual
+  bool
+  IsSelectionEnabled() const = 0;
 };
 
 
index 4fbc54d8cfbe2fb03656eec6c40911d754c1f3ad..3e4e6c42c60f89ec4cd10ad49dd0bd304b22e33a 100644 (file)
@@ -184,10 +184,28 @@ public:
   bool
   GetDynamicPreSelection() const;
 
+  virtual
+  void
+  SetPreSelectionEnabled( bool theEnabled );
+
+  virtual
+  bool
+  IsPreSelectionEnabled() const;
+
+  virtual
+  void
+  SetSelectionEnabled( bool theEnabled );
+
+  virtual
+  bool
+  IsSelectionEnabled() const;
+
 private:
   int mySelectionMode;
 
   bool myDynamicPreselection;
+  bool myPreselectionEnabled;
+  bool mySelectionEnabled;
 
   struct TIOLessThan
   {
index d89674a8a08d10ce2b8fbca722d70349e4ebc252..4a13dd7ee74f1e95c14e3fff05cf0a308952d6e0 100644 (file)
@@ -29,7 +29,6 @@
 #include <vtkActorCollection.h>
 
 //#include "SUIT_Session.h"
-#include "SVTK_Selection.h"
 #include "SVTK_ViewModel.h"
 #include "SVTK_ViewWindow.h"
 #include "SVTK_View.h"
@@ -87,7 +86,8 @@ SVTK_Viewer::SVTK_Viewer()
   myProjMode = 0;
   myStyle = 0;
   myZoomingStyle = 0;
-  myDynamicPreSelection = false;
+  mySelectionEnabled = true;
+  myPreSelectionMode = Standard_Preselection;
   mySpaceBtn[0] = 1;
   mySpaceBtn[1] = 2;
   mySpaceBtn[2] = 9;
@@ -179,7 +179,8 @@ SUIT_ViewWindow* SVTK_Viewer::createView( SUIT_Desktop* theDesktop )
   aViewWindow->SetProjectionMode( projectionMode() );
   aViewWindow->SetInteractionStyle( interactionStyle() );
   aViewWindow->SetZoomingStyle( zoomingStyle() );
-  aViewWindow->SetDynamicPreSelection( dynamicPreSelection() );
+  aViewWindow->SetPreSelectionMode( preSelectionMode() );
+  aViewWindow->SetSelectionEnabled( isSelectionEnabled() );
   aViewWindow->SetIncrementalSpeed( incrementalSpeed(), incrementalSpeedMode() );
   aViewWindow->SetSpacemouseButtons( spacemouseBtn(1), spacemouseBtn(2), spacemouseBtn(3) );
 
@@ -335,27 +336,27 @@ void SVTK_Viewer::setZoomingStyle( const int theStyle )
 }
 
 /*!
-  \return dynamic preselection
+  \return current preselection mode
 */
-bool SVTK_Viewer::dynamicPreSelection() const
+Preselection_Mode SVTK_Viewer::preSelectionMode() const
 {
-  return myDynamicPreSelection;
+  return myPreSelectionMode;
 }
 
 /*!
-  Sets dynamic preselection
-  \param theMode - new dynamic preselection mode
+  Sets preselection mode
+  \param theMode - new preselection mode
 */
-void SVTK_Viewer::setDynamicPreSelection( const bool theMode )
+void SVTK_Viewer::setPreSelectionMode( Preselection_Mode theMode )
 {
-  myDynamicPreSelection = theMode;
+  myPreSelectionMode = theMode;
   
   if (SUIT_ViewManager* aViewManager = getViewManager()) {
     QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
     for ( uint i = 0; i < aViews.count(); i++ )
     {
       if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
-        aView->SetDynamicPreSelection( theMode );
+        aView->SetPreSelectionMode( theMode );
     }
   }
 }
@@ -494,6 +495,15 @@ void SVTK_Viewer::enableSelection(bool isEnabled)
 {
   mySelectionEnabled = isEnabled;
   //!! To be done for view windows
+   
+  if (SUIT_ViewManager* aViewManager = getViewManager()) {
+    QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
+    for ( uint i = 0; i < aViews.count(); i++ )
+    {
+      if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
+        aView->SetSelectionEnabled( isEnabled );
+    }
+  }
 }
 
 /*!
index c4a73cf8ec59ac0f361cd96c19f0d3844c10f43c..155fd1f61fe137cb8ba2b78d945802c493644276 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "SVTK.h"
 #include "SVTK_ViewModelBase.h"
+#include "SVTK_Selection.h"
 
 #include "Qtx.h"
 
@@ -125,12 +126,12 @@ public:
   //! Sets zooming style
   void setZoomingStyle( const int );
 
-  //! Gets dynamic preselection
-  bool dynamicPreSelection() const;
-
-  //! Sets dynamic preselection
-  void setDynamicPreSelection( const bool );
+  //! Gets current preselection mode (standard, dynamic or disabled)
+  Preselection_Mode preSelectionMode() const;
 
+  //! Sets new preselection mode
+  void setPreSelectionMode( Preselection_Mode );
   //! Get incremental speed (see #SVTK_InteractorStyle::ControllerIncrement)
   int incrementalSpeed() const;
 
@@ -207,7 +208,7 @@ private:
   int                  myProjMode;
   int                  myStyle;
   int                  myZoomingStyle;
-  bool                 myDynamicPreSelection;
+  Preselection_Mode    myPreSelectionMode;
   int                  mySpaceBtn[3];
 };
 
index 4f7091ac4c21d289fbd84f8c4a25849bc5f54d24..fba7c6f7637c19b03d2c310ef553c0fd12360c62 100755 (executable)
@@ -35,6 +35,7 @@
 #include <QToolBar>
 #include <QEvent>
 #include <QFileInfo>
+#include <QSignalMapper>
 #include <QXmlStreamWriter>
 #include <QXmlStreamReader>
 #include <QXmlStreamAttributes>
@@ -71,6 +72,7 @@
 #include "SUIT_ViewManager.h"
 #include "QtxActionToolMgr.h"
 #include "QtxMultiAction.h"
+#include "QtxActionGroup.h"
 
 #include "VTKViewer_Utilities.h"
 #include "VTKViewer_Trihedron.h"
@@ -148,10 +150,15 @@ void SVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel)
 {
   myInteractor = new SVTK_RenderWindowInteractor(this,"SVTK_RenderWindowInteractor");
   
-  SVTK_Selector* aSelector = SVTK_Selector::New(); 
-  aSelector->SetDynamicPreSelection( SUIT_Session::session()->resourceMgr()->
-                                    booleanValue( "VTKViewer", "dynamic_preselection", true ) );
-  
+  SVTK_Selector* aSelector = SVTK_Selector::New();
+  int aPreselectionMode =  SUIT_Session::session()->resourceMgr()->
+    integerValue( "VTKViewer", "preselection", Standard_Preselection );
+  aSelector->SetDynamicPreSelection( aPreselectionMode == Dynamic_Preselection );
+  aSelector->SetPreSelectionEnabled( aPreselectionMode != Preselection_Disabled );
+  bool isSelectionEnabled = SUIT_Session::session()->resourceMgr()->
+    booleanValue( "VTKViewer", "enable_selection", true );
+  aSelector->SetSelectionEnabled( isSelectionEnabled );
+    
   SVTK_GenericRenderWindowInteractor* aDevice = SVTK_GenericRenderWindowInteractor::New();
   aDevice->SetRenderWidget(myInteractor);
   aDevice->SetSelector(aSelector);
@@ -891,12 +898,21 @@ void SVTK_ViewWindow::SetZoomingStyle(const int theStyle)
 }
 
 /*!
-  Switch dynamic preselection on / off
-  \param theDynPreselection - dynamic pre-selection mode
+  Set preselection mode.
+  \param theMode the mode to set (standard, dynamic or disabled)
+*/
+void SVTK_ViewWindow::SetPreSelectionMode( Preselection_Mode theMode )
+{
+  onSwitchPreSelectionMode( theMode );
+}
+
+/*!
+  Enables/disables selection.
+  \param theEnable if true - selection will be enabled
 */
-void SVTK_ViewWindow::SetDynamicPreSelection( bool theDynPreselection )
+void SVTK_ViewWindow::SetSelectionEnabled( bool theEnable )
 {
-  onSwitchDynamicPreSelection( theDynPreselection );
+  onEnableSelection( theEnable );
 }
 
 /*!
@@ -946,16 +962,36 @@ void SVTK_ViewWindow::onSwitchZoomingStyle( bool theOn )
 }
 
 /*!
-  Toogles dynamic preselection on/off
+  Switch preselection mode.
+  \param theMode the preselection mode
 */
-void SVTK_ViewWindow::onSwitchDynamicPreSelection( bool theOn )
+void SVTK_ViewWindow::onSwitchPreSelectionMode( int theMode )
 {
-  GetSelector()->SetDynamicPreSelection( theOn );
+  GetSelector()->SetDynamicPreSelection( theMode == Dynamic_Preselection );
+  GetSelector()->SetPreSelectionEnabled( theMode != Preselection_Disabled );
 
   // update action state if method is called outside
-  QtxAction* a = getAction( SwitchDynamicPreselectionId );
-  if ( a->isChecked() != theOn )
-    a->setChecked( theOn );
+  QtxAction* a = getAction( StandardPreselectionId + theMode );
+  if ( a && !a->isChecked() )
+    a->setChecked( true );
+}
+
+/*!
+  Enables/disables selection.
+  \param theOn if true - selection will be enabled
+*/
+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 );
 }
 
 /*!
@@ -2094,14 +2130,51 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr)
   connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onSwitchZoomingStyle(bool)));
   mgr->registerAction( anAction, SwitchZoomingStyleId );
 
-  // Turn on/off dynamic pre-selection
-  anAction = new QtxAction(tr("MNU_SVTK_DYNAMIC_PRESLECTION_SWITCH"), 
-                           theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_DYNAMIC_PRESLECTION_SWITCH" ) ),
-                           tr( "MNU_SVTK_DYNAMIC_PRESLECTION_SWITCH" ), 0, this);
-  anAction->setStatusTip(tr("DSC_SVTK_DYNAMIC_PRESLECTION_SWITCH"));
+  // Pre-selection
+  QSignalMapper* aSignalMapper = new QSignalMapper( this );
+  connect(aSignalMapper, SIGNAL(mapped(int)), this, SLOT(onSwitchPreSelectionMode(int)));
+
+  anAction = new QtxAction(tr("MNU_SVTK_PRESELECTION_STANDARD"), 
+                           theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_PRESELECTION_STANDARD" ) ),
+                           tr( "MNU_SVTK_PRESELECTION_STANDARD" ), 0, this);
+  anAction->setStatusTip(tr("DSC_SVTK_PRESELECTION_STANDARD"));
+  anAction->setCheckable(true);
+  connect(anAction, SIGNAL(activated()), aSignalMapper, SLOT(map()));
+  aSignalMapper->setMapping( anAction, Standard_Preselection );
+  mgr->registerAction( anAction, StandardPreselectionId );
+  
+  anAction = new QtxAction(tr("MNU_SVTK_PRESELECTION_DYNAMIC"), 
+                           theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_PRESELECTION_DYNAMIC" ) ),
+                           tr( "MNU_SVTK_PRESELECTION_DYNAMIC" ), 0, this);
+  anAction->setStatusTip(tr("DSC_SVTK_PRESELECTION_DYNAMIC"));
   anAction->setCheckable(true);
-  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onSwitchDynamicPreSelection(bool)));
-  mgr->registerAction( anAction, SwitchDynamicPreselectionId );
+  connect(anAction, SIGNAL(activated()), aSignalMapper, SLOT(map()));
+  aSignalMapper->setMapping( anAction, Dynamic_Preselection );
+  mgr->registerAction( anAction, DynamicPreselectionId );
+
+  anAction = new QtxAction(tr("MNU_SVTK_PRESELECTION_DISABLED"), 
+                           theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_PRESELECTION_DISABLED" ) ),
+                           tr( "MNU_SVTK_PRESELECTION_DISABLED" ), 0, this);
+  anAction->setStatusTip(tr("DSC_SVTK_PRESELECTION_DISABLED"));
+  anAction->setCheckable(true);
+  connect(anAction, SIGNAL(activated()), aSignalMapper, SLOT(map()));
+  aSignalMapper->setMapping( anAction, Preselection_Disabled );
+  mgr->registerAction( anAction, DisablePreselectionId );
+
+  QtxActionGroup* aPreselectionAction = new QtxActionGroup( this, true );
+  aPreselectionAction->add( getAction( StandardPreselectionId ) );
+  aPreselectionAction->add( getAction( DynamicPreselectionId ) );
+  aPreselectionAction->add( getAction( DisablePreselectionId ) );
+  mgr->registerAction( aPreselectionAction, PreselectionId );
+
+  // Selection
+  anAction = new QtxAction(tr("MNU_SVTK_ENABLE_SELECTION"), 
+                           theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_SELECTION" ) ),
+                           tr( "MNU_SVTK_ENABLE_SELECTION" ), 0, this);
+  anAction->setStatusTip(tr("DSC_SVTK_ENABLE_SELECTION"));
+  anAction->setCheckable(true);
+  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onEnableSelection(bool)));
+  mgr->registerAction( anAction, EnableSelectionId );
 
   // Start recording
   myStartAction = new QtxAction(tr("MNU_SVTK_RECORDING_START"), 
@@ -2149,7 +2222,14 @@ void SVTK_ViewWindow::createToolBar()
   mgr->append( DumpId, myToolBar );
   mgr->append( SwitchInteractionStyleId, myToolBar );
   mgr->append( SwitchZoomingStyleId, myToolBar );
-  mgr->append( SwitchDynamicPreselectionId, myToolBar );
+
+  mgr->append( mgr->separator(), myToolBar );
+  mgr->append( PreselectionId, myToolBar );
+  mgr->append( EnableSelectionId, myToolBar );
+
+  mgr->append( mgr->separator(), myToolBar );
+
   mgr->append( ViewTrihedronId, myToolBar );
 
   QtxMultiAction* aScaleAction = new QtxMultiAction( this );
index e4a916ebb5d3e5ee32d032d08d6b9a13c2a46ef1..58f2e8a733d378bef709861c9037acd1cdde8bee 100755 (executable)
@@ -233,8 +233,11 @@ class SVTK_EXPORT SVTK_ViewWindow : public SUIT_ViewWindow
   //! Set zooming style
   virtual void SetZoomingStyle( const int );
 
-  //! Set dynamic preselection on/off
-  virtual void SetDynamicPreSelection( bool );
+  //! Set preselection mode
+  virtual void SetPreSelectionMode( Preselection_Mode );
+
+  //! Enable/disable selection
+  virtual void SetSelectionEnabled( bool );
 
   //! Customize space mouse buttons
   virtual void SetSpacemouseButtons( const int, const int, const int );
@@ -315,7 +318,9 @@ public slots:
 
   void onSwitchInteractionStyle(bool theOn);
   void onSwitchZoomingStyle(bool theOn);
-  void onSwitchDynamicPreSelection(bool theOn);
+
+  void onSwitchPreSelectionMode(int theMode);
+  void onEnableSelection(bool theOn);
 
   void onStartRecording();
   void onPlayRecording();
@@ -411,7 +416,9 @@ protected:
          FrontId, BackId, TopId, BottomId, LeftId, RightId, ClockWiseId, AntiClockWiseId, ResetId,
         ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate,
          ParallelModeId, ProjectionModeId, ViewParametersId, SynchronizeId, SwitchInteractionStyleId,
-         SwitchZoomingStyleId,SwitchDynamicPreselectionId,
+         SwitchZoomingStyleId, 
+        PreselectionId, StandardPreselectionId, DynamicPreselectionId, DisablePreselectionId, 
+        EnableSelectionId,
          StartRecordingId, PlayRecordingId, PauseRecordingId, StopRecordingId };
 
   SVTK_View* myView;
index 3794dfb5484936bf515ef3d47c51d554786dbb7a..f446c771825d8456bde0ff561cfcf6a8b1503f3d 100644 (file)
         <translation>vtk_view_recording_stop.png</translation>
     </message>
     <message>
-        <source>ICON_SVTK_DYNAMIC_PRESLECTION_SWITCH</source>
-        <translation>vtk_view_highlight.png</translation>
+        <source>ICON_SVTK_PRESELECTION_STANDARD</source>
+        <translation>vtk_view_highlight_std.png</translation>
+    </message>
+    <message>
+        <source>ICON_SVTK_PRESELECTION_DYNAMIC</source>
+        <translation>vtk_view_highlight_dyn.png</translation>
+    </message>
+    <message>
+        <source>ICON_SVTK_PRESELECTION_DISABLED</source>
+        <translation>vtk_view_highlight_off.png</translation>
+    </message>
+    <message>
+        <source>ICON_SVTK_SELECTION</source>
+        <translation>vtk_view_selection.png</translation>
     </message>
 </context>
 </TS>
index 623656fef725fe54d64257f63301db8156edb705..947d70d93f202b066a798001d097b8d1a7e258e5 100644 (file)
     </message>
     <message>
         <source>MNU_SVTK_ZOOMING_STYLE_SWITCH</source>
-        <translation>Zomming style switch</translation>
+        <translation>Zooming style switch</translation>
+    </message>
+    <message>
+        <source>DSC_SVTK_PRESELECTION_STANDARD</source>
+        <translation>Standard preselection mode</translation>
+    </message>
+    <message>
+        <source>MNU_SVTK_PRESELECTION_STANDARD</source>
+        <translation>Standard Preselection Mode</translation>
+    </message>
+    <message>
+        <source>DSC_SVTK_PRESELECTION_DYNAMIC</source>
+        <translation>Dynamic preselection mode</translation>
+    </message>
+    <message>
+        <source>MNU_SVTK_PRESELECTION_DYNAMIC</source>
+        <translation>Dynamic Preselection Mode</translation>
     </message>
     <message>
-        <source>DSC_SVTK_DYNAMIC_PRESLECTION_SWITCH</source>
-        <translation>Dynamic preselection switch</translation>
+        <source>DSC_SVTK_PRESELECTION_DISABLED</source>
+        <translation>Disable preselection</translation>
     </message>
     <message>
-        <source>MNU_SVTK_DYNAMIC_PRESLECTION_SWITCH</source>
-        <translation>Dynamic preselection switch</translation>
+        <source>MNU_SVTK_PRESELECTION_DISABLED</source>
+        <translation>Disable Preselection</translation>
     </message>
+    <message>
+        <source>DSC_SVTK_ENABLE_SELECTION</source>
+        <translation>Enable/Disable selection</translation>
+    </message>
+    <message>
+        <source>MNU_SVTK_ENABLE_SELECTION</source>
+        <translation>Enable/Disable selection</translation>
+    </message>         
 </context>
 <context>
     <name>SVTK_FontWidget</name>
index 048f36de35ea93a9ba34eae37a711c15655057a4..ba75a9bda0f8ccb7cc753a65502ed8dc06775374 100755 (executable)
         <translation>Changer le style de zoom</translation>
     </message>
     <message>
-        <source>DSC_SVTK_DYNAMIC_PRESLECTION_SWITCH</source>
-        <translation>Pré-sélection dynamique</translation>
+        <source>DSC_SVTK_PRESELECTION_STANDARD</source>
+        <translation>Standard preselection mode</translation>
     </message>
     <message>
-        <source>MNU_SVTK_DYNAMIC_PRESLECTION_SWITCH</source>
-        <translation>Pré-sélection dynamique</translation>
+        <source>MNU_SVTK_PRESELECTION_STANDARD</source>
+        <translation>Standard Preselection Mode</translation>
     </message>
+    <message>
+        <source>DSC_SVTK_PRESELECTION_DYNAMIC</source>
+        <translation>Dynamic preselection mode</translation>
+    </message>
+    <message>
+        <source>MNU_SVTK_PRESELECTION_DYNAMIC</source>
+        <translation>Dynamic Preselection Mode</translation>
+    </message>
+    <message>
+        <source>DSC_SVTK_PRESELECTION_DISABLED</source>
+        <translation>Disable preselection</translation>
+    </message>
+    <message>
+        <source>MNU_SVTK_PRESELECTION_DISABLED</source>
+        <translation>Disable Preselection</translation>
+    </message>
+    <message>
+        <source>DSC_SVTK_ENABLE_SELECTION</source>
+        <translation>Enable/Disable selection</translation>
+    </message>
+    <message>
+        <source>MNU_SVTK_ENABLE_SELECTION</source>
+        <translation>Enable/Disable selection</translation>
+    </message>         
 </context>
 <context>
     <name>SVTK_FontWidget</name>
diff --git a/src/SVTK/resources/vtk_view_highlight_dyn.png b/src/SVTK/resources/vtk_view_highlight_dyn.png
new file mode 100755 (executable)
index 0000000..0aa1d6f
Binary files /dev/null and b/src/SVTK/resources/vtk_view_highlight_dyn.png differ
diff --git a/src/SVTK/resources/vtk_view_highlight_off.png b/src/SVTK/resources/vtk_view_highlight_off.png
new file mode 100755 (executable)
index 0000000..d0a344d
Binary files /dev/null and b/src/SVTK/resources/vtk_view_highlight_off.png differ
diff --git a/src/SVTK/resources/vtk_view_highlight_std.png b/src/SVTK/resources/vtk_view_highlight_std.png
new file mode 100755 (executable)
index 0000000..5029867
Binary files /dev/null and b/src/SVTK/resources/vtk_view_highlight_std.png differ
diff --git a/src/SVTK/resources/vtk_view_selection.png b/src/SVTK/resources/vtk_view_selection.png
new file mode 100644 (file)
index 0000000..24fb632
Binary files /dev/null and b/src/SVTK/resources/vtk_view_selection.png differ