]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix fo Issue 0019666: EDF 712 VISU (Animation "Scalar map on deformed shape" does... V4_1_0_maintainance_20080714
authorrnv <rnv@opencascade.com>
Thu, 10 Jul 2008 06:55:25 +0000 (06:55 +0000)
committerrnv <rnv@opencascade.com>
Thu, 10 Jul 2008 06:55:25 +0000 (06:55 +0000)
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISU_I/VISU_TimeAnimation.cxx

index 2eddab33d46b074cee95f7b346e16e4ab4348afb..e4811c5fa2bfd4bfa84c8be510f3aa05543167f0 100644 (file)
 
 #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<VISU::ColoredPrs3d_i*>(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<VISU::DeformedShapeAndScalarMap_i*>(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<TYPE*>(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<TYPE*>(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<TYPE*>(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<VISU::ColoredPrs3d_i*>(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()
 {
index ffe3504d8764625dd01ce4b189f1587223aa6573..172daf209f09f8ce3b13eac1e47a49e51e78ed3c 100644 (file)
@@ -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());