From e4f5b557e3b423aad1bf9ca91a382dce1e19b15b Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 17 May 2007 13:59:13 +0000 Subject: [PATCH] To apply right scalar bar title for ScalarMapOnDeformedShape presentation --- src/VISU_I/VISU_ColoredPrs3d_i.cc | 28 +++++---- src/VISU_I/VISU_ColoredPrs3d_i.hh | 5 +- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc | 58 ++++++++++++++----- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh | 29 +++++++--- 4 files changed, 85 insertions(+), 35 deletions(-) diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index a5581e2c..a3e8e67c 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -314,16 +314,20 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- -const VISU::PValForTime& +VISU::PValForTime VISU::ColoredPrs3d_i -::GetValForTime() const +::GetScalarValForTime() const { VISU::TValField& aValField = GetField()->myValField; - PValForTime& aValForTime = aValField[myTimeStampNumber]; + PValForTime aValForTime; + VISU::TValField::iterator anIter = aValField.find(myTimeStampNumber); + if(anIter != aValField.end()) + aValForTime = anIter->second; return aValForTime; } +//---------------------------------------------------------------------------- VISU::ColoredPrs3d::TimeStampsRange* VISU::ColoredPrs3d_i ::GetTimeStampsRange() @@ -707,14 +711,16 @@ void VISU::ColoredPrs3d_i ::SetTitle(const char* theTitle) { - std::strstream aStream; - const VISU::PValForTime& aValForTime = GetValForTime(); - aStream<myTime)<myTime; + aStream<GetInput(); - SetField(anInput->GetField(theMeshName, aEntity, theFieldName)); + myScalarField = anInput->GetField(theMeshName, aEntity, theFieldName); VISU::PUnstructuredGridIDMapper anIDMapper = anInput->GetTimeStampOnMesh(theMeshName, @@ -392,7 +405,10 @@ VISU::ScalarMapOnDeformedShape_i myScalarMeshName = theMeshName; myScalarEntity = theEntity; myScalarFieldName = theFieldName; - myScalarIteration = theTimeStampNumber; + myScalarTimeStampNumber = theTimeStampNumber; + + SetTitle(theFieldName); + myParamsTime.Modified(); } @@ -429,7 +445,21 @@ CORBA::Long VISU::ScalarMapOnDeformedShape_i ::GetScalarLIteration() { - return myScalarIteration; + return myScalarTimeStampNumber; +} + + +//---------------------------------------------------------------------------- +VISU::PValForTime +VISU::ScalarMapOnDeformedShape_i +::GetScalarValForTime() const +{ + VISU::TValField& aValField = myScalarField->myValField; + PValForTime aValForTime; + VISU::TValField::iterator anIter = aValField.find(myScalarTimeStampNumber); + if(anIter != aValField.end()) + aValForTime = anIter->second; + return aValForTime; } diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh index b5a8a056..3c265777 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh @@ -94,6 +94,11 @@ namespace VISU } protected: + //! Redefines VISU_ColoredPrs3d_i::SetField + virtual + void + SetField(VISU::PField theField); + //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine virtual void @@ -104,14 +109,6 @@ namespace VISU bool CheckIsPossible(); - VISU_ScalarMapOnDeformedShapePL *myScalarMapOnDeformedShapePL; - SALOMEDS::Color myColor; - bool myIsColored; - std::string myScalarMeshName; - std::string myScalarFieldName; - VISU::Entity myScalarEntity; - CORBA::Long myScalarIteration; - public: //! Redefines VISU_ColoredPrs3d_i::IsPossible static @@ -186,6 +183,22 @@ namespace VISU virtual CORBA::Long GetScalarLIteration(); + + virtual + VISU::PValForTime + GetScalarValForTime() const; + + private: + VISU_ScalarMapOnDeformedShapePL *myScalarMapOnDeformedShapePL; + + bool myIsColored; + SALOMEDS::Color myColor; + + PField myScalarField; + std::string myScalarMeshName; + std::string myScalarFieldName; + VISU::Entity myScalarEntity; + CORBA::Long myScalarTimeStampNumber; }; } #endif -- 2.39.2