From 9e38de33d26c2c6adf8f3a136651323a3af629ec Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 2 Nov 2006 14:16:20 +0000 Subject: [PATCH] To introduce CORBA::Boolean ColoredPrs3d::IsTimeStampFixed() --- idl/VISU_Gen.idl | 4 + src/VISU_I/VISU_ColoredPrs3d_i.cc | 150 ++++++++++++++++++------------ src/VISU_I/VISU_ColoredPrs3d_i.hh | 13 +++ src/VISU_I/VISU_GaussPoints_i.cc | 2 +- src/VISU_I/VISU_ScalarMap_i.cc | 2 +- 5 files changed, 108 insertions(+), 63 deletions(-) diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index b35287ef..ddb2b9cd 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -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); diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index e30d881b..5059f347 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -33,6 +33,7 @@ #include "SUIT_ResourceMgr.h" #include "SALOME_Event.hxx" +#include #include #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(theOrigin)){ - ColoredPrs3d_i* anOrigin = const_cast(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(theOrigin)){ + ColoredPrs3d_i* anOrigin = const_cast(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<myTime)<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(); diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index cd53ce7a..2c6ba689 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -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; diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 674cbe0d..466823dd 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -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()); diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index b52232ed..5d7c37f8 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -349,7 +349,7 @@ VISU::ScalarMap_i if(VISU_ScalarMapAct* anActor = dynamic_cast(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()); -- 2.39.2