X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVISU_I%2FVISU_TimeAnimation.h;h=d2da49a4c4bcae61918a3aada2dd7ac6534c6c60;hb=e967b0415406f4f86ca2c9489abc8554b4c15dae;hp=87f08e6ebb45b49e62f7e2f28e9d8de0abc46ff9;hpb=11b47d48aa238206c0a6493749a1ac8a9fd93c69;p=modules%2Fvisu.git diff --git a/src/VISU_I/VISU_TimeAnimation.h b/src/VISU_I/VISU_TimeAnimation.h index 87f08e6e..d2da49a4 100644 --- a/src/VISU_I/VISU_TimeAnimation.h +++ b/src/VISU_I/VISU_TimeAnimation.h @@ -1,52 +1,88 @@ -// File : VISU_TimeAnimation.h -// Created : 10 / 04 / 2003 -// Author : Vitaly SMETANNIKOV -// Project : SALOME -// Module : VISU_I -// Copyright : Open CASCADE +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : VISU_TimeAnimation.h +// Author : Vitaly SMETANNIKOV +// Module : VISU #ifndef VISU_TIMEANIMATION_H #define VISU_TIMEANIMATION_H +#include "VISUConfig.hh" + +#include + #include #include #include -#include "VISU_Actor.h" -#include "VISU_PrsObject_i.hh" -#include "VTKViewer_ViewFrame.h" +class SVTK_ViewWindow; +class VISU_Actor; + +namespace VISU +{ + class Result_i; + class ColoredPrs3d_i; +} struct FieldData { - VISU::VISUType myPrsType; - SALOMEDS::SObject_var myField; // field label - long myNbTimes; // number of Timestamps - VISU::ScalarMap_i** myPrs; // Presentations - VISU_Actor** myActors; // Actors - double* myTiming; // time values + VISU::VISUType myPrsType; + _PTR(SObject) myField; // field label + long myNbTimes; // number of Timestamps + long myNbFrames; // number of created Frames + std::vector myPrs; // Presentations + std::vector myActors; // Actors + std::vector myTiming; // time values + CORBA::Float myOffset[3]; }; class VISU_TimeAnimation: public QObject, public QThread { - Q_OBJECT + Q_OBJECT; public: - static VISU::Result_i* createPresent(SALOMEDS::SObject_var theField); - static VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject); - static double getTimeValue(SALOMEDS::SObject_var theTimestamp); - - VISU_TimeAnimation(SALOMEDS::Study_var theStudy); + //static VISU::Result_i* createPresent (SALOMEDS::SObject_var theField); + //static VISU::Storable::TRestoringMap getMapOfValue (SALOMEDS::SObject_var theSObject); + //static double getTimeValue (SALOMEDS::SObject_var theTimestamp); + + static VISU::Result_i* createPresent (_PTR(SObject) theField); + static VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject); + static double getTimeValue (_PTR(SObject) theTimestamp); + + VISU_TimeAnimation(_PTR(Study) theStudy, + VISU::View3D_ptr theView3D = VISU::View3D::_nil()); ~VISU_TimeAnimation(); - void addField(SALOMEDS::SObject_var theField); - FieldData& getFieldData(int theNum) { return myFieldsLst[theNum]; } + virtual VISU::VISUType GetType() { return VISU::TNONE;}; + + void addField (_PTR(SObject) theField); + void addField (SALOMEDS::SObject_ptr theField); + FieldData& getFieldData (int theNum) { return myFieldsLst[theNum]; } - bool generateFrames(); - void generatePresentations(int theFieldNum); - void setViewer(VTKViewer_ViewFrame* theView) { myView = theView; } - VTKViewer_ViewFrame* getViewer() { return myView; } + CORBA::Boolean generateFrames(); + void generatePresentations(CORBA::Long theFieldNum); + void setViewer(SVTK_ViewWindow* theView) { myView = theView; } + SVTK_ViewWindow* getViewer() { return myView; } void clearView(); void clearData(FieldData& theData); + void clearFieldData() { myFieldsLst.clear();}; void stopAnimation(); void startAnimation(); @@ -54,53 +90,155 @@ class VISU_TimeAnimation: public QObject, public QThread void prevFrame(); void firstFrame(); void lastFrame(); - void gotoFrame(long theFrame); + void gotoFrame(CORBA::Long theFrame); + + CORBA::Long getNbFields() { return myFieldsLst.size(); } + CORBA::Long getNbFrames(); + CORBA::Boolean isRunning() { return myIsActive; } + CORBA::Long getCurrentFrame() { return myFrame; } + + VISU::ColoredPrs3d_ptr getPresentation(CORBA::Long theField, CORBA::Long theFrame); - int getNbFields() { return myFieldsLst.size(); } - long getNbFrames(); - bool isRunning() { return myIsActive; } - long getCurrentFrame() { return myFrame; } + void setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType) + { myFieldsLst[theFieldNum].myPrsType = theType; } + VISU::VISUType getPresentationType(CORBA::Long theFieldNum) + { return myFieldsLst[theFieldNum].myPrsType; } - VISU::ScalarMap_i* getPresentation(int theField, long theFrame); + void setSpeed(CORBA::Long theSpeed); + CORBA::Long getSpeed() { return mySpeed; } - void setPresentationType(int theFieldNum, VISU::VISUType theType) { myFieldsLst[theFieldNum].myPrsType = theType; } - VISU::VISUType getPresentationType(int theFieldNum) { return myFieldsLst[theFieldNum].myPrsType; } + CORBA::Boolean isProportional() { return myProportional; } - void setSpeed(int theSpeed); - int getSpeed() { return mySpeed; } + void setAnimationRange(CORBA::Double theMin, CORBA::Double theMax) + { myTimeMinVal = theMin; myTimeMaxVal = theMax; } - bool isProportional() { return myProportional; } + CORBA::Double getMinRange() { return myTimeMinVal; } + CORBA::Double getMaxRange() { return myTimeMaxVal; } + CORBA::Boolean isRangeDefined() { return !((myTimeMaxVal == 0) && (myTimeMinVal == myTimeMaxVal)); } - void setAnimationRange(double theMin, double theMax) - { myMaxVal = theMax; myMinVal = theMin; } + void dumpTo(const char* thePath) { myDumpPath = thePath; } + std::string setDumpFormat(const char* theFormat); + bool checkAVIMaker() const; - double getMinRange() { return myMinVal; } - double getMaxRange() { return myMaxVal; } - bool isRangeDefined() { return ((myMaxVal!=0) && (myMinVal != 0)); } + QString getLastErrorMsg() { return myLastError; } - void dumpTo(QString thePath) { myDumpPath = thePath; } + CORBA::Boolean isCycling() { return myCycling; } + + CORBA::Double getMinTime() { return myTimeMin;} + CORBA::Double getMaxTime() { return myTimeMax;} + + void setProportional(CORBA::Boolean theProp) { myProportional = theProp; } + void setCycling(CORBA::Boolean theCycle) { myCycling = theCycle; } + + SALOMEDS::SObject_ptr publishInStudy(); + void restoreFromStudy(SALOMEDS::SObject_ptr theField); + void restoreFromStudy(_PTR(SObject) theField); + void saveAnimation(); + bool isSavedInStudy() const { return !myAnimEntry.isEmpty(); } public slots: - void setProportional(bool theProp) { myProportional = theProp; } + void setProportionalSlot(bool theProp) { myProportional = theProp; } + void setCyclingSlot(bool theCycle) { myCycling = theCycle; } signals: void frameChanged(long theNewFrame, double theTime); + void stopped(); protected: void run(); + QString GenerateName(); + + private slots: + void onViewDeleted(); private: + QString myLastError; QValueList myFieldsLst; bool myIsActive; long myFrame; int mySpeed; bool myProportional; - SALOMEDS::Study_var myStudy; + bool myCycling; + _PTR(Study) myStudy; - double myMaxVal, myMinVal; + double myTimeMinVal, myTimeMaxVal; //!< Range of time stams, set by user + double myTimeMin , myTimeMax ; //!< Range of time stams, available for animation QString myDumpPath; - VTKViewer_ViewFrame* myView; + QString myDumpFormat; + QString myAVIMaker; + long myFileIndex; + SVTK_ViewWindow* myView; + + QString myAnimEntry; + + static int myNBAnimations; +}; + + +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::TANIMATION; } + //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::ColoredPrs3d_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 char* setDumpFormat(const char* theFormat); + + virtual CORBA::Boolean isCycling(); + + virtual CORBA::Double getMinTime(); + virtual CORBA::Double getMaxTime(); + + virtual void setProportional(CORBA::Boolean theProp); + virtual void setCycling(CORBA::Boolean theCycle); + + virtual SALOMEDS::SObject_ptr publishInStudy(); + virtual void restoreFromStudy(SALOMEDS::SObject_ptr theField); + virtual CORBA::Boolean isSavedInStudy(); + virtual void saveAnimation(); }; #endif //VISU_TIMEANIMATION_H