From b28cc72d7a5e6f30092e4eb391eaa3ef8565255a Mon Sep 17 00:00:00 2001 From: rnv Date: Wed, 29 Sep 2010 07:18:25 +0000 Subject: [PATCH] Fix for the WinTC5.1.4: parameters of StreamLines are not taken in account. --- src/VISUGUI/VISU_msg_en.ts | 5 + src/VISUGUI/VisuGUI_StreamLinesDlg.cxx | 164 ++++++++++++++----------- src/VISUGUI/VisuGUI_StreamLinesDlg.h | 2 + 3 files changed, 101 insertions(+), 70 deletions(-) diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index df2c36fb..99926d85 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -3027,6 +3027,11 @@ Please select another field. USE_COLOR_BTN Use Color + + STREAM_MEMORY_ALERT + Building presentation with the initial parameters impossible, because there is not enough memory. +Some parameters has been changed. Can you please confirm that you want to continue anyway? + VisuGUI_SweepPrefDlg diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx index d7d6a6d7..3e771585 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx @@ -73,7 +73,8 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule) : VisuGUI_ScalarBarBaseDlg(theModule), - myVisuGUI(theModule) + myVisuGUI(theModule), + myStatus(false) { setWindowTitle(tr("DLG_TITLE")); setSizeGripEnabled(TRUE); @@ -399,76 +400,9 @@ void VisuGUI_StreamLinesDlg::initFromPrsObject ( VISU::ColoredPrs3d_i* thePrs, } int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs) -{ - if(!myInputPane->check() || !GetScalarPane()->check()) - return 0; - - int anIsOk = myInputPane->storeToPrsObject( myPrsCopy ); - anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy ); - - if (anIsOk) { - myPrsCopy->ShowColored(myUseScalar->isChecked()); - if (!myPrsCopy->IsColored()) { - SALOMEDS::Color aColor; - aColor.R = SelColor->color().red()/255.; - aColor.G = SelColor->color().green()/255.; - aColor.B = SelColor->color().blue()/255.; - myPrsCopy->SetColor(aColor); - } - - VISU::StreamLines::Direction aDirection = VISU::StreamLines::BOTH; - switch (myDirCombo->currentIndex()) { - case 0: - aDirection = VISU::StreamLines::FORWARD; - break; - case 1: - aDirection = VISU::StreamLines::BACKWARD; - break; - case 2: - aDirection = VISU::StreamLines::BOTH; - } - - VISU::Prs3d_var aPrs; - int aSrcSelection = myUseSrcCombo->currentIndex(); - int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentIndex() : -1; - if ((aSrcSelection > 0) && (aSrcItem > -1)) { - VISU::VISUType aType; - QString aName; - switch (aSrcSelection) { - case 1: // Entity - aPrs = myEntityList[aSrcItem]; - aType = VISU::TENTITY; - aName = myEntitiesLst[aSrcItem]; - break; - case 2: // Family - aPrs = myFamilyList[aSrcItem]; - aType = VISU::TFAMILY; - aName = myFamilisLst[aSrcItem]; - break; - case 3: // Group - aPrs = myGroupList[aSrcItem]; - aType = VISU::TGROUP; - aName = myGroupsLst[aSrcItem]; - break; - case 4: // Presentation - aPrs = myPrsList[aSrcItem]; - break; - } - if (CORBA::is_nil(aPrs) && aSrcSelection != 4) { - aPrs = createMesh(aType, aName); - } - } - anIsOk &= myPrsCopy->SetParams(myIntegStepLen->value(), - myPropTime->value(), - myStepLen->value(), - aPrs, - myPntPercent->value(), - aDirection); - } - +{ VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); - - return anIsOk; + return myStatus; } /*! @@ -547,6 +481,78 @@ void VisuGUI_StreamLinesDlg::onSourceTypeChange(int theIndex) { } +void VisuGUI_StreamLinesDlg::storeToPrsCopy() { + + if(!myInputPane->check() || !GetScalarPane()->check()) { + myStatus = false; + return; + } + + myStatus = myInputPane->storeToPrsObject( myPrsCopy ); + myStatus &= GetScalarPane()->storeToPrsObject( myPrsCopy ); + + if (myStatus) { + myPrsCopy->ShowColored(myUseScalar->isChecked()); + if (!myPrsCopy->IsColored()) { + SALOMEDS::Color aColor; + aColor.R = SelColor->color().red()/255.; + aColor.G = SelColor->color().green()/255.; + aColor.B = SelColor->color().blue()/255.; + myPrsCopy->SetColor(aColor); + } + + VISU::StreamLines::Direction aDirection = VISU::StreamLines::BOTH; + switch (myDirCombo->currentIndex()) { + case 0: + aDirection = VISU::StreamLines::FORWARD; + break; + case 1: + aDirection = VISU::StreamLines::BACKWARD; + break; + case 2: + aDirection = VISU::StreamLines::BOTH; + } + + VISU::Prs3d_var aPrs; + int aSrcSelection = myUseSrcCombo->currentIndex(); + int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentIndex() : -1; + if ((aSrcSelection > 0) && (aSrcItem > -1)) { + VISU::VISUType aType; + QString aName; + switch (aSrcSelection) { + case 1: // Entity + aPrs = myEntityList[aSrcItem]; + aType = VISU::TENTITY; + aName = myEntitiesLst[aSrcItem]; + break; + case 2: // Family + aPrs = myFamilyList[aSrcItem]; + aType = VISU::TFAMILY; + aName = myFamilisLst[aSrcItem]; + break; + case 3: // Group + aPrs = myGroupList[aSrcItem]; + aType = VISU::TGROUP; + aName = myGroupsLst[aSrcItem]; + break; + case 4: // Presentation + aPrs = myPrsList[aSrcItem]; + break; + } + if (CORBA::is_nil(aPrs) && aSrcSelection != 4) { + aPrs = createMesh(aType, aName); + } + } + myStatus &= myPrsCopy->SetParams(myIntegStepLen->value(), + myPropTime->value(), + myStepLen->value(), + aPrs, + myPntPercent->value(), + aDirection); + } +} + + VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QString theName) { return VISU::Mesh::_nil(); @@ -554,6 +560,24 @@ VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QStri void VisuGUI_StreamLinesDlg::accept() { + + //rnv: To fix the IPAL21920: WinTC5.1.4: parameters of StreamLines are not taken in account. + //rnv: Show confirmation message in case if 'Used points' and 'Step length' were re-calculated. + //1. Store parameters to the myPrsCopy + storeToPrsCopy(); + + //2. Check 'Used points' and 'Step length' parameters + if( myStepLen->value() > myPrsCopy->GetStepLength() || + myPntPercent->value() > myPrsCopy->GetUsedPoints() ) { + QString aWarning = tr("STREAM_MEMORY_ALERT"); + if( SUIT_MessageBox::warning( this, tr( "WRN_VISU_WARNING" ), aWarning, tr( "BUT_OK" ), tr( "CANCEL" ) ) == 1 ) { + // Set re-calculated values + myStepLen->setValue(myPrsCopy->GetStepLength()); + myPntPercent->setValue(myPrsCopy->GetUsedPoints()); + return; + } + } + VisuGUI_ScalarBarBaseDlg::accept(); } diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.h b/src/VISUGUI/VisuGUI_StreamLinesDlg.h index a0eebdf9..5667480d 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.h +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.h @@ -63,6 +63,7 @@ public: protected: virtual QString GetContextHelpFilePath(); + void storeToPrsCopy(); protected slots: void accept(); @@ -103,6 +104,7 @@ private: _PTR(SObject) mySelectionObj; SALOME::GenericObjPtr myPrsCopy; SalomeApp_Module* myVisuGUI; + bool myStatus; private slots: //void setVColor(); -- 2.39.2