From 229a43f21939163c9ddb9c0e1ff2fc5c58adbd7e Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 18 Jul 2005 14:09:32 +0000 Subject: [PATCH] IPAL8941: enable Animation with Plot3D --- src/VISUGUI/VisuGUI.cxx | 2 +- src/VISUGUI/VisuGUI_TimeAnimation.cxx | 75 +++++++++++++++++---------- src/VISU_I/VISU_TimeAnimation.cxx | 18 +++++++ 3 files changed, 68 insertions(+), 27 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 81ae90a2..13b4a38a 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -2481,11 +2481,11 @@ createPopupMenus() mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true ); mgr->setRule( action( VISU_CUT_PLANES ), aRule, true ); mgr->setRule( action( VISU_CUT_LINES ), aRule, true ); + mgr->setRule( action( VISU_PLOT_3D ), aRule, true ); aRule += " and nbComponents>1"; mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true ); mgr->setRule( action( VISU_VECTORS ), aRule, true ); mgr->setRule( action( VISU_STREAM_LINES ), aRule, true ); - mgr->setRule( action( VISU_PLOT_3D ), aRule, true ); // table commands aRule = aSel_One_ObjBr + " and type='VISU::TTABLE'"; diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index b2d43a52..cfb7e796 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -14,6 +14,7 @@ #include "VisuGUI_Tools.h" #include "VisuGUI_DeformedShapeDlg.h" #include "VisuGUI_CutPlanesDlg.h" +#include "VisuGUI_Plot3DDlg.h" #include "VisuGUI_VectorsDlg.h" #include "VisuGUI_IsoSurfacesDlg.h" #include "VisuGUI_StreamLinesDlg.h" @@ -24,6 +25,7 @@ #include "VISU_IsoSurfaces_i.hh" #include "VISU_DeformedShape_i.hh" #include "VISU_CutPlanes_i.hh" +#include "VISU_Plot3D_i.hh" #include "VISU_CutLines_i.hh" #include "VISU_Vectors_i.hh" #include "VISU_StreamLines_i.hh" @@ -58,7 +60,6 @@ #define MAXVAL 1e10 - ArrangeDlg::ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator) : QDialog(theParent, "ArrangeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myAnimator(theAnimator), myViewWindow(theAnimator->getViewer()) @@ -484,40 +485,56 @@ SetupDlg::SetupDlg (QWidget* theParent, VISU_TimeAnimation* theAnimator) aMainLayout->addWidget(aBtnBox); } +//************************************************************************ +enum PrsComboItem { + TSCALARMAP_ITEM = 0, // VISU::TSCALARMAP + TISOSURFACE_ITEM = 1, // VISU::TISOSURFACE + TCUTPLANES_ITEM = 2, // VISU::TCUTPLANES + TPLOT3D_ITEM = 3, // VISU::TPLOT3D + TDEFORMEDSHAPE_ITEM = 4, // VISU::TDEFORMEDSHAPE + TVECTORS_ITEM = 5, // VISU::TVECTORS + TSTREAMLINES_ITEM = 6 // VISU::TSTREAMLINES +}; + //************************************************************************ void SetupDlg::onFieldChange (int theIndex) { FieldData& aData = myAnimator->getFieldData(theIndex); myTypeCombo->clear(); - myTypeCombo->insertItem("Scalar Map"); - myTypeCombo->insertItem("Iso Surfaces"); - myTypeCombo->insertItem("Cut Planes"); + // ATTENTION: append items in the same order like it is done in the PrsComboItem enumeration + myTypeCombo->insertItem("Scalar Map"); // item 0 + myTypeCombo->insertItem("Iso Surfaces"); // item 1 + myTypeCombo->insertItem("Cut Planes"); // item 2 + myTypeCombo->insertItem("Plot 3D"); // item 3 _PTR(SObject) aSObject = aData.myField; long aNumComp = VISU::getValue(aSObject, "myNumComponent").toLong(); if (aNumComp > 1) { - myTypeCombo->insertItem("Deformed Shape"); - myTypeCombo->insertItem("Vectors"); - myTypeCombo->insertItem("Stream Lines"); + myTypeCombo->insertItem("Deformed Shape"); // item 4 + myTypeCombo->insertItem("Vectors"); // item 5 + myTypeCombo->insertItem("Stream Lines"); // item 6 } switch (aData.myPrsType) { case VISU::TSCALARMAP: //Scalar Map - myTypeCombo->setCurrentItem(0); + myTypeCombo->setCurrentItem(TSCALARMAP_ITEM); break; case VISU::TISOSURFACE: //Iso Surfaces - myTypeCombo->setCurrentItem(1); + myTypeCombo->setCurrentItem(TISOSURFACE_ITEM); break; case VISU::TCUTPLANES: //Cut Planes - myTypeCombo->setCurrentItem(2); + myTypeCombo->setCurrentItem(TCUTPLANES_ITEM); + break; + case VISU::TPLOT3D: //Plot 3D + myTypeCombo->setCurrentItem(TPLOT3D_ITEM); break; case VISU::TDEFORMEDSHAPE: //Deformed Shape - myTypeCombo->setCurrentItem(3); + myTypeCombo->setCurrentItem(TDEFORMEDSHAPE_ITEM); break; case VISU::TVECTORS: //Vectors - myTypeCombo->setCurrentItem(4); + myTypeCombo->setCurrentItem(TVECTORS_ITEM); break; case VISU::TSTREAMLINES: //Stream Lines - myTypeCombo->setCurrentItem(5); + myTypeCombo->setCurrentItem(TSTREAMLINES_ITEM); aData.myPrsType = VISU::TSTREAMLINES; break; } @@ -529,22 +546,25 @@ void SetupDlg::onTypeChanged (int theIndex) { FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem()); switch (theIndex) { - case 0: //Scalar Map + case TSCALARMAP_ITEM: //Scalar Map aData.myPrsType = VISU::TSCALARMAP; break; - case 1: //Iso Surfaces + case TISOSURFACE_ITEM: //Iso Surfaces aData.myPrsType = VISU::TISOSURFACE; break; - case 2: //Cut Planes + case TCUTPLANES_ITEM: //Cut Planes aData.myPrsType = VISU::TCUTPLANES; break; - case 3: //Deformed Shape + case TPLOT3D_ITEM: //Plot 3D + aData.myPrsType = VISU::TPLOT3D; + break; + case TDEFORMEDSHAPE_ITEM: //Deformed Shape aData.myPrsType = VISU::TDEFORMEDSHAPE; break; - case 4: //Vectors + case TVECTORS_ITEM: //Vectors aData.myPrsType = VISU::TVECTORS; break; - case 5: //Stream Lines + case TSTREAMLINES_ITEM: //Stream Lines aData.myPrsType = VISU::TSTREAMLINES; break; } @@ -603,15 +623,15 @@ void SetupDlg::onPreferencesDlg() delete aDlg;} switch (myTypeCombo->currentItem()) { - case 0: //Scalar Map + case TSCALARMAP_ITEM: //Scalar Map c.suspend(); EDITPRS(VISU::ScalarMap_i, VisuGUI_ScalarBarDlg); break; - case 1: //Iso Surfaces + case TISOSURFACE_ITEM: //Iso Surfaces c.suspend(); EDITPRS(VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg); break; - case 2: //Cut Planes + case TCUTPLANES_ITEM: //Cut Planes // EDITPRS(VISU::CutPlanes_i, VisuGUI_CutPlanesDlg); { c.suspend(); @@ -627,21 +647,24 @@ void SetupDlg::onPreferencesDlg() delete aDlg; } break; - case 3: //Deformed Shape + case TPLOT3D_ITEM: //Plot 3D + c.suspend(); + EDITPRS(VISU::Plot3D_i, VisuGUI_Plot3DDlg); + break; + case TDEFORMEDSHAPE_ITEM: //Deformed Shape c.suspend(); EDITPRS(VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg); break; - case 4: //Vectors + case TVECTORS_ITEM: //Vectors c.suspend(); EDITPRS(VISU::Vectors_i, VisuGUI_VectorsDlg); break; - case 5: //Stream Lines + case TSTREAMLINES_ITEM: //Stream Lines c.suspend(); EDITPRS(VISU::StreamLines_i, VisuGUI_StreamLinesDlg); break; } #undef EDITPRS - } diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index b9f713c2..b074f5f1 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -17,6 +17,7 @@ #include "VISU_IsoSurfaces_i.hh" #include "VISU_DeformedShape_i.hh" #include "VISU_CutPlanes_i.hh" +#include "VISU_Plot3D_i.hh" #include "VISU_CutLines_i.hh" #include "VISU_Vectors_i.hh" #include "VISU_StreamLines_i.hh" @@ -230,6 +231,15 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) { } break; + case VISU::TPLOT3D: // Cut Planes + { + VISU::Plot3D_i* aPresent = new VISU::Plot3D_i (pResult, false); + aPresent->Create(aMeshName.latin1(), anEntity, + aFieldName.latin1(), aTimeStampId); + aData.myPrs[i] = aPresent; + } + break; + case VISU::TDEFORMEDSHAPE: // Deformed Shape { VISU::DeformedShape_i* aPresent = new VISU::DeformedShape_i(pResult, false); @@ -262,6 +272,9 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) { aData.myPrs[i] = aPresent; } break; + default: + MESSAGE("Not implemented for this presentation type: " << aData.myPrsType); + return; } if (aData.myPrs[i]->GetMin() < aMin) aMin = aData.myPrs[i]->GetMin(); if (aData.myPrs[i]->GetMax() > aMax) aMax = aData.myPrs[i]->GetMax(); @@ -621,6 +634,9 @@ std::string GetPresentationComment (VISU::VISUType thePrsType) case VISU::TCUTPLANES: aPrsCmt = VISU::CutPlanes_i::myComment; break; + case VISU::TPLOT3D: + aPrsCmt = VISU::Plot3D_i::myComment; + break; case VISU::TDEFORMEDSHAPE: aPrsCmt = VISU::DeformedShape_i::myComment; break; @@ -787,6 +803,8 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField) aData.myPrsType = VISU::TISOSURFACE; else if (strName == VISU::CutPlanes_i::myComment.c_str()) aData.myPrsType = VISU::TCUTPLANES; + else if (strName == VISU::Plot3D_i::myComment.c_str()) + aData.myPrsType = VISU::TPLOT3D; else if (strName == VISU::DeformedShape_i::myComment.c_str()) aData.myPrsType = VISU::TDEFORMEDSHAPE; else if (strName == VISU::Vectors_i::myComment.c_str()) -- 2.39.2