#include <vtkSphereSource.h>
#include <vtkPoints.h>
#include <vtkSphere.h>
+#include <vtkImplicitSum.h>
#include <vtkImplicitFunction.h>
vtkCxxRevisionMacro(VISU_SphereWidget, "$Revision$");
// function:
// purpose:
//====================================================================
-VISU_SphereWidget::VISU_SphereWidget()
-:
- VISU_ImplicitFunctionWidget()
-{
+VISU_SphereWidget::VISU_SphereWidget(){
int i, j;
//
myState = VISU_SphereWidget::Start;
mySelectedSphereProperty = NULL;
CreateDefaultProperties();
myRmin=1.e-7;
+
mySphere=vtkSphere::New();
+ myImplicitSum=vtkImplicitSum::New();
+ myImplicitSum->AddFunction(mySphere,-1.0);
+
}
//====================================================================
// function: ~
mySelectedSphereProperty->Delete();
}
mySphere->Delete();
+ myImplicitSum->Delete();
}
//====================================================================
// function: SetThetaResolution
//====================================================================
vtkImplicitFunction* VISU_SphereWidget::ImplicitFunction()
{
- return mySphere;
+ return myImplicitSum;
}
//====================================================================
// function: SetEnabled
#include "VISU_ImplicitFunctionWidget.hxx"
+class VISU_UnScaledActor;
+
class vtkActor;
class vtkPolyDataMapper;
class vtkPoints;
class vtkSphere;
class vtkCellPicker;
class vtkProperty;
-class VISU_UnScaledActor;
class vtkSphere;
+class vtkImplicitSum;
class vtkImplicitFunction;
//
class VISU_SphereWidget : public VISU_ImplicitFunctionWidget
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
//
#include <vtkObject.h>
#include <vtkImplicitFunction.h>
-#include <vtkImplicitSum.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkObjectFactory.h>
#include <vtkCallbackCommand.h>
{
myDummyWidget=NULL;
myDisableAll=0;
- myImplicitSum=vtkImplicitSum::New();
myNbWidgets=2;
myActiveIndex=-1;// 0 - PlanesWidget; 1 - SphereWidget
myPriority=0.;
myWidgets[i]->AddObserver(vtkCommand::InteractionEvent,
myEventCallbackCommand,
myPriority);
- //
- vtkImplicitFunction *pIF=myWidgets[i]->ImplicitFunction();
- myImplicitSum->AddFunction(pIF, 0.);
}
}
//==================================================================
}
//
myEventCallbackCommand->Delete();
- myImplicitSum->Delete();
}
//==================================================================
// function: GetEnabled
//==================================================================
vtkImplicitFunction* VISU_WidgetCtrl::ImplicitFunction()
{
- int i;
- float aWeight;
- vtkImplicitFunction *pIF;
- //
- for (int i=0; i<myNbWidgets; ++i) {
- pIF=myWidgets[i]->ImplicitFunction();
- aWeight=(i==myActiveIndex)? 1. : 0.;
- if (i==myActiveIndex && i==1){
- aWeight=-1.;
- }
- myImplicitSum->SetFunctionWeight(pIF, aWeight);
- }
- //return myImplicitSum;
return this;
}
class vtkRenderWindowInteractor;
class vtkCommand;
class vtkCallbackCommand;
-class vtkImplicitSum;
class VISU_PlanesWidget;
class VISU_SphereWidget;
int myCounter;
int myDisableAll;
float myPriority;
- vtkImplicitSum* myImplicitSum;
VISU_ImplicitFunctionWidget *myWidgets[2];
VISU_ImplicitFunctionWidget *myDummyWidget;
VISU_PlanesWidget *myPlanesWidget;