- Animation : Title modification only taken into account for the first time step.
//------------------------------------------------------------------------
namespace
{
+ template<class TPrs3d, class TDialog>
+ void
+ InitDiloglgFromPrsObject(TDialog* theDialog,
+ FieldData& theData)
+ {
+ theDialog->initFromPrsObject(dynamic_cast<TPrs3d*>(theData.myPrs[0]));
+ }
+
+
+ template<>
+ void
+ InitDiloglgFromPrsObject
+ <VISU::ScalarMapOnDeformedShape_i, VisuGUI_ScalarMapOnDeformedShapeDlg>(VisuGUI_ScalarMapOnDeformedShapeDlg* theDialog,
+ FieldData& theData)
+ {
+ theDialog->initFromPrsObject(dynamic_cast<VISU::ScalarMapOnDeformedShape_i*>(theData.myPrs[0]), true);
+ }
+
+
template<class TPrs3d, class TDialog>
void
EditPrs(VisuGUI* theModule,
VISU_TimeAnimation* theAnimator)
{
TDialog* aDlg = new TDialog(theModule);
- aDlg->initFromPrsObject(dynamic_cast<TPrs3d*>(theData.myPrs[0]));
+ InitDiloglgFromPrsObject<TPrs3d, TDialog>(aDlg, theData);
if (aDlg->exec()) {
- for (int i = 0; i < theData.myNbFrames; i++)
- aDlg->storeToPrsObject(dynamic_cast<TPrs3d*>(theData.myPrs[i]));
+ aDlg->storeToPrsObject(dynamic_cast<TPrs3d*>(theData.myPrs[0]));
+ for (int i = 1; i < theData.myNbFrames; i++)
+ theData.myPrs[i]->SameAsParams(theData.myPrs[0],
+ theData.myPrs[i]->GetMeshName(),
+ theData.myPrs[i]->GetFieldName(),
+ theData.myPrs[i]->GetEntity(),
+ theData.myPrs[i]->GetIteration(),
+ true);
if ( theAnimator->getAnimationMode() == 1 ) {
for (int i = 1; i < theAnimator->getNbFields(); i++) {
for (int j = 0; j < theAnimator->getFieldData(i).myNbFrames; j++)
- aDlg->storeToPrsObject(dynamic_cast<TPrs3d*>(theAnimator->getFieldData(i).myPrs[j]));
+ theAnimator->getFieldData(i).myPrs[j]->SameAsParams(theData.myPrs[0],
+ theData.myPrs[j]->GetMeshName(),
+ theData.myPrs[j]->GetFieldName(),
+ theData.myPrs[j]->GetEntity(),
+ theData.myPrs[j]->GetIteration(),
+ true);
}
}
}
break;
case TSCALARMAPONDEFORMEDSHAPE_ITEM: //Scalar Map on Deformed Shape
c.suspend();
- {
- typedef VisuGUI_ScalarMapOnDeformedShapeDlg DLG;
- typedef VISU::ScalarMapOnDeformedShape_i TYPE;
- DLG* aDlg = new DLG (myModule);
- aDlg->initFromPrsObject(dynamic_cast<TYPE*>(aData.myPrs[0]),true);
- if (aDlg->exec())
- {
- int anbFrames=aDlg->getCurrentScalarNbIterations();
- int aIter = 0;
- for (int i = 0; i < aData.myNbFrames; i++){
- TYPE* aCurrPrs_i = dynamic_cast<TYPE*>(aData.myPrs[i]);
- aIter = i+1;
- if(i+1 > anbFrames)
- aIter=anbFrames;
- aDlg->storeToPrsObject(aCurrPrs_i,false,aIter);
- }
- }
- delete aDlg;
- }
+ EditPrs<VISU::ScalarMapOnDeformedShape_i,VisuGUI_ScalarMapOnDeformedShapeDlg>(myModule,aData,myAnimator);
break;
case TVECTORS_ITEM: //Vectors
c.suspend();
void
VISU::ColoredPrs3d_i
::SameAsParams(const ColoredPrs3d_i* theOrigin,
- const std::string& theMeshName, const std::string& theFieldName,
- VISU::Entity theEntity, int theIteration,
+ const std::string& theMeshName,
+ const std::string& theFieldName,
+ VISU::Entity theEntity,
+ int theIteration,
bool theIsFixedRange)
{
myMeshName = theMeshName;
myMeshName = theMeshName;
myEntity = (VISU::TEntity)theEntity;
- myFieldName =theFieldName;
+ myFieldName = theFieldName;
myIteration = theIteration;
Build(false); // to get corresponding input from result and initilize the pipeline
void
SameAs(const Prs3d_i* theOrigin);
- /*!
- * \brief Works like SameAs() method, but keep myIteration value unchanged.
- *
- * Is used in VISU_TimeAnimation class implementation.
- */
+ //! Works like SameAs() method, but allows to customize some key parameters
+ virtual
void
SameAsParams(const ColoredPrs3d_i* theOrigin,
- const std::string& theMeshName, const std::string& theFieldName,
- VISU::Entity theEntity, int theIteration,
+ const std::string& theMeshName,
+ const std::string& theFieldName,
+ VISU::Entity theEntity,
+ int theIteration,
bool theIsFixedRange);
virtual const VISU::PField&
VISU::ScalarMapOnDeformedShape_i
::SameAs(const Prs3d_i* theOrigin)
{
- if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::SameAs:"<<__LINE__<<endl;
- int theScalarIter = this->GetScalarIteration();
- string theScalarMeshName = this->GetScalarMeshName();
- string theScalarFieldName = this->GetScalarFieldName();
- if(MYDEBUG) cout << "SameAs:"<<endl
- << "\t"<<theScalarIter<<":"<<theScalarMeshName.c_str()<<":"<<theScalarFieldName.c_str()<<endl;
+ if(const ScalarMapOnDeformedShape_i* aPrs3d = dynamic_cast<const ScalarMapOnDeformedShape_i*>(theOrigin)){
+ ScalarMapOnDeformedShape_i* anOrigin = const_cast<ScalarMapOnDeformedShape_i*>(aPrs3d);
- TSuperClass::SameAs(theOrigin);
- if(const ScalarMapOnDeformedShape_i* aPrs3d = dynamic_cast<const ScalarMapOnDeformedShape_i*>(theOrigin)){
- ScalarMapOnDeformedShape_i* anOrigin = const_cast<ScalarMapOnDeformedShape_i*>(aPrs3d);
+ TSuperClass::SameAs(theOrigin);
this->SetScalarField(anOrigin->GetScalarMeshName().c_str(),
anOrigin->GetScalarFieldName().c_str(),
- theScalarIter,
+ anOrigin->GetScalarIteration(),
anOrigin->GetScalarEntity());
+
+ // To restore the original title
+ this->SetTitle(anOrigin->GetTitle());
+ }
+}
+
+void
+VISU::ScalarMapOnDeformedShape_i
+::SameAsParams(const ColoredPrs3d_i* theOrigin,
+ const std::string& theMeshName,
+ const std::string& theFieldName,
+ VISU::Entity theEntity,
+ int theIteration,
+ bool theIsFixedRange)
+{
+ if(const ScalarMapOnDeformedShape_i* aPrs3d = dynamic_cast<const ScalarMapOnDeformedShape_i*>(theOrigin)){
+ ScalarMapOnDeformedShape_i* anOrigin = const_cast<ScalarMapOnDeformedShape_i*>(aPrs3d);
+
+ TSuperClass::SameAsParams(theOrigin, theMeshName, theFieldName, theEntity, theIteration, theIsFixedRange);
+
+ this->SetScalarIteration(theIteration);
+
+ // To restore the original title
+ this->SetTitle(anOrigin->GetTitle());
+
Update();
}
}
+
void VISU::ScalarMapOnDeformedShape_i::SetTitle(const char* theTitle)
{
std::strstream aStream;
return &this->GetScalarFieldName()[0];
}
-void VISU::ScalarMapOnDeformedShape_i::SetScalarIteration(const int theValue){
+void VISU::ScalarMapOnDeformedShape_i::SetScalarIteration(int theValue){
if(myScalarIteration != theValue){
myScalarIteration = theValue;
SetTitle(GetScalarFieldName().c_str());
}
}
-
int VISU::ScalarMapOnDeformedShape_i::GetScalarIteration(){
return myScalarIteration;
}
void
SameAs(const Prs3d_i* theOrigin);
+ //! Reimplements the VISU::ColoredPrs3d_i::SameAsParams method
+ virtual
+ void
+ SameAsParams(const ColoredPrs3d_i* theOrigin,
+ const std::string& theMeshName,
+ const std::string& theFieldName,
+ VISU::Entity theEntity,
+ int theIteration,
+ bool theIsFixedRange);
+
virtual const VISU::PField&
GetField() const;
virtual void SetScalarFieldName(const char* theName);
virtual std::string GetScalarFieldName();
virtual char* GetScalarCFieldName();
- virtual void SetScalarIteration(const int theValue);
+
+ virtual void SetScalarIteration(int theValue);
virtual int GetScalarIteration();
virtual CORBA::Long GetScalarLIteration();
+
virtual void SetScalarMeshName(const char* theName);
virtual std::string GetScalarMeshName();
virtual char* GetScalarCMeshName();
+
virtual void SetScalarEntity(const VISU::TEntity theValue);
virtual VISU::TEntity GetScalarEntity();
virtual void SetScalarEEntity(const VISU::Entity theValue);