//----------------------------------------------------------------------------
-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()
VISU::ColoredPrs3d_i
::SetTitle(const char* 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();
+ if(VISU::PValForTime aValForTime = GetScalarValForTime()){
+ std::strstream aStream;
+ const VISU::TTime& aTime = aValForTime->myTime;
+ aStream<<theTitle<<" "<<VISU_Convertor::GenerateName(aTime)<<std::ends;
+ std::string aScalarBarTitle = aStream.str();
+ if(myTitle != theTitle || myScalarBarTitle != aScalarBarTitle){
+ myScalarBarTitle = aScalarBarTitle;
+ myTitle = theTitle;
+ myParamsTime.Modified();
+ }
}
}
ColoredPrs3d_i(thePublishInStudyMode),
ScalarMap_i(thePublishInStudyMode),
myScalarMapOnDeformedShapePL(NULL),
- myScalarIteration(1)
+ myScalarTimeStampNumber(1)
{}
{
myIsColored = true;
myColor.R = myColor.G = myColor.B = 0.5;
- VISU::Storable* aRes = TSuperClass::Create(theMeshName,
- theEntity,
- theFieldName,
- theTimeStampNumber);
+
SetScalarField(theMeshName.c_str(),
theFieldName.c_str(),
theTimeStampNumber,
theEntity);
- return aRes;
+
+ return TSuperClass::Create(theMeshName,
+ theEntity,
+ theFieldName,
+ theTimeStampNumber);
}
::Restore(SALOMEDS::Study_ptr theStudy,
const Storable::TRestoringMap& theMap)
{
- if(!TSuperClass::Restore(theStudy, theMap))
- return NULL;
-
QString aMeshName = VISU::Storable::FindValue(theMap,"myScalarMeshName");
VISU::Entity anEntity = VISU::Entity(VISU::Storable::FindValue(theMap,"myScalarFieldName").toInt());
aTimeStampNumber,
anEntity);
+ if(!TSuperClass::Restore(theStudy, theMap))
+ return NULL;
+
SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt();
myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
Storable::DataToStream( theStr, "myScalarFieldName", myScalarFieldName.c_str());
Storable::DataToStream( theStr, "myScalarMeshName", myScalarMeshName.c_str());
- Storable::DataToStream( theStr, "myScalarIteration", int(myScalarIteration));
+ Storable::DataToStream( theStr, "myScalarIteration", int(myScalarTimeStampNumber));
Storable::DataToStream( theStr, "myScalarEntity", int(myScalarEntity));
Storable::DataToStream( theStr, "myFactor", GetScale() );
}
+//---------------------------------------------------------------
+void
+VISU::ScalarMapOnDeformedShape_i
+::SetField(VISU::PField theField)
+{
+ TSuperClass::SetField(theField);
+
+ if(!myScalarField)
+ myScalarField = theField;
+}
+
+
//---------------------------------------------------------------
void
VISU::ScalarMapOnDeformedShape_i
anIsModified |= myScalarFieldName != theFieldName;
if(!anIsModified)
- anIsModified |= myScalarIteration != theTimeStampNumber;
+ anIsModified |= myScalarTimeStampNumber != theTimeStampNumber;
if(!anIsModified)
return;
VISU::TEntity aEntity = VISU::TEntity(theEntity);
VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
- SetField(anInput->GetField(theMeshName, aEntity, theFieldName));
+ myScalarField = anInput->GetField(theMeshName, aEntity, theFieldName);
VISU::PUnstructuredGridIDMapper anIDMapper =
anInput->GetTimeStampOnMesh(theMeshName,
myScalarMeshName = theMeshName;
myScalarEntity = theEntity;
myScalarFieldName = theFieldName;
- myScalarIteration = theTimeStampNumber;
+ myScalarTimeStampNumber = theTimeStampNumber;
+
+ SetTitle(theFieldName);
+
myParamsTime.Modified();
}
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;
}
}
protected:
+ //! Redefines VISU_ColoredPrs3d_i::SetField
+ virtual
+ void
+ SetField(VISU::PField theField);
+
//! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
virtual
void
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
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