From: apo Date: Sat, 1 Dec 2007 16:10:41 +0000 (+0000) Subject: Another fix, on thread safety X-Git-Tag: mergeto_BR_Dev_For_4_0_07-Dec-07 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bc3284218ccf18fd12c6b4fd496ea87c06bc2c0a;p=modules%2Fvisu.git Another fix, on thread safety --- diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 0069fcca..4655001d 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -784,28 +784,81 @@ VISU::ColoredPrs3d_i return GetComponentMax(GetScalarMode()); } + +//---------------------------------------------------------------------------- +struct TGetComponentMin: public SALOME_Event +{ + VISU::ColoredPrs3d_i* myColoredPrs3d; + vtkIdType myCompID; + + typedef CORBA::Double TResult; + TResult myResult; + + TGetComponentMin( VISU::ColoredPrs3d_i* theColoredPrs3d, + vtkIdType theCompID ): + myColoredPrs3d( theColoredPrs3d ), + myCompID( theCompID ) + {} + + virtual + void + Execute() + { + VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); + if ( aMinMaxController ) { + myResult = aMinMaxController->GetComponentMin( myCompID ); + } else { + VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myCompID ); + myResult = aTMinMax.first; + } + } +}; + + //---------------------------------------------------------------------------- CORBA::Double VISU::ColoredPrs3d_i ::GetComponentMin(vtkIdType theCompID) { - if(PMinMaxController aMinMaxController = GetMinMaxController()) - return aMinMaxController->GetComponentMin(theCompID); - - TMinMax aTMinMax = GetField()->GetMinMax(theCompID); - return aTMinMax.first; + return ProcessEvent( new TGetComponentMin( this, theCompID ) ); } +//---------------------------------------------------------------------------- +struct TGetComponentMax: public SALOME_Event +{ + VISU::ColoredPrs3d_i* myColoredPrs3d; + vtkIdType myCompID; + + typedef CORBA::Double TResult; + TResult myResult; + + TGetComponentMax( VISU::ColoredPrs3d_i* theColoredPrs3d, + vtkIdType theCompID ): + myColoredPrs3d( theColoredPrs3d ), + myCompID( theCompID ) + {} + + virtual + void + Execute() + { + VISU::PMinMaxController aMinMaxController = myColoredPrs3d->GetMinMaxController(); + if ( aMinMaxController ) { + myResult = aMinMaxController->GetComponentMax( myCompID ); + } else { + VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myCompID ); + myResult = aTMinMax.second; + } + } +}; + + //---------------------------------------------------------------------------- vtkFloatingPointType VISU::ColoredPrs3d_i ::GetComponentMax(vtkIdType theCompID) { - if(PMinMaxController aMinMaxController = GetMinMaxController()) - return aMinMaxController->GetComponentMax(theCompID); - - TMinMax aTMinMax = GetField()->GetMinMax(theCompID); - return aTMinMax.second; + return ProcessEvent( new TGetComponentMax( this, theCompID ) ); } //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 72be5b9c..1af1cbaa 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -881,11 +881,11 @@ VISU::GaussPoints_i aScalarBarCtrl->SetRangeLocal(aRange); } - TMinMax aTMinMax(-VTK_LARGE_FLOAT,VTK_LARGE_FLOAT); bool anIsMinMaxDone = IsGlobalRangeDefined(); - if(anIsMinMaxDone) - aTMinMax = GetField()->GetMinMax(GetScalarMode()); aScalarBarCtrl->SetGlobalRangeIsDefined(anIsMinMaxDone); + + TMinMax aTMinMax( GetComponentMin( GetScalarMode() ), + GetComponentMax( GetScalarMode() )); aScalarBarCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second); VISU_ScalarBarCtrl::EMode aScalarBarMode = VISU_ScalarBarCtrl::eGlobal; @@ -1044,32 +1044,78 @@ VISU::GaussPoints_i UseFixedRange(false); } + +//---------------------------------------------------------------------------- +struct TGetSourceMin: public SALOME_Event +{ + VISU::GaussPoints_i* myColoredPrs3d; + + typedef CORBA::Double TResult; + TResult myResult; + + TGetSourceMin( VISU::GaussPoints_i* theColoredPrs3d ): + myColoredPrs3d( theColoredPrs3d ) + {} + + virtual + void + Execute() + { + if ( myColoredPrs3d->IsTimeStampFixed() || myColoredPrs3d->GetIsActiveLocalScalarBar() ) { + vtkFloatingPointType aRange[2]; + myColoredPrs3d->GetSpecificPL()->GetSourceRange(aRange); + myResult = aRange[0]; + }else{ + VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myColoredPrs3d->GetScalarMode() ); + myResult = aTMinMax.first; + } + } +}; + + +//---------------------------------------------------------------------------- CORBA::Double VISU::GaussPoints_i ::GetSourceMin() { - if(IsTimeStampFixed() || GetIsActiveLocalScalarBar()){ - vtkFloatingPointType aRange[2]; - GetSpecificPL()->GetSourceRange(aRange); - return aRange[0]; - }else{ - TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode()); - return aTMinMax.first; - } + return ProcessEvent( new TGetSourceMin( this ) ); } + +//---------------------------------------------------------------------------- +struct TGetSourceMax: public SALOME_Event +{ + VISU::GaussPoints_i* myColoredPrs3d; + + typedef CORBA::Double TResult; + TResult myResult; + + TGetSourceMax( VISU::GaussPoints_i* theColoredPrs3d ): + myColoredPrs3d( theColoredPrs3d ) + {} + + virtual + void + Execute() + { + if ( myColoredPrs3d->IsTimeStampFixed() || myColoredPrs3d->GetIsActiveLocalScalarBar() ) { + vtkFloatingPointType aRange[2]; + myColoredPrs3d->GetSpecificPL()->GetSourceRange(aRange); + myResult = aRange[1]; + }else{ + VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myColoredPrs3d->GetScalarMode() ); + myResult = aTMinMax.second; + } + } +}; + + +//---------------------------------------------------------------------------- CORBA::Double VISU::GaussPoints_i ::GetSourceMax() { - if(IsTimeStampFixed() || GetIsActiveLocalScalarBar()){ - vtkFloatingPointType aRange[2]; - GetSpecificPL()->GetSourceRange(aRange); - return aRange[1]; - }else{ - TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode()); - return aTMinMax.second; - } + return ProcessEvent( new TGetSourceMax( this ) ); }