]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
For presentations published under TimeStamp their function GetTimeStamp range will...
authorapo <apo@opencascade.com>
Thu, 2 Nov 2006 10:40:27 +0000 (10:40 +0000)
committerapo <apo@opencascade.com>
Thu, 2 Nov 2006 10:40:27 +0000 (10:40 +0000)
src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_ColoredPrs3d_i.hh

index be840816c92370a0df5d6c984afbbd52e9327f71..e30d881b46290e4a9a62fe4a6d2a504498779dea 100644 (file)
@@ -50,6 +50,7 @@ ColoredPrs3d_i(Result_i* theResult,
   PrsObject_i(SALOMEDS::Study::_nil()),
   Prs3d_i(theResult),
   myPublishInStudyMode(thePublishInStudyMode),
+  myIsTimeStampFixed(thePublishInStudyMode == EPublishUnderTimeStamp),
   myScalarMapPL(NULL),
   myIsFixedRange(false)
 {}
@@ -62,6 +63,7 @@ ColoredPrs3d_i(Result_i* theResult,
   PrsObject_i(theSObject->GetStudy()),
   Prs3d_i(theResult,theSObject),
   myPublishInStudyMode(EDoNotPublish),
+  myIsTimeStampFixed(true),
   myScalarMapPL(NULL),
   myIsFixedRange(false)
 {}
@@ -291,11 +293,23 @@ VISU::ColoredPrs3d::TimeStampsRange*
 VISU::ColoredPrs3d_i
 ::GetTimeStampsRange()
 {
+  VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = new VISU::ColoredPrs3d::TimeStampsRange();
+  VISU::TValField& aValField = GetField()->myValField;
+  if(myIsTimeStampFixed){
+    aTimeStampsRange->length(1);
+    PValForTime& aValForTime = aValField[GetTimeStampNumber()];
+    std::string aTime = VISU_Convertor::GenerateName(aValForTime->myTime);
+    VISU::ColoredPrs3d::TimeStampInfo anInfo;
+    anInfo.myNumber = GetTimeStampNumber();
+    anInfo.myTime = aTime.c_str();
+    aTimeStampsRange[0] = anInfo;
+    return aTimeStampsRange._retn();    
+  }
+
   // To exclude timstamps with repeated time
   typedef std::map<std::string, long> TTimeStampsRange;
   TTimeStampsRange aRange;
   {
-    const VISU::TValField& aValField = GetField()->myValField;
     VISU::TValField::const_iterator anIter = aValField.begin();
     for(; anIter != aValField.end(); anIter++){
       vtkIdType aTimeStampNumber = anIter->first;
@@ -318,7 +332,6 @@ VISU::ColoredPrs3d_i
   }
 
   // To map the C++ data structures to the corresponding CORBA ones
-  VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = new VISU::ColoredPrs3d::TimeStampsRange();
   {
     aTimeStampsRange->length(aRange.size());
     TTimeStampsSortedRange::const_iterator anIter = aSortedRange.begin();
@@ -804,6 +817,7 @@ VISU::ColoredPrs3d_i
   SetEntity((VISU::Entity)VISU::Storable::FindValue(theMap,"myEntity").toInt());
   SetFieldName(VISU::Storable::FindValue(theMap,"myFieldName").latin1());
   SetTimeStampNumber(VISU::Storable::FindValue(theMap,"myIteration").toInt());
+  myIsTimeStampFixed = VISU::Storable::FindValue(theMap,"myIsTimeStampFixed").toInt();
   OnSetInput();
 
   Build(ERestore);
@@ -846,14 +860,15 @@ VISU::ColoredPrs3d_i
 {
   TSuperClass::ToStream(theStr);
 
-  Storable::DataToStream( theStr, "myScalarMode",     int(GetScalarMode()) );
-  Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
-  Storable::DataToStream( theStr, "myOrientation",    myOrientation );
-
   Storable::DataToStream( theStr, "myMeshName",       GetCMeshName() );
   Storable::DataToStream( theStr, "myEntity",         GetEntity() );
   Storable::DataToStream( theStr, "myFieldName",      GetCFieldName() );
   Storable::DataToStream( theStr, "myIteration",      int(GetTimeStampNumber()) );
+  Storable::DataToStream( theStr, "myIteration",      int(myIsTimeStampFixed) );
+
+  Storable::DataToStream( theStr, "myScalarMode",     int(GetScalarMode()) );
+  Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
+  Storable::DataToStream( theStr, "myOrientation",    myOrientation );
 
   Storable::DataToStream( theStr, "myTitle",          myTitle.c_str() );
   Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
index afd7f67eb3ec8517f09aebd88c045c40d73dda76..cd53ce7a41ad0f05e9a80b609f497ec96fb682a6 100644 (file)
@@ -381,6 +381,7 @@ namespace VISU
     Entity myEntity;
     std::string myFieldName;
     CORBA::Long myTimeStampNumber;
+    bool myIsTimeStampFixed;
 
     PField myField;
     EPublishInStudyMode myPublishInStudyMode;