]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Another fix, on thread safety MERGE_MULTIPR_EVOLUTION mergeto_BR_Dev_For_4_0_07-Dec-07
authorapo <apo@opencascade.com>
Sat, 1 Dec 2007 16:10:41 +0000 (16:10 +0000)
committerapo <apo@opencascade.com>
Sat, 1 Dec 2007 16:10:41 +0000 (16:10 +0000)
src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_GaussPoints_i.cc

index 0069fccac53940b71199551e9bbccb517477044e..4655001deca04191aabbfad8f75b1fefc1fc7456 100644 (file)
@@ -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 ) );
 }
 
 //----------------------------------------------------------------------------
index 72be5b9c20b1057a0b5e0eee9590f06e071f8841..1af1cbaa4850d8915c3f5ff0d2b832992f01c540 100644 (file)
@@ -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 ) );
 }