1. Animation::addField(...) method returns now a boolean value.
2. All checks for compatibility of several animated fields
(according to time stamps number) were moved from
VisuGUI::OnTimeAnimation() slot to addField(...) method
of implementation.
/*! Defines the field which will be used as a base for generation of the animation.
* \param theObject The %SObject corresponding to the field.
*/
- void addField(in SALOMEDS::SObject theObject);
+ boolean addField(in SALOMEDS::SObject theObject);
/*! Generates presentations on the basis of the field.
* \param theFieldNum The number of the field, which will be used
msgid "ERR_CANT_CREATE_ACTOR"
msgstr "Can't create actor for this presentation"
+msgid "ERR_CANT_CREATE_ANIMATION"
+msgstr "Can't create animation for these fields:\n number of time stamps is not the same!"
+
# Preferences for VISU module (VisuGUI.cxx)
msgid "VISU_SCALAR_BAR"
SALOME_ListIO aListIO;
aSelectionMgr->selectedObjects(aListIO);
- bool isDefined = false;
- long aNbTimes = 0;
SALOME_ListIteratorOfListIO It (aListIO);
for (; It.More(); It.Next()) {
_PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
- if (!aSObject) continue;
- if (getValue(aSObject, "myComment") == QString("FIELD")) {
- long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
- if (aNumber > 1) {
- if (!isDefined) {
- aNbTimes = aNumber;
- aAnimationDlg->addField(aSObject);
- isDefined = true;
- } else if (aNbTimes == aNumber) {
- aAnimationDlg->addField(aSObject);
- }
- }
+ if ( !aAnimationDlg->addField(aSObject) ) {
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_CANT_CREATE_ANIMATION"),
+ tr("BUT_OK"));
+ delete aAnimationDlg;
+ return;
}
}
- if (isDefined) aAnimationDlg->show();
- else delete aAnimationDlg;
+ aAnimationDlg->show();
}
//************************************************************************
}
//------------------------------------------------------------------------
-void VisuGUI_TimeAnimationDlg::addField (_PTR(SObject) theSObject)
+bool VisuGUI_TimeAnimationDlg::addField (_PTR(SObject) theSObject)
{
myPlayFrame->setEnabled(false);
- myAnimator->addField(theSObject);
+ return myAnimator->addField(theSObject);
}
//------------------------------------------------------------------------
VisuGUI_TimeAnimationDlg(VisuGUI* theModule, _PTR(Study) theStudy);
~VisuGUI_TimeAnimationDlg();
- void addField(_PTR(SObject) theField);
+ bool addField(_PTR(SObject) theField);
void clearView();
void restoreFromStudy(_PTR(SObject) theAnimation);
//------------------------------------------------------------------------
-void VISU_TimeAnimation::addField (_PTR(SObject) theField)
+bool VISU_TimeAnimation::addField (_PTR(SObject) theField)
{
+ if (!theField) return false;
+
FieldData aNewData;
aNewData.myField = theField;
aNewData.myNbFrames = 0;
aNewData.myPrsType = VISU::TSCALARMAP;
aNewData.myOffset[0] = aNewData.myOffset[1] = aNewData.myOffset[2] = 0;
VISU::Storable::TRestoringMap aMap = getMapOfValue(aNewData.myField);
+ if(VISU::Storable::FindValue(aMap,"myComment") != QString("FIELD"))
+ return false;
+
aNewData.myNbTimes = VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
+ if ( aNewData.myNbTimes < 2 )
+ return false;
+
+ if ( !myFieldsLst.isEmpty() && myFieldsLst.first().myNbTimes != aNewData.myNbTimes )
+ return false;
+
myFieldsLst.append(aNewData);
//find Min/Max timestamps
myTimeMax = getTimeValue(anIter->Value());
}
}
+
+ return true;
}
//------------------------------------------------------------------------
-void VISU_TimeAnimation::addField (SALOMEDS::SObject_ptr theField)
+bool VISU_TimeAnimation::addField (SALOMEDS::SObject_ptr theField)
{
SALOMEDS::SObject_var theFieldDup = SALOMEDS::SObject::_duplicate(theField);
_PTR(SObject) aField = VISU::GetClientSObject(theFieldDup, myStudy);
- addField(aField);
+ return addField(aField);
}
delete myAnim;
}
-void VISU_TimeAnimation_i::addField (SALOMEDS::SObject_ptr theField)
+bool VISU_TimeAnimation_i::addField (SALOMEDS::SObject_ptr theField)
{
- myAnim->addField(theField);
+ return myAnim->addField(theField);
}
CORBA::Boolean VISU_TimeAnimation_i::generateFrames()
virtual VISU::VISUType GetType() { return VISU::TNONE;};
- void addField (_PTR(SObject) theField);
- void addField (SALOMEDS::SObject_ptr theField);
+ bool addField (_PTR(SObject) theField);
+ bool addField (SALOMEDS::SObject_ptr theField);
FieldData& getFieldData (int theNum) { return myFieldsLst[theNum]; }
CORBA::Boolean generateFrames();
virtual VISU::VISUType GetType() { return VISU::TANIMATION; }
//virtual VISU::VISUType GetType() { return VISU::TNONE; }
- virtual void addField(SALOMEDS::SObject_ptr theField);
+ virtual bool addField(SALOMEDS::SObject_ptr theField);
virtual CORBA::Boolean generateFrames();
virtual void generatePresentations(CORBA::Long theFieldNum);