From: smh Date: Tue, 11 May 2004 06:41:16 +0000 (+0000) Subject: Fix on Bug PAL5834 X-Git-Tag: Ecole_Ete_a5~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5a6b6ff36dcbec4721ac8d39c1f873227b14707c;p=modules%2Fvisu.git Fix on Bug PAL5834 - v1_4_1 and current: VTK error messages appear on execution of "Sweep" command --- diff --git a/src/PIPELINE/VISU_IsoSurfacesPL.cxx b/src/PIPELINE/VISU_IsoSurfacesPL.cxx index b6bbb643..e47acd33 100644 --- a/src/PIPELINE/VISU_IsoSurfacesPL.cxx +++ b/src/PIPELINE/VISU_IsoSurfacesPL.cxx @@ -107,13 +107,33 @@ void VISU_IsoSurfacesPL::Update(){ VISU_ScalarMapPL::Update(); } + +static void SearchRange(vtkContourFilter* theContourFilter, + int theNbParts, + float theDelta, + float theRange[2]) +{ + float aRange = theRange[0] - theDelta; + do{ + theContourFilter->GenerateValues(theNbParts,theRange); + theContourFilter->Update(); + static float EPS = 1.0E-3, INCREMENT = 3.0; + theRange[0] -= EPS*theDelta; + theDelta *= INCREMENT; + if(aRange > theRange[0]) break; + }while(!theContourFilter->GetOutput()->GetNumberOfPoints()); +} + + void VISU_IsoSurfacesPL::SetMapScale(float theMapScale){ VISU_ScalarMapPL::SetMapScale(theMapScale); - float aRange[2] = {GetMax() - theMapScale*(GetMax()-GetMin()), GetMax()}; + float aDelta = GetMax()-GetMin(); + float aRange[2] = {GetMax() - theMapScale*aDelta, GetMax()}; float aNewRange[2] = {aRange[0], aRange[1]}; + ::SearchRange(myContourFilter,GetNbParts(),aDelta,aNewRange); + //myContourFilter->GenerateValues(GetNbParts(),aNewRange); if(GetScaling() == VTK_SCALE_LOG10) VISU_LookupTable::ComputeLogRange(aRange,aNewRange); - myContourFilter->GenerateValues(GetNbParts(),aNewRange); Modified(); }