From: vsr Date: Fri, 9 Aug 2013 08:55:09 +0000 (+0000) Subject: 0021883 [CEA 674] Deactivate pre-selection in OCC and VTK viewer X-Git-Tag: BR_hydro_v_0_3_1~85 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8d973f87a441c75acab8b1cf0d3f54434735008e;p=modules%2Fgui.git 0021883 [CEA 674] Deactivate pre-selection in OCC and VTK viewer 0022174 [CEA 793] De-activate entirely selection in order to have a fast view usage --- diff --git a/doc/salome/gui/images/vtkviewer_toolbar.png b/doc/salome/gui/images/vtkviewer_toolbar.png index 460794973..e97246d60 100644 Binary files a/doc/salome/gui/images/vtkviewer_toolbar.png and b/doc/salome/gui/images/vtkviewer_toolbar.png differ diff --git a/doc/salome/gui/input/vtk_3d_viewer.doc b/doc/salome/gui/input/vtk_3d_viewer.doc index 1774bf1f5..e3838531e 100644 --- a/doc/salome/gui/input/vtk_3d_viewer.doc +++ b/doc/salome/gui/input/vtk_3d_viewer.doc @@ -35,12 +35,20 @@ only for parallel (non-perspective) view's mode. \image html vtk_view_highlight.png -Dynamic pre-selection switch - 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: +- Standard preselection mode - pre-selection is enabled in a standard mode; +- Dynamic preselection mode - 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); +- Disable preselection - pre-selection is disabled. + +
+ +\image html vtk_view_selection.png + +Enable/Disable selection - enables or disables selection in the view.
\image html vtk_view_triedre.png diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 7059f2474..eebf92b7b 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -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 <> + 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 <> + // ... -> empty frame (for layout) <> // ... space mouse sub-group <> @@ -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 lst; +#ifndef DISABLE_SALOMEOBJECT + viewManagers( SVTK_Viewer::Type(), lst ); + QListIterator it( lst ); + while ( it.hasNext() ) + { + SUIT_ViewModel* vm = it.next()->getViewModel(); + if ( !vm || !vm->inherits( "SVTK_Viewer" ) ) + continue; + + SVTK_Viewer* vtkVM = dynamic_cast( 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 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( vm ); - if( vtkVM ) vtkVM->setDynamicPreSelection( mode ); + if( vtkVM ) vtkVM->enableSelection( isToEnableSelection ); } #endif } diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index a1a6eb82e..078a2185d 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -151,7 +151,8 @@ - + + diff --git a/src/Qtx/QtxActionGroup.cxx b/src/Qtx/QtxActionGroup.cxx index 420f329bc..52e3bf688 100644 --- a/src/Qtx/QtxActionGroup.cxx +++ b/src/Qtx/QtxActionGroup.cxx @@ -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 diff --git a/src/Qtx/QtxActionGroup.h b/src/Qtx/QtxActionGroup.h index f1c333bf6..e62a4f950 100644 --- a/src/Qtx/QtxActionGroup.h +++ b/src/Qtx/QtxActionGroup.h @@ -46,6 +46,8 @@ public: void add( QAction* ); + void setEnabled( bool ); + public slots: void setExclusive( const bool ); void setUsesDropDown( const bool ); diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx index 5f74dd561..6a2291996 100644 --- a/src/SVTK/SALOME_Actor.cxx +++ b/src/SVTK/SALOME_Actor.cxx @@ -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 ); diff --git a/src/SVTK/SVTK_InteractorStyle.cxx b/src/SVTK/SVTK_InteractorStyle.cxx index ea8c11bd3..831110451 100644 --- a/src/SVTK/SVTK_InteractorStyle.cxx +++ b/src/SVTK/SVTK_InteractorStyle.cxx @@ -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); diff --git a/src/SVTK/SVTK_Selection.h b/src/SVTK/SVTK_Selection.h index b4586d076..4dd1f8aef 100644 --- a/src/SVTK/SVTK_Selection.h +++ b/src/SVTK/SVTK_Selection.h @@ -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 diff --git a/src/SVTK/SVTK_Selector.cxx b/src/SVTK/SVTK_Selector.cxx index 5c9fb1059..8af1ef2b1 100644 --- a/src/SVTK/SVTK_Selector.cxx +++ b/src/SVTK/SVTK_Selector.cxx @@ -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; +} diff --git a/src/SVTK/SVTK_Selector.h b/src/SVTK/SVTK_Selector.h index a745648a0..801ea715b 100644 --- a/src/SVTK/SVTK_Selector.h +++ b/src/SVTK/SVTK_Selector.h @@ -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; }; diff --git a/src/SVTK/SVTK_SelectorDef.h b/src/SVTK/SVTK_SelectorDef.h index 4fbc54d8c..3e4e6c42c 100644 --- a/src/SVTK/SVTK_SelectorDef.h +++ b/src/SVTK/SVTK_SelectorDef.h @@ -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 { diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index d89674a8a..4a13dd7ee 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.cxx @@ -29,7 +29,6 @@ #include //#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 aViews = aViewManager->getViews(); for ( uint i = 0; i < aViews.count(); i++ ) { if ( TViewWindow* aView = dynamic_cast(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 aViews = aViewManager->getViews(); + for ( uint i = 0; i < aViews.count(); i++ ) + { + if ( TViewWindow* aView = dynamic_cast(aViews.at( i )) ) + aView->SetSelectionEnabled( isEnabled ); + } + } } /*! diff --git a/src/SVTK/SVTK_ViewModel.h b/src/SVTK/SVTK_ViewModel.h index c4a73cf8e..155fd1f61 100644 --- a/src/SVTK/SVTK_ViewModel.h +++ b/src/SVTK/SVTK_ViewModel.h @@ -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]; }; diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index 4f7091ac4..fba7c6f76 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -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( 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 ); diff --git a/src/SVTK/SVTK_ViewWindow.h b/src/SVTK/SVTK_ViewWindow.h index e4a916ebb..58f2e8a73 100755 --- a/src/SVTK/SVTK_ViewWindow.h +++ b/src/SVTK/SVTK_ViewWindow.h @@ -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; diff --git a/src/SVTK/resources/SVTK_images.ts b/src/SVTK/resources/SVTK_images.ts index 3794dfb54..f446c7718 100644 --- a/src/SVTK/resources/SVTK_images.ts +++ b/src/SVTK/resources/SVTK_images.ts @@ -56,8 +56,20 @@ vtk_view_recording_stop.png - ICON_SVTK_DYNAMIC_PRESLECTION_SWITCH - vtk_view_highlight.png + ICON_SVTK_PRESELECTION_STANDARD + vtk_view_highlight_std.png + + + ICON_SVTK_PRESELECTION_DYNAMIC + vtk_view_highlight_dyn.png + + + ICON_SVTK_PRESELECTION_DISABLED + vtk_view_highlight_off.png + + + ICON_SVTK_SELECTION + vtk_view_selection.png diff --git a/src/SVTK/resources/SVTK_msg_en.ts b/src/SVTK/resources/SVTK_msg_en.ts index 623656fef..947d70d93 100644 --- a/src/SVTK/resources/SVTK_msg_en.ts +++ b/src/SVTK/resources/SVTK_msg_en.ts @@ -209,16 +209,40 @@ MNU_SVTK_ZOOMING_STYLE_SWITCH - Zomming style switch + Zooming style switch + + + DSC_SVTK_PRESELECTION_STANDARD + Standard preselection mode + + + MNU_SVTK_PRESELECTION_STANDARD + Standard Preselection Mode + + + DSC_SVTK_PRESELECTION_DYNAMIC + Dynamic preselection mode + + + MNU_SVTK_PRESELECTION_DYNAMIC + Dynamic Preselection Mode - DSC_SVTK_DYNAMIC_PRESLECTION_SWITCH - Dynamic preselection switch + DSC_SVTK_PRESELECTION_DISABLED + Disable preselection - MNU_SVTK_DYNAMIC_PRESLECTION_SWITCH - Dynamic preselection switch + MNU_SVTK_PRESELECTION_DISABLED + Disable Preselection + + DSC_SVTK_ENABLE_SELECTION + Enable/Disable selection + + + MNU_SVTK_ENABLE_SELECTION + Enable/Disable selection + SVTK_FontWidget diff --git a/src/SVTK/resources/SVTK_msg_fr.ts b/src/SVTK/resources/SVTK_msg_fr.ts index 048f36de3..ba75a9bda 100755 --- a/src/SVTK/resources/SVTK_msg_fr.ts +++ b/src/SVTK/resources/SVTK_msg_fr.ts @@ -212,13 +212,37 @@ Changer le style de zoom - DSC_SVTK_DYNAMIC_PRESLECTION_SWITCH - Pré-sélection dynamique + DSC_SVTK_PRESELECTION_STANDARD + Standard preselection mode - MNU_SVTK_DYNAMIC_PRESLECTION_SWITCH - Pré-sélection dynamique + MNU_SVTK_PRESELECTION_STANDARD + Standard Preselection Mode + + DSC_SVTK_PRESELECTION_DYNAMIC + Dynamic preselection mode + + + MNU_SVTK_PRESELECTION_DYNAMIC + Dynamic Preselection Mode + + + DSC_SVTK_PRESELECTION_DISABLED + Disable preselection + + + MNU_SVTK_PRESELECTION_DISABLED + Disable Preselection + + + DSC_SVTK_ENABLE_SELECTION + Enable/Disable selection + + + MNU_SVTK_ENABLE_SELECTION + Enable/Disable selection + SVTK_FontWidget diff --git a/src/SVTK/resources/vtk_view_highlight_dyn.png b/src/SVTK/resources/vtk_view_highlight_dyn.png new file mode 100755 index 000000000..0aa1d6f9c 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 index 000000000..d0a344d5c 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 index 000000000..502986786 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 index 000000000..24fb63242 Binary files /dev/null and b/src/SVTK/resources/vtk_view_selection.png differ