]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Implementation SALOME_Event's wrappers for VISU::TimeAnimation CORBA servants QT_EVENT mergeto_Event_Server_20Apr04
authorsmh <smh@opencascade.com>
Tue, 20 Apr 2004 05:51:38 +0000 (05:51 +0000)
committersmh <smh@opencascade.com>
Tue, 20 Apr 2004 05:51:38 +0000 (05:51 +0000)
src/VISU_I/VISU_TimeAnimation.cxx
src/VISU_I/VISU_TimeAnimation.h

index 381061681e5d4cc9a8ecce1c934a608dea8be602..de153fed99dcf9192c76621964b3f043de305e43 100644 (file)
@@ -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<VISU_TimeAnimation,bool>(myAnim,&VISU_TimeAnimation::generateFrames));
+}
+
+
+void VISU_TimeAnimation_i::generatePresentations(CORBA::Long theFieldNum){
+  myAnim->generatePresentations(theFieldNum);
+}
+
+
+void VISU_TimeAnimation_i::clearView(){
+  ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::clearView));
+}
+
+
+void VISU_TimeAnimation_i::stopAnimation(){
+  ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::stopAnimation));
+}
+
+
+void VISU_TimeAnimation_i::startAnimation(){
+  ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::startAnimation));
+}
+
+
+void VISU_TimeAnimation_i::nextFrame(){
+  ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::nextFrame));
+}
+
+
+void VISU_TimeAnimation_i::prevFrame(){
+  ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::prevFrame));
+}
+
+
+void VISU_TimeAnimation_i::firstFrame(){
+  ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::firstFrame));
+}
+
+
+void VISU_TimeAnimation_i::lastFrame(){
+  ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::lastFrame));
+}
+
+
+void VISU_TimeAnimation_i::gotoFrame(CORBA::Long theFrame){
+  ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_TimeAnimation,CORBA::Long>(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);
+}
+
+
index 0331f2f773b52e8bd94c2f763a7c31aa44330f74..243836a27c102e94ddcb217fcae4f76dc0868e09 100644 (file)
@@ -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