Salome HOME
Merge from PortingMED3 07Apr11
[modules/visu.git] / src / VISU_I / VISU_TimeAnimation.cxx
index 3437df86b508ce7af261c8016e571065917d891b..497166a38e43062e3488d62a6ccc8d0dd027c31b 100644 (file)
@@ -1,4 +1,4 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -19,6 +19,7 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  File   : VISU_TimeAnimation.cxx
 //  Author : Vitaly SMETANNIKOV
 //  Module : VISU
@@ -42,6 +43,7 @@
 #include "VISU_CutPlanes_i.hh"
 #include "VISU_Plot3D_i.hh"
 #include "VISU_CutLines_i.hh"
+#include "VISU_CutSegment_i.hh"
 #include "VISU_Vectors_i.hh"
 #include "VISU_StreamLines_i.hh"
 #include "VISU_GaussPoints_i.hh"
@@ -125,7 +127,7 @@ namespace VISU
 
     void
     AddController(ColoredPrs3d_i* theReference, 
-                 VISU::PMinMaxController theMinMaxController)
+                  VISU::PMinMaxController theMinMaxController)
     {
       myMinMaxContainer[ TKey( theReference ) ] = theMinMaxController;
     }
@@ -136,8 +138,8 @@ namespace VISU
     {
       TMinMaxContainer::iterator anIter = myMinMaxContainer.find( TKey( theFromPrs3 ) );
       if ( anIter != myMinMaxContainer.end() ) {
-       myMinMaxContainer.erase( anIter );
-       myMinMaxContainer[ TKey( theToPrs3d ) ] = VISU::CreateDefaultMinMaxController( theToPrs3d );      
+        myMinMaxContainer.erase( anIter );
+        myMinMaxContainer[ TKey( theToPrs3d ) ] = VISU::CreateDefaultMinMaxController( theToPrs3d );      
       }
     }
 
@@ -147,11 +149,11 @@ namespace VISU
     {
       vtkFloatingPointType aMin = TMinMaxController::GetComponentMin(theCompID);
       if ( !myMinMaxContainer.empty() ) {
-       TMinMaxContainer::const_iterator anIter = myMinMaxContainer.begin();
-       for(; anIter != myMinMaxContainer.end(); anIter++){
-         VISU::PMinMaxController aMinMaxController = anIter->second;
-         aMin = std::min(aMin, aMinMaxController->GetComponentMin(theCompID));
-       }
+        TMinMaxContainer::const_iterator anIter = myMinMaxContainer.begin();
+        for(; anIter != myMinMaxContainer.end(); anIter++){
+          VISU::PMinMaxController aMinMaxController = anIter->second;
+          aMin = std::min(aMin, aMinMaxController->GetComponentMin(theCompID));
+        }
       }
       return aMin;
     }
@@ -162,11 +164,11 @@ namespace VISU
     {
       vtkFloatingPointType aMax = TMinMaxController::GetComponentMax(theCompID);
       if ( !myMinMaxContainer.empty() ) {
-       TMinMaxContainer::const_iterator anIter = myMinMaxContainer.begin();
-       for(; anIter != myMinMaxContainer.end(); anIter++){
-         VISU::PMinMaxController aMinMaxController = anIter->second;
-         aMax = std::max(aMax, aMinMaxController->GetComponentMax(theCompID));
-       }
+        TMinMaxContainer::const_iterator anIter = myMinMaxContainer.begin();
+        for(; anIter != myMinMaxContainer.end(); anIter++){
+          VISU::PMinMaxController aMinMaxController = anIter->second;
+          aMax = std::max(aMax, aMinMaxController->GetComponentMax(theCompID));
+        }
       }
       return aMax;
     }
@@ -205,6 +207,9 @@ VISU_TimeAnimation::VISU_TimeAnimation (_PTR(Study) theStudy,
 
   myDumpPath = "";
   myAVIMaker = "jpeg2yuv";
+
+  myDumpMode = VISU::GetResourceMgr()->integerValue("VISU", "dump_mode", 0);
+  myTimeStampFrequency = VISU::GetResourceMgr()->integerValue("VISU", "time_stamp_frequency", 1);
 }
 
 
@@ -296,7 +301,7 @@ bool VISU_TimeAnimation::addField (_PTR(SObject) theField)
       VISU::Storable::TRestoringMap aFMap = VISU::Storable::GetStorableMap(myFieldsLst.first().myField);
       long aNumComp = VISU::Storable::FindValue(aFMap, "myNumComponent").toLong();
       if ( aNumCompCurr != aNumComp )
-       return false;
+        return false;
     }
 
     if ( !myFieldsLst.isEmpty() )
@@ -344,7 +349,7 @@ void VISU_TimeAnimation::_clearData(FieldData& theData) {
   if (!theData.myActors.empty()) {
     for (int i = 0, iEnd = theData.myActors.size(); i < iEnd; i++) {
       if (theData.myActors[i] != 0) {
-       theData.myActors[i]->RemoveFromRender(aRen);
+        theData.myActors[i]->RemoveFromRender(aRen);
       }
     }
     theData.myActors.clear();
@@ -352,7 +357,7 @@ void VISU_TimeAnimation::_clearData(FieldData& theData) {
   if (!theData.myPrs.empty()) {
     for (int i = 0, iEnd = theData.myPrs.size(); i < iEnd; i++)
       if (theData.myPrs[i] != 0) {
-       theData.myPrs[i]->_remove_ref();
+        theData.myPrs[i]->_remove_ref();
       }
     theData.myPrs.clear();
   }
@@ -372,12 +377,12 @@ namespace
   template<class TPrs3d>
   void
   GeneratePresentations(_PTR(Study) theStudy,
-                       FieldData& theData,
-                       VISU::Result_i* theResult,
-                       bool theIsRangeDefined,
-                       CORBA::Double theTimeMin,
-                       CORBA::Double theTimeMax,
-                       QList<long> theSequence)
+                        FieldData& theData,
+                        VISU::Result_i* theResult,
+                        bool theIsRangeDefined,
+                        CORBA::Double theTimeMin,
+                        CORBA::Double theTimeMax,
+                        QList<long> theSequence)
   {
     _PTR(ChildIterator) anIter = theStudy->NewChildIterator(theData.myField);
     anIter->Next(); // First is reference on support
@@ -391,26 +396,26 @@ namespace
     long aSequenceIndex = 1;
     for(; anIter->More(); anIter->Next(), aSequenceIndex++){
       if (aFrameId == theData.myNbTimes) {
-       MESSAGE("There are extra timestamps in field");
-       return;
+        MESSAGE("There are extra timestamps in field");
+        return;
       }
       _PTR(SObject) aTimeStamp = anIter->Value();
       if(!aTimeStamp) 
-       continue;
+        continue;
 
       long aSequenceId = -1;
 
       theData.myTiming[aFrameId] = VISU_TimeAnimation::getTimeValue(aTimeStamp);
       if (theIsRangeDefined) {
-       if (theData.myTiming[aFrameId] < theTimeMin) 
-         continue;
-       if (theData.myTiming[aFrameId] > theTimeMax) 
-         break;
+        if (theData.myTiming[aFrameId] < theTimeMin) 
+          continue;
+        if (theData.myTiming[aFrameId] > theTimeMax) 
+          break;
       }
       else if (isSequenceDefined) {
-       aSequenceId = theSequence.indexOf( aSequenceIndex );
-       if( aSequenceId == -1 )
-         continue;
+        aSequenceId = theSequence.indexOf( aSequenceIndex );
+        if( aSequenceId == -1 )
+          continue;
       }
 
       VISU::Storable::TRestoringMap aTimeMap = VISU::Storable::GetStorableMap(aTimeStamp);
@@ -432,12 +437,12 @@ namespace
 #endif
         if(aPresent->Apply(false)){
           /*
-           if(isSequenceDefined)
-           {
-             theData.myPrs[aSequenceId] = aPresent;
-             aFrameId++;
-           }
-           else
+            if(isSequenceDefined)
+            {
+              theData.myPrs[aSequenceId] = aPresent;
+              aFrameId++;
+            }
+            else
           */
           theData.myPrs[aFrameId++] = aPresent;
           anIsCreated = true;
@@ -451,16 +456,16 @@ namespace
         INFOS("Unknown exception was occured!");
       }
       if(!anIsCreated)
-       aPresent->_remove_ref();
+        aPresent->_remove_ref();
     }
 
     theData.myNbFrames = aFrameId;
 
     if (theData.myPrsType != VISU::TGAUSSPOINTS) {
       for(long aFrameId = 0; aFrameId < theData.myNbFrames; aFrameId++) {
-       if (VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(theData.myPrs[aFrameId])){
-         aPrs->SetOffset(theData.myOffset);
-       }
+        if (VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(theData.myPrs[aFrameId])){
+          aPrs->SetOffset(theData.myOffset);
+        }
       }
     }
   }
@@ -533,94 +538,103 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum)
   switch (aData.myPrsType) {
   case VISU::TSCALARMAP:
     GeneratePresentations<ScalarMap_i>(myStudy,
-                                      aData,
-                                      aResult,
-                                      isRangeDefined(),
-                                      myTimeMinVal,
-                                      myTimeMaxVal,
-                                      aSequence);
+                                       aData,
+                                       aResult,
+                                       isRangeDefined(),
+                                       myTimeMinVal,
+                                       myTimeMaxVal,
+                                       aSequence);
     break;
   case VISU::TISOSURFACES: // Iso Surfaces
     GeneratePresentations<IsoSurfaces_i>(myStudy,
-                                        aData,
-                                        aResult,
-                                        isRangeDefined(),
-                                        myTimeMinVal,
-                                        myTimeMaxVal,
-                                        aSequence);
+                                         aData,
+                                         aResult,
+                                         isRangeDefined(),
+                                         myTimeMinVal,
+                                         myTimeMaxVal,
+                                         aSequence);
     break;
   case VISU::TCUTPLANES: // Cut Planes
     GeneratePresentations<CutPlanes_i>(myStudy,
-                                      aData,
-                                      aResult,
-                                      isRangeDefined(),
-                                      myTimeMinVal,
-                                      myTimeMaxVal,
-                                      aSequence);
+                                       aData,
+                                       aResult,
+                                       isRangeDefined(),
+                                       myTimeMinVal,
+                                       myTimeMaxVal,
+                                       aSequence);
     break;
   case VISU::TCUTLINES: // Cut Lines
     GeneratePresentations<CutLines_i>(myStudy,
-                                     aData,
-                                     aResult,
-                                     isRangeDefined(),
-                                     myTimeMinVal,
-                                     myTimeMaxVal,
-                                     aSequence);
+                                      aData,
+                                      aResult,
+                                      isRangeDefined(),
+                                      myTimeMinVal,
+                                      myTimeMaxVal,
+                                      aSequence);
+    break;
+  case VISU::TCUTSEGMENT: // Cut Segment
+    GeneratePresentations<CutSegment_i>(myStudy,
+                                        aData,
+                                        aResult,
+                                        isRangeDefined(),
+                                        myTimeMinVal,
+                                        myTimeMaxVal,
+                                        aSequence);
     break;
   case VISU::TPLOT3D: // Plot3d
     GeneratePresentations<Plot3D_i>(myStudy,
-                                   aData,
-                                   aResult,
-                                   isRangeDefined(),
-                                   myTimeMinVal,
-                                   myTimeMaxVal,
-                                   aSequence);
+                                    aData,
+                                    aResult,
+                                    isRangeDefined(),
+                                    myTimeMinVal,
+                                    myTimeMaxVal,
+                                    aSequence);
     break;
   case VISU::TDEFORMEDSHAPE: // Deformed Shape
     GeneratePresentations<DeformedShape_i>(myStudy,
-                                          aData,
-                                          aResult,
-                                          isRangeDefined(),
-                                          myTimeMinVal,
-                                          myTimeMaxVal,
-                                          aSequence);
+                                           aData,
+                                           aResult,
+                                           isRangeDefined(),
+                                           myTimeMinVal,
+                                           myTimeMaxVal,
+                                           aSequence);
     break;
   case VISU::TVECTORS: // Vectors
     GeneratePresentations<Vectors_i>(myStudy,
-                                    aData,
-                                    aResult,
-                                    isRangeDefined(),
-                                    myTimeMinVal,
-                                    myTimeMaxVal,
-                                    aSequence);
+                                     aData,
+                                     aResult,
+                                     isRangeDefined(),
+                                     myTimeMinVal,
+                                     myTimeMaxVal,
+                                     aSequence);
     break;
   case VISU::TSTREAMLINES: // Stream Lines
     GeneratePresentations<StreamLines_i>(myStudy,
-                                        aData,
-                                        aResult,
-                                        isRangeDefined(),
-                                        myTimeMinVal,
-                                        myTimeMaxVal,
-                                        aSequence);
+                                         aData,
+                                         aResult,
+                                         isRangeDefined(),
+                                         myTimeMinVal,
+                                         myTimeMaxVal,
+                                         aSequence);
     break;
   case VISU::TGAUSSPOINTS: // Gauss Points
     GeneratePresentations<GaussPoints_i>(myStudy,
-                                        aData,
-                                        aResult,
-                                        isRangeDefined(),
-                                        myTimeMinVal,
-                                        myTimeMaxVal,
-                                        aSequence);
+                                         aData,
+                                         aResult,
+                                         isRangeDefined(),
+                                         myTimeMinVal,
+                                         myTimeMaxVal,
+                                         aSequence);
     break;
   case VISU::TSCALARMAPONDEFORMEDSHAPE: // Scalar map on deformed shape
   case VISU::TDEFORMEDSHAPEANDSCALARMAP:
     GeneratePresentations<DeformedShapeAndScalarMap_i>(myStudy,
-                                                      aData,
-                                                      aResult,
-                                                      isRangeDefined(),
-                                                      myTimeMinVal,
-                                                      myTimeMaxVal,
-                                                      aSequence);
+                                                       aData,
+                                                       aResult,
+                                                       isRangeDefined(),
+                                                       myTimeMinVal,
+                                                       myTimeMaxVal,
+                                                       aSequence);
     break;
   default:
     MESSAGE("Not implemented for this presentation type: " << aData.myPrsType);
@@ -638,32 +652,32 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum)
     if (theFieldNum == getNbFields() - 1) {
       if ( aData.myPrsType != VISU::TGAUSSPOINTS && aData.myPrsType != TDEFORMEDSHAPEANDSCALARMAP && aData.myPrsType != TSCALARMAPONDEFORMEDSHAPE) {
 
-       // Initialize the MinMax controller
-       VISU::PCompositeMinMaxController aMinMaxController(new VISU::TCompositeMinMaxController());
-       if ( myAnimationMode == VISU::Animation::PARALLEL ) {
-         FieldData& aFieldData = getFieldData(theFieldNum);
-         VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[0];
-         aMinMaxController->AddController( aPrs3d, VISU::CreateDefaultMinMaxController( aPrs3d ) );
-       } else {
-         for (int aFieldId = 0; aFieldId < getNbFields(); aFieldId++) {
-           FieldData& aFieldData = getFieldData(aFieldId);
-           VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[0];
-           aMinMaxController->AddController( aPrs3d, VISU::CreateDefaultMinMaxController( aPrs3d ) );
-         }
-       }
-
-       double aMin = getMinFieldsValue(myFieldsLst);
-       double aMax = getMaxFieldsValue(myFieldsLst);
-
-       for (int aFieldId = 0; aFieldId < getNbFields(); aFieldId++) {
-         FieldData& aFieldData = getFieldData(aFieldId);
-         for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) {
-           VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[aFrameId];
-           aPrs3d->SetMinMaxController(aMinMaxController);
-           if (VISU::IsoSurfaces_i* anIsoSurfaces = dynamic_cast<VISU::IsoSurfaces_i*>(aPrs3d))
-             anIsoSurfaces->SetSubRange(aMin, aMax);
-         }
-       }
+        // Initialize the MinMax controller
+        VISU::PCompositeMinMaxController aMinMaxController(new VISU::TCompositeMinMaxController());
+        if ( myAnimationMode == VISU::Animation::PARALLEL ) {
+          FieldData& aFieldData = getFieldData(theFieldNum);
+          VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[0];
+          aMinMaxController->AddController( aPrs3d, VISU::CreateDefaultMinMaxController( aPrs3d ) );
+        } else {
+          for (int aFieldId = 0; aFieldId < getNbFields(); aFieldId++) {
+            FieldData& aFieldData = getFieldData(aFieldId);
+            VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[0];
+            aMinMaxController->AddController( aPrs3d, VISU::CreateDefaultMinMaxController( aPrs3d ) );
+          }
+        }
+
+        double aMin = getMinFieldsValue(myFieldsLst);
+        double aMax = getMaxFieldsValue(myFieldsLst);
+
+        for (int aFieldId = 0; aFieldId < getNbFields(); aFieldId++) {
+          FieldData& aFieldData = getFieldData(aFieldId);
+          for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) {
+            VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[aFrameId];
+            aPrs3d->SetMinMaxController(aMinMaxController);
+            if (VISU::IsoSurfaces_i* anIsoSurfaces = dynamic_cast<VISU::IsoSurfaces_i*>(aPrs3d))
+              anIsoSurfaces->SetSubRange(aMin, aMax);
+          }
+        }
       }
     }
   }
@@ -688,17 +702,17 @@ CORBA::Boolean VISU_TimeAnimation::_generateFrames() {
     for (long j = 0; j < aData.myNbFrames; j++) {
       VISU_Actor* aActor = NULL;
       try{
-       aData.myPrs[j]->SetOffset(aData.myOffset);
-       aActor = aData.myPrs[j]->CreateActor();
-       myView->AddActor(aActor);
-       bool condition = ( myAnimationMode == VISU::Animation::PARALLEL ) ? (j == 0) : (j == 0 && i == 0);
-       if(condition)
-         aActor->VisibilityOn();
-       else
-         aActor->VisibilityOff();
+        aData.myPrs[j]->SetOffset(aData.myOffset);
+        aActor = aData.myPrs[j]->CreateActor();
+        myView->AddActor(aActor);
+        bool condition = ( myAnimationMode == VISU::Animation::PARALLEL ) ? (j == 0) : (j == 0 && i == 0);
+        if(condition)
+          aActor->VisibilityOn();
+        else
+          aActor->VisibilityOff();
       }catch(...){ //catch(std::runtime_error& exc){
-       aNoError = false;
-       myLastError += QString("%1 ").arg(aData.myTiming[j]);
+        aNoError = false;
+        myLastError += QString("%1 ").arg(aData.myTiming[j]);
       }
       aData.myActors[j] = aActor;
     }
@@ -706,7 +720,7 @@ CORBA::Boolean VISU_TimeAnimation::_generateFrames() {
   myFrame = 0;
   myLastError += QString(" timestamp(s) cannot be created.");
   ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
-                                                                           myFrame, myFieldsLst[0].myTiming[myFrame]));
+                                                                            myFrame, myFieldsLst[0].myTiming[myFrame]));
   myView->Repaint();
   return aNoError;
 }
@@ -729,9 +743,9 @@ void VISU_TimeAnimation::_clearView() {
     FieldData& aData = myFieldsLst[i];
     if (!aData.myActors.empty()) {
       for (int i = 0, iEnd = aData.myActors.size(); i < iEnd; i++) {
-       if (aData.myActors[i] != 0) {
-         aData.myActors[i]->RemoveFromRender(aRen);
-       }
+        if (aData.myActors[i] != 0) {
+          aData.myActors[i]->RemoveFromRender(aRen);
+        }
       }
       aData.myActors.clear();
     }
@@ -822,36 +836,36 @@ void VISU_TimeAnimation::_nextFrame() {
 
     if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
       for (i = 0; i < getNbFields(); i++)
-       if (myFieldsLst[i].myActors[myFrame] != 0)
-         visibilityOff(i, myFrame);
+        if (myFieldsLst[i].myActors[myFrame] != 0)
+          visibilityOff(i, myFrame);
     }
     else { //successive animation mode
       aPair = getRelativeFrameNumber(myFrame);
       aFieldId = aPair.first;
       aFrameId = aPair.second;
       if (myFieldsLst[aFieldId].myActors[aFrameId] != 0)
-       visibilityOff(aFieldId, aFrameId);
+        visibilityOff(aFieldId, aFrameId);
     }
 
     myFrame++;
 
     if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
       for (i = 0; i < getNbFields(); i++)
-       if (myFieldsLst[i].myActors[myFrame] != 0)
-         myFieldsLst[i].myActors[myFrame]->VisibilityOn();
+        if (myFieldsLst[i].myActors[myFrame] != 0)
+          myFieldsLst[i].myActors[myFrame]->VisibilityOn();
 
       ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
-                                                                               myFrame, myFieldsLst[0].myTiming[myFrame]));
+                                                                                myFrame, myFieldsLst[0].myTiming[myFrame]));
     }
     else { //successive animation mode
       aPair = getRelativeFrameNumber(myFrame);
       aFieldId = aPair.first;
       aFrameId = aPair.second;
       if (myFieldsLst[aFieldId].myActors[aFrameId] != 0)
-       myFieldsLst[aFieldId].myActors[aFrameId]->VisibilityOn();
+        myFieldsLst[aFieldId].myActors[aFrameId]->VisibilityOn();
 
       ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
-                                                                               myFrame, myFieldsLst[aFieldId].myTiming[aFrameId]));
+                                                                                myFrame, myFieldsLst[aFieldId].myTiming[aFrameId]));
     }
     myView->Repaint();
   }
@@ -879,36 +893,36 @@ void VISU_TimeAnimation::_prevFrame() {
 
     if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
       for (i = 0; i < getNbFields(); i++)
-       if (myFieldsLst[i].myActors[myFrame] != 0)
-         visibilityOff(i, myFrame);
+        if (myFieldsLst[i].myActors[myFrame] != 0)
+          visibilityOff(i, myFrame);
     }
     else { //successive animation mode
       aPair = getRelativeFrameNumber(myFrame);
       aFieldId = aPair.first;
       aFrameId = aPair.second;
       if (myFieldsLst[aFieldId].myActors[aFrameId] != 0)
-         visibilityOff(aFieldId, aFrameId);
+          visibilityOff(aFieldId, aFrameId);
     }
 
     myFrame--;
 
     if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
       for (i = 0; i < getNbFields(); i++)
-       if (myFieldsLst[i].myActors[myFrame] != 0)
-         myFieldsLst[i].myActors[myFrame]->VisibilityOn();
+        if (myFieldsLst[i].myActors[myFrame] != 0)
+          myFieldsLst[i].myActors[myFrame]->VisibilityOn();
 
       ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
-                                                                               myFrame, myFieldsLst[0].myTiming[myFrame]));
+                                                                                myFrame, myFieldsLst[0].myTiming[myFrame]));
     }
     else { //successive animation mode
       aPair = getRelativeFrameNumber(myFrame);
       aFieldId = aPair.first;
       aFrameId = aPair.second;
       if (myFieldsLst[aFieldId].myActors[aFrameId] != 0)
-         myFieldsLst[aFieldId].myActors[aFrameId]->VisibilityOn();
+          myFieldsLst[aFieldId].myActors[aFrameId]->VisibilityOn();
 
       ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
-                                                                               myFrame, myFieldsLst[aFieldId].myTiming[aFrameId]));
+                                                                                myFrame, myFieldsLst[aFieldId].myTiming[aFrameId]));
     }
     myView->Repaint();
   }
@@ -932,8 +946,8 @@ void VISU_TimeAnimation::_firstFrame() {
   if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
     for (i = 0; i < getNbFields(); i++)
       if(!myFieldsLst[i].myActors.empty())
-       if (myFieldsLst[i].myActors[myFrame] != 0)
-         visibilityOff(i, myFrame);
+        if (myFieldsLst[i].myActors[myFrame] != 0)
+          visibilityOff(i, myFrame);
     }
   else { //successive animation mode
     std::pair<int,long> aPair = getRelativeFrameNumber(myFrame);
@@ -941,7 +955,7 @@ void VISU_TimeAnimation::_firstFrame() {
     long aFrameId = aPair.second;
     if(!myFieldsLst[aFieldId].myActors.empty())
       if (myFieldsLst[aFieldId].myActors[aFrameId] != 0)
-       visibilityOff(aFieldId, aFrameId);
+        visibilityOff(aFieldId, aFrameId);
   }
   myFrame = 0;
 
@@ -954,11 +968,11 @@ void VISU_TimeAnimation::_firstFrame() {
   for (i = 0; i < imax; i++)
     if(!myFieldsLst[i].myActors.empty())
       if (myFieldsLst[i].myActors[myFrame] != 0)
-       myFieldsLst[i].myActors[myFrame]->VisibilityOn();
+        myFieldsLst[i].myActors[myFrame]->VisibilityOn();
 
   if(!myFieldsLst[0].myTiming.empty()){
     ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
-                                                                             myFrame, myFieldsLst[0].myTiming[myFrame]));
+                                                                              myFrame, myFieldsLst[0].myTiming[myFrame]));
     myView->Repaint();
   }
 }
@@ -985,7 +999,7 @@ void VISU_TimeAnimation::_lastFrame() {
   if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
     for (i = 0; i < getNbFields(); i++)
       if (myFieldsLst[i].myActors[myFrame] != 0)
-       visibilityOff(i, myFrame);
+        visibilityOff(i, myFrame);
   }
   else { //successive animation mode
     aPair = getRelativeFrameNumber(myFrame);
@@ -1000,20 +1014,20 @@ void VISU_TimeAnimation::_lastFrame() {
   if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
     for (i = 0; i < getNbFields(); i++)
       if (myFieldsLst[i].myActors[myFrame] != 0)
-       myFieldsLst[i].myActors[myFrame]->VisibilityOn();
+        myFieldsLst[i].myActors[myFrame]->VisibilityOn();
     
     ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
-                                                                             myFrame, myFieldsLst[0].myTiming[myFrame]));
+                                                                              myFrame, myFieldsLst[0].myTiming[myFrame]));
   }
   else { //successive animation mode
     aPair = getRelativeFrameNumber(myFrame);
     aFieldId = aPair.first;
     aFrameId = aPair.second;
     if (myFieldsLst[aFieldId].myActors[aFrameId] != 0)
-       myFieldsLst[aFieldId].myActors[aFrameId]->VisibilityOn();
+        myFieldsLst[aFieldId].myActors[aFrameId]->VisibilityOn();
 
     ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
-                                                                             myFrame, myFieldsLst[aFieldId].myTiming[aFrameId]));
+                                                                              myFrame, myFieldsLst[aFieldId].myTiming[aFrameId]));
   }
 
   myView->Repaint();
@@ -1045,14 +1059,14 @@ void VISU_TimeAnimation::_gotoFrame(CORBA::Long theFrame) {
   if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
     for (i = 0; i < getNbFields(); i++)
       if (myFieldsLst[i].myActors[myFrame] != 0)
-       visibilityOff(i, myFrame);
+        visibilityOff(i, myFrame);
   }
   else { //successive animation mode
     aPair = getRelativeFrameNumber(myFrame);
     aFieldId = aPair.first;
     aFrameId = aPair.second;
     if (myFieldsLst[aFieldId].myActors[aFrameId] != 0)
-       visibilityOff(aFieldId, aFrameId);
+        visibilityOff(aFieldId, aFrameId);
   }
 
   myFrame = theFrame;
@@ -1060,20 +1074,20 @@ void VISU_TimeAnimation::_gotoFrame(CORBA::Long theFrame) {
   if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
     for (i = 0; i < getNbFields(); i++)
       if (myFieldsLst[i].myActors[myFrame] != 0)
-       myFieldsLst[i].myActors[myFrame]->VisibilityOn();
+        myFieldsLst[i].myActors[myFrame]->VisibilityOn();
 
     ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
-                                                                             myFrame, myFieldsLst[0].myTiming[myFrame]));
+                                                                              myFrame, myFieldsLst[0].myTiming[myFrame]));
   }
   else { //successive animation mode
     aPair = getRelativeFrameNumber(myFrame);
     aFieldId = aPair.first;
     aFrameId = aPair.second;
     if (myFieldsLst[aFieldId].myActors[aFrameId] != 0)
-       myFieldsLst[aFieldId].myActors[aFrameId]->VisibilityOn();
+        myFieldsLst[aFieldId].myActors[aFrameId]->VisibilityOn();
 
     ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
-                                                                             myFrame, myFieldsLst[aFieldId].myTiming[aFrameId]));
+                                                                              myFrame, myFieldsLst[aFieldId].myTiming[aFrameId]));
   }
 
   myView->Repaint();
@@ -1144,9 +1158,9 @@ long VISU_TimeAnimation::getAbsoluteFrameNumber(std::pair<int,long> theFieldTime
     }
     else { //successive animation mode
       if ( aFieldId == 0 && aFrameNum <= myFieldsAbsFrames[aFieldId] )
-       aRes = aFrameNum;
+        aRes = aFrameNum;
       else if ( aFieldId && aFrameNum <= myFieldsAbsFrames[aFieldId] - myFieldsAbsFrames[aFieldId-1] )
-       aRes = myFieldsAbsFrames[aFieldId-1] + aFrameNum;
+        aRes = myFieldsAbsFrames[aFieldId-1] + aFrameNum;
     }
   }
   return aRes - 1;
@@ -1164,14 +1178,14 @@ std::pair<int,long> VISU_TimeAnimation::getRelativeFrameNumber(long theFrame)
     }
     else { //successive animation mode
       for (int i = 0, iEnd = myFieldsAbsFrames.size(); i < iEnd; i++)
-       if ( myFieldsAbsFrames[i] >= theFrame ) {
-         aRes.first = i;
-         if ( i == 0 )
-           aRes.second = theFrame - 1;
-         else
-           aRes.second = theFrame-myFieldsAbsFrames[i-1] - 1;
-         break;
-       }
+        if ( myFieldsAbsFrames[i] >= theFrame ) {
+          aRes.first = i;
+          if ( i == 0 )
+            aRes.second = theFrame - 1;
+          else
+            aRes.second = theFrame-myFieldsAbsFrames[i-1] - 1;
+          break;
+        }
     }
   }
   return aRes;
@@ -1195,14 +1209,14 @@ void VISU_TimeAnimation::parallelAnimation( bool& theIsDumping, QList<int>& theI
     if (myExecutionState->IsActive()) {
       for (int i = 0; i < getNbFields(); i++) {
         FieldData& aData = myFieldsLst[i];
-       if (aData.myNbFrames == 0)
-         continue;
+        if (aData.myNbFrames == 0)
+          continue;
         if (myFrame > 0) {
           if (aData.myActors[myFrame-1] != 0)
             visibilityOff(i, myFrame-1);
         } else {
-         if (aData.myActors[aData.myNbFrames-1] != 0)
-           visibilityOff(i, aData.myNbFrames-1);
+          if (aData.myActors[aData.myNbFrames-1] != 0)
+            visibilityOff(i, aData.myNbFrames-1);
         }
         if (aData.myActors[myFrame] != 0 && myView) {
           ProcessVoidEvent(new TVoidMemFunEvent<VISU_Actor>(aData.myActors[myFrame],
@@ -1210,7 +1224,7 @@ void VISU_TimeAnimation::parallelAnimation( bool& theIsDumping, QList<int>& theI
         }
       }
       if (!myView)
-       return;
+        return;
       bool repainArg = false;
       ProcessVoidEvent(new TVoidMemFun1ArgEvent<SVTK_ViewWindow,bool>(myView,
                                                                       &SVTK_ViewWindow::Repaint,
@@ -1247,10 +1261,10 @@ void VISU_TimeAnimation::parallelAnimation( bool& theIsDumping, QList<int>& theI
       // We must unlock mutex for some time before grabbing to allow view updating
       msleep(delay);
       if (!myExecutionState->IsActive()) 
-       return;
+        return;
 
       if (!(aFirstFieldData.myField)) // break, if field was deleted.
-       break;
+        break;
 
       saveImages( 0, aOneVal, aNbFiles, theIndexList );
     }
@@ -1262,10 +1276,10 @@ void VISU_TimeAnimation::parallelAnimation( bool& theIsDumping, QList<int>& theI
     if (myFrame == aFirstFieldData.myNbFrames) {
       if (!myCycling) {
         aHasNextFrame = false;
-       myFrame--;
+        myFrame--;
       }
       else
-       myFrame = 0;
+        myFrame = 0;
     }
   } // while (aHasNextFrame && myExecutionState->IsActive())
 }
@@ -1300,11 +1314,11 @@ void VISU_TimeAnimation::successiveAnimation( bool& theIsDumping, QList<int>& th
       if ( !aData.myPrs[0] ) continue;
       for (; aFrame < aData.myNbFrames && myExecutionState->IsActive(); aFrame++, myFrame++)
       {
-       ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>
+        ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>
                          (this, &VISU_TimeAnimation::_emitFrameChanged,
                           myFrame, myFieldsLst[aFieldId].myTiming[aFrame]));
 
-       if (myExecutionState->IsActive()) {
+        if (myExecutionState->IsActive()) {
           if (aFrame > 0) {
             if (aData.myActors[aFrame-1] != 0)
               visibilityOff(aFieldId, aFrame-1);
@@ -1323,50 +1337,50 @@ void VISU_TimeAnimation::successiveAnimation( bool& theIsDumping, QList<int>& th
                                                               &VISU_Actor::VisibilityOn));
           }
 
-         if (!myView)
-           return;
+          if (!myView)
+            return;
           bool repainArg = false;
           ProcessVoidEvent(new TVoidMemFun1ArgEvent<SVTK_ViewWindow,bool>(myView,
                                                                           &SVTK_ViewWindow::Repaint,
                                                                           repainArg));
-       }
-
-       k = 1;
-       if (myProportional) {
-         switch (aFrame) {
-         case 0:
-           break;
-         case 1:
-           if (aFirstFieldData.myNbFrames > 2)
-             k = (aFirstFieldData.myTiming[aFrame+1] -
-                  aFirstFieldData.myTiming[aFrame]) / aOneVal;
-           break;
-         default:
-           if (aFrame < (aFirstFieldData.myNbFrames - 1))
-             k = (aFirstFieldData.myTiming[aFrame+1] -
-                  aFirstFieldData.myTiming[aFrame]) / aOneVal;
-         }
-       }
-       int delay = (int)(1000. * k / mySpeed);
-       theIsDumping = !myDumpPath.isEmpty();
-       if (delay < 1 && theIsDumping) {
-         // We must unlock mutex for some time before grabbing to allow view updating
-         delay = 1;
-       }
-       msleep(delay);
-
-       if (!myExecutionState->IsActive()) return;
-
-       if (theIsDumping) {
-         // We must unlock mutex for some time before grabbing to allow view updating
-         msleep(delay);
-         if (!myExecutionState->IsActive()) return;
-
-         if (!(myFieldsLst[aFieldId].myField)) // break, if field was deleted.
-           break;
-
-         saveImages( aFieldId, aOneVal, aNbFiles, theIndexList );
-       }
+        }
+
+        k = 1;
+        if (myProportional) {
+          switch (aFrame) {
+          case 0:
+            break;
+          case 1:
+            if (aFirstFieldData.myNbFrames > 2)
+              k = (aFirstFieldData.myTiming[aFrame+1] -
+                   aFirstFieldData.myTiming[aFrame]) / aOneVal;
+            break;
+          default:
+            if (aFrame < (aFirstFieldData.myNbFrames - 1))
+              k = (aFirstFieldData.myTiming[aFrame+1] -
+                   aFirstFieldData.myTiming[aFrame]) / aOneVal;
+          }
+        }
+        int delay = (int)(1000. * k / mySpeed);
+        theIsDumping = !myDumpPath.isEmpty();
+        if (delay < 1 && theIsDumping) {
+          // We must unlock mutex for some time before grabbing to allow view updating
+          delay = 1;
+        }
+        msleep(delay);
+
+        if (!myExecutionState->IsActive()) return;
+
+        if (theIsDumping) {
+          // We must unlock mutex for some time before grabbing to allow view updating
+          msleep(delay);
+          if (!myExecutionState->IsActive()) return;
+
+          if (!(myFieldsLst[aFieldId].myField)) // break, if field was deleted.
+            break;
+
+          saveImages( aFieldId, aOneVal, aNbFiles, theIndexList );
+        }
       } // for (; aFrame < aData.myNbFrames && myExecutionState->IsActive(); aFrame++, myFrame++)
     } // for (int aFieldId = 0;
 
@@ -1383,8 +1397,8 @@ void VISU_TimeAnimation::successiveAnimation( bool& theIsDumping, QList<int>& th
 
 //------------------------------------------------------------------------
 void VISU_TimeAnimation::saveImages( int theFieldId, 
-                                    double& theOneVal, int& theNbFiles, 
-                                    QList<int>& theIndexList )
+                                     double& theOneVal, int& theNbFiles, 
+                                     QList<int>& theIndexList )
 {
   if (myDumpFormat.compare("AVI") != 0) {
     QString aFile(myDumpPath);
@@ -1408,14 +1422,17 @@ void VISU_TimeAnimation::saveImages( int theFieldId,
     aFile += ".";
     aFile += myDumpFormat.toLower();
     ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
-                    (myView,&SVTK_ViewWindow::RefreshDumpImage)); // IPAL13602
+                     (myView,&SVTK_ViewWindow::RefreshDumpImage)); // IPAL13602
     ProcessEvent(new TMemFun2ArgEvent<SUIT_ViewWindow,bool,const QString&,const QString&>
-                (myView,&SUIT_ViewWindow::dumpViewToFormat,aFile,myDumpFormat));
+                 (myView,&SUIT_ViewWindow::dumpViewToFormat,aFile,myDumpFormat));
   } else {
     QFileInfo aFileInfo(myDumpPath);
     QString aDirPath = aFileInfo.absolutePath();
     QString aBaseName = aFileInfo.fileName();
     
+    if( myTimeStampFrequency > 1 && myFrame % myTimeStampFrequency != 0 )
+      return;
+
     switch (myFrame) {
     case 0: 
       break;
@@ -1424,12 +1441,12 @@ void VISU_TimeAnimation::saveImages( int theFieldId,
       break;
     default:
       if (myProportional) {
-       FieldData& aFirstFieldData = myFieldsLst[0];
-       double p = (aFirstFieldData.myTiming[myFrame] -
-                   aFirstFieldData.myTiming[myFrame-1]) / theOneVal;
-       myFileIndex += (long) (5*p);
+        FieldData& aFirstFieldData = myFieldsLst[0];
+        double p = (aFirstFieldData.myTiming[myFrame] -
+                    aFirstFieldData.myTiming[myFrame-1]) / theOneVal;
+        myFileIndex += (long) (5*p);
       } else {
-       myFileIndex += 5;
+        myFileIndex += 5;
       }
     }
     
@@ -1449,8 +1466,8 @@ void VISU_TimeAnimation::saveImages( int theFieldId,
       int height = img.height(); height = (height/16)*16;
       QImage copy = img.copy(0, 0, width, height);
       if (copy.save(aFile, "JPEG")) {
-       theIndexList.append(myFileIndex);
-       theNbFiles++;
+        theIndexList.append(myFileIndex);
+        theNbFiles++;
       }
     }
   }
@@ -1475,7 +1492,7 @@ void VISU_TimeAnimation::run()
 
   // make AVI file if need
   if (isDumping && myDumpFormat.compare("AVI") == 0 && myExecutionState->IsActive()) {
-    double aFPS = 17.3 * mySpeed;
+    double aFPS = 17.3 * mySpeed / myTimeStampFrequency;
 
     QFileInfo aFileInfo(myDumpPath);
     QString aDirPath = aFileInfo.absolutePath();
@@ -1483,24 +1500,31 @@ void VISU_TimeAnimation::run()
 
     // add missing files
     if (anIndexList.count() > 1) {
-      QString aFFile = aDirPath + QDir::separator() + aBaseName;
+      QString aFFile = aDirPath + "/" + aBaseName;
       aFFile += QString("_%1.jpeg");
       int aStartIndex = anIndexList[0], anEndIndex;
       for (int i = 1; i < anIndexList.count(); i++) {
-       anEndIndex = anIndexList[i];
-       QString aCurFile = aFFile.arg(QString::number(aStartIndex).rightJustified(8, '0'));
-       QStringList aCommands;
-       for (int j = aStartIndex+1; j < anEndIndex; j++) {
-         QString aFile = aFFile.arg(QString::number(j).rightJustified(8, '0'));
-         aCommands.append(QString("ln -s %1 %2").arg(aCurFile).arg(aFile));
-       }
-       system(aCommands.join(" ; \\\n").toLatin1().data());
-       aStartIndex = anEndIndex;
+        anEndIndex = anIndexList[i];
+        QString aCurFile = aFFile.arg(QString::number(aStartIndex).rightJustified(8, '0'));
+        QStringList aCommands;
+        QString aSeparator;
+        for (int j = aStartIndex+1; j < anEndIndex; j++) {
+          QString aFile = aFFile.arg(QString::number(j).rightJustified(8, '0'));
+#ifndef WIN32
+          aCommands.append(QString("ln -s %1 %2").arg(aCurFile).arg(aFile));
+          aSeparator = QString(" ; \\\n");
+#else
+          aCommands.append(QString("COPY /Y %1 %2 > NUL").arg(QString(aCurFile).replace("/","\\\\")).arg(QString(aFile).replace("/","\\\\")));
+          aSeparator = QString(" & ");
+#endif
+        }
+        system(aCommands.join(aSeparator).toLatin1().data());
+        aStartIndex = anEndIndex;
       }
     }
 
     // make AVI file
-    QString aPattern = aDirPath + QDir::separator() + aBaseName;
+    QString aPattern = aDirPath + "/" + aBaseName;
     aPattern += "_\%08d.jpeg";
 
     QString aCmd = myAVIMaker;
@@ -1509,18 +1533,29 @@ void VISU_TimeAnimation::run()
     aCmd += QString(" -f %1").arg(aFPS);
     // aCmd += QString(" -n %1").arg(aNbFiles);
     aCmd += QString(" -n %1").arg(myFileIndex+1);
-    aCmd += QString(" -j %1").arg(aPattern);
+    aCmd += QString(" -j \"%1\"").arg(aPattern);
     aCmd += " | yuv2lav";
-    aCmd += QString(" -o %1").arg(myDumpPath);
+    aCmd += QString(" -o \"%1\"").arg(myDumpPath);
+  #ifdef WIN32
+    aCmd += " -f aA";   
+  #endif
     system(aCmd.toLatin1().data());
 
     // remove temporary jpeg files
+#ifndef WIN32
     aCmd = "( ";
     aCmd += QString("cd %1").arg(aDirPath);
     aCmd += "; ls";
     aCmd += QString(" | egrep '%1_[0-9]*.jpeg'").arg(aBaseName);
     aCmd += " | xargs rm";
     aCmd += " )";
+#else
+  QString tmpFile = QString("_") + aBaseName + "_tempfile";
+  QString diskName = aDirPath.split("/")[0];
+  aCmd = diskName + " && (cd " + aDirPath.replace("/","\\\\") + 
+    " && ((dir /b | findstr " + aBaseName + "_[0-9]*.jpeg > " + tmpFile + 
+    ") & (for /f %i in (" + tmpFile + ") do (del \"%i\")) & (del " + tmpFile + "))) > NUL";
+#endif
     system(aCmd.toLatin1().data());
   }
 
@@ -1616,18 +1651,18 @@ bool VISU_TimeAnimation::getIndicesFromSequence( QString theSequence, QList<long
       ok = false;
       int aLeftIndex = aLeftIndexStr.toLong( &ok );
       if( !ok )
-       continue;
+        continue;
 
       ok = false;
       int aRightIndex = aRightIndexStr.toLong( &ok );
       if( !ok )
-       continue;
+        continue;
 
       if( aLeftIndex >= aRightIndex )
-       continue;
+        continue;
 
       for( int i = aLeftIndex; i <= aRightIndex; i++ )
-       theIndices.append( i );
+        theIndices.append( i );
 
       isCorrect = true;
     }
@@ -1643,7 +1678,8 @@ std::string VISU_TimeAnimation::setDumpFormat(const char* theFormat)
   QList<QByteArray> aDumpFormats = QImageWriter::supportedImageFormats();
   if (myDumpFormat.isEmpty() || 
       (aDumpFormats.indexOf(theFormat) < 0 && myDumpFormat.compare("AVI") != 0)) {
-    if (aDumpFormats.indexOf("JPEG"))
+    if (aDumpFormats.indexOf("JPEG") >= 0 ||
+        aDumpFormats.indexOf("jpeg") >= 0)
       myDumpFormat = "JPEG";
     else
       myDumpFormat = aDumpFormats.at(0);
@@ -1651,15 +1687,26 @@ std::string VISU_TimeAnimation::setDumpFormat(const char* theFormat)
   return myDumpFormat.toLatin1().data();
 }
 
+//------------------------------------------------------------------------
+void VISU_TimeAnimation::setTimeStampFrequency(CORBA::Long theFrequency)
+{
+  myTimeStampFrequency = theFrequency;
+}
+
 //------------------------------------------------------------------------
 bool VISU_TimeAnimation::checkAVIMaker() const
 {
   QList<QByteArray> aDumpFormats = QImageWriter::supportedImageFormats();
-  if (aDumpFormats.indexOf("JPEG") < 0) return false;
+  if (aDumpFormats.indexOf("JPEG") < 0 &&
+      aDumpFormats.indexOf("jpeg") < 0)
+    return false;
 
-  QString aCmd("which ");
-  aCmd += myAVIMaker;
-  aCmd += " >& /dev/null";
+  QString aCmd;
+#ifndef WIN32
+  aCmd = "which " + myAVIMaker + " 2> /dev/null";
+#else
+  aCmd = "setlocal & set P2=.;%PATH% & (for %e in (%PATHEXT%) do @for %i in (" + myAVIMaker + "%e) do @if NOT \"%~$P2:i\"==\"\" exit /b 0) & exit /b 1";
+#endif
   int iErr = system(aCmd.toLatin1().data());
   return (iErr == 0);
 }
@@ -1688,6 +1735,9 @@ std::string GetPresentationComment (VISU::VISUType thePrsType)
   case VISU::TCUTLINES:
     aPrsCmt = VISU::CutLines_i::myComment;
     break;
+  case VISU::TCUTSEGMENT:
+    aPrsCmt = VISU::CutSegment_i::myComment;
+    break;
   case VISU::TPLOT3D:
     aPrsCmt = VISU::Plot3D_i::myComment;
     break;
@@ -1719,9 +1769,9 @@ SALOMEDS::SObject_ptr VISU_TimeAnimation::publishInStudy()
 {
   if (myStudy->GetProperties()->IsLocked()) {
     SUIT_MessageBox::warning(0,
-                            QObject::tr("WRN_VISU_WARNING"),
-                            QObject::tr("WRN_STUDY_LOCKED"),
-                            QObject::tr("BUT_OK"));
+                             QObject::tr("WRN_VISU_WARNING"),
+                             QObject::tr("WRN_STUDY_LOCKED"),
+                             QObject::tr("BUT_OK"));
     return SALOMEDS::SObject::_nil();
   }
 
@@ -1733,18 +1783,18 @@ SALOMEDS::SObject_ptr VISU_TimeAnimation::publishInStudy()
   QString aComment;
   aComment.sprintf("myComment=ANIMATION;myTimeMinVal=%g;myTimeMaxVal=%g;mySequence=%s;myMode=%d",
                    myTimeMinVal,
-                  myTimeMaxVal,
-                  mySequence.toLatin1().data(),
-                  myAnimationMode);
+                   myTimeMaxVal,
+                   mySequence.toLatin1().data(),
+                   myAnimationMode);
 
   string anEntry = VISU::CreateAttributes(myStudy,
-                                         aSComponentEntry.c_str(),
-                                         VISU::NO_ICON,
-                                         VISU::NO_IOR,
+                                          aSComponentEntry.c_str(),
+                                          VISU::NO_ICON,
+                                          VISU::NO_IOR,
                                           GenerateName().toLatin1().data(),
-                                         VISU::NO_PERFSITENT_REF,
-                                         aComment.toLatin1().data(),
-                                         true);
+                                          VISU::NO_PERFSITENT_REF,
+                                          aComment.toLatin1().data(),
+                                          true);
   myAnimEntry = anEntry.c_str();
   _PTR(SObject) aAnimSObject = myStudy->FindObjectID(anEntry.c_str());
 
@@ -1762,20 +1812,20 @@ SALOMEDS::SObject_ptr VISU_TimeAnimation::publishInStudy()
       string aPrsComment = strOut.str();
       string aPrsMyComment = aData.myPrs[0]->GetComment();
       if(aPrsMyComment == "PRSMERGER")
-       aPrsMyComment = "SCALARMAP";
+        aPrsMyComment = "SCALARMAP";
       VISU::CreateAttributes(myStudy, 
-                            newObj->GetID().c_str(),
-                            VISU::NO_ICON,
-                            VISU::NO_IOR,
-                            aPrsMyComment.c_str(),
-                            VISU::NO_PERFSITENT_REF,
-                            aPrsComment.c_str(),
-                            true);
+                             newObj->GetID().c_str(),
+                             VISU::NO_ICON,
+                             VISU::NO_IOR,
+                             aPrsMyComment.c_str(),
+                             VISU::NO_PERFSITENT_REF,
+                             aPrsComment.c_str(),
+                             true);
     }
   }
   aStudyBuilder->CommitCommand();
 
-  return VISU::GetSObject(aAnimSObject);
+  return VISU::GetSObject(aAnimSObject)._retn();
 }
 
 //------------------------------------------------------------------------
@@ -1795,9 +1845,9 @@ void VISU_TimeAnimation::saveAnimation()
   QString aComment;
   aComment.sprintf("myComment=ANIMATION;myTimeMinVal=%g;myTimeMaxVal=%g;mySequence=%s;myMode=%d",
                    myTimeMinVal,
-                  myTimeMaxVal,
-                  mySequence.toLatin1().data(),
-                  myAnimationMode);
+                   myTimeMaxVal,
+                   mySequence.toLatin1().data(),
+                   myAnimationMode);
 
   _PTR(GenericAttribute) anAttr;
   anAttr = aStudyBuilder->FindOrCreateAttribute(aAnimSObject, "AttributeString");
@@ -1837,13 +1887,13 @@ void VISU_TimeAnimation::saveAnimation()
 
     } else {
       VISU::CreateAttributes(myStudy, 
-                            aRefObj->GetID().c_str(),
-                            VISU::NO_ICON,
-                            VISU::NO_IOR,
+                             aRefObj->GetID().c_str(),
+                             VISU::NO_ICON,
+                             VISU::NO_IOR,
                              aPrsNameTxt.c_str(),
-                            VISU::NO_PERFSITENT_REF,
-                            aPrsComment.c_str(),
-                            true);
+                             VISU::NO_PERFSITENT_REF,
+                             aPrsComment.c_str(),
+                             true);
     }
   }
   aStudyBuilder->CommitCommand();
@@ -1910,6 +1960,8 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
       aData.myPrsType = VISU::TCUTPLANES;
     else if (strName == VISU::CutLines_i::myComment.c_str())
       aData.myPrsType = VISU::TCUTLINES;
+    else if (strName == VISU::CutSegment_i::myComment.c_str())
+      aData.myPrsType = VISU::TCUTSEGMENT;
     else if (strName == VISU::Plot3D_i::myComment.c_str())
       aData.myPrsType = VISU::TPLOT3D;
     else if (strName == VISU::DeformedShape_i::myComment.c_str())
@@ -1935,25 +1987,25 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
     }
     for (int i = 1; i < aData.myNbFrames; i++) {
       if (!aData.myPrs[0])
-       continue;
+        continue;
       bool anIsFixedRange = false;
       if (aData.myPrsType != VISU::TGAUSSPOINTS) {
-       if (VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(aData.myPrs[i]))
-         anIsFixedRange = aPrs->IsRangeFixed();
+        if (VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(aData.myPrs[i]))
+          anIsFixedRange = aPrs->IsRangeFixed();
       }
       if (aData.myPrsType == VISU::TDEFORMEDSHAPEANDSCALARMAP) {
-       if (VISU::DeformedShapeAndScalarMap_i* aDeformedPrs =
-           dynamic_cast<VISU::DeformedShapeAndScalarMap_i*>(aData.myPrs[i])) {
-         //Set correct time stamp number
-         int aTimeStampNum = aDeformedPrs->GetScalarTimeStampNumber();
-         aDeformedPrs->SameAs(aData.myPrs[0]);
-         aDeformedPrs->SetScalarField(aDeformedPrs->GetScalarEntity(),
-                                      aDeformedPrs->GetScalarFieldName(),
-                                      aTimeStampNum);
-       }
+        if (VISU::DeformedShapeAndScalarMap_i* aDeformedPrs =
+            dynamic_cast<VISU::DeformedShapeAndScalarMap_i*>(aData.myPrs[i])) {
+          //Set correct time stamp number
+          int aTimeStampNum = aDeformedPrs->GetScalarTimeStampNumber();
+          aDeformedPrs->SameAs(aData.myPrs[0]);
+          aDeformedPrs->SetScalarField(aDeformedPrs->GetScalarEntity(),
+                                       aDeformedPrs->GetScalarFieldName(),
+                                       aTimeStampNum);
+        }
       }
       else
-       aData.myPrs[i]->SameAs(aData.myPrs[0]);
+        aData.myPrs[i]->SameAs(aData.myPrs[0]);
     }
   }
   string aStr = aAnimSObject->GetID();
@@ -1975,24 +2027,24 @@ void VISU_TimeAnimation::ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredP
 
   if ( !aPrs_i ) 
     THROW_SALOME_CORBA_EXCEPTION("Error : invalid dynamic cast of the given presentation to VISU::ColoredPrs3d_i",
-                                SALOME::INTERNAL_ERROR);
+                                 SALOME::INTERNAL_ERROR);
   
   if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
     FieldData& aData = myFieldsLst[theFieldNum];
     
     if ( aData.myPrs.empty() )
       THROW_SALOME_CORBA_EXCEPTION("Error : presentations for the given field is not yet created!",
-                                  SALOME::INTERNAL_ERROR);
+                                   SALOME::INTERNAL_ERROR);
     
     if ( aPrs_i->GetCResult() != aData.myPrs[0]->GetCResult() )
       THROW_SALOME_CORBA_EXCEPTION("Error : the MED file is not the same!",
-                                  SALOME::INTERNAL_ERROR);
+                                   SALOME::INTERNAL_ERROR);
     
     for (int i = 0; i < aData.myNbFrames; i++) {
       bool anIsFixedRange = false;
       if (aData.myPrsType != VISU::TGAUSSPOINTS) {
-       if (VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(aData.myPrs[i]))
-         anIsFixedRange = aPrs->IsRangeFixed();
+        if (VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(aData.myPrs[i]))
+          anIsFixedRange = aPrs->IsRangeFixed();
       }
       aData.myPrs[i]->SameAs(aPrs_i);
     }
@@ -2002,11 +2054,11 @@ void VISU_TimeAnimation::ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredP
       FieldData& aData = myFieldsLst[f];
       
       if ( aData.myPrs.empty() )
-       THROW_SALOME_CORBA_EXCEPTION("Error : presentations for the given field is not yet created!",
-                                    SALOME::INTERNAL_ERROR);
+        THROW_SALOME_CORBA_EXCEPTION("Error : presentations for the given field is not yet created!",
+                                     SALOME::INTERNAL_ERROR);
       
       for (int i = 0; i < aData.myNbFrames; i++) {
-       aData.myPrs[i]->SameAs(aPrs_i);
+        aData.myPrs[i]->SameAs(aPrs_i);
       }
     }
   }
@@ -2245,6 +2297,16 @@ char* VISU_TimeAnimation_i::setDumpFormat (const char* theFormat)
   return CORBA::string_dup(aDumpFormat.c_str());
 }
 
+void VISU_TimeAnimation_i::setTimeStampFrequency(CORBA::Long theFrequency)
+{
+  myAnim->setTimeStampFrequency(theFrequency);
+}
+
+CORBA::Long VISU_TimeAnimation_i::getTimeStampFrequency()
+{
+  return myAnim->getTimeStampFrequency();
+}
+
 CORBA::Boolean VISU_TimeAnimation_i::isCycling()
 {
   return myAnim->isCycling();