From 509e41c2de2c1503792e619a74b9f6c94b9dcae2 Mon Sep 17 00:00:00 2001 From: mkr Date: Wed, 1 Nov 2006 16:33:06 +0000 Subject: [PATCH] Fix for bug PAL13727 : EDF 323 VISU : anim properties accessible via TUI : add ApplyProperties(...) method for Animation object. --- idl/VISU_Gen.idl | 11 ++++++++++ src/VISU_I/VISU_TimeAnimation.cxx | 36 +++++++++++++++++++++++++++++++ src/VISU_I/VISU_TimeAnimation.h | 4 ++++ 3 files changed, 51 insertions(+) diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index c83a4dc7..3001e0b0 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -1353,6 +1353,17 @@ module VISU { * Gets the animation mode. */ AnimationMode getAnimationMode(); + + /*! + * Apply the presentation properties to all fields. The exception is raised in the following cases: + * 1) presentations for the given field is not yet created; + * 2) invalid dynamic cast of the given presentation to VISU::ColoredPrs3d_i; + * 3) the MED file is not the same; + * 4) the mesh name is not the same; + * 5) the field name is not the same; + * 6) the entity is not the same. + */ + void ApplyProperties(in long theFieldNum, in ColoredPrs3d thePrs); }; /*! \brief Interface %Result diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index d2c26193..f751e5f6 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -1634,6 +1634,36 @@ void VISU_TimeAnimation::onViewDeleted() myView = 0; } +void VISU_TimeAnimation::ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredPrs3d_ptr thePrs) + throw (SALOME::SALOME_Exception) +{ + FieldData& aData = myFieldsLst[theFieldNum]; + + if ( aData.myPrs.empty() ) + throw SALOME_Exception(LOCALIZED("Error : presentations for the given field is not yet created!")); + + VISU::ColoredPrs3d_i* aPrs_i = dynamic_cast(GetServant(thePrs).in()); + + if ( !aPrs_i ) + throw SALOME_Exception(LOCALIZED("Error : invalid dynamic cast of the given presentation to VISU::ColoredPrs3d_i")); + + if ( aPrs_i->GetResult() != aData.myPrs[0]->GetResult() ) + throw SALOME_Exception(LOCALIZED("Error : the MED file is not the same!")); + + if ( aPrs_i->GetMeshName() != aData.myPrs[0]->GetMeshName() ) + throw SALOME_Exception(LOCALIZED("Error : the mesh name is not the same!")); + + if ( aPrs_i->GetFieldName() != aData.myPrs[0]->GetFieldName() ) + throw SALOME_Exception(LOCALIZED("Error : the field name is not the same!")); + + if ( aPrs_i->GetEntity() != aData.myPrs[0]->GetEntity() ) + throw SALOME_Exception(LOCALIZED("Error : the entity is not the same!")); + + for (int i = 0; i < aData.myNbFrames; i++) { + aData.myPrs[i]->SameAsParams(aPrs_i); + } + +} //======================================================================== //======================================================================== @@ -1914,3 +1944,9 @@ VISU::Animation::AnimationMode VISU_TimeAnimation_i::getAnimationMode() { return VISU::Animation::AnimationMode(myAnim->getAnimationMode()); } + +void VISU_TimeAnimation_i::ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredPrs3d_ptr thePrs) + throw (SALOME::SALOME_Exception) +{ + myAnim->ApplyProperties(theFieldNum, thePrs); +} diff --git a/src/VISU_I/VISU_TimeAnimation.h b/src/VISU_I/VISU_TimeAnimation.h index 07db1a65..b0062a3c 100644 --- a/src/VISU_I/VISU_TimeAnimation.h +++ b/src/VISU_I/VISU_TimeAnimation.h @@ -166,6 +166,8 @@ class VISU_TimeAnimation: public QObject, public QThread void setAnimationMode(int theMode) { myAnimationMode = theMode; } int getAnimationMode() { return myAnimationMode; } + void ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredPrs3d_ptr thePrs) throw (SALOME::SALOME_Exception); + public slots: void setProportionalSlot(bool theProp) { myProportional = theProp; } void setCyclingSlot(bool theCycle) { myCycling = theCycle; } @@ -279,6 +281,8 @@ public: virtual void setAnimationMode(VISU::Animation::AnimationMode theMode); virtual VISU::Animation::AnimationMode getAnimationMode(); + + virtual void ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredPrs3d_ptr thePrs) throw (SALOME::SALOME_Exception); }; #endif //VISU_TIMEANIMATION_H -- 2.39.2