mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add time step slider to 3d views (#9695)
Add new toolbar with slider that controls visible timestep in the view
This commit is contained in:
parent
85f1b004cb
commit
712bad97bd
@ -728,6 +728,19 @@ void RiuMainWindow::createToolBars()
|
||||
m_animationToolBar = new caf::AnimationToolBar( "Animation", this );
|
||||
addToolBar( m_animationToolBar );
|
||||
|
||||
{
|
||||
QToolBar* toolbar = addToolBar( tr( "Timestep Slider" ) );
|
||||
toolbar->setObjectName( toolbar->windowTitle() );
|
||||
|
||||
m_animationSlider = new QSlider( Qt::Horizontal, toolbar );
|
||||
m_animationSliderAction = toolbar->addWidget( m_animationSlider );
|
||||
|
||||
connect( m_animationSlider, SIGNAL( valueChanged( int ) ), SLOT( slotAnimationSliderMoved( int ) ) );
|
||||
}
|
||||
|
||||
// make sure slider updates if user uses animation toolbar
|
||||
connect( m_animationToolBar, SIGNAL( frameChanged( int ) ), SLOT( slotAnimationControlFrameChanged( int ) ) );
|
||||
|
||||
refreshAnimationActions();
|
||||
refreshDrawStyleActions();
|
||||
}
|
||||
@ -1032,6 +1045,28 @@ void RiuMainWindow::refreshAnimationActions()
|
||||
m_animationToolBar->setCurrentTimeStepIndex( currentTimeStepIndex );
|
||||
|
||||
m_animationToolBar->setEnabled( enableAnimControls );
|
||||
|
||||
m_animationSliderAction->setEnabled( enableAnimControls );
|
||||
m_animationSlider->blockSignals( true );
|
||||
m_animationSlider->setMaximum( timeStepStrings.size() - 1 );
|
||||
m_animationSlider->setMinimum( 0 );
|
||||
m_animationSlider->setSingleStep( 1 );
|
||||
m_animationSlider->setPageStep( 1 );
|
||||
m_animationSlider->setValue( currentTimeStepIndex );
|
||||
m_animationSlider->blockSignals( false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotAnimationControlFrameChanged( int frameIndex )
|
||||
{
|
||||
if ( m_animationSlider )
|
||||
{
|
||||
m_animationSlider->blockSignals( true );
|
||||
m_animationSlider->setValue( frameIndex );
|
||||
m_animationSlider->blockSignals( false );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1862,6 +1897,18 @@ void RiuMainWindow::updateScaleValue()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotAnimationSliderMoved( int newValue )
|
||||
{
|
||||
if ( RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer() )
|
||||
{
|
||||
RiaApplication::instance()->activeReservoirView()->viewer()->setCurrentFrame( newValue );
|
||||
}
|
||||
m_animationToolBar->setCurrentTimeStepIndex( newValue );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// TODO: This function will be moved to a class responsible for handling the application selection concept
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -39,6 +39,7 @@ class QToolButton;
|
||||
class QComboBox;
|
||||
class QTimer;
|
||||
class QUndoView;
|
||||
class QSlider;
|
||||
|
||||
class Rim3dView;
|
||||
class RimCase;
|
||||
@ -224,6 +225,9 @@ private slots:
|
||||
|
||||
void slotShowWellCellsAction( bool doAdd );
|
||||
|
||||
void slotAnimationSliderMoved( int newValue );
|
||||
void slotAnimationControlFrameChanged( int newValue );
|
||||
|
||||
// Debug slots
|
||||
void slotSnapshotAllViewsToFile();
|
||||
|
||||
@ -270,6 +274,9 @@ private:
|
||||
QAction* m_drawStyleSurfOnlyAction;
|
||||
QAction* m_showWellCellsAction;
|
||||
QAction* m_drawStyleDeformationsAction;
|
||||
QAction* m_animationSliderAction;
|
||||
|
||||
QSlider* m_animationSlider;
|
||||
|
||||
QToolBar* m_holoLensToolBar;
|
||||
|
||||
|
@ -159,7 +159,7 @@ void RiuMainWindowBase::loadWinGeoAndDockToolBarLayout()
|
||||
{
|
||||
if ( toolbarLayout.isValid() )
|
||||
{
|
||||
restoreState( toolbarLayout.toByteArray(), 0 );
|
||||
restoreState( toolbarLayout.toByteArray(), 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -209,7 +209,7 @@ void RiuMainWindowBase::saveWinGeoAndDockToolBarLayout()
|
||||
QByteArray winGeo = saveGeometry();
|
||||
settings.setValue( QString( "%1/winGeometry" ).arg( registryFolderName() ), winGeo );
|
||||
|
||||
QByteArray layout = saveState( 0 );
|
||||
QByteArray layout = saveState( 1 );
|
||||
settings.setValue( QString( "%1/toolBarLayout" ).arg( registryFolderName() ), layout );
|
||||
|
||||
settings.setValue( QString( "%1/isMaximized" ).arg( registryFolderName() ), isMaximized() );
|
||||
|
@ -377,6 +377,8 @@ void AnimationToolBar::slotUpdateAnimationGuiFromFrameIndex( int value )
|
||||
m_timestepCombo->setCurrentIndex( value );
|
||||
updateAnimationButtons();
|
||||
connect( m_timestepCombo, SIGNAL( currentIndexChanged( int ) ), m_activeAnimationControl, SLOT( setCurrentFrame( int ) ) );
|
||||
|
||||
emit frameChanged( value );
|
||||
}
|
||||
|
||||
} // End namespace caf
|
||||
|
@ -72,6 +72,9 @@ public:
|
||||
|
||||
void setCurrentTimeStepIndex( int index );
|
||||
|
||||
signals:
|
||||
void frameChanged( int frameIndex );
|
||||
|
||||
public slots:
|
||||
void slotUpdateTimestepList( int frameCount );
|
||||
void playPauseChanged();
|
||||
|
Loading…
Reference in New Issue
Block a user