From: apo Date: Tue, 6 Dec 2005 07:18:28 +0000 (+0000) Subject: To improve animation. X-Git-Tag: TG-D5-38-2003_D2005-20-12~62 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3e5f98c5a5cf2b6183f38ca0ea23a9423ddd66c2;p=modules%2Fvisu.git To improve animation. Now, SetupAnimation dialog does not change current type of presentation --- diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 4c848645..8d3703af 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -435,19 +435,22 @@ void ArrangeDlg::acceptViewWindow() //------------------------------------------------------------------------ //------------------------------------------------------------------------ //------------------------------------------------------------------------ -SetupDlg::SetupDlg (VisuGUI* theModule, VISU_TimeAnimation* theAnimator) - : QDialog(VISU::GetDesktop(theModule), "SetupDlg", true, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), - myModule(theModule) +SetupDlg::SetupDlg (QWidget* theParent, + VisuGUI* theModule, + VISU_TimeAnimation* theAnimator) : + QDialog(theParent, + "SetupDlg", + true, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myAnimator(theAnimator), + myModule(theModule) { setCaption("Setup Animation"); setSizeGripEnabled( TRUE ); - myAnimator = theAnimator; QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6); aMainLayout->setSpacing(5); - QFrame* aRangeGrp = new QFrame(this); QGridLayout* aRangeLayout = new QGridLayout( aRangeGrp ); aRangeLayout->setSpacing( 6 ); @@ -566,66 +569,73 @@ void SetupDlg::onFieldChange (int theIndex) { FieldData& aData = myAnimator->getFieldData(theIndex); myTypeCombo->clear(); + myTypeId2ComboId.clear(); myComboId2TypeId.clear(); // ATTENTION: append items in the same order like it is done in the PrsComboItem enumeration myTypeCombo->insertItem("Scalar Map"); // item 0 + myTypeId2ComboId[TSCALARMAP_ITEM] = myComboId2TypeId.size(); myComboId2TypeId.push_back(TSCALARMAP_ITEM);; myTypeCombo->insertItem("Iso Surfaces"); // item 1 + myTypeId2ComboId[TISOSURFACE_ITEM] = myComboId2TypeId.size(); myComboId2TypeId.push_back(TISOSURFACE_ITEM);; myTypeCombo->insertItem("Cut Planes"); // item 2 + myTypeId2ComboId[TCUTPLANES_ITEM] = myComboId2TypeId.size(); myComboId2TypeId.push_back(TCUTPLANES_ITEM);; myTypeCombo->insertItem("Plot 3D"); // item 3 + myTypeId2ComboId[TPLOT3D_ITEM] = myComboId2TypeId.size(); myComboId2TypeId.push_back(TPLOT3D_ITEM);; _PTR(SObject) aSObject = aData.myField; long aNumComp = VISU::getValue(aSObject, "myNumComponent").toLong(); if (aNumComp > 1) { myTypeCombo->insertItem("Deformed Shape"); // item 4 + myTypeId2ComboId[TDEFORMEDSHAPE_ITEM] = myComboId2TypeId.size(); myComboId2TypeId.push_back(TDEFORMEDSHAPE_ITEM);; myTypeCombo->insertItem("Vectors"); // item 5 + myTypeId2ComboId[TVECTORS_ITEM] = myComboId2TypeId.size(); myComboId2TypeId.push_back(TVECTORS_ITEM);; myTypeCombo->insertItem("Stream Lines"); // item 6 + myTypeId2ComboId[TSTREAMLINES_ITEM] = myComboId2TypeId.size(); myComboId2TypeId.push_back(TSTREAMLINES_ITEM);; } long anEntityId = VISU::getValue(aSObject, "myEntityId").toLong(); if(anEntityId == VISU::CELL){ myTypeCombo->insertItem("Gauss Points"); // item 7 + myTypeId2ComboId[TGAUSSPOINTS_ITEM] = myComboId2TypeId.size(); myComboId2TypeId.push_back(TGAUSSPOINTS_ITEM);; } switch (aData.myPrsType) { case VISU::TSCALARMAP: //Scalar Map - myTypeCombo->setCurrentItem(TSCALARMAP_ITEM); + myTypeCombo->setCurrentItem(myTypeId2ComboId[TSCALARMAP_ITEM]); break; case VISU::TISOSURFACE: //Iso Surfaces - myTypeCombo->setCurrentItem(TISOSURFACE_ITEM); + myTypeCombo->setCurrentItem(myTypeId2ComboId[TISOSURFACE_ITEM]); break; case VISU::TCUTPLANES: //Cut Planes - myTypeCombo->setCurrentItem(TCUTPLANES_ITEM); + myTypeCombo->setCurrentItem(myTypeId2ComboId[TCUTPLANES_ITEM]); break; case VISU::TPLOT3D: //Plot 3D - myTypeCombo->setCurrentItem(TPLOT3D_ITEM); + myTypeCombo->setCurrentItem(myTypeId2ComboId[TPLOT3D_ITEM]); break; case VISU::TDEFORMEDSHAPE: //Deformed Shape - myTypeCombo->setCurrentItem(TDEFORMEDSHAPE_ITEM); + myTypeCombo->setCurrentItem(myTypeId2ComboId[TDEFORMEDSHAPE_ITEM]); break; case VISU::TVECTORS: //Vectors - myTypeCombo->setCurrentItem(TVECTORS_ITEM); + myTypeCombo->setCurrentItem(myTypeId2ComboId[TVECTORS_ITEM]); break; case VISU::TSTREAMLINES: //Stream Lines - myTypeCombo->setCurrentItem(TSTREAMLINES_ITEM); - aData.myPrsType = VISU::TSTREAMLINES; + myTypeCombo->setCurrentItem(myTypeId2ComboId[TSTREAMLINES_ITEM]); break; case VISU::TGAUSSPOINTS: //Gauss Points - myTypeCombo->setCurrentItem(TGAUSSPOINTS_ITEM); - aData.myPrsType = VISU::TGAUSSPOINTS; + myTypeCombo->setCurrentItem(myTypeId2ComboId[TGAUSSPOINTS_ITEM]); break; } //myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP); @@ -891,11 +901,14 @@ static const char * pauseIco[] = { static QPixmap MYpausePixmap(pauseIco); -VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Study) theStudy) - : QDialog(VISU::GetDesktop(theModule), "VisuGUI_TimeAnimationDlg", false, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), - myModule(theModule), - myStudy(theStudy) +VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Study) theStudy) : + QDialog(VISU::GetDesktop(theModule), + "VisuGUI_TimeAnimationDlg", + false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), + myModule(theModule), + myStudy(theStudy), + mySetupDlg(NULL) { setCaption("Animation"); setSizeGripEnabled( TRUE ); @@ -1172,6 +1185,12 @@ void VisuGUI_TimeAnimationDlg::clearView() myAnimator->clearView(); } +//------------------------------------------------------------------------ +void VisuGUI_TimeAnimationDlg::showEvent(QShowEvent* theEvent) +{ + mySetupDlg = new SetupDlg(this,myModule, myAnimator); +} + //------------------------------------------------------------------------ void VisuGUI_TimeAnimationDlg::closeEvent (QCloseEvent* theEvent) { @@ -1218,11 +1237,10 @@ void VisuGUI_TimeAnimationDlg::onExecution (long theNewFrame, double theTime) //------------------------------------------------------------------------ void VisuGUI_TimeAnimationDlg::onSetupDlg() { - if (myAnimator->getNbFrames() > 0) myAnimator->firstFrame(); - SetupDlg* aDlg = new SetupDlg (myModule, myAnimator); - aDlg->exec(); + if (myAnimator->getNbFrames() > 0) + myAnimator->firstFrame(); + mySetupDlg->exec(); myPlayFrame->setEnabled(false); - delete aDlg; } //------------------------------------------------------------------------ diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.h b/src/VISUGUI/VisuGUI_TimeAnimation.h index eba6c928..cfb3401e 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.h +++ b/src/VISUGUI/VisuGUI_TimeAnimation.h @@ -90,7 +90,9 @@ class SetupDlg: public QDialog { Q_OBJECT public: - SetupDlg(VisuGUI* theModule, VISU_TimeAnimation* theAnimator); + SetupDlg(QWidget* theParent, + VisuGUI* theModule, + VISU_TimeAnimation* theAnimator); ~SetupDlg() {}; private slots: @@ -110,6 +112,7 @@ class SetupDlg: public QDialog { QListBox* myFieldLst; QComboBox* myTypeCombo; std::vector myComboId2TypeId; + std::map myTypeId2ComboId; QPushButton* myPropBtn; QPushButton* myArrangeBtn; @@ -133,6 +136,7 @@ class VisuGUI_TimeAnimationDlg: public QDialog protected: virtual void closeEvent(QCloseEvent* theEvent); + virtual void showEvent(QShowEvent* theEvent); void stopAnimation(); private slots: @@ -162,6 +166,7 @@ class VisuGUI_TimeAnimationDlg: public QDialog QPushButton* myGenBtn; QFrame* myPlayFrame; + SetupDlg* mySetupDlg; _PTR(Study) myStudy; VisuGUI* myModule;