From 85af4ad7afe69aea5fba76c048201a6fb5584f4a Mon Sep 17 00:00:00 2001 From: smh Date: Tue, 20 Apr 2004 05:51:38 +0000 Subject: [PATCH] Implementation SALOME_Event's wrappers for VISU::TimeAnimation CORBA servants --- src/VISU_I/VISU_TimeAnimation.cxx | 179 +++++++++++++++++++++++++++++- src/VISU_I/VISU_TimeAnimation.h | 66 ++++++++++- 2 files changed, 236 insertions(+), 9 deletions(-) diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index 38106168..de153fed 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -21,6 +21,8 @@ #include "VISU_ScalarBarActor.hxx" #include "VISU_Actor.h" +#include "SALOME_Event.hxx" + #include "VTKViewer_ViewFrame.h" #include "QAD_Config.h" @@ -30,9 +32,10 @@ using namespace std; //QWaitCondition myCondition; static int MYDELAY = 1; + //************************************************************************ -VISU_TimeAnimation::VISU_TimeAnimation(SALOMEDS::Study_var theStudy, VISU::View3D_ptr theView3D) { - myStudy = theStudy; +VISU_TimeAnimation::VISU_TimeAnimation(SALOMEDS::Study_ptr theStudy, VISU::View3D_ptr theView3D) { + myStudy = SALOMEDS::Study::_duplicate(theStudy); myIsActive = false; myFrame = 0; mySpeed = 1; @@ -241,14 +244,13 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) { //************************************************************************ -CORBA::Boolean VISU_TimeAnimation::generateFrames() { +CORBA::Boolean VISU_TimeAnimation::generateFrames(){ if (!myView) { MESSAGE("Viewer is nod defined for animation"); return false; } myLastError = QString("Frame(s) for "); bool aNoError = true; - VISU::Mutex mt(myMutex,qApp,MYDELAY); clearView(); vtkRenderer* aRen = myView->getRenderer(); for (int i = 0; i < getNbFields(); i++) { @@ -283,7 +285,6 @@ void VISU_TimeAnimation::clearView() { MESSAGE("Viewer is nod defined for animation"); return; } - VISU::Mutex mt(myMutex,qApp,MYDELAY); vtkRenderer* aRen = myView->getRenderer(); for (int i = 0; i < getNbFields(); i++) { FieldData& aData = myFieldsLst[i]; @@ -548,3 +549,171 @@ double VISU_TimeAnimation::getTimeValue(SALOMEDS::SObject_var theTimeStamp) { void VISU_TimeAnimation::setSpeed(CORBA::Long theSpeed) { mySpeed = (theSpeed<1)? 1 : theSpeed; } + + +//======================================================================== +VISU_TimeAnimation_i::VISU_TimeAnimation_i(SALOMEDS::Study_ptr theStudy, VISU::View3D_ptr theView3D){ + myAnim = new VISU_TimeAnimation(theStudy,theView3D); +} + + +VISU_TimeAnimation_i::~VISU_TimeAnimation_i(){ + delete myAnim; +} + + +void VISU_TimeAnimation_i::addField(SALOMEDS::SObject_ptr theField){ + myAnim->addField(theField); +} + + +CORBA::Boolean VISU_TimeAnimation_i::generateFrames(){ + return ProcessEvent(new TMemFunEvent(myAnim,&VISU_TimeAnimation::generateFrames)); +} + + +void VISU_TimeAnimation_i::generatePresentations(CORBA::Long theFieldNum){ + myAnim->generatePresentations(theFieldNum); +} + + +void VISU_TimeAnimation_i::clearView(){ + ProcessVoidEvent(new TVoidMemFunEvent(myAnim,&VISU_TimeAnimation::clearView)); +} + + +void VISU_TimeAnimation_i::stopAnimation(){ + ProcessVoidEvent(new TVoidMemFunEvent(myAnim,&VISU_TimeAnimation::stopAnimation)); +} + + +void VISU_TimeAnimation_i::startAnimation(){ + ProcessVoidEvent(new TVoidMemFunEvent(myAnim,&VISU_TimeAnimation::startAnimation)); +} + + +void VISU_TimeAnimation_i::nextFrame(){ + ProcessVoidEvent(new TVoidMemFunEvent(myAnim,&VISU_TimeAnimation::nextFrame)); +} + + +void VISU_TimeAnimation_i::prevFrame(){ + ProcessVoidEvent(new TVoidMemFunEvent(myAnim,&VISU_TimeAnimation::prevFrame)); +} + + +void VISU_TimeAnimation_i::firstFrame(){ + ProcessVoidEvent(new TVoidMemFunEvent(myAnim,&VISU_TimeAnimation::firstFrame)); +} + + +void VISU_TimeAnimation_i::lastFrame(){ + ProcessVoidEvent(new TVoidMemFunEvent(myAnim,&VISU_TimeAnimation::lastFrame)); +} + + +void VISU_TimeAnimation_i::gotoFrame(CORBA::Long theFrame){ + ProcessVoidEvent(new TVoidMemFun1ArgEvent(myAnim,&VISU_TimeAnimation::gotoFrame,theFrame)); +} + + +CORBA::Long VISU_TimeAnimation_i::getNbFields(){ + return myAnim->getNbFields(); +} + + +CORBA::Long VISU_TimeAnimation_i::getNbFrames(){ + return myAnim->getNbFrames(); +} + + +CORBA::Boolean VISU_TimeAnimation_i::isRunning(){ + return myAnim->isRunning(); +} + + +CORBA::Long VISU_TimeAnimation_i::getCurrentFrame(){ + return myAnim->getCurrentFrame(); +} + + +VISU::ScalarMap_ptr VISU_TimeAnimation_i::getPresentation(CORBA::Long theField, CORBA::Long theFrame){ + return myAnim->getPresentation(theField,theFrame); +} + + +void VISU_TimeAnimation_i::setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType){ + myAnim->setPresentationType(theFieldNum,theType); +} + + +VISU::VISUType VISU_TimeAnimation_i::getPresentationType(CORBA::Long theFieldNum){ + return myAnim->getPresentationType(theFieldNum); +} + + +void VISU_TimeAnimation_i::setSpeed(CORBA::Long theSpeed){ + myAnim->setSpeed(theSpeed); +} + + +CORBA::Long VISU_TimeAnimation_i::getSpeed(){ + return myAnim->getSpeed(); +} + + +CORBA::Boolean VISU_TimeAnimation_i::isProportional(){ + return myAnim->isProportional(); +} + + +void VISU_TimeAnimation_i::setAnimationRange(CORBA::Double theMin, CORBA::Double theMax){ + myAnim->setAnimationRange(theMin,theMax); +} + + +CORBA::Double VISU_TimeAnimation_i::getMinRange(){ + return myAnim->getMinRange(); +} + + +CORBA::Double VISU_TimeAnimation_i::getMaxRange(){ + return myAnim->getMaxRange(); +} + + +CORBA::Boolean VISU_TimeAnimation_i::isRangeDefined(){ + return myAnim->isRangeDefined(); +} + + +void VISU_TimeAnimation_i::dumpTo(const char* thePath){ + myAnim->dumpTo(thePath); +} + + +CORBA::Boolean VISU_TimeAnimation_i::isCycling(){ + return myAnim->isCycling(); +} + + +CORBA::Double VISU_TimeAnimation_i::getMinTime(){ + return myAnim->getMinTime(); +} + + +CORBA::Double VISU_TimeAnimation_i::getMaxTime(){ + return myAnim->getMaxTime(); +} + + +void VISU_TimeAnimation_i::setProportional(CORBA::Boolean theProp){ + myAnim->setProportional(theProp); +} + + +void VISU_TimeAnimation_i::setCycling(CORBA::Boolean theCycle){ + myAnim->setCycling(theCycle); +} + + diff --git a/src/VISU_I/VISU_TimeAnimation.h b/src/VISU_I/VISU_TimeAnimation.h index 0331f2f7..243836a2 100644 --- a/src/VISU_I/VISU_TimeAnimation.h +++ b/src/VISU_I/VISU_TimeAnimation.h @@ -35,9 +35,7 @@ struct FieldData }; -class VISU_TimeAnimation: public QObject, public QThread, - public virtual POA_VISU::Animation, - public virtual VISU::Base_i +class VISU_TimeAnimation: public QObject, public QThread { Q_OBJECT; public: @@ -45,7 +43,7 @@ class VISU_TimeAnimation: public QObject, public QThread, static VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject); static double getTimeValue(SALOMEDS::SObject_var theTimestamp); - VISU_TimeAnimation(SALOMEDS::Study_var theStudy, VISU::View3D_ptr theView3D = VISU::View3D::_nil()); + VISU_TimeAnimation(SALOMEDS::Study_ptr theStudy, VISU::View3D_ptr theView3D = VISU::View3D::_nil()); ~VISU_TimeAnimation(); virtual VISU::VISUType GetType() { return VISU::TNONE;}; @@ -130,4 +128,64 @@ class VISU_TimeAnimation: public QObject, public QThread, VTKViewer_ViewFrame* myView; }; + +class VISU_TimeAnimation_i: public virtual POA_VISU::Animation, + public virtual VISU::Base_i +{ + VISU_TimeAnimation* myAnim; +public: + VISU_TimeAnimation_i(SALOMEDS::Study_ptr theStudy, + VISU::View3D_ptr theView3D = VISU::View3D::_nil()); + ~VISU_TimeAnimation_i(); + + virtual VISU::VISUType GetType(){ return VISU::TNONE;} + + virtual void addField(SALOMEDS::SObject_ptr theField); + + virtual CORBA::Boolean generateFrames(); + virtual void generatePresentations(CORBA::Long theFieldNum); + + virtual void clearView(); + + virtual void stopAnimation(); + virtual void startAnimation(); + virtual void nextFrame(); + virtual void prevFrame(); + virtual void firstFrame(); + virtual void lastFrame(); + virtual void gotoFrame(CORBA::Long theFrame); + + virtual CORBA::Long getNbFields(); + virtual CORBA::Long getNbFrames(); + virtual CORBA::Boolean isRunning(); + virtual CORBA::Long getCurrentFrame(); + + virtual VISU::ScalarMap_ptr getPresentation(CORBA::Long theField, CORBA::Long theFrame); + + virtual void setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType); + virtual VISU::VISUType getPresentationType(CORBA::Long theFieldNum); + + virtual void setSpeed(CORBA::Long theSpeed); + virtual CORBA::Long getSpeed(); + + virtual CORBA::Boolean isProportional(); + + virtual void setAnimationRange(CORBA::Double theMin, CORBA::Double theMax); + + virtual CORBA::Double getMinRange(); + virtual CORBA::Double getMaxRange(); + virtual CORBA::Boolean isRangeDefined(); + + virtual void dumpTo(const char* thePath); + + virtual CORBA::Boolean isCycling(); + + virtual CORBA::Double getMinTime(); + virtual CORBA::Double getMaxTime(); + + virtual void setProportional(CORBA::Boolean theProp); + virtual void setCycling(CORBA::Boolean theCycle); +}; + + #endif //VISU_TIMEANIMATION_H -- 2.39.2