--- /dev/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)
+//=====
+#include "bbcreaMaracasVisuTubeFilter.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+
+#include <vtkPolyData.h>
+#include <vtkPoints.h>
+#include <vtkCellArray.h>
+#include <vtkDoubleArray.h>
+#include <vtkPolyData.h>
+#include <vtkPointData.h>
+
+#include <vtkCell.h>
+#include <vtkCellData.h>
+#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()
+ {
+ }
+
+ 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;
+ }
+
+ void MaracasTubeFilter::SetlstRadius( std::vector<double> lstRadius )
+ {
+ this->lstRadius=lstRadius;
+ }
+
+
+ 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;
+
+ // Create points and cells
+ vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
+ for(i = 0; i < lstPointX.size(); i++)
+ {
+ points->InsertPoint(i, lstPointX[i], lstPointY[i], lstPointZ[i]);
+ }
+
+ vtkSmartPointer<vtkCellArray> lines =
+ vtkSmartPointer<vtkCellArray>::New();
+ lines->InsertNextCell( lstPointX.size() );
+ for (i = 0; i < lstPointX.size(); i++)
+ {
+ lines->InsertCellPoint(i);
+ }
+
+ vtkSmartPointer<vtkPolyData> polyData =
+ vtkSmartPointer<vtkPolyData>::New();
+ polyData->SetPoints(points);
+ polyData->SetLines(lines);
+
+
+ // Varying tube radius using sine-function
+ vtkSmartPointer<vtkDoubleArray> tubeRadius =
+ vtkSmartPointer<vtkDoubleArray>::New();
+ tubeRadius->SetName("TubeRadius");
+ tubeRadius->SetNumberOfTuples( lstRadius.size() );
+ for (i=0 ;i<lstRadius.size() ; i++)
+ {
+ tubeRadius->SetTuple1(i, lstRadius[i] );
+ }
+ polyData->GetPointData()->AddArray(tubeRadius);
+ polyData->GetPointData()->SetActiveScalars("TubeRadius");
+
+ // RBG array (could add Alpha channel too I guess...)
+ // Varying from blue to red
+ vtkSmartPointer<vtkUnsignedCharArray> colors =
+ vtkSmartPointer<vtkUnsignedCharArray>::New();
+ colors->SetName("Colors");
+ colors->SetNumberOfComponents(3);
+ colors->SetNumberOfTuples( lstPointX.size() );
+ for (i = 0; i < lstPointX.size() ;i++)
+ {
+ colors->InsertTuple3(i, 255 , 0.0 , 0.0 );
+ }
+ polyData->GetPointData()->AddArray(colors);
+
+ vtkSmartPointer<vtkTubeFilter> tube
+ = vtkSmartPointer<vtkTubeFilter>::New();
+ tube->SetInput(polyData);
+ tube->SetNumberOfSides(nTv);
+ tube->SetVaryRadiusToVaryRadiusByAbsoluteScalar();
+
+ vtkSmartPointer<vtkPolyDataMapper> mapper =
+ vtkSmartPointer<vtkPolyDataMapper>::New();
+ mapper->SetInputConnection(tube->GetOutputPort());
+ mapper->ScalarVisibilityOn();
+ mapper->SetScalarModeToUsePointFieldData();
+ mapper->SelectColorArray("Colors");
+
+ vtkSmartPointer<vtkActor> actor =
+ vtkSmartPointer<vtkActor>::New();
+ actor->SetMapper(mapper);
+
+ renderer->AddActor(actor);
+ }
+
+
+
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,TubeFilter)
+BBTK_BLACK_BOX_IMPLEMENTATION(TubeFilter,bbtk::AtomicBlackBox);
+//=====
+// 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::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+
+ printf("EED TubeFilter::Process start \n");
+
+ tubefilter->SetvtkRenderer( bbGetInputRenderer() );
+ tubefilter->SetlstPoints( bbGetInputlstPointX(), bbGetInputlstPointY(), bbGetInputlstPointZ() );
+ tubefilter->SetlstRadius( bbGetInputlstRadio() );
+ tubefilter->Run();
+ bbSetOutputOutAxis( NULL );
+
+ 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);
+
+}
+//=====
+// 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();
+
+}
+//=====
+// 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
+
+
--- /dev/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)
+//=====
+#ifndef __bbcreaMaracasVisuTubeFilter_h_INCLUDED__
+#define __bbcreaMaracasVisuTubeFilter_h_INCLUDED__
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include <vtkProp3D.h>
+#include <vtkRenderer.h>
+#include <vtkTransform.h>
+
+namespace bbcreaMaracasVisu
+{
+
+ class MaracasTubeFilter
+ {
+ public:
+ MaracasTubeFilter();
+ ~MaracasTubeFilter();
+
+ void SetvtkRenderer( vtkRenderer *render);
+ void SetlstPoints( std::vector<double> lstPointX , std::vector<double> lstPointY , std::vector<double> lstPointZ );
+ void SetlstRadius( std::vector<double> lstRadius );
+ void Run();
+
+ vtkRenderer *renderer;
+
+ std::vector<double> lstPointX;
+ std::vector<double> lstPointY;
+ std::vector<double> lstPointZ;
+ std::vector<double> lstRadius;
+
+ };
+
+class bbcreaMaracasVisu_EXPORT TubeFilter
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(TubeFilter,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+ BBTK_DECLARE_INPUT(Renderer ,vtkRenderer*);
+ BBTK_DECLARE_INPUT(lstPointX,std::vector<double>);
+ BBTK_DECLARE_INPUT(lstPointY,std::vector<double>);
+ BBTK_DECLARE_INPUT(lstPointZ,std::vector<double>);
+ BBTK_DECLARE_INPUT(lstRadio ,std::vector<double>);
+ BBTK_DECLARE_INPUT(Colour ,std::vector<double>);
+ BBTK_DECLARE_INPUT(Transform, vtkLinearTransform *);
+ BBTK_DECLARE_OUTPUT(OutAxis,vtkProp3D *);
+ BBTK_PROCESS(Process);
+ void Process();
+
+ MaracasTubeFilter *tubefilter;
+
+//=====
+// 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)
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(TubeFilter,bbtk::AtomicBlackBox);
+ BBTK_NAME("TubeFilter");
+ BBTK_AUTHOR("Info-Dev");
+ BBTK_DESCRIPTION("vtk Tube Filter");
+ BBTK_CATEGORY("actor");
+ BBTK_INPUT(TubeFilter,Renderer,"Renderer",vtkRenderer*,"");
+ BBTK_INPUT(TubeFilter,lstPointX,"lstPointX",std::vector<double>,"");
+ BBTK_INPUT(TubeFilter,lstPointY,"lstPointY",std::vector<double>,"");
+ BBTK_INPUT(TubeFilter,lstPointZ,"lstPointZ",std::vector<double>,"");
+ BBTK_INPUT(TubeFilter,lstRadio,"lstRadio",std::vector<double>,"");
+ BBTK_INPUT(TubeFilter,Colour,"Colour",std::vector<double>,"");
+ BBTK_INPUT(TubeFilter,Transform,"vtkTransform", vtkLinearTransform *,"");
+ BBTK_OUTPUT(TubeFilter,OutAxis,"Tube Actor",vtkProp3D *,"");
+ BBTK_END_DESCRIBE_BLACK_BOX(TubeFilter);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuTubeFilter_h_INCLUDED__
+
BBTK_BLACK_BOX_IMPLEMENTATION(DrawAxe3D,bbtk::AtomicBlackBox);
void DrawAxe3D::Process()
{
+ printf("EED DrawAxe3D::Process start \n");
+
std::vector< double > vectx = bbGetInputlstPointX();
std::vector< double > vecty = bbGetInputlstPointY();
std::vector< double > vectz = bbGetInputlstPointZ();
firsttime=false;
bbGetInputRenderer()->AddActor( mvtkactor );
}
+
+ printf("EED DrawAxe3D::Process end \n");
+
}
void DrawAxe3D::bbUserSetDefaultValues()
BBTK_AUTHOR("InfoTeam CREATIS-LRMN");
BBTK_DESCRIPTION("Draw Axis Tree 3D");
BBTK_CATEGORY("actor");
-BBTK_INPUT(DrawAxisTree3D,Renderer,"Renderer",vtkRenderer*,"");
-BBTK_INPUT(DrawAxisTree3D,lstIndexs,"Indexs",std::vector<int>,"");
-BBTK_INPUT(DrawAxisTree3D,lstPointX,"lstPointX",std::vector<double>,"");
-BBTK_INPUT(DrawAxisTree3D,lstPointY,"lstPointY",std::vector<double>,"");
-BBTK_INPUT(DrawAxisTree3D,lstPointZ,"lstPointZ",std::vector<double>,"");
-BBTK_INPUT(DrawAxisTree3D,lstRadio,"lstRadio",std::vector<double>,"");
-BBTK_INPUT(DrawAxisTree3D,Colour,"Colour",std::vector<double>,"");
-BBTK_INPUT(DrawAxisTree3D,Transform,"vtkTransform", vtkLinearTransform *,"");
-BBTK_INPUT(DrawAxisTree3D,iAxis,"iAxis",int,"");
-BBTK_OUTPUT(DrawAxisTree3D,OutAxis,"Axis[iAxis]",vtkProp3D *,"");
+ BBTK_INPUT(DrawAxisTree3D,Renderer,"Renderer",vtkRenderer*,"");
+ BBTK_INPUT(DrawAxisTree3D,lstIndexs,"Indexs",std::vector<int>,"");
+ BBTK_INPUT(DrawAxisTree3D,lstPointX,"lstPointX",std::vector<double>,"");
+ BBTK_INPUT(DrawAxisTree3D,lstPointY,"lstPointY",std::vector<double>,"");
+ BBTK_INPUT(DrawAxisTree3D,lstPointZ,"lstPointZ",std::vector<double>,"");
+ BBTK_INPUT(DrawAxisTree3D,lstRadio,"lstRadio",std::vector<double>,"");
+ BBTK_INPUT(DrawAxisTree3D,Colour,"Colour",std::vector<double>,"");
+ BBTK_INPUT(DrawAxisTree3D,Transform,"vtkTransform", vtkLinearTransform *,"");
+ BBTK_INPUT(DrawAxisTree3D,iAxis,"iAxis",int,"");
+ BBTK_OUTPUT(DrawAxisTree3D,OutAxis,"Axis[iAxis]",vtkProp3D *,"");
BBTK_END_DESCRIBE_BLACK_BOX(DrawAxisTree3D);
}
// EO namespace bbcreaMaracasVisu