From: apo Date: Wed, 12 Dec 2007 15:11:55 +0000 (+0000) Subject: Fix for Bug NPAL18277 X-Git-Tag: V4_1_0rc3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=36cadf3f855537a79c3defe2c79e7a5b4ba57ecf;p=modules%2Fvisu.git Fix for Bug NPAL18277 EDF 629 VISU : 3.2.9 and 4.1 Regression --- diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx index 5b2e881e..98dcd686 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx @@ -339,6 +339,8 @@ VisuGUI_ScalarMapOnDeformedShapeDlg QString theFieldName, const bool save_scalar_pane ) { + QApplication::setOverrideCursor(Qt::waitCursor); + if( save_scalar_pane ) GetScalarPane()->storeToPrsObject(myPrsCopy); @@ -357,6 +359,8 @@ VisuGUI_ScalarMapOnDeformedShapeDlg if( save_scalar_pane ) UpdateScalarField(); + + QApplication::restoreOverrideCursor(); } void VisuGUI_ScalarMapOnDeformedShapeDlg::accept() diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 7df71bef..664b8162 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -90,6 +90,13 @@ namespace VISU return theField->GetMinMax(theCompID); } + //--------------------------------------------------------------- + void + TMinMaxController + ::UpdateReference(ColoredPrs3d_i* theFromPrs3, ColoredPrs3d_i* theToPrs3d) + {} + + //--------------------------------------------------------------- vtkFloatingPointType TMinMaxController @@ -112,19 +119,22 @@ namespace VISU struct TSimpleMinMaxController: virtual TVTKMinMaxController { VISU::Result_i* myResult; - VISU::PField myField; + VISU::ColoredPrs3d_i* myColoredPrs3d; TSimpleMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d): myResult(theColoredPrs3d->GetCResult()), - myField(theColoredPrs3d->GetField()) + myColoredPrs3d(theColoredPrs3d) {} + ~TSimpleMinMaxController() + {} + virtual vtkFloatingPointType GetComponentMin(vtkIdType theCompID) { - if(myField){ - TMinMax aMinMax = GetMinMax(myResult, myField, theCompID); + if ( VISU::PField aField = myColoredPrs3d->GetScalarField() ) { + TMinMax aMinMax = GetMinMax(myResult, aField, theCompID); return aMinMax.first; } return TMinMaxController::GetComponentMin(theCompID); @@ -134,8 +144,8 @@ namespace VISU vtkFloatingPointType GetComponentMax(vtkIdType theCompID) { - if(myField){ - TMinMax aMinMax = GetMinMax(myResult, myField, theCompID); + if ( VISU::PField aField = myColoredPrs3d->GetScalarField() ) { + TMinMax aMinMax = GetMinMax(myResult, aField, theCompID); return aMinMax.second; } return TMinMaxController::GetComponentMax(theCompID); @@ -493,7 +503,7 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- void VISU::ColoredPrs3d_i -::SetMinMaxController(const VISU::PMinMaxController& theController) +::SetMinMaxController( const VISU::PMinMaxController& theController ) { myMinMaxController = theController; @@ -502,6 +512,18 @@ VISU::ColoredPrs3d_i } +//---------------------------------------------------------------------------- +void +VISU::ColoredPrs3d_i +::SetMinMaxController( VISU::ColoredPrs3d_i* theOrigin ) +{ + VISU::PMinMaxController aController = theOrigin->GetMinMaxController(); + aController->UpdateReference( theOrigin, this ); + + SetMinMaxController( aController ); +} + + //---------------------------------------------------------------------------- CORBA::Long VISU::ColoredPrs3d_i @@ -652,8 +674,8 @@ VISU::ColoredPrs3d_i TSuperClass::SameAs(theOrigin); - CORBA::Long aNbComp = GetField()->myNbComp; - CORBA::Long anOriginNbComp = anOrigin->GetField()->myNbComp; + CORBA::Long aNbComp = GetScalarField()->myNbComp; + CORBA::Long anOriginNbComp = anOrigin->GetScalarField()->myNbComp; if(anOriginNbComp < aNbComp) SetScalarMode(0); else @@ -666,7 +688,7 @@ VISU::ColoredPrs3d_i SetBarOrientation(anOrigin->GetBarOrientation()); - SetMinMaxController(anOrigin->GetMinMaxController()); + SetMinMaxController( anOrigin ); if(anOrigin->IsRangeFixed()) SetRange(anOrigin->GetMin(), anOrigin->GetMax()); @@ -718,7 +740,7 @@ void VISU::ColoredPrs3d_i ::SetScalarMode(CORBA::Long theScalarMode) { - CORBA::Long aNbComp = GetField()->myNbComp; + CORBA::Long aNbComp = GetScalarField()->myNbComp; if(aNbComp == 1) theScalarMode = 1; else if(theScalarMode > aNbComp) @@ -830,7 +852,7 @@ struct TGetComponentMin: public SALOME_Event if ( aMinMaxController ) { myResult = aMinMaxController->GetComponentMin( myCompID ); } else { - VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myCompID ); + VISU::TMinMax aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID ); myResult = aTMinMax.first; } } @@ -868,7 +890,7 @@ struct TGetComponentMax: public SALOME_Event if ( aMinMaxController ) { myResult = aMinMaxController->GetComponentMax( myCompID ); } else { - VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myCompID ); + VISU::TMinMax aTMinMax = myColoredPrs3d->GetScalarField()->GetMinMax( myCompID ); myResult = aTMinMax.second; } } @@ -1822,7 +1844,7 @@ VISU::ColoredPrs3d_i aRestoringMap["myEntityId"] = QString::number(GetEntity()); aRestoringMap["myFieldName"] = GetCFieldName(); aRestoringMap["myTimeStampId"] = QString::number(GetTimeStampNumber()); - aRestoringMap["myNumComponent"] = QString::number(GetField()->myNbComp); + aRestoringMap["myNumComponent"] = QString::number(GetScalarField()->myNbComp); std::string anEntry = GetCResult()->GetEntry(aRestoringMap); if(anEntry == "") throw std::runtime_error("There is no Entry for binding the presentation !!!"); @@ -1832,7 +1854,7 @@ VISU::ColoredPrs3d_i GetEntity(), GetCFieldName().c_str(), GetTimeStampNumber(), - GetField()->myNbComp); + GetScalarField()->myNbComp); CORBA::String_var anIOR = GetID(); CreateAttributes(GetStudyDocument(), anEntry, diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index 9b1c3ecb..cb22f72d 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -38,9 +38,15 @@ class VISU_ColoredPL; namespace VISU { + class ColoredPrs3d_i; + //---------------------------------------------------------------------------- struct TMinMaxController { + virtual + void + UpdateReference(ColoredPrs3d_i* theFromPrs3, ColoredPrs3d_i* theToPrs3d); + virtual vtkFloatingPointType GetComponentMin(vtkIdType theCompID); @@ -81,8 +87,6 @@ namespace VISU //---------------------------------------------------------------------------- - class ColoredPrs3d_i; - PMinMaxController CreateDefaultMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d); @@ -180,7 +184,10 @@ namespace VISU GetMinMaxController(); void - SetMinMaxController(const VISU::PMinMaxController& theController); + SetMinMaxController( const VISU::PMinMaxController& theController ); + + void + SetMinMaxController( ColoredPrs3d_i* theOrigin ); virtual CORBA::Long diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc index 365d28e1..ac6a8322 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc @@ -360,6 +360,7 @@ VISU::ScalarMapOnDeformedShape_i myScalarTimeStampNumber = theTimeStampNumber; SetTitle(theFieldName); + SetScalarMode(GetScalarMode()); if(!IsRangeFixed() && IsPipeLineExists()) SetSourceRange(); diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index 6152e6fb..6d82f267 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -114,13 +114,26 @@ namespace VISU //------------------------------------------------------------------------ struct TCompositeMinMaxController : virtual TVTKMinMaxController { - typedef std::vector TMinMaxContainer; + typedef ColoredPrs3d_i* TKey; + typedef std::map< TKey, VISU::PMinMaxController > TMinMaxContainer; TMinMaxContainer myMinMaxContainer; void - AddController(VISU::PMinMaxController theMinMaxController) + AddController(ColoredPrs3d_i* theReference, + VISU::PMinMaxController theMinMaxController) { - myMinMaxContainer.push_back(theMinMaxController); + myMinMaxContainer[ TKey( theReference ) ] = theMinMaxController; + } + + virtual + void + UpdateReference(ColoredPrs3d_i* theFromPrs3, ColoredPrs3d_i* theToPrs3d) + { + TMinMaxContainer::iterator anIter = myMinMaxContainer.find( TKey( theFromPrs3 ) ); + if ( anIter != myMinMaxContainer.end() ) { + myMinMaxContainer.erase( anIter ); + myMinMaxContainer[ TKey( theToPrs3d ) ] = VISU::CreateDefaultMinMaxController( theToPrs3d ); + } } virtual @@ -128,9 +141,10 @@ namespace VISU GetComponentMin(vtkIdType theCompID) { vtkFloatingPointType aMin = TMinMaxController::GetComponentMin(theCompID); - if(!myMinMaxContainer.empty()){ - for(size_t anId = 0; anId < myMinMaxContainer.size(); anId++){ - VISU::PMinMaxController aMinMaxController = myMinMaxContainer[anId]; + if ( !myMinMaxContainer.empty() ) { + TMinMaxContainer::const_iterator anIter = myMinMaxContainer.begin(); + for(; anIter != myMinMaxContainer.end(); anIter++){ + VISU::PMinMaxController aMinMaxController = anIter->second; aMin = std::min(aMin, aMinMaxController->GetComponentMin(theCompID)); } } @@ -142,9 +156,10 @@ namespace VISU GetComponentMax(vtkIdType theCompID) { vtkFloatingPointType aMax = TMinMaxController::GetComponentMax(theCompID); - if(!myMinMaxContainer.empty()){ - for(size_t anId = 0; anId < myMinMaxContainer.size(); anId++){ - VISU::PMinMaxController aMinMaxController = myMinMaxContainer[anId]; + if ( !myMinMaxContainer.empty() ) { + TMinMaxContainer::const_iterator anIter = myMinMaxContainer.begin(); + for(; anIter != myMinMaxContainer.end(); anIter++){ + VISU::PMinMaxController aMinMaxController = anIter->second; aMax = std::max(aMax, aMinMaxController->GetComponentMax(theCompID)); } } @@ -609,12 +624,12 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) { if ( myAnimationMode == VISU::Animation::PARALLEL ) { FieldData& aFieldData = getFieldData(theFieldNum); VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[0]; - aMinMaxController->AddController(VISU::CreateDefaultMinMaxController(aPrs3d)); + aMinMaxController->AddController( aPrs3d, VISU::CreateDefaultMinMaxController( aPrs3d ) ); } else { for (int aFieldId = 0; aFieldId < getNbFields(); aFieldId++) { FieldData& aFieldData = getFieldData(aFieldId); VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[0]; - aMinMaxController->AddController(VISU::CreateDefaultMinMaxController(aPrs3d)); + aMinMaxController->AddController( aPrs3d, VISU::CreateDefaultMinMaxController( aPrs3d ) ); } }