if (!CORBA::is_nil(theView3D)) {
VISU::View3D_i* pView = dynamic_cast<VISU::View3D_i*>(GetServant(theView3D).in());
- //QAD_StudyFrame* aStudyFrame = pView->GetStudyFrame();
- //myView = VISU::GetViewFrame(aStudyFrame);
- SUIT_ViewWindow* aVW = pView->myViewWindow;
+ SUIT_ViewWindow* aVW = pView->GetViewWindow();
myView = VISU::GetViewWindow(aVW);
}
//************************************************************************
void VISU_TimeAnimation::addField (SALOMEDS::SObject_ptr theField)
{
- FieldData aNewData;
- _PTR(SObject) aField = VISU::GetClientSObject(theField, myStudy);
- aNewData.myField = aField;
- aNewData.myNbFrames = 0;
- aNewData.myPrsType = VISU::TSCALARMAP;
- VISU::Storable::TRestoringMap aMap = getMapOfValue(aNewData.myField);
- aNewData.myNbTimes = VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
- myFieldsLst.append(aNewData);
-
- //find Min/Max timestamps
- if ((myTimeMin == 0) && (myTimeMax == 0)) {
- _PTR(ChildIterator) anIter = myStudy->NewChildIterator(aField);
- anIter->Next(); // First is reference on support
- myTimeMin = getTimeValue(anIter->Value());
- for(; anIter->More(); anIter->Next()) {
- myTimeMax = getTimeValue(anIter->Value());
- }
- }
+ SALOMEDS::SObject_var theFieldDup = SALOMEDS::SObject::_duplicate(theField);
+ _PTR(SObject) aField = VISU::GetClientSObject(theFieldDup, myStudy);
+ addField(aField);
}
}
break;
- case VISU::TPLOT3D: // Cut Planes
+ case VISU::TPLOT3D: // Plot3d
{
VISU::Plot3D_i* aPresent = new VISU::Plot3D_i (pResult, false);
aPresent->Create(aMeshName.latin1(), anEntity,
i++;
}
aData.myNbFrames = i;
- QString aFixRange = VISU::GetResourceMgr()->stringValue("Visu:SBImposeRange");
- if (aFixRange.compare("true") != 0) {
+
+ int rangeType = VISU::GetResourceMgr()->integerValue("VISU" , "scalar_range_type", 0);
+ if ( rangeType != 1 ) {
for (i = 0; i < aData.myNbFrames; i++) {
aData.myPrs[i]->SetRange(aMin, aMax);
aData.myPrs[i]->SetOffset(aData.myOffset);
}
myView->Repaint(false);
- int delay = 100;
if (isDumping) {
+ // We must unlock mutex for some time before grabbing to allow view updating
+ qApp->unlock();
+ msleep(100);
+ qApp->lock();
+
QPixmap px = QPixmap::grabWindow(myView->winId());
QString aFile(myDumpPath);
QString aName = QString("%1").arg(myFieldsLst[0].myTiming[myFrame]);
myFieldsLst[0].myTiming[myFrame]) / aOneVal;
}
}
- delay = (int)(1000. * k / mySpeed);
+ int delay = (int)(1000. * k / mySpeed);
+ qApp->unlock();
+ msleep(delay);
+ qApp->lock();
}
- qApp->unlock();
- msleep(delay);
- qApp->lock();
if (!myIsActive) break;
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()) {
- 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);
+ generatePresentations(i);
}
+ 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);
+ _PTR(SObject) aAnimSObject = myStudy->FindObjectID(myAnimEntry.latin1());
if (!aAnimSObject) return;
_PTR(StudyBuilder) aStudyBuilder = myStudy->NewBuilder();
_PTR(GenericAttribute) anAttr;
anAttr = aStudyBuilder->FindOrCreateAttribute(aAnimSObject, "AttributeComment");
_PTR(AttributeComment) aCmnt (anAttr);
- aCmnt->SetValue(aComment);
+ 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");
}
aData.myPrs[0]->GetOffset(aData.myOffset);
for (int i = 1; i < aData.myNbFrames; i++) {
- aData.myPrs[i]->SameAs(aData.myPrs[0]);
+ //jfa 03.08.2005:aData.myPrs[i]->SameAs(aData.myPrs[0]);
+ aData.myPrs[i]->SameAsParams(aData.myPrs[0]);//jfa 03.08.2005
}
}
string aStr = aAnimSObject->GetID();