From d76d09cd3c7dfff47920a0c4c30935c3d164e4cb Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 9 Nov 2006 09:08:19 +0000 Subject: [PATCH] To fix problem with update scalar range after changing presentation input --- src/VISU_I/VISU_ColoredPrs3d_i.cc | 24 +++++++++------ src/VISU_I/VISU_GaussPoints_i.cc | 51 ++++++++++++++++++++++++++++++- src/VISU_I/VISU_GaussPoints_i.hh | 13 +++++++- src/VISU_I/VISU_IsoSurfaces_i.cc | 2 +- src/VISU_I/VISU_ScalarMap_i.cc | 4 +++ 5 files changed, 82 insertions(+), 12 deletions(-) diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index f2979693..8eb26020 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -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()); diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index c7707c98..5a895bc8 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -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) diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index 57162216..bc44b491 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -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 - diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index 76b59a8e..c8e4a79e 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -212,7 +212,7 @@ VISU::IsoSurfaces_i ::DoSetInput(bool theIsInitilizePipe) { TSuperClass::DoSetInput(theIsInitilizePipe); - if(theIsInitilizePipe) + if(theIsInitilizePipe || (!IsTimeStampFixed() && !IsRangeFixed())) SetSubRange(GetSourceMin(), GetSourceMax()); } diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index fa2f3e99..b2e12a83 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -285,6 +285,10 @@ VISU::ScalarMap_i GetSpecificPL()->Init(); GetSpecificPL()->Build(); } + + // To update scalar range according to the new input + if(!IsTimeStampFixed() && !IsRangeFixed()) + SetSourceRange(); } -- 2.39.2