]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for IPAL14030 : "ApplyProperties()" doesn't set "ScalarMode" and "Title" properties.
authormkr <mkr@opencascade.com>
Wed, 29 Nov 2006 15:02:23 +0000 (15:02 +0000)
committermkr <mkr@opencascade.com>
Wed, 29 Nov 2006 15:02:23 +0000 (15:02 +0000)
Note : now we can rewrite titles of presentations with help of
ApplyProperties(...) method, but the part of the title containing
the time value and the unit is invariable (for example, for the
presentation with the title "temperature 0.01, s", the part " 0.01, s"
is invariable and part "temperature" is rewritable).

src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_ColoredPrs3d_i.hh
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_ScalarMap_i.cc
src/VISU_I/VISU_TimeAnimation.cxx

index 5d670d5d859bcc2853c49b7e9486b1a60883a6c8..90d6c02237d755bc578c14c39d0292f19f16f6a6 100644 (file)
@@ -146,19 +146,22 @@ VISU::ColoredPrs3d_i
 ::SameAsParams(const ColoredPrs3d_i* theOrigin, 
               const std::string& theMeshName, const std::string& theFieldName,
               VISU::Entity theEntity, int theIteration,
-              char* theTitle, bool theIsFixedRange)
+              bool theIsFixedRange)
 {
   myMeshName = theMeshName;
   myFieldName = theFieldName;
   myEntity = (VISU::TEntity)theEntity;
   myIteration = theIteration;
+  int aScalarMode = (const_cast<ColoredPrs3d_i*>(theOrigin))->GetScalarMode();
 
   SameAs(theOrigin);
   
-  myTitle = theTitle;  
   myIsFixedRange = theIsFixedRange;
   
   Build(-1);
+  
+  SetScalarMode(aScalarMode); // mkr : IPAL14030
+
   Update();
 }
 
@@ -280,9 +283,18 @@ VISU::ColoredPrs3d_i
 
 void
 VISU::ColoredPrs3d_i
-::SetTitle(const char* theName) 
-{
-  myTitle = theName;
+::SetTitle(const char* theTitle) 
+{
+  // mkr : IPAL14030
+  std::strstream aStream;
+  const VISU::TValField& aValField = myField->myValField;
+  const VISU::PValForTime aValForTime = aValField.find(myIteration)->second;
+  aStream<<theTitle<<" "<<VISU_Convertor::GenerateName(aValForTime->myTime)<<std::ends;
+  std::string aScalarBarTitle = aStream.str();
+  if(myTitle != theTitle || myScalarBarTitle != aScalarBarTitle){
+    myScalarBarTitle = aScalarBarTitle;
+    myTitle = theTitle;
+  }
 }
 
 char* 
@@ -448,6 +460,13 @@ VISU::ColoredPrs3d_i
   myLabelColor[2] = theB; 
 }
 
+//----------------------------------------------------------------------------
+std::string
+VISU::ColoredPrs3d_i
+::GetScalarBarTitle()
+{
+  return myScalarBarTitle;
+}
 
 //----------------------------------------------------------------------------
 /**
@@ -689,7 +708,7 @@ VISU::ColoredPrs3d_i
       const VISU::TValField& aValField = myField->myValField;
       const VISU::PValForTime aValForTime = aValField.find(myIteration)->second;
       aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime->myTime).c_str());
-      if (theRestoring == 0) myTitle = aComment.simplifyWhiteSpace().latin1();
+      if (theRestoring == 0) SetTitle(myFieldName.c_str());
     }
     if(myAddToStudy){
       myName = GenerateName().latin1();
index 4f59e59f2e41ed29a88c9ee044c32e9ab8efd8e4..865326772152cb39f9869269cfcfea5b9a358b46 100644 (file)
@@ -124,7 +124,7 @@ namespace VISU
 
     virtual
     void
-    SetTitle(const char* theName);
+    SetTitle(const char* theTitle);
 
     virtual
     char* 
@@ -134,6 +134,7 @@ namespace VISU
   protected:
     VISU::ScalarMap::Orientation myOrientation;
     std::string myTitle;
+    std::string myScalarBarTitle;
     int myNumberOfLabels;
     vtkFloatingPointType myPosition[2], myWidth, myHeight;
 
@@ -167,7 +168,7 @@ namespace VISU
     SameAsParams(const ColoredPrs3d_i* theOrigin, 
                 const std::string& theMeshName, const std::string& theFieldName,
                 VISU::Entity theEntity, int theIteration,
-                char* theTitle, bool theIsFixedRange);
+                bool theIsFixedRange);
 
     virtual const VISU::PField&
     GetField() const;
@@ -275,6 +276,9 @@ namespace VISU
                  vtkFloatingPointType theG, 
                  vtkFloatingPointType theB);
 
+    std::string 
+    GetScalarBarTitle();
+
     //----------------------------------------------------------------------------
   protected:
     PField myField;
index 2fde203e88d8f84600bbc39a0b1706cd9fb0896d..6b88d23c4788cecf0b68f5cef8a181cc21f042b4 100644 (file)
@@ -628,7 +628,7 @@ VISU::GaussPoints_i
 ::UpdateScalarBar(vtkScalarBarActor *theScalarBar,
                  vtkLookupTable* theLookupTable)
 {
-  theScalarBar->SetTitle(myTitle.c_str());
+  theScalarBar->SetTitle(GetScalarBarTitle().c_str());
   theScalarBar->SetOrientation(myOrientation);
   theScalarBar->SetNumberOfLabels(myNumberOfLabels);
 
index 45abb66c777d8ba2cb652f507e476cffae0d4fe9..5e1f83c6b72d2eb66afb9908f9bc21fb634acf37 100644 (file)
@@ -344,7 +344,7 @@ VISU::ScalarMap_i
   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
     VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
     aScalarBar->SetLookupTable(myScalarMapPL->GetBarTable());
-    aScalarBar->SetTitle(myTitle.c_str());
+    aScalarBar->SetTitle(GetScalarBarTitle().c_str()); // mkr : IPAL14030
     aScalarBar->SetOrientation(myOrientation);
     aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
     aScalarBar->GetPositionCoordinate()->SetValue(myPosition[0],myPosition[1]);
index 71055430e4f726446fcae72d72503d5df312eb18..bd64fe81cf576b8e7413cbb09d55e554e6010bf4 100644 (file)
@@ -1654,7 +1654,7 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
       aData.myPrs[i]->SameAsParams(aData.myPrs[0],
                                   aData.myPrs[i]->GetMeshName(),aData.myPrs[i]->GetFieldName(),
                                   aData.myPrs[i]->GetEntity(), aData.myPrs[i]->GetIteration(),
-                                  aData.myPrs[i]->GetTitle(), anIsFixedRange);//jfa 03.08.2005
+                                  anIsFixedRange);//jfa 03.08.2005
     }
   }
   string aStr = aAnimSObject->GetID();
@@ -1691,8 +1691,8 @@ void VISU_TimeAnimation::ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredP
       }
       aData.myPrs[i]->SameAsParams(aPrs_i,
                                   aData.myPrs[i]->GetMeshName(),aData.myPrs[i]->GetFieldName(),
-                                  aData.myPrs[i]->GetEntity(), aData.myPrs[i]->GetIteration(),
-                                  aData.myPrs[i]->GetTitle(), anIsFixedRange);
+                                  aData.myPrs[i]->GetEntity(), aData.myPrs[i]->GetIteration(), 
+                                  anIsFixedRange);
     }
   }
   else if ( myAnimationMode == 1 ) { // successive animation mode
@@ -1706,7 +1706,7 @@ void VISU_TimeAnimation::ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredP
        aData.myPrs[i]->SameAsParams(aPrs_i,
                                     aData.myPrs[i]->GetMeshName(),aData.myPrs[i]->GetFieldName(),
                                     aData.myPrs[i]->GetEntity(), aData.myPrs[i]->GetIteration(),
-                                    aData.myPrs[i]->GetTitle(), true);
+                                    true);
       }
     }
   }