+ ProcessVoidEvent(new TEvent(this));
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::UpdateFromResult(Result_i* theResult)
+{
+ struct TEvent: public SALOME_Event
+ {
+ VISU::ColoredPrs3d_i* myColoredPrs3d;
+
+ TEvent(VISU::ColoredPrs3d_i* theColoredPrs3d):
+ myColoredPrs3d(theColoredPrs3d)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ try{
+ myColoredPrs3d->DoSetInput(false, false);
+ myColoredPrs3d->UpdateActors();
+ }catch(std::exception& exc){
+ INFOS("Follow exception was occured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was occured!");
+ }
+ }
+ };
+
+ if ( theResult == GetCResult() )
+ ProcessVoidEvent(new TEvent(this));
+}
+
+
+//---------------------------------------------------------------
+bool
+VISU::ColoredPrs3d_i
+::SetInput(bool theReInit)
+{
+ try{
+ if(TSuperClass::SetInput(theReInit)){
+ if(CheckIsPossible()){
+ if(OnSetInput(theReInit)){
+ if(Create(GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()))
+ return true;
+ }else
+ return true;
+ }
+ }
+ }catch(...){
+ }
+
+ return false;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::OnRestoreInput()
+{
+ TSuperClass::OnRestoreInput();
+ myEntity = myPreviousEntity;
+ myFieldName = myPreviousFieldName;
+ myTimeStampNumber = myPreviousTimeStampNumber;
+}
+
+
+//---------------------------------------------------------------
+bool
+VISU::ColoredPrs3d_i
+::OnSetInput(bool theReInit)
+{
+ bool anIsCreatNew = !IsPipeLineExists();
+ if(anIsCreatNew)
+ CreatePipeLine(NULL); // to create proper pipeline
+
+ try{
+ DoSetInput(anIsCreatNew, theReInit);
+
+ if(anIsCreatNew)
+ GetSpecificPL()->Init();
+
+ // To update scalar range according to the new input
+ if(!IsRangeFixed() && theReInit)
+ SetSourceRange();
+
+ if(GetPublishInStudyMode() != EDoNotPublish)
+ GetCResult()->ConnectObserver(this, myResultConnection);
+
+ myPreviousEntity = myEntity;
+ myPreviousFieldName = myFieldName;
+ myPreviousTimeStampNumber = myTimeStampNumber;
+ }catch(std::exception& exc){
+ INFOS("Follow exception was occured :\n"<<exc.what());
+ OnRestoreInput();
+ throw;
+ }catch(...){
+ INFOS("Unknown exception was occured!");
+ OnRestoreInput();
+ throw;
+ }
+
+ // To update title according to the new input
+ if(theReInit)
+ SetTitle(GetCFieldName().c_str());
+
+ return anIsCreatNew;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetEntity(VISU::Entity theEntity)
+{
+ if(myEntity == theEntity)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myEntity = theEntity;
+ myParamsTime.Modified();
+}
+
+
+//---------------------------------------------------------------
+VISU::Entity
+VISU::ColoredPrs3d_i
+::GetEntity()
+{
+ return myEntity;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::TEntity
+VISU::ColoredPrs3d_i
+::GetTEntity() const
+{
+ return VISU::TEntity(int(myEntity));
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetFieldName(const char* theFieldName)
+{
+ if(myFieldName == theFieldName)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myFieldName = theFieldName;
+ myParamsTime.Modified();
+}
+
+
+//----------------------------------------------------------------------------
+char*
+VISU::ColoredPrs3d_i
+::GetFieldName()
+{
+ return CORBA::string_dup(myFieldName.c_str());
+}
+
+
+//----------------------------------------------------------------------------
+std::string
+VISU::ColoredPrs3d_i
+::GetCFieldName() const
+{
+ return myFieldName;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::PField
+VISU::ColoredPrs3d_i
+::GetField()
+{
+ return myField;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetField(VISU::PField theField)
+{
+ myField = theField;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetTimeStampNumber(CORBA::Long theTimeStampNumber)
+{
+ if(myTimeStampNumber == theTimeStampNumber)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myTimeStampNumber = theTimeStampNumber;
+ myParamsTime.Modified();
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetTimeStampNumber()
+{
+ return myTimeStampNumber;
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetTimeStampNumberByIndex( CORBA::Long theIndex )
+{
+ VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange = GetTimeStampsRange();
+ CORBA::Long aLength = aTimeStampsRange->length();
+
+ if( theIndex >= 0 && theIndex < aLength )
+ {
+ VISU::ColoredPrs3dHolder::TimeStampInfo anInfo = aTimeStampsRange[ theIndex ];
+ return anInfo.myNumber;
+ }
+
+ return -1;
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetTimeStampIndexByNumber( CORBA::Long theNumber )
+{
+ VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange = GetTimeStampsRange();
+ CORBA::Long aLength = aTimeStampsRange->length();
+
+ for( int index = 0; index < aLength; index++ )
+ {
+ VISU::ColoredPrs3dHolder::TimeStampInfo anInfo = aTimeStampsRange[ index ];
+
+ if( anInfo.myNumber == theNumber )
+ return index;
+ }
+
+ return -1;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::PField
+VISU::ColoredPrs3d_i
+::GetScalarField()
+{
+ return myField;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::PMinMaxController
+VISU::ColoredPrs3d_i
+::GetMinMaxController()
+{
+ return myMinMaxController;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetMinMaxController( const VISU::PMinMaxController& theController )
+{
+ myMinMaxController = theController;
+
+ if(!IsRangeFixed())
+ SetSourceRange();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetMinMaxController( VISU::ColoredPrs3d_i* theOrigin )
+{
+ VISU::PMinMaxController aController = theOrigin->GetMinMaxController();
+
+ if ( aController )
+ aController->UpdateReference( theOrigin, this );
+
+ SetMinMaxController( aController );
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetScalarTimeStampNumber() const
+{
+ return myTimeStampNumber;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dHolder::TimeStampsRange*
+VISU::ColoredPrs3d_i
+::GetTimeStampsRange()
+{
+ VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange =
+ new VISU::ColoredPrs3dHolder::TimeStampsRange();
+ VISU::TValField& aValField = GetField()->myValField;
+ if(IsTimeStampFixed()){
+ aTimeStampsRange->length(1);
+ PValForTime& aValForTime = aValField[GetTimeStampNumber()];
+ std::string aTime = VISU_Convertor::GenerateName(aValForTime->myTime);
+ VISU::ColoredPrs3dHolder::TimeStampInfo anInfo;
+ anInfo.myNumber = GetTimeStampNumber();
+ anInfo.myTime = aTime.c_str();
+ aTimeStampsRange[0] = anInfo;
+ return aTimeStampsRange._retn();
+ }
+
+ // To exclude timstamps with repeated time
+ typedef std::map<std::string, long> TTimeStampsRange;
+ TTimeStampsRange aRange;
+ {
+ VISU::TValField::const_iterator anIter = aValField.begin();
+ for(; anIter != aValField.end(); anIter++){
+ vtkIdType aTimeStampNumber = anIter->first;
+ const PValForTime& aValForTime = anIter->second;
+ std::string aTime = VISU_Convertor::GenerateName(aValForTime->myTime);
+ aRange[aTime] = aTimeStampNumber;
+ }
+ }
+
+ // To sort timestamps according to their timestamp number
+ typedef std::map<long, std::string> TTimeStampsSortedRange;
+ TTimeStampsSortedRange aSortedRange;
+ {
+ TTimeStampsRange::const_iterator anIter = aRange.begin();
+ for(size_t aCounter = 0; anIter != aRange.end(); anIter++, aCounter++){
+ vtkIdType aTimeStampNumber = anIter->second;
+ const std::string& aTime = anIter->first;
+ aSortedRange[aTimeStampNumber] = aTime;
+ }
+ }
+
+ // To map the C++ data structures to the corresponding CORBA ones
+ {
+ aTimeStampsRange->length(aRange.size());
+ TTimeStampsSortedRange::const_iterator anIter = aSortedRange.begin();
+ for(size_t aCounter = 0; anIter != aSortedRange.end(); anIter++, aCounter++){
+ vtkIdType aTimeStampNumber = anIter->first;
+ const std::string& aTime = anIter->second;
+ VISU::ColoredPrs3dHolder::TimeStampInfo anInfo;
+ anInfo.myNumber = aTimeStampNumber;
+ anInfo.myTime = aTime.c_str();
+ aTimeStampsRange[aCounter] = anInfo;
+ }
+ }
+ return aTimeStampsRange._retn();
+}
+
+CORBA::Float
+VISU::ColoredPrs3d_i
+::GetMemorySize()
+{
+ return TSuperClass::GetMemorySize();
+}
+
+VISU::ColoredPrs3dHolder::BasicInput*
+VISU::ColoredPrs3d_i
+::GetBasicInput()
+{
+ VISU::ColoredPrs3dHolder::BasicInput* aBasicInput = new VISU::ColoredPrs3dHolder::BasicInput();
+ aBasicInput->myResult = GetResultObject();
+ aBasicInput->myMeshName = GetMeshName();
+ aBasicInput->myEntity = GetEntity();
+ aBasicInput->myFieldName = GetFieldName();
+ aBasicInput->myTimeStampNumber = GetTimeStampNumber();
+
+ return aBasicInput;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetHolderEntry(const std::string& theEntry)
+{
+ myHolderEntry = theEntry;
+}
+
+
+//----------------------------------------------------------------------------
+std::string
+VISU::ColoredPrs3d_i
+::GetHolderEntry()
+{
+ return myHolderEntry;
+}
+
+
+//----------------------------------------------------------------------------
+std::string
+VISU::ColoredPrs3d_i
+::GetActorEntry()
+{
+ if(myHolderEntry != "")
+ return myHolderEntry;
+ return TSuperClass::GetActorEntry();
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Boolean
+VISU::ColoredPrs3d_i
+::IsTimeStampFixed()
+{
+ return myIsTimeStampFixed;
+}
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3d_i::EPublishInStudyMode
+VISU::ColoredPrs3d_i
+::GetPublishInStudyMode()
+{
+ return myPublishInStudyMode;