]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To fix problem with update scalar range after changing presentation input
authorapo <apo@opencascade.com>
Thu, 9 Nov 2006 09:08:19 +0000 (09:08 +0000)
committerapo <apo@opencascade.com>
Thu, 9 Nov 2006 09:08:19 +0000 (09:08 +0000)
src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_GaussPoints_i.hh
src/VISU_I/VISU_IsoSurfaces_i.cc
src/VISU_I/VISU_ScalarMap_i.cc

index f2979693441b108105fbc71b8f61c6a6f541e274..8eb2602048465a0a146638a8f2ee2b1ec574e360 100644 (file)
@@ -129,6 +129,8 @@ VISU::ColoredPrs3d_i
     CreatePipeLine(NULL); // to create proper pipeline
 
   DoSetInput(anIsNotCreated);
+
+  // To update title according to the new input
   SetTitle(GetCTitle().c_str());
 
   return anIsNotCreated;
@@ -467,9 +469,11 @@ CORBA::Double
 VISU::ColoredPrs3d_i
 ::GetSourceMin()
 {
-  if(IsTimeStampFixed())
-    return myScalarMapPL->GetScalarRange()[0];
-  else{
+  if(IsTimeStampFixed()){
+    vtkFloatingPointType aRange[2];
+    GetSpecificPL()->GetSourceRange(aRange);
+    return aRange[0];
+  }else{
     TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
     return aTMinMax.first;
   }
@@ -479,9 +483,11 @@ CORBA::Double
 VISU::ColoredPrs3d_i
 ::GetSourceMax()
 {
-  if(IsTimeStampFixed())
-    return myScalarMapPL->GetScalarRange()[1];
-  else{
+  if(IsTimeStampFixed()){
+    vtkFloatingPointType aRange[2];
+    GetSpecificPL()->GetSourceRange(aRange);
+    return aRange[1];
+  }else{
     TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
     return aTMinMax.second;
   }
@@ -492,14 +498,14 @@ void
 VISU::ColoredPrs3d_i
 ::SetNbColors(CORBA::Long theNbColors)
 {
-  myScalarMapPL->SetNbColors(theNbColors);
+  GetSpecificPL()->SetNbColors(theNbColors);
 }
 
 CORBA::Long 
 VISU::ColoredPrs3d_i
 ::GetNbColors()
 {
-  return myScalarMapPL->GetNbColors();
+  return GetSpecificPL()->GetNbColors();
 }
 
 void
@@ -1074,7 +1080,7 @@ VISU::ColoredPrs3d_i
     QString aComment;
     myName = "NoName";
     if(theBuildMode == ECreateNew || theBuildMode == ESameAs){
-      if(!myIsFixedRange
+      if(!IsRangeFixed()
        SetSourceRange();
       if(theBuildMode == ECreateNew) 
        SetTitle(GetCFieldName().c_str());
index c7707c98a2c87a3d498357827e88e6bd91c94cca..5a895bc8da5313a21126209acc95fb66d72c85cc 100644 (file)
@@ -526,6 +526,10 @@ VISU::GaussPoints_i
     GetSpecificPL()->Build();
   }
   GetCResult()->MinMaxConnect(this);
+
+  // To update scalar range according to the new input
+  if(!IsTimeStampFixed())
+    SetSourceRange();
 }
 
 
@@ -641,7 +645,7 @@ VISU::GaussPoints_i
   theLookupTable->SetNumberOfColors(aLookupTable->GetNumberOfColors());
   theScalarBar->SetMaximumNumberOfColors(aLookupTable->GetNumberOfColors());
 
-    vtkFloatingPointType anRGB[3];
+  vtkFloatingPointType anRGB[3];
 
   vtkTextProperty* aTitleProp = theScalarBar->GetTitleTextProperty();
   aTitleProp->SetFontFamily(GetTitFontType());
@@ -810,6 +814,50 @@ VISU::GaussPoints_i
   return GetCResult()->IsMinMaxDone();
 }
 
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::SetSourceRange()
+{
+  if(IsTimeStampFixed() || GetIsActiveLocalScalarBar())
+    GetSpecificPL()->SetSourceRange();
+  else{
+    TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
+    vtkFloatingPointType aScalarRange[2] = {aTMinMax.first, aTMinMax.second};
+    GetSpecificPL()->SetScalarRange(aScalarRange);
+  }
+}
+
+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;
+  }
+}
+
+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;
+  }
+}
+
+
+//----------------------------------------------------------------------------
 bool
 VISU::GaussPoints_i
 ::GetIsDispGlobalScalarBar() const 
@@ -817,6 +865,7 @@ VISU::GaussPoints_i
   return myIsDispGlobalScalarBar;
 }
 
+
 void
 VISU::GaussPoints_i
 ::SetBiColor(bool theIsBiColor)
index 57162216435e71d401494034865704f4ee796873..bc44b491fd29eebe8ebb48eec6ecc50c5907d52a 100644 (file)
@@ -237,6 +237,18 @@ namespace VISU
     bool
     IsGlobalRangeDefined() const;
 
+    virtual
+    CORBA::Double 
+    GetSourceMin();
+
+    virtual
+    CORBA::Double 
+    GetSourceMax();
+
+    virtual 
+    void
+    SetSourceRange();
+
     //! To update the min / max automatically
     virtual
     void
@@ -348,4 +360,3 @@ namespace VISU
 }
 
 #endif
-
index 76b59a8e42d5ea681247d130fca92446123eaa14..c8e4a79e8ec81aa650d407c648158978b67ee38e 100644 (file)
@@ -212,7 +212,7 @@ VISU::IsoSurfaces_i
 ::DoSetInput(bool theIsInitilizePipe)
 {
   TSuperClass::DoSetInput(theIsInitilizePipe);
-  if(theIsInitilizePipe)
+  if(theIsInitilizePipe || (!IsTimeStampFixed() && !IsRangeFixed()))
     SetSubRange(GetSourceMin(), GetSourceMax());
 }
 
index fa2f3e9941a98cee77566af3a49102342f758568..b2e12a830135509d757f6dea5dd28dbc08164d79 100644 (file)
@@ -285,6 +285,10 @@ VISU::ScalarMap_i
     GetSpecificPL()->Init();
     GetSpecificPL()->Build();
   }
+
+  // To update scalar range according to the new input
+  if(!IsTimeStampFixed() && !IsRangeFixed())
+    SetSourceRange();
 }