]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug IPAL11503:
authorenk <enk@opencascade.com>
Tue, 14 Feb 2006 12:30:35 +0000 (12:30 +0000)
committerenk <enk@opencascade.com>
Tue, 14 Feb 2006 12:30:35 +0000 (12:30 +0000)
CRASH after trying to "Show..." animation, based on "Scalar map on Deformad shape".

src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx
src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc

index ccb1c5737824a1ab136e4e6811ed7e57ab10e5f0..5089932d8b6edef6a7e5dc58b1ca48f85ed154b4 100644 (file)
@@ -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;
index 9b8868e34f352262ec469a5c9453892e8edd94bb..75430d9088eae6e4dabb2d549b29715d04e849d7 100644 (file)
@@ -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<const ScalarMapOnDeformedShape_i*>(theOrigin)){
     ScalarMapOnDeformedShape_i* anOrigin = const_cast<ScalarMapOnDeformedShape_i*>(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();
   }