#include <vtkDataSet.h>
#include <vtkDataSetAttributes.h>
#include <vtkProperty.h>
-#include <vtkSmartPointer.h>
#include <vtkTubeFilter.h>
#include <vtkDataSetMapper.h>
#include <vtkPolyDataMapper.h>
-#include <vtkActor.h>
namespace bbcreaMaracasVisu
MaracasTubeFilter::MaracasTubeFilter()
{
}
+
+ MaracasTubeFilter::~MaracasTubeFilter()
+ {
+ // Interface Update
+ if (renderer!=NULL )
+ {
+ renderer->RemoveActor(actor);
+ }
+
+ }
+
void MaracasTubeFilter::SetvtkRenderer(vtkRenderer *render)
{
this->renderer = render;
}
+
+
void MaracasTubeFilter::SetlstPoints( std::vector<double> lstPointX , std::vector<double> lstPointY , std::vector<double> lstPointZ )
{
- this->lstPointX=lstPointX;
- this->lstPointY=lstPointY;
- this->lstPointZ=lstPointZ;
+ this->lstPointX = lstPointX;
+ this->lstPointY = lstPointY;
+ this->lstPointZ = lstPointZ;
}
void MaracasTubeFilter::SetlstRadius( std::vector<double> lstRadius )
{
- this->lstRadius=lstRadius;
+ this->lstRadius = lstRadius;
+ }
+
+ void MaracasTubeFilter::SetOpacity(double opacity)
+ {
+ this->opacity = opacity;
+ }
+
+ void MaracasTubeFilter::SetTransform( vtkLinearTransform* transform )
+ {
+ this->transform = transform;
}
+ vtkActor *MaracasTubeFilter::GetActor()
+ {
+ return actor;
+ }
void MaracasTubeFilter::Run()
{
- // Spiral tube
-// double vX, vY, vZ;
-// unsigned int nV = 256; // No. of vertices
-// unsigned int nCyc = 5; // No. of spiral cycles
-// double rT1 = 0.1, rT2 = 0.5;// Start/end tube radii
-// double rS = 2; // Spiral radius
-// double h = 10; // Height
- unsigned int nTv = 8; // No. of surface elements for each tube vertex
-
unsigned int i;
+ unsigned int nTv = 8; // No. of surface elements for each tube vertex
// Create points and cells
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
mapper->SetScalarModeToUsePointFieldData();
mapper->SelectColorArray("Colors");
- vtkSmartPointer<vtkActor> actor =
- vtkSmartPointer<vtkActor>::New();
+ // vtkSmartPointer<vtkActor> actor =vtkSmartPointer<vtkActor>::New();
+ actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
+ actor->GetProperty()->SetOpacity( opacity );
+
- renderer->AddActor(actor);
+ if ( transform!=NULL )
+ {
+ actor->SetUserTransform( transform );
+ }
+
+ // Interface Update
+ if (renderer!=NULL )
+ {
+ renderer->AddActor(actor);
+ }
+
}
printf("EED TubeFilter::Process start \n");
+ if (tubefilter!=NULL)
+ {
+ delete tubefilter;
+ }
+
+ tubefilter = new MaracasTubeFilter();
tubefilter->SetvtkRenderer( bbGetInputRenderer() );
tubefilter->SetlstPoints( bbGetInputlstPointX(), bbGetInputlstPointY(), bbGetInputlstPointZ() );
tubefilter->SetlstRadius( bbGetInputlstRadio() );
+ tubefilter->SetOpacity( bbGetInputOpacity() );
+ tubefilter->SetTransform( bbGetInputTransform() );
tubefilter->Run();
- bbSetOutputOutAxis( NULL );
-
+ bbSetOutputOutAxis( tubefilter->GetActor() );
printf("EED TubeFilter::Process end \n");
}
+
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
void TubeFilter::bbUserSetDefaultValues()
{
-
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
-// bbSetInputIn(0);
-
+ bbSetInputOpacity(1);
+ bbSetInputTransform(NULL);
+
}
+
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
void TubeFilter::bbUserInitializeProcessing()
{
-
// THE INITIALIZATION METHOD BODY :
// Here does nothing
// but this is where you should allocate the internal/output pointers
-// if any
-
- tubefilter = new MaracasTubeFilter();
-
+// if any
+ tubefilter = NULL;
}
+
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
void TubeFilter::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
// if any
-
}
+
}
// EO namespace bbcreaMaracasVisu