From 2f873f08e131dae380629a162b6d3f7d1fea2990 Mon Sep 17 00:00:00 2001 From: enk Date: Tue, 14 Feb 2006 12:30:35 +0000 Subject: [PATCH] Fix for Bug IPAL11503: CRASH after trying to "Show..." animation, based on "Scalar map on Deformad shape". --- .../VisuGUI_ScalarMapOnDeformedShapeDlg.cxx | 43 +++++++++++++++++-- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc | 5 ++- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx index ccb1c573..5089932d 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx @@ -171,10 +171,45 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject (VISU::ScalarMapOnDe Handle(SALOME_InteractiveObject) aIO = selected.First(); if (aIO->hasEntry()) { _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry()); - aSObject = aSObject->GetFather(); - aSObject = aSObject->GetFather(); - aSObject = aSObject->GetFather(); - aSObject = aSObject->GetFather(); + _PTR(GenericAttribute) anTmpAttr; + if(aSObject->FindAttribute(anTmpAttr, "AttributeComment")){ + _PTR(AttributeComment) aTmpComment (anTmpAttr); + string aTmpComm = aTmpComment->Value(); + QString aTmpstrIn (aTmpComm.c_str()); + VISU::Storable::TRestoringMap aTmpaMap; + VISU::Storable::StrToMap(aTmpstrIn,aTmpaMap); + bool aTmpisExist; + VISU::VISUType aTmpType = (VISU::VISUType)VISU::Storable::FindValue(aTmpaMap,"myType",&aTmpisExist).toInt(); + switch(aTmpType){ + case VISU::TTIMESTAMP: + { + aSObject = aSObject->GetFather(); + aSObject = aSObject->GetFather(); + break; + } + case VISU::TFIELD: + { + _PTR(SObject) newSObject; + if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject; + aSObject = aSObject->GetFather(); + break; + } + case VISU::TANIMATION: + { + _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject); + for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) { + _PTR(SObject) aTmpChildSObj = aTmpIter->Value(); + _PTR(SObject) newSObject; + if(aTmpChildSObj->ReferencedObject(newSObject)){ + aSObject = newSObject; + aSObject->GetFather(); + break; + } + } + break; + } + } + } mySelectionObj = aSObject; CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj); VISU::Result_var aResult; diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc index 9b8868e3..75430d90 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc @@ -161,15 +161,18 @@ void VISU::ScalarMapOnDeformedShape_i ::SameAs(const Prs3d_i* theOrigin) { + int theScalarIter = GetScalarIteration(); + TSuperClass::SameAs(theOrigin); if(const ScalarMapOnDeformedShape_i* aPrs3d = dynamic_cast(theOrigin)){ ScalarMapOnDeformedShape_i* anOrigin = const_cast(aPrs3d); // increment the scalar iteration for using in VISU_TimeAnimation class implementation. + int anOriginScalarIter = anOrigin->GetScalarIteration(); this->SetScalarField(anOrigin->GetScalarMeshName().c_str(), anOrigin->GetScalarFieldName().c_str(), - anOrigin->GetScalarIteration() + 1, + theScalarIter, anOrigin->GetScalarEntity()); Update(); } -- 2.39.2