vm->setStaticTrihedronVisible( resMgr->booleanValue( "VTKViewer", "show_static_trihedron", vm->isStaticTrihedronVisible() ) );
vm->setInteractionStyle( resMgr->integerValue( "VTKViewer", "navigation_mode", vm->interactionStyle() ) );
vm->setZoomingStyle( resMgr->integerValue( "VTKViewer", "zooming_mode", vm->zoomingStyle() ) );
+ vm->setDynamicPreSelection( resMgr->booleanValue( "VTKViewer", "dynamic_preselection", vm->dynamicPreSelection() ) );
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) ),
pref->setItemProperty( "indexes", aModeIndexesList, vtkSpeedMode );
pref->addPreference( tr( "PREF_SHOW_STATIC_TRIHEDRON" ), vtkGen, LightApp_Preferences::Bool, "VTKViewer", "show_static_trihedron" );
+ pref->addPreference( tr( "PREF_DYNAMIC_PRESELECTION" ), vtkGen, LightApp_Preferences::Bool, "VTKViewer", "dynamic_preselection" );
int vtkSM = pref->addPreference( tr( "PREF_FRAME_SPACEMOUSE" ), vtkGroup, LightApp_Preferences::GroupBox );
pref->setItemProperty( "columns", 2, vtkSM );
}
#endif
+#ifndef DISABLE_VTKVIEWER
+ if ( sec == QString( "VTKViewer" ) && param == QString( "dynamic_preselection" ) )
+ {
+ bool mode = resMgr->booleanValue( "VTKViewer", "dynamic_preselection", true );
+ 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->setDynamicPreSelection( mode );
+ }
+#endif
+ }
+#endif
+
#ifndef DISABLE_VTKVIEWER
if ( sec == QString( "VTKViewer" ) && param == QString( "show_static_trihedron" ) )
{
<parameter name="projection_mode" value="0"/>
<parameter name="trihedron_size" value="105"/>
<parameter name="relative_size" value="true"/>
- <parameter name="use_advanced_selection_algorithm" value="true"/>
+ <parameter name="dynamic_preselection" value="true"/>
<parameter name="navigation_mode" value="0"/>
<parameter name="zooming_mode" value="0"/>
<parameter name="speed_value" value="10"/>
<translation>Python Console</translation>
</message>
<message>
- <source>PREF_USE_ADVANCED_SELECTION_ALGORITHM</source>
- <translation>Use Advanced Selection Algorithm</translation>
+ <source>PREF_DYNAMIC_PRESELECTION</source>
+ <translation>Dynamic pre-selection</translation>
</message>
<message>
<source>TOT_CLOSE</source>
<translation>Console Python</translation>
</message>
<message>
- <source>PREF_USE_ADVANCED_SELECTION_ALGORITHM</source>
+ <source>PREF_DYNAMIC_PRESELECTION</source>
<translation>Utiliser l'algorithme de sélection avancée</translation>
</message>
<message>
resources/vtk_view_recording_play.png \
resources/vtk_view_recording_pause.png \
resources/vtk_view_recording_stop.png \
- resources/vtk_view_sync.png
+ resources/vtk_view_sync.png \
+ resources/vtk_view_highlight.png
nodist_salomeres_DATA = \
SVTK_msg_en.qm \
myCellPicker(vtkCellPicker::New())
{
mySelectionMode = ActorSelection;
+ myDynamicPreselection = true;
myPicker->Delete();
myCellPicker->Delete();
SVTK_SelectorDef
::Pick(const SVTK_SelectionEvent* theEvent, vtkRenderer* theRenderer) const
{
- bool anAdvancedSelectionAlgorithm = true;
- SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
- if ( aResourceMgr )
- anAdvancedSelectionAlgorithm = aResourceMgr->booleanValue( "VTKViewer", "use_advanced_selection_algorithm", true );
-
vtkActorCollection* aListActors = NULL;
- if ( anAdvancedSelectionAlgorithm ) {
+
+ if ( GetDynamicPreSelection() ) {
myCellPicker->Pick(theEvent->myX,
theEvent->myY,
0.0,
myPicker->SetTolerance(theTolerance);
myCellPicker->SetTolerance(theTolerance);
}
+
+void
+SVTK_SelectorDef
+::SetDynamicPreSelection( bool theIsDynPreselect )
+{
+ myDynamicPreselection = theIsDynPreselect;
+}
+
+bool
+SVTK_SelectorDef
+::GetDynamicPreSelection() const
+{
+ return myDynamicPreselection;
+}
virtual
void
SetTolerance(const double& theTolerance) = 0;
+
+ virtual
+ void
+ SetDynamicPreSelection( bool theIsDynPreselect ) = 0;
+
+ virtual
+ bool
+ GetDynamicPreSelection() const = 0;
};
void
SetTolerance(const double& theTolerance);
+ virtual
+ void
+ SetDynamicPreSelection( bool theIsDynPreselect );
+
+ virtual
+ bool
+ GetDynamicPreSelection() const;
+
private:
int mySelectionMode;
+ bool myDynamicPreselection;
+
struct TIOLessThan
{
bool
myProjMode = 0;
myStyle = 0;
myZoomingStyle = 0;
+ myDynamicPreSelection = false;
mySpaceBtn[0] = 1;
mySpaceBtn[1] = 2;
mySpaceBtn[2] = 9;
aViewWindow->SetProjectionMode( projectionMode() );
aViewWindow->SetInteractionStyle( interactionStyle() );
aViewWindow->SetZoomingStyle( zoomingStyle() );
+ aViewWindow->SetDynamicPreSelection( dynamicPreSelection() );
aViewWindow->SetIncrementalSpeed( incrementalSpeed(), incrementalSpeedMode() );
aViewWindow->SetSpacemouseButtons( spacemouseBtn(1), spacemouseBtn(2), spacemouseBtn(3) );
}
}
+/*!
+ \return dynamic preselection
+*/
+bool SVTK_Viewer::dynamicPreSelection() const
+{
+ return myDynamicPreSelection;
+}
+
+/*!
+ Sets dynamic preselection
+ \param theMode - new dynamic preselection mode
+*/
+void SVTK_Viewer::setDynamicPreSelection( const bool theMode )
+{
+ myDynamicPreSelection = 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 );
+ }
+ }
+}
+
/*!
\return incremental speed value
*/
//! Sets zooming style
void setZoomingStyle( const int );
+ //! Gets dynamic preselection
+ bool dynamicPreSelection() const;
+
+ //! Sets dynamic preselection
+ void setDynamicPreSelection( const bool );
+
//! Get incremental speed (see #SVTK_InteractorStyle::ControllerIncrement)
int incrementalSpeed() const;
int myProjMode;
int myStyle;
int myZoomingStyle;
+ bool myDynamicPreSelection;
int mySpaceBtn[3];
};
{
myInteractor = new SVTK_RenderWindowInteractor(this,"SVTK_RenderWindowInteractor");
- SVTK_Selector* aSelector = SVTK_Selector::New();
+ SVTK_Selector* aSelector = SVTK_Selector::New();
+ aSelector->SetDynamicPreSelection( SUIT_Session::session()->resourceMgr()->
+ booleanValue( "VTKViewer", "dynamic_preselection", true ) );
SVTK_GenericRenderWindowInteractor* aDevice = SVTK_GenericRenderWindowInteractor::New();
aDevice->SetRenderWidget(myInteractor);
myToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"), false, Qt::AllToolBarAreas, -1, this );
myRecordingToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_RECORD_LABEL"), false, Qt::AllToolBarAreas, -1, this );
- createActions( SUIT_Session::session()->activeApplication()->resourceMgr() );
+ createActions( SUIT_Session::session()->resourceMgr() );
createToolBar();
SetEventDispatcher(myInteractor->GetDevice());
onSwitchZoomingStyle( theStyle==1 );
}
+/*!
+ Switch dynamic preselection on / off
+ \param theDynPreselection - dynamic pre-selection mode
+*/
+void SVTK_ViewWindow::SetDynamicPreSelection( bool theDynPreselection )
+{
+ onSwitchDynamicPreSelection( theDynPreselection );
+}
+
/*!
Switches "keyboard free" interaction style on/off
*/
a->setChecked( theOn );
}
+/*!
+ Toogles dynamic preselection on/off
+*/
+void SVTK_ViewWindow::onSwitchDynamicPreSelection( bool theOn )
+{
+ GetSelector()->SetDynamicPreSelection( theOn );
+
+ // update action state if method is called outside
+ QtxAction* a = getAction( SwitchDynamicPreselectionId );
+ if ( a->isChecked() != theOn )
+ a->setChecked( theOn );
+}
+
/*!
Sets incremental speed
\param theValue - new incremental speed
connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onSwitchInteractionStyle(bool)));
mgr->registerAction( anAction, SwitchInteractionStyleId );
- // Switch between zomming styles
+ // Switch between zooming styles
anAction = new QtxAction(tr("MNU_SVTK_ZOOMING_STYLE_SWITCH"),
theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_ZOOMING_STYLE_SWITCH" ) ),
tr( "MNU_SVTK_ZOOMING_STYLE_SWITCH" ), 0, this);
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"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onSwitchDynamicPreSelection(bool)));
+ mgr->registerAction( anAction, SwitchDynamicPreselectionId );
+
// Start recording
myStartAction = new QtxAction(tr("MNU_SVTK_RECORDING_START"),
theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_RECORDING_START" ) ),
mgr->append( DumpId, myToolBar );
mgr->append( SwitchInteractionStyleId, myToolBar );
mgr->append( SwitchZoomingStyleId, myToolBar );
+ mgr->append( SwitchDynamicPreselectionId, myToolBar );
mgr->append( ViewTrihedronId, myToolBar );
QtxMultiAction* aScaleAction = new QtxMultiAction( this );
//! Redirect the request to #SVTK_MainWindow::SetZoomingStyle
virtual void SetZoomingStyle( const int );
+ virtual void SetDynamicPreSelection( bool );
+
//! Redirect the request to #SVTK_MainWindow::SetSpacemouseButtons
virtual void SetSpacemouseButtons( const int, const int, const int );
void onSwitchInteractionStyle(bool theOn);
void onSwitchZoomingStyle(bool theOn);
+ void onSwitchDynamicPreSelection(bool theOn);
void onStartRecording();
void onPlayRecording();
FrontId, BackId, TopId, BottomId, LeftId, RightId, ClockWiseId, AntiClockWiseId, ResetId,
ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate,
ParallelModeId, ProjectionModeId, ViewParametersId, SynchronizeId, SwitchInteractionStyleId,
- SwitchZoomingStyleId,
+ SwitchZoomingStyleId,SwitchDynamicPreselectionId,
StartRecordingId, PlayRecordingId, PauseRecordingId, StopRecordingId };
-
SVTK_View* myView;
//SVTK_MainWindow* myMainWindow;
SVTK_ViewModelBase* myModel;
<source>ICON_SVTK_SYNCHRONIZE</source>
<translation>vtk_view_sync.png</translation>
</message>
+ <message>
+ <source>ICON_SVTK_DYNAMIC_PRESLECTION_SWITCH</source>
+ <translation>vtk_view_highlight.png</translation>
+ </message>
</context>
</TS>
<source>MNU_SVTK_ZOOMING_STYLE_SWITCH</source>
<translation>Zomming style switch</translation>
</message>
+ <message>
+ <source>DSC_SVTK_DYNAMIC_PRESLECTION_SWITCH</source>
+ <translation>Dynamic preselection switch</translation>
+ </message>
+ <message>
+ <source>MNU_SVTK_DYNAMIC_PRESLECTION_SWITCH</source>
+ <translation>Dynamic preselection switch</translation>
+ </message>
</context>
<context>
<name>SVTK_FontWidget</name>