From: mkr Date: Wed, 25 Oct 2006 07:56:29 +0000 (+0000) Subject: Modifications, which are concern to bug PAL11537: X-Git-Tag: V3_2_3pre1~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=67bbb3c080660c9dc3fc3b0de556af554bf48809;p=modules%2Fvisu.git Modifications, which are concern to bug PAL11537: 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. --- diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index a0396431..2c18149d 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -1156,7 +1156,7 @@ module VISU { /*! 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 diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index bc56f444..13fc8200 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -52,6 +52,9 @@ msgstr "The object can't be built" 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" diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index a0b3895a..7d94a704 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -1655,27 +1655,19 @@ OnTimeAnimation() 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(); } //************************************************************************ diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 5345c71c..dd50ee2d 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -1248,10 +1248,10 @@ void VisuGUI_TimeAnimationDlg::onTypeChange (int index) } //------------------------------------------------------------------------ -void VisuGUI_TimeAnimationDlg::addField (_PTR(SObject) theSObject) +bool VisuGUI_TimeAnimationDlg::addField (_PTR(SObject) theSObject) { myPlayFrame->setEnabled(false); - myAnimator->addField(theSObject); + return myAnimator->addField(theSObject); } //------------------------------------------------------------------------ diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.h b/src/VISUGUI/VisuGUI_TimeAnimation.h index 604cd24b..6caff7f6 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.h +++ b/src/VISUGUI/VisuGUI_TimeAnimation.h @@ -146,7 +146,7 @@ class VisuGUI_TimeAnimationDlg: public QDialog 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); diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index a34e2052..fa85ef87 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -145,15 +145,26 @@ VISU_TimeAnimation::~VISU_TimeAnimation() //------------------------------------------------------------------------ -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 @@ -165,14 +176,16 @@ void VISU_TimeAnimation::addField (_PTR(SObject) theField) 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); } @@ -1294,9 +1307,9 @@ VISU_TimeAnimation_i::~VISU_TimeAnimation_i() 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() diff --git a/src/VISU_I/VISU_TimeAnimation.h b/src/VISU_I/VISU_TimeAnimation.h index 0c99f7e8..e4554843 100644 --- a/src/VISU_I/VISU_TimeAnimation.h +++ b/src/VISU_I/VISU_TimeAnimation.h @@ -88,8 +88,8 @@ class VISU_TimeAnimation: public QObject, public QThread 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(); @@ -209,7 +209,7 @@ public: 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);