From b2b5d26625992eef94dbd3eec32f6dc9724bd5f2 Mon Sep 17 00:00:00 2001 From: mkr Date: Wed, 29 Nov 2006 15:02:23 +0000 Subject: [PATCH] Fix for IPAL14030 : "ApplyProperties()" doesn't set "ScalarMode" and "Title" properties. 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 | 31 +++++++++++++++++++++++++------ src/VISU_I/VISU_ColoredPrs3d_i.hh | 8 ++++++-- src/VISU_I/VISU_GaussPoints_i.cc | 2 +- src/VISU_I/VISU_ScalarMap_i.cc | 2 +- src/VISU_I/VISU_TimeAnimation.cxx | 8 ++++---- 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 5d670d5d..90d6c022 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -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(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<myTime)<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(); diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index 4f59e59f..86532677 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -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; diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 2fde203e..6b88d23c 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -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); diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 45abb66c..5e1f83c6 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -344,7 +344,7 @@ VISU::ScalarMap_i if(VISU_ScalarMapAct* anActor = dynamic_cast(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]); diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index 71055430..bd64fe81 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -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); } } } -- 2.39.2