From 6a15fbba1f4c61a1b200f025d2d3bbbcdc5bf297 Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 29 Nov 2005 13:20:49 +0000 Subject: [PATCH] To fix a regression - segmentation does not work --- src/PIPELINE/VISU_SphereWidget.cxx | 13 ++++++++----- src/PIPELINE/VISU_SphereWidget.hxx | 7 +++++-- src/PIPELINE/VISU_WidgetCtrl.cxx | 19 ------------------- src/PIPELINE/VISU_WidgetCtrl.hxx | 2 -- 4 files changed, 13 insertions(+), 28 deletions(-) diff --git a/src/PIPELINE/VISU_SphereWidget.cxx b/src/PIPELINE/VISU_SphereWidget.cxx index f242513c..3ecbf95b 100755 --- a/src/PIPELINE/VISU_SphereWidget.cxx +++ b/src/PIPELINE/VISU_SphereWidget.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include vtkCxxRevisionMacro(VISU_SphereWidget, "$Revision$"); @@ -26,10 +27,7 @@ vtkStandardNewMacro(VISU_SphereWidget); // function: // purpose: //==================================================================== -VISU_SphereWidget::VISU_SphereWidget() -: - VISU_ImplicitFunctionWidget() -{ +VISU_SphereWidget::VISU_SphereWidget(){ int i, j; // myState = VISU_SphereWidget::Start; @@ -80,7 +78,11 @@ VISU_SphereWidget::VISU_SphereWidget() mySelectedSphereProperty = NULL; CreateDefaultProperties(); myRmin=1.e-7; + mySphere=vtkSphere::New(); + myImplicitSum=vtkImplicitSum::New(); + myImplicitSum->AddFunction(mySphere,-1.0); + } //==================================================================== // function: ~ @@ -107,6 +109,7 @@ VISU_SphereWidget::~VISU_SphereWidget() mySelectedSphereProperty->Delete(); } mySphere->Delete(); + myImplicitSum->Delete(); } //==================================================================== // function: SetThetaResolution @@ -253,7 +256,7 @@ vtkProperty* VISU_SphereWidget::GetSelectedSphereProperty () //==================================================================== vtkImplicitFunction* VISU_SphereWidget::ImplicitFunction() { - return mySphere; + return myImplicitSum; } //==================================================================== // function: SetEnabled diff --git a/src/PIPELINE/VISU_SphereWidget.hxx b/src/PIPELINE/VISU_SphereWidget.hxx index 7373e4be..80cdcd3c 100755 --- a/src/PIPELINE/VISU_SphereWidget.hxx +++ b/src/PIPELINE/VISU_SphereWidget.hxx @@ -3,6 +3,8 @@ #include "VISU_ImplicitFunctionWidget.hxx" +class VISU_UnScaledActor; + class vtkActor; class vtkPolyDataMapper; class vtkPoints; @@ -11,8 +13,8 @@ class vtkSphereSource; class vtkSphere; class vtkCellPicker; class vtkProperty; -class VISU_UnScaledActor; class vtkSphere; +class vtkImplicitSum; class vtkImplicitFunction; // class VISU_SphereWidget : public VISU_ImplicitFunctionWidget @@ -120,7 +122,8 @@ protected: vtkProperty *mySphereProperty; vtkProperty *mySelectedSphereProperty; float myRmin; - vtkSphere *mySphere; + vtkSphere *mySphere; + vtkImplicitSum* myImplicitSum; private: VISU_SphereWidget(const VISU_SphereWidget&); //Not implemented void operator=(const VISU_SphereWidget&); //Not implemented diff --git a/src/PIPELINE/VISU_WidgetCtrl.cxx b/src/PIPELINE/VISU_WidgetCtrl.cxx index 3e94497b..89ffa75f 100644 --- a/src/PIPELINE/VISU_WidgetCtrl.cxx +++ b/src/PIPELINE/VISU_WidgetCtrl.cxx @@ -36,7 +36,6 @@ // #include #include -#include #include #include #include @@ -53,7 +52,6 @@ VISU_WidgetCtrl::VISU_WidgetCtrl() { myDummyWidget=NULL; myDisableAll=0; - myImplicitSum=vtkImplicitSum::New(); myNbWidgets=2; myActiveIndex=-1;// 0 - PlanesWidget; 1 - SphereWidget myPriority=0.; @@ -86,9 +84,6 @@ VISU_WidgetCtrl::VISU_WidgetCtrl() myWidgets[i]->AddObserver(vtkCommand::InteractionEvent, myEventCallbackCommand, myPriority); - // - vtkImplicitFunction *pIF=myWidgets[i]->ImplicitFunction(); - myImplicitSum->AddFunction(pIF, 0.); } } //================================================================== @@ -106,7 +101,6 @@ VISU_WidgetCtrl::~VISU_WidgetCtrl() } // myEventCallbackCommand->Delete(); - myImplicitSum->Delete(); } //================================================================== // function: GetEnabled @@ -326,19 +320,6 @@ float VISU_WidgetCtrl::GetPlaceFactor() //================================================================== vtkImplicitFunction* VISU_WidgetCtrl::ImplicitFunction() { - int i; - float aWeight; - vtkImplicitFunction *pIF; - // - for (int i=0; iImplicitFunction(); - aWeight=(i==myActiveIndex)? 1. : 0.; - if (i==myActiveIndex && i==1){ - aWeight=-1.; - } - myImplicitSum->SetFunctionWeight(pIF, aWeight); - } - //return myImplicitSum; return this; } diff --git a/src/PIPELINE/VISU_WidgetCtrl.hxx b/src/PIPELINE/VISU_WidgetCtrl.hxx index 98a6a667..8737b5dc 100644 --- a/src/PIPELINE/VISU_WidgetCtrl.hxx +++ b/src/PIPELINE/VISU_WidgetCtrl.hxx @@ -37,7 +37,6 @@ class vtkObject; class vtkRenderWindowInteractor; class vtkCommand; class vtkCallbackCommand; -class vtkImplicitSum; class VISU_PlanesWidget; class VISU_SphereWidget; @@ -107,7 +106,6 @@ protected: int myCounter; int myDisableAll; float myPriority; - vtkImplicitSum* myImplicitSum; VISU_ImplicitFunctionWidget *myWidgets[2]; VISU_ImplicitFunctionWidget *myDummyWidget; VISU_PlanesWidget *myPlanesWidget; -- 2.39.2