Skip to content

Commit

Permalink
- fix time slider
Browse files Browse the repository at this point in the history
  • Loading branch information
vwaurich authored and adeas31 committed Sep 30, 2016
1 parent 256dfe6 commit a6aa2a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
18 changes: 12 additions & 6 deletions OMEdit/OMEditGUI/Animation/AnimationWindowContainer.cpp
Expand Up @@ -119,7 +119,6 @@ AnimationWindowContainer::AnimationWindowContainer(QWidget *pParent)
mpAnimationToolBar->addWidget(mpAnimationTimeLabel);
mpAnimationToolBar->addWidget(mpPerspectiveDropDownBox);

//connect(mpAnimationSlider, SIGNAL(sliderMoved(int)),mpAnimationWindowContainer, SLOT(sliderSetTimeSlotFunction(int)));
addToolBar(Qt::TopToolBarArea,mpAnimationToolBar);

mpViewerWidget->setParent(this);//important!!
Expand All @@ -132,7 +131,7 @@ AnimationWindowContainer::AnimationWindowContainer(QWidget *pParent)
connect(mpAnimationPlayAction, SIGNAL(triggered()),this, SLOT(playSlotFunction()));
connect(mpAnimationPauseAction, SIGNAL(triggered()),this, SLOT(pauseSlotFunction()));
connect(mpPerspectiveDropDownBox, SIGNAL(activated(int)), this, SLOT(setPerspective(int)));

connect(mpAnimationSlider, SIGNAL(sliderMoved(int)),this, SLOT(sliderSetTimeSlotFunction(int)));
}

/*!
Expand Down Expand Up @@ -260,14 +259,14 @@ double AnimationWindowContainer::getTimeFraction(){

/*!
* \brief AnimationWindowContainer::sliderSetTimeSlotFunction
* slot function for the time slider
* slot function for the time slider to jump to the adjusted point of time
*/
void AnimationWindowContainer::sliderSetTimeSlotFunction(int value){
int time = (mpVisualizer->getTimeManager()->getEndTime()
float time = (mpVisualizer->getTimeManager()->getEndTime()
- mpVisualizer->getTimeManager()->getStartTime())
* (float) (value / 100.0);
mpVisualizer->getTimeManager()->setVisTime(time);
mpVisualizer->sceneUpdate();
mpVisualizer->updateScene(time);
}


Expand Down Expand Up @@ -301,8 +300,15 @@ void AnimationWindowContainer::initSlotFunction(){
* updates the visualization objects
*/
void AnimationWindowContainer::updateSceneFunction(){
if (!(mpVisualizer==NULL))
if (!(mpVisualizer == NULL))
{
//update the scene
mpVisualizer->sceneUpdate();

// set time slider
int time = mpVisualizer->getTimeManager()->getTimeFraction();
mpAnimationSlider->setValue(time);
}
}

/*!
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/OMEditGUI/Animation/TimeManager.cpp
Expand Up @@ -54,9 +54,9 @@ void TimeManager::updateTick()
_realTime = _visualTimer.time_m() / 1000.0;
}

double TimeManager::getTimeFraction()
int TimeManager::getTimeFraction()
{
return _visTime / (_endTime - _startTime);
return int(_visTime / (_endTime - _startTime)*100);
}

double TimeManager::getEndTime() const
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/Animation/TimeManager.h
Expand Up @@ -86,7 +86,7 @@ class TimeManager
/*! \brief Sets pause status to new value. */
void setPause(const bool status);

double getTimeFraction();
int getTimeFraction();

private:
//! Time of the current simulation step.
Expand Down

0 comments on commit a6aa2a6

Please sign in to comment.