From 622301adaab1d034a537d191f0c180c8323f360c Mon Sep 17 00:00:00 2001 From: rnv Date: Thu, 10 Jul 2008 06:55:25 +0000 Subject: [PATCH] Fix fo Issue 0019666: EDF 712 VISU (Animation "Scalar map on deformed shape" does not display the scalar map). --- src/VISUGUI/VisuGUI_TimeAnimation.cxx | 78 ++++++++++++++++++++++++--- src/VISU_I/VISU_TimeAnimation.cxx | 2 +- 2 files changed, 73 insertions(+), 7 deletions(-) diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 2eddab33..e4811c5f 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -86,6 +86,42 @@ #define MAXVAL 1e10 +namespace { + void GeneratePresentations(int theFieldId, VISU_TimeAnimation* theAnimator) + { + theAnimator->generatePresentations(theFieldId); + FieldData& aFieldData = theAnimator->getFieldData(theFieldId); + + + int aRefFieldId = ( theAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) ? theFieldId : 0; + if(VISU::ColoredPrs3d_i* aInitialPrs3d = dynamic_cast(theAnimator->getFieldData(aRefFieldId).myPrs[0])){ + for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) { + VISU::ColoredPrs3d_i* aColoredPrs3d = aFieldData.myPrs[aFrameId]; + + // Special case for DeformedShape And ScalarMap presentation + // Restore time stamp number for all presentations + VISU::DeformedShapeAndScalarMap_i* aDeformedAndScalPrs = dynamic_cast(aColoredPrs3d); + int aTimeStampNum = -1; + if(aDeformedAndScalPrs){ + aTimeStampNum = aDeformedAndScalPrs->GetScalarTimeStampNumber(); + } + aColoredPrs3d->SameAs(aInitialPrs3d); + + if(aDeformedAndScalPrs){ + aDeformedAndScalPrs->SetScalarField(aDeformedAndScalPrs->GetScalarEntity(), + aDeformedAndScalPrs->GetScalarFieldName(), + aTimeStampNum); + } + + std::string aTitle = aColoredPrs3d->GetCTitle(); + if ( aFrameId != 0 && theAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) { + aColoredPrs3d->SetTitle(aTitle.c_str()); + } + } + } + } +} + ArrangeDlg::ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator) : QDialog(theParent, "ArrangeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), @@ -311,7 +347,7 @@ void ArrangeDlg::acceptAnimation() QApplication::setOverrideCursor( Qt::waitCursor ); FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem()); if (aData.myPrs.empty()) - myAnimator->generatePresentations(myFieldLst->currentItem()); + GeneratePresentations(myFieldLst->currentItem(),myAnimator); vtkFloatingPointType aBounds[6]; aData.myPrs[0]->GetBounds(aBounds); vtkFloatingPointType aDist = 0; @@ -953,10 +989,35 @@ void SetupDlg::onPreferencesDlg() DLG* aDlg = new DLG (myModule); TYPE* aPrs3d = dynamic_cast(aData.myPrs[0]); aDlg->initFromPrsObject(aPrs3d, true); - if (aDlg->exec() && aDlg->storeToPrsObject(aData.myPrs[0])) { - for (int i = 1; i < aData.myNbFrames; i++){ - aData.myPrs[i]->SameAs(aData.myPrs[0]); - } + if (aDlg->exec() && aDlg->storeToPrsObject(aData.myPrs[0])) { + for (long aFrameId = 1; aFrameId < aData.myNbFrames; aFrameId++){ + TYPE* aDeformedPrs3d = dynamic_cast(aData.myPrs[aFrameId]); + //Set correct time stamp number + int aTimeStampNum = aDeformedPrs3d->GetScalarTimeStampNumber(); + aDeformedPrs3d->SameAs(aPrs3d); + aDeformedPrs3d->SetScalarField(aDeformedPrs3d->GetScalarEntity(), + aDeformedPrs3d->GetScalarFieldName(), + aTimeStampNum); + + } + + if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) { + for (int aFieldId = 1; aFieldId < myAnimator->getNbFields(); aFieldId++) { + FieldData& aFieldData = myAnimator->getFieldData(aFieldId); + for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) { + TYPE* aDeformedPrs3d = dynamic_cast(aFieldData.myPrs[aFrameId]); + std::string aTitle = aDeformedPrs3d->GetCTitle(); + //Set correct time stamp number + int aTimeStampNum = aDeformedPrs3d->GetScalarTimeStampNumber(); + aDeformedPrs3d->SameAs(aPrs3d); + aDeformedPrs3d->SetTitle(aTitle.c_str()); + aDeformedPrs3d->SetScalarField(aDeformedPrs3d->GetScalarEntity(), + aDeformedPrs3d->GetScalarFieldName(), + aTimeStampNum); + + } + } + } } delete aDlg; } @@ -1526,7 +1587,8 @@ void VisuGUI_TimeAnimationDlg::createFrames() FieldData& aFieldData = myAnimator->getFieldData(i); if( aFieldData.myPrs.empty() ) { - myAnimator->generatePresentations(i); + //myAnimator->generatePresentations(i); + GeneratePresentations(i,myAnimator); continue; } @@ -1535,6 +1597,8 @@ void VisuGUI_TimeAnimationDlg::createFrames() // when a range or a sequence of the animation has been changed if( isRegenerate ) { + GeneratePresentations(i,myAnimator); + /* VISU::ColoredPrs3d_i* aPrs3d = dynamic_cast(aFieldData.myPrs[0]); if( !aPrs3d ) continue; @@ -1550,6 +1614,7 @@ void VisuGUI_TimeAnimationDlg::createFrames() aColoredPrs3d->SetTitle(aTitle.c_str()); } } + */ } } if( isRegenerate ) @@ -1578,6 +1643,7 @@ void VisuGUI_TimeAnimationDlg::createFrames() //myPlayFrame->setEnabled(true); } + //------------------------------------------------------------------------ void VisuGUI_TimeAnimationDlg::onPlayPressed() { diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index ffe3504d..172daf20 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -632,7 +632,7 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) myFieldsAbsFrames.push_back(aData.myNbFrames); if (theFieldNum == getNbFields() - 1) { - if ( aData.myPrsType != VISU::TGAUSSPOINTS) { + if ( aData.myPrsType != VISU::TGAUSSPOINTS && aData.myPrsType != TDEFORMEDSHAPEANDSCALARMAP && aData.myPrsType != TSCALARMAPONDEFORMEDSHAPE) { // Initialize the MinMax controller VISU::PCompositeMinMaxController aMinMaxController(new VISU::TCompositeMinMaxController()); -- 2.39.2