From: apo Date: Tue, 29 Nov 2005 13:00:28 +0000 (+0000) Subject: To fix a regression - segmentation does not work X-Git-Tag: TG-D5-38-2003_D2005-20-12~103 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dd6ce4ecc2f80d5381bcb67b645f6429dd659319;p=modules%2Fvisu.git To fix a regression - segmentation does not work --- diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 28ab063a..4df910a0 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -131,6 +131,7 @@ VISU_GaussPointsPL myExtractor->SetInput( GetInput2() ); myFieldTransform->SetInput( myExtractor->GetOutput() ); + myFieldTransform->Update(); myCellDataToPointData->SetInput( myFieldTransform->GetUnstructuredGridOutput() ); if( myIsDeformed ) diff --git a/src/PIPELINE/VISU_WidgetCtrl.cxx b/src/PIPELINE/VISU_WidgetCtrl.cxx index f8bed9bc..3e94497b 100644 --- a/src/PIPELINE/VISU_WidgetCtrl.cxx +++ b/src/PIPELINE/VISU_WidgetCtrl.cxx @@ -32,6 +32,8 @@ #include "VISU_PlanesWidget.hxx" #include "VISU_SphereWidget.hxx" // +#include +// #include #include #include @@ -48,8 +50,6 @@ vtkStandardNewMacro(VISU_WidgetCtrl); // purpose : //================================================================== VISU_WidgetCtrl::VISU_WidgetCtrl() -: - vtkObject() { myDummyWidget=NULL; myDisableAll=0; @@ -148,6 +148,8 @@ void VISU_WidgetCtrl::SetEnabled(int theFlag) myWidgets[i]->SetEnabled(0); } } + + Modified(); } //================================================================== // function: ProcessEvents @@ -195,6 +197,8 @@ void VISU_WidgetCtrl::SetActiveIndex(const int theIndex) if (theIndex>=0 && theIndexSetInteractor(theRWI); } + + Modified(); } //================================================================== // function: GetInteractor @@ -303,6 +309,8 @@ void VISU_WidgetCtrl::SetPlaceFactor(float theFactor) for (int i=0; iSetPlaceFactor(theFactor); } + + Modified(); } //================================================================== // function: GetPlaceFactor @@ -330,5 +338,46 @@ vtkImplicitFunction* VISU_WidgetCtrl::ImplicitFunction() } myImplicitSum->SetFunctionWeight(pIF, aWeight); } - return myImplicitSum; + //return myImplicitSum; + return this; +} + +//================================================================== +float +VISU_WidgetCtrl +::EvaluateFunction(float theX[3]) +{ + if(VISU_ImplicitFunctionWidget* aWidget = GetActiveWidget()){ + if(vtkImplicitFunction* aFunction = aWidget->ImplicitFunction()) + return aFunction->EvaluateFunction(theX[0],theX[1],theX[2]); + } + return 1.0; +} + +//================================================================== +void +VISU_WidgetCtrl +::EvaluateGradient(float theX[3], float theG[3]) +{ + theG[0] = theG[1] = theG[2] = 0.0; + if(VISU_ImplicitFunctionWidget* aWidget = GetActiveWidget()){ + if(vtkImplicitFunction* aFunction = aWidget->ImplicitFunction()) + aFunction->EvaluateGradient(theX,theG); + } +} + +//================================================================== +unsigned long +VISU_WidgetCtrl +::GetMTime() +{ + unsigned long aTime = Superclass::GetMTime(); + + if(vtkImplicitFunction* aFunction = myPlanesWidget->ImplicitFunction()) + aTime = std::max(aTime,aFunction->GetMTime()); + + if(vtkImplicitFunction* aFunction = mySphereWidget->ImplicitFunction()) + aTime = std::max(aTime,aFunction->GetMTime()); + + return aTime; } diff --git a/src/PIPELINE/VISU_WidgetCtrl.hxx b/src/PIPELINE/VISU_WidgetCtrl.hxx index d6825324..98a6a667 100644 --- a/src/PIPELINE/VISU_WidgetCtrl.hxx +++ b/src/PIPELINE/VISU_WidgetCtrl.hxx @@ -30,7 +30,7 @@ #define __VISU_WidgetCtrl_hxx -#include +#include class vtkImplicitFunction; class vtkObject; @@ -43,14 +43,26 @@ class VISU_PlanesWidget; class VISU_SphereWidget; class VISU_ImplicitFunctionWidget; -class VISU_WidgetCtrl : public vtkObject +class VISU_WidgetCtrl : public vtkImplicitFunction { public: static VISU_WidgetCtrl *New(); vtkTypeRevisionMacro(VISU_WidgetCtrl,vtkObject); vtkImplicitFunction* ImplicitFunction(); - // + + virtual + float + EvaluateFunction(float theX[3]); + + virtual + void + EvaluateGradient(float theX[3], float theG[3]); + + virtual + unsigned long + GetMTime(); + void PlaceWidget(float theBounds[6]); void SetEnabled(int theFlag); int GetEnabled();