From 2041845854a8995d3987de68896251ae72cc2eb4 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Tue, 25 Jun 2019 10:58:52 +0200 Subject: [PATCH] #3267 BBTK Feature New Normal - VectorFilterString Box --- packages/std/src/bbstdVectorFilterString.cxx | 128 +++++++++++++++++++ packages/std/src/bbstdVectorFilterString.h | 91 +++++++++++++ packages/vtk/src/bbvtkPolyDataToActor.cxx | 23 +++- packages/vtk/src/bbvtkSphereSource.xml | 3 + 4 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 packages/std/src/bbstdVectorFilterString.cxx create mode 100644 packages/std/src/bbstdVectorFilterString.h diff --git a/packages/std/src/bbstdVectorFilterString.cxx b/packages/std/src/bbstdVectorFilterString.cxx new file mode 100644 index 0000000..23adb9d --- /dev/null +++ b/packages/std/src/bbstdVectorFilterString.cxx @@ -0,0 +1,128 @@ +//===== +// 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 "bbstdVectorFilterString.h" +#include "bbstdPackage.h" +namespace bbstd +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,VectorFilterString) +BBTK_BLACK_BOX_IMPLEMENTATION(VectorFilterString,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 VectorFilterString::ConnectionRepetitions( std::vector vIn,std::vector *vOut ) +{ + int i,size=vIn.size(); + int itmp=0, acum=0; + std::string stmp; + for( i=0;ipush_back(std::to_string(acum)); + acum=1; + } + } // for + vOut->push_back(std::to_string(acum)); +} + +void VectorFilterString::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') + +// bbSetOutputOut( bbGetInputIn() ); +// std::cout << "Output value = " < vOut0; + std::vector vOut1; + std::vector vOut2; + std::vector vOut3; + std::vector vOut4; + std::vector vOut5; + std::vector vOut6; + std::vector vOut7; + std::vector vOut8; + std::vector vOut9; + ConnectionRepetitions( bbGetInputIn0() , &vOut0 ); + ConnectionRepetitions( bbGetInputIn1() , &vOut1 ); + ConnectionRepetitions( bbGetInputIn2() , &vOut2 ); + ConnectionRepetitions( bbGetInputIn3() , &vOut3 ); + ConnectionRepetitions( bbGetInputIn4() , &vOut4 ); + ConnectionRepetitions( bbGetInputIn5() , &vOut5 ); + ConnectionRepetitions( bbGetInputIn6() , &vOut6 ); + ConnectionRepetitions( bbGetInputIn7() , &vOut7 ); + ConnectionRepetitions( bbGetInputIn8() , &vOut8 ); + ConnectionRepetitions( bbGetInputIn9() , &vOut9 ); + bbSetOutputOut0( vOut0 ); + bbSetOutputOut1( vOut1 ); + bbSetOutputOut2( vOut2 ); + bbSetOutputOut3( vOut3 ); + bbSetOutputOut4( vOut4 ); + bbSetOutputOut5( vOut5 ); + bbSetOutputOut6( vOut6 ); + bbSetOutputOut7( vOut7 ); + bbSetOutputOut8( vOut8 ); + bbSetOutputOut9( vOut9 ); + } + + + +} +//===== +// 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 VectorFilterString::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputType(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 VectorFilterString::bbUserInitializeProcessing() +{ + +// THE INITIALIZATION METHOD BODY : +// Here does nothing +// but this is where you should allocate the internal/output pointers +// if any + + +} +//===== +// 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 VectorFilterString::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbstd + + diff --git a/packages/std/src/bbstdVectorFilterString.h b/packages/std/src/bbstdVectorFilterString.h new file mode 100644 index 0000000..dd61882 --- /dev/null +++ b/packages/std/src/bbstdVectorFilterString.h @@ -0,0 +1,91 @@ +//===== +// 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 __bbstdVectorFilterString_h_INCLUDED__ +#define __bbstdVectorFilterString_h_INCLUDED__ + +#include "bbstd_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +namespace bbstd +{ + +class bbstd_EXPORT VectorFilterString + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(VectorFilterString,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(In0,std::vector); + BBTK_DECLARE_INPUT(In1,std::vector); + BBTK_DECLARE_INPUT(In2,std::vector); + BBTK_DECLARE_INPUT(In3,std::vector); + BBTK_DECLARE_INPUT(In4,std::vector); + BBTK_DECLARE_INPUT(In5,std::vector); + BBTK_DECLARE_INPUT(In6,std::vector); + BBTK_DECLARE_INPUT(In7,std::vector); + BBTK_DECLARE_INPUT(In8,std::vector); + BBTK_DECLARE_INPUT(In9,std::vector); + BBTK_DECLARE_INPUT(Type,int); + + BBTK_DECLARE_OUTPUT(Out0,std::vector); + BBTK_DECLARE_OUTPUT(Out1,std::vector); + BBTK_DECLARE_OUTPUT(Out2,std::vector); + BBTK_DECLARE_OUTPUT(Out3,std::vector); + BBTK_DECLARE_OUTPUT(Out4,std::vector); + BBTK_DECLARE_OUTPUT(Out5,std::vector); + BBTK_DECLARE_OUTPUT(Out6,std::vector); + BBTK_DECLARE_OUTPUT(Out7,std::vector); + BBTK_DECLARE_OUTPUT(Out8,std::vector); + BBTK_DECLARE_OUTPUT(Out9,std::vector); + BBTK_PROCESS(Process); + void Process(); + +void ConnectionRepetitions( std::vector vIn,std::vector *vOut ); + +//===== +// 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(VectorFilterString,bbtk::AtomicBlackBox); + BBTK_NAME("VectorFilterString"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(VectorFilterString,In0,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In1,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In2,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In3,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In4,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In5,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In6,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In7,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In8,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In9,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,Type,"(Default 0) 0:count connected repetitions",int,""); + + BBTK_OUTPUT(VectorFilterString,Out0,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out1,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out2,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out3,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out4,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out5,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out6,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out7,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out8,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out9,"First output",std::vector,""); + +BBTK_END_DESCRIBE_BLACK_BOX(VectorFilterString); +//===== +// 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 bbstd + +#endif // __bbstdVectorFilterString_h_INCLUDED__ + diff --git a/packages/vtk/src/bbvtkPolyDataToActor.cxx b/packages/vtk/src/bbvtkPolyDataToActor.cxx index ba44143..569bcb2 100644 --- a/packages/vtk/src/bbvtkPolyDataToActor.cxx +++ b/packages/vtk/src/bbvtkPolyDataToActor.cxx @@ -43,10 +43,12 @@ #include "vtkProperty.h" #include "vtkLinearTransform.h" +#include "vtkCleanPolyData.h" #include "bbvtkPolyDataToActor.h" #include "bbvtkPackage.h" +#include "vtkRenderWindow.h" namespace bbvtk { @@ -107,13 +109,32 @@ namespace bbvtk void PolyDataToActor::DoProcess() { +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +//https://stackoverflow.com/questions/47528086/problems-with-rendering-transparent-objects-in-vtk +//https://itk.org/Wiki/VTK/Depth_Peeling +bbGetInputRenderer()->SetUseDepthPeeling(1); +bbGetInputRenderer()->SetOcclusionRatio(0.1); +bbGetInputRenderer()->SetMaximumNumberOfPeels(100); +bbGetInputRenderer()->GetRenderWindow()->SetMultiSamples(0); +bbGetInputRenderer()->GetRenderWindow()->SetAlphaBitPlanes(1); + + if (bbGetInputActive()==true) { + + //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 polydatamapper->SetInput( bbGetInputIn() ); #else - polydatamapper->SetInputData( bbGetInputIn() ); + polydatamapper->SetInputData( bbGetInputIn() ); #endif vtkactor->GetProperty()->SetRepresentation( bbGetInputRepresentation() ); diff --git a/packages/vtk/src/bbvtkSphereSource.xml b/packages/vtk/src/bbvtkSphereSource.xml index c526c82..50d2bc1 100644 --- a/packages/vtk/src/bbvtkSphereSource.xml +++ b/packages/vtk/src/bbvtkSphereSource.xml @@ -39,6 +39,9 @@ if (bbGetInputActive()==true)
   bbSetInputActive(true);
   bbSetInputRadius(10);
+  bbSetInputCenterX(0);
+  bbSetInputCenterY(0);
+  bbSetInputCenterZ(0);
   bbSetInputPhiResolution(10);
   bbSetInputThetaResolution(10);
 
-- 2.45.1