for (int i = 0; i < getNbFields(); i++) {
FieldData& aData = myFieldsLst[i];
+
_PTR(SObject) newObj = aStudyBuilder->NewObject(aAnimSObject);
aStudyBuilder->Addreference(newObj, aData.myField);
+
if (aData.myPrs.empty()) {
generatePresentations(i);
- //VISU::CreateAttributes(myStudy, newObj->GetID().c_str(),"","",
- // GetPresentationComment(aData.myPrsType).c_str(),"","",true);
- }// else {
- ostringstream strOut;
- aData.myPrs[0]->ToStream(strOut);
- string aPrsComment = strOut.str();
- VISU::CreateAttributes(myStudy, newObj->GetID().c_str(),"","",
- aData.myPrs[0]->GetComment(),"",aPrsComment.c_str(),true);
- //}
+ }
+ ostringstream strOut;
+ aData.myPrs[0]->ToStream(strOut);
+ string aPrsComment = strOut.str();
+ VISU::CreateAttributes(myStudy, newObj->GetID().c_str(),"","",
+ aData.myPrs[0]->GetComment(),"",aPrsComment.c_str(),true);
}
aStudyBuilder->CommitCommand();
//************************************************************************
void VISU_TimeAnimation::saveAnimation()
{
- if (myStudy->GetProperties()->IsLocked()) return;
+ if (myStudy->GetProperties()->IsLocked()) return;
if (myAnimEntry.isEmpty()) return;
_PTR(SObject) aAnimSObject = myStudy->FindObjectID(myAnimEntry.latin1());
aCmnt->SetValue(aComment.latin1());
_PTR(ChildIterator) anIter = myStudy->NewChildIterator(aAnimSObject);
- int i;
- for (i = 0, anIter->Init(); anIter->More(); anIter->Next(), i++) {
+ int i = 0, nbf = getNbFields();
+ for (anIter->Init(); anIter->More(); anIter->Next(), i++) {
+ if (i >= nbf) break; // it must not be
FieldData& aData = myFieldsLst[i];
+ // Get presentation name and comment
+ if (aData.myPrs.empty()) {
+ generatePresentations(i);
+ }
+ ostringstream strOut;
+ aData.myPrs[0]->ToStream(strOut);
+ string aPrsComment = strOut.str();
+ string aPrsNameTxt = aData.myPrs[0]->GetComment();
+
+ // Save in study
_PTR(SObject) aRefObj = anIter->Value();
_PTR(ChildIterator) anPrsIter = myStudy->NewChildIterator(aRefObj);
anPrsIter->Init();
- string aPrsComment, aPrsNameTxt;
- if (aData.myPrs.empty()) {
- aPrsComment = "";
- aPrsNameTxt = GetPresentationComment(aData.myPrsType);
- } else {
- ostringstream strOut;
- aData.myPrs[0]->ToStream(strOut);
- aPrsComment = strOut.str();
-
- aPrsNameTxt = aData.myPrs[0]->GetComment();
- }
-
if (anPrsIter->More()) {
_PTR(SObject) aPrsObj = anPrsIter->Value();
anAttr = aStudyBuilder->FindOrCreateAttribute(aPrsObj, "AttributeComment");