]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To introduce CORBA::Boolean ColoredPrs3d::IsTimeStampFixed()
authorapo <apo@opencascade.com>
Thu, 2 Nov 2006 14:16:20 +0000 (14:16 +0000)
committerapo <apo@opencascade.com>
Thu, 2 Nov 2006 14:16:20 +0000 (14:16 +0000)
idl/VISU_Gen.idl
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

index b35287ef0db3e62c7894d7da18a7f235e6f9f814..ddb2b9cd2df6357a62935eda3611b5625f0f642f 100644 (file)
@@ -452,6 +452,10 @@ module VISU {
      */
     TimeStampsRange GetTimeStampsRange();
 
+    /*! Defines whether this presentation is bound to timestamp or not.
+     */
+    boolean IsTimeStampFixed();
+
     /*! Sets the method of coloring of the elements composing a 3D presentation.
      */
     void SetScalarMode(in long theScalarMode);
index e30d881b46290e4a9a62fe4a6d2a504498779dea..5059f3476477e560ecf4d607b18f1423dbc28097 100644 (file)
@@ -33,6 +33,7 @@
 #include "SUIT_ResourceMgr.h"
 #include "SALOME_Event.hxx"
 
+#include <strstream>
 #include <vtkMapper.h>
 
 #ifdef _DEBUG_
@@ -128,6 +129,7 @@ VISU::ColoredPrs3d_i
     CreatePipeLine(NULL); // to create proper pipeline
 
   DoSetInput();
+  SetTitle(GetCTitle().c_str());
 
   return anIsNotCreated;
 }
@@ -232,62 +234,16 @@ VISU::ColoredPrs3d_i
 }
 
 
-//---------------------------------------------------------------
-void
+//----------------------------------------------------------------------------
+const VISU::PValForTime&
 VISU::ColoredPrs3d_i
-::SameAs(const Prs3d_i* theOrigin)
-{
-  if(const ColoredPrs3d_i* aPrs3d = dynamic_cast<const ColoredPrs3d_i*>(theOrigin)){
-    ColoredPrs3d_i* anOrigin = const_cast<ColoredPrs3d_i*>(aPrs3d);
-    SetMeshName(anOrigin->GetCMeshName().c_str());
-    SetEntity(anOrigin->GetEntity());
-    SetFieldName(anOrigin->GetCFieldName().c_str());
-    SetTimeStampNumber(anOrigin->GetTimeStampNumber());
-    OnSetInput();
-
-    Build(ESameAs);
-    
-    TSuperClass::SameAs(theOrigin);
-    
-    SetScalarMode(anOrigin->GetScalarMode());
-    SetNbColors(anOrigin->GetNbColors());
-    SetBarOrientation(anOrigin->GetBarOrientation());
-    
-    SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY());
-    SetSize(anOrigin->GetWidth(), anOrigin->GetHeight());
-    SetLabels(anOrigin->GetLabels());
-    SetTitle(anOrigin->GetTitle());
-    
-    SetBoldTitle(anOrigin->IsBoldTitle());
-    SetItalicTitle(anOrigin->IsItalicTitle());
-    SetShadowTitle(anOrigin->IsShadowTitle());
-    SetTitFontType(anOrigin->GetTitFontType());
-    vtkFloatingPointType r,g,b;
-    anOrigin->GetTitleColor(&r,&g,&b);
-    SetTitleColor(r,g,b);
-    
-    SetBoldLabel(anOrigin->IsBoldLabel());
-    SetItalicLabel(anOrigin->IsItalicLabel());
-    SetShadowLabel(anOrigin->IsShadowLabel());
-    SetLblFontType(anOrigin->GetLblFontType());
-    anOrigin->GetLabelColor(&r,&g,&b);
-    SetLabelColor(r,g,b);
-  }
+::GetValForTime() const 
+{ 
+  VISU::TValField& aValField = GetField()->myValField;
+  PValForTime& aValForTime = aValField[myTimeStampNumber];
+  return aValForTime;
 }
-  
-void
-VISU::ColoredPrs3d_i
-::SameAsParams(const ColoredPrs3d_i* theOrigin)
-{
-  int aTimeStampNumber = GetTimeStampNumber();
-  SameAs(theOrigin);
-  SetTimeStampNumber(aTimeStampNumber);
-  OnSetInput();
 
-  Build(ESameAs);
-  Update();
-}
 
 VISU::ColoredPrs3d::TimeStampsRange* 
 VISU::ColoredPrs3d_i
@@ -295,7 +251,7 @@ VISU::ColoredPrs3d_i
 {
   VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = new VISU::ColoredPrs3d::TimeStampsRange();
   VISU::TValField& aValField = GetField()->myValField;
-  if(myIsTimeStampFixed){
+  if(IsTimeStampFixed()){
     aTimeStampsRange->length(1);
     PValForTime& aValForTime = aValField[GetTimeStampNumber()];
     std::string aTime = VISU_Convertor::GenerateName(aValForTime->myTime);
@@ -347,6 +303,71 @@ VISU::ColoredPrs3d_i
   return aTimeStampsRange._retn();
 }
 
+//----------------------------------------------------------------------------
+CORBA::Boolean 
+VISU::ColoredPrs3d_i
+::IsTimeStampFixed()
+{
+  return myIsTimeStampFixed;
+}
+
+//---------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SameAs(const Prs3d_i* theOrigin)
+{
+  if(const ColoredPrs3d_i* aPrs3d = dynamic_cast<const ColoredPrs3d_i*>(theOrigin)){
+    ColoredPrs3d_i* anOrigin = const_cast<ColoredPrs3d_i*>(aPrs3d);
+    SetMeshName(anOrigin->GetCMeshName().c_str());
+    SetEntity(anOrigin->GetEntity());
+    SetFieldName(anOrigin->GetCFieldName().c_str());
+    SetTimeStampNumber(anOrigin->GetTimeStampNumber());
+    OnSetInput();
+
+    Build(ESameAs);
+    
+    TSuperClass::SameAs(theOrigin);
+    
+    SetScalarMode(anOrigin->GetScalarMode());
+    SetNbColors(anOrigin->GetNbColors());
+    SetBarOrientation(anOrigin->GetBarOrientation());
+    
+    SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY());
+    SetSize(anOrigin->GetWidth(), anOrigin->GetHeight());
+    SetLabels(anOrigin->GetLabels());
+    SetTitle(anOrigin->GetTitle());
+    
+    SetBoldTitle(anOrigin->IsBoldTitle());
+    SetItalicTitle(anOrigin->IsItalicTitle());
+    SetShadowTitle(anOrigin->IsShadowTitle());
+    SetTitFontType(anOrigin->GetTitFontType());
+    vtkFloatingPointType r,g,b;
+    anOrigin->GetTitleColor(&r,&g,&b);
+    SetTitleColor(r,g,b);
+    
+    SetBoldLabel(anOrigin->IsBoldLabel());
+    SetItalicLabel(anOrigin->IsItalicLabel());
+    SetShadowLabel(anOrigin->IsShadowLabel());
+    SetLblFontType(anOrigin->GetLblFontType());
+    anOrigin->GetLabelColor(&r,&g,&b);
+    SetLabelColor(r,g,b);
+  }
+}
+  
+void
+VISU::ColoredPrs3d_i
+::SameAsParams(const ColoredPrs3d_i* theOrigin)
+{
+  int aTimeStampNumber = GetTimeStampNumber();
+  SameAs(theOrigin);
+  SetTimeStampNumber(aTimeStampNumber);
+  OnSetInput();
+
+  Build(ESameAs);
+  Update();
+}
+
 //----------------------------------------------------------------------------
 CORBA::Long 
 VISU::ColoredPrs3d_i
@@ -474,7 +495,12 @@ void
 VISU::ColoredPrs3d_i
 ::SetTitle(const char* theTitle) 
 {
-  if(myTitle != theTitle){
+  std::strstream aStream;
+  const VISU::PValForTime& aValForTime = GetValForTime();
+  aStream<<theTitle<<" "<<VISU_Convertor::GenerateName(aValForTime->myTime)<<std::ends;
+  std::string aScalarBarTitle = aStream.str();
+  if(myTitle != theTitle || myScalarBarTitle != aScalarBarTitle){
+    myScalarBarTitle = aScalarBarTitle;
     myTitle = theTitle;
     myParamsTime.Modified();
   }
@@ -692,6 +718,13 @@ VISU::ColoredPrs3d_i
   myIsFixedRange = theUseFixedRange;
 }
 
+std::string
+VISU::ColoredPrs3d_i
+::GetScalarBarTitle()
+{
+  return myScalarBarTitle;
+}
+
 //----------------------------------------------------------------------------
 /**
  * Creates ColoredPrs3d and initialises it from resources
@@ -952,13 +985,8 @@ VISU::ColoredPrs3d_i
     if(theBuildMode == ECreateNew || theBuildMode == ESameAs){
       if(!myIsFixedRange) 
        myScalarMapPL->SetSourceRange();
-      const VISU::TValField& aValField = GetField()->myValField;
-      const VISU::PValForTime aValForTime = aValField.find(GetTimeStampNumber())->second;
-      aComment.sprintf("%s %s",
-                      GetCFieldName().c_str(),
-                      VISU_Convertor::GenerateName(aValForTime->myTime).c_str());
       if(theBuildMode == ECreateNew) 
-       myTitle = aComment.simplifyWhiteSpace().latin1();
+       SetTitle(GetCFieldName().c_str());
     }
     if(myPublishInStudyMode == EPublishUnderTimeStamp){
       myName = GenerateName().latin1();
index cd53ce7a41ad0f05e9a80b609f497ec96fb682a6..2c6ba689fa4c36b5c3b376904fd195f8203c1720 100644 (file)
@@ -97,10 +97,18 @@ namespace VISU
     CORBA::Long
     GetTimeStampNumber();
 
+    virtual 
+    const VISU::PValForTime&
+    GetValForTime() const;
+
     virtual
     VISU::ColoredPrs3d::TimeStampsRange*
     GetTimeStampsRange();
 
+    virtual 
+    CORBA::Boolean 
+    IsTimeStampFixed();
+
     //----------------------------------------------------------------------------
     virtual
     CORBA::Long
@@ -376,6 +384,9 @@ namespace VISU
     void
     UseFixedRange(bool theUseFixedRange);
 
+    std::string 
+    GetScalarBarTitle();
+
   private:
     // Decalare basic input parameters
     Entity myEntity;
@@ -387,6 +398,8 @@ namespace VISU
     EPublishInStudyMode myPublishInStudyMode;
 
     std::string myTitle;
+    std::string myScalarBarTitle;
+
     int myNumberOfLabels;
     VISU::ScalarMap::Orientation myOrientation;
     vtkFloatingPointType myPosition[2], myWidth, myHeight;
index 674cbe0d7a5d3edf4a7a6d98e12e35318af2d376..466823dd2412a71701f6f989421d56eabf76ece9 100644 (file)
@@ -631,7 +631,7 @@ VISU::GaussPoints_i
 ::UpdateScalarBar(vtkScalarBarActor *theScalarBar,
                  vtkLookupTable* theLookupTable)
 {
-  theScalarBar->SetTitle(GetCTitle().c_str());
+  theScalarBar->SetTitle(GetScalarBarTitle().c_str());
   theScalarBar->SetOrientation(GetBarOrientation());
   theScalarBar->SetNumberOfLabels(GetLabels());
 
index b52232ed0447ef0aa96fa267deff94f1657ceb66..5d7c37f8dd7238a8cc148bb3acb77e8552d5820a 100644 (file)
@@ -349,7 +349,7 @@ VISU::ScalarMap_i
   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
     VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
     aScalarBar->SetLookupTable(GetSpecificPL()->GetBarTable());
-    aScalarBar->SetTitle(GetCTitle().c_str());
+    aScalarBar->SetTitle(GetScalarBarTitle().c_str());
     aScalarBar->SetOrientation(GetBarOrientation());
     aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
     aScalarBar->GetPositionCoordinate()->SetValue(GetPosX(),GetPosY());