From 42189b3e2ca84138399908d39950731733c15839 Mon Sep 17 00:00:00 2001 From: srn Date: Mon, 12 Feb 2007 14:50:38 +0000 Subject: [PATCH] Added possibility to restore Animations --- src/VISU_I/VISU_DumpPython.cc | 107 ++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index 0806825c..9b5af88c 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -1311,6 +1311,92 @@ namespace VISU } } + //=========================================================================== + void + DumpAnimationsToPython(SALOMEDS::Study_ptr theStudy, + CORBA::Boolean theIsPublished, + CORBA::Boolean& theIsValidScript, + SALOMEDS::SObject_ptr theSObject, + std::ostream& theStr, + std::string thePrefix) + { + + if(!theIsPublished) return; + + SALOMEDS::ChildIterator_var aChildItet = theStudy->NewChildIterator(theSObject); + for(aChildItet->InitEx(false); aChildItet->More(); aChildItet->Next()){ + SALOMEDS::SObject_var aSObject = aChildItet->Value(); + + SALOMEDS::GenericAttribute_var anAttr; + if (!aSObject->FindAttribute(anAttr, "AttributeString")) continue; + + SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); + QString value (aStringAttr->Value()); + if(value.isEmpty()) continue; + + VISU::Storable::TRestoringMap aMap; + VISU::Storable::StrToMap(value, aMap); + bool isExist; + + QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&isExist); + if(!isExist || aTypeName != "ANIMATION") continue; + + //ANIMATION + theStr<GetName(); + theStr<NewChildIterator(aSObject); + for (anIter->Init(); anIter->More(); anIter->Next()) { + SALOMEDS::SObject_var anObj = anIter->Value(); + + //FIELD + theStr<FindAttribute(anAttr, "AttributeString")) { + aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); + theStr<Value()<<"')"<< endl; + } + + SALOMEDS::SObject_var refObj; + if(anObj->ReferencedObject(refObj)) { + SALOMEDS::SObject_var father = refObj->GetFather(); + value = refObj->GetName(); + QString path(theStudy->GetObjectPath(father)); + //The following code requierd as a field name can contain '/' character + theStr<GetName(); + if(!value.isEmpty()) theStr<NewChildIterator(anObj); + for (aSubIter->Init(); aSubIter->More(); aSubIter->Next()) { + SALOMEDS::SObject_var aSubObj = aSubIter->Value(); + + theStr<GetName(); + if(!value.isEmpty()) theStr<FindAttribute(anAttr, "AttributeString")) { + aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); + theStr<Value()<<"')"<< endl; + } + } + + } + + } + + theStr<