--- /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 "bbstdVectorFilterDouble.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,VectorFilterDouble)
+BBTK_BLACK_BOX_IMPLEMENTATION(VectorFilterDouble,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 VectorFilterDouble::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')
+
+ std::vector< std::vector<double> * > pLstVec;
+ std::vector< std::vector<double> * > pLstVecOut;
+ std::vector<double> In0 = bbGetInputIn0();
+ std::vector<double> In1 = bbGetInputIn1();
+ std::vector<double> In2 = bbGetInputIn2();
+ std::vector<double> In3 = bbGetInputIn3();
+ std::vector<double> In4 = bbGetInputIn4();
+ std::vector<double> In5 = bbGetInputIn5();
+ std::vector<double> In6 = bbGetInputIn6();
+ std::vector<double> In7 = bbGetInputIn7();
+ std::vector<double> In8 = bbGetInputIn8();
+ std::vector<double> In9 = bbGetInputIn9();
+
+ if (bbGetInputIn0().size()!=0) { pLstVec.push_back( &In0 ); }
+ if (bbGetInputIn1().size()!=0) { pLstVec.push_back( &In1 ); }
+ if (bbGetInputIn2().size()!=0) { pLstVec.push_back( &In2 ); }
+ if (bbGetInputIn3().size()!=0) { pLstVec.push_back( &In3 ); }
+ if (bbGetInputIn4().size()!=0) { pLstVec.push_back( &In4 ); }
+ if (bbGetInputIn5().size()!=0) { pLstVec.push_back( &In5 ); }
+ if (bbGetInputIn6().size()!=0) { pLstVec.push_back( &In6 ); }
+ if (bbGetInputIn7().size()!=0) { pLstVec.push_back( &In7 ); }
+ if (bbGetInputIn8().size()!=0) { pLstVec.push_back( &In8 ); }
+ if (bbGetInputIn9().size()!=0) { pLstVec.push_back( &In9 ); }
+
+ std::vector<double> Out0;
+ std::vector<double> Out1;
+ std::vector<double> Out2;
+ std::vector<double> Out3;
+ std::vector<double> Out4;
+ std::vector<double> Out5;
+ std::vector<double> Out6;
+ std::vector<double> Out7;
+ std::vector<double> Out8;
+ std::vector<double> Out9;
+
+ pLstVecOut.push_back( &Out0 );
+ pLstVecOut.push_back( &Out1 );
+ pLstVecOut.push_back( &Out2 );
+ pLstVecOut.push_back( &Out3 );
+ pLstVecOut.push_back( &Out4 );
+ pLstVecOut.push_back( &Out5 );
+ pLstVecOut.push_back( &Out6 );
+ pLstVecOut.push_back( &Out7 );
+ pLstVecOut.push_back( &Out8 );
+ pLstVecOut.push_back( &Out9 );
+
+
+ if (bbGetInputType()==0) // Erase duplicate lines
+ {
+ bool okSizeVec=true;
+ int ipLstvec;
+ for (ipLstvec=1;ipLstvec<pLstVec.size();ipLstvec++)
+ {
+ if ( (*pLstVec[ipLstvec]).size()!=(*pLstVec[0]).size() ) { okSizeVec=false; }
+ }
+ if ( okSizeVec==false)
+ {
+ printf("EED VectorFilterDouble::Process WARNING! vectors are not of the same size.\n");
+ } else {
+ int iLine;
+ int ipLstvec2;
+ bool okLine;
+ for (iLine=0 ; iLine < (*pLstVec[0]).size() ; iLine++ )
+ {
+ okLine=false;
+ for ( ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+ {
+ if ( (*pLstVec[ipLstvec2])[iLine]!=(*pLstVec[ipLstvec2])[iLine-1] ) { okLine=true; }
+ } // for ipLstVec2
+
+ if ( (okLine==true) || (iLine==0) )
+ {
+ for (ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+ {
+ (*pLstVecOut[ipLstvec2]).push_back( (*pLstVec[ipLstvec2])[iLine] );
+ } // for
+ } // if okLine
+ } // for iLine
+ } // if okSizeVec
+ } // Type==0
+
+
+ if (bbGetInputType()==1) // Resize vector
+ {
+ int ipLstvec2;
+ double iLine;
+ int sizeLines = (*pLstVec[0]).size();
+ double step = (double)sizeLines/(double)bbGetInputk1();
+ for (iLine=0 ; iLine<sizeLines ; iLine=iLine+step)
+ {
+ for (ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+ {
+ (*pLstVecOut[ipLstvec2]).push_back( (*pLstVec[ipLstvec2])[(int)iLine] );
+ } // for
+ } // for ipLstVec
+ } // Type==1
+
+ if (bbGetInputType()==2) // Insert intermediate pointss
+ {
+ int ipLstvec;
+ int i;
+ int size;
+ double result;
+ for (ipLstvec=0 ; ipLstvec<pLstVec.size() ; ipLstvec++)
+ {
+ size=(*pLstVec[ipLstvec]).size();
+ if (size>=2)
+ {
+ for (i=0;i<size-1;i++)
+ {
+ (*pLstVecOut[ipLstvec]).push_back( (*pLstVec[ipLstvec])[i] ); // First item
+ result=((*pLstVec[ipLstvec])[i] + (*pLstVec[ipLstvec])[i+1] ) / 2;
+ (*pLstVecOut[ipLstvec]).push_back( result );
+ }// for size
+ (*pLstVecOut[ipLstvec]).push_back( (*pLstVec[ipLstvec])[size-1] ); // Last item
+ } // if size>=2
+ } // for pLstVec
+ } // Type==2
+
+
+ bbSetOutputOut0( Out0 );
+ bbSetOutputOut1( Out1 );
+ bbSetOutputOut2( Out2 );
+ bbSetOutputOut3( Out3 );
+ bbSetOutputOut4( Out4 );
+ bbSetOutputOut5( Out5 );
+ bbSetOutputOut6( Out6 );
+ bbSetOutputOut7( Out7 );
+ bbSetOutputOut8( Out8 );
+ bbSetOutputOut9( Out9 );
+}
+//=====
+// 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 VectorFilterDouble::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 VectorFilterDouble::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 VectorFilterDouble::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbstd
+
+
--- /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 __bbstdVectorFilterDouble_h_INCLUDED__
+#define __bbstdVectorFilterDouble_h_INCLUDED__
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT VectorFilterDouble
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(VectorFilterDouble,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(Type,int);
+ BBTK_DECLARE_INPUT(k1,double);
+ BBTK_DECLARE_INPUT(In0,std::vector<double>);
+ BBTK_DECLARE_INPUT(In1,std::vector<double>);
+ BBTK_DECLARE_INPUT(In2,std::vector<double>);
+ BBTK_DECLARE_INPUT(In3,std::vector<double>);
+ BBTK_DECLARE_INPUT(In4,std::vector<double>);
+ BBTK_DECLARE_INPUT(In5,std::vector<double>);
+ BBTK_DECLARE_INPUT(In6,std::vector<double>);
+ BBTK_DECLARE_INPUT(In7,std::vector<double>);
+ BBTK_DECLARE_INPUT(In8,std::vector<double>);
+ BBTK_DECLARE_INPUT(In9,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Out0,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Out1,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Out2,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Out3,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Out4,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Out5,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Out6,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Out7,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Out8,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Out9,std::vector<double>);
+ BBTK_PROCESS(Process);
+ void Process();
+//=====
+// 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(VectorFilterDouble,bbtk::AtomicBlackBox);
+ BBTK_NAME("VectorFilterDouble");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(VectorFilterDouble,Type,"default (0) 0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points",int,"");
+ BBTK_INPUT(VectorFilterDouble,k1,"default (0) nothing (Type0), k1=new size vectors (Type 1) , ",double,"");
+ BBTK_INPUT(VectorFilterDouble,In0,"Input vector",std::vector<double>,"");
+ BBTK_INPUT(VectorFilterDouble,In1,"Input vector",std::vector<double>,"");
+ BBTK_INPUT(VectorFilterDouble,In2,"Input vector",std::vector<double>,"");
+ BBTK_INPUT(VectorFilterDouble,In3,"Input vector",std::vector<double>,"");
+ BBTK_INPUT(VectorFilterDouble,In4,"Input vector",std::vector<double>,"");
+ BBTK_INPUT(VectorFilterDouble,In5,"Input vector",std::vector<double>,"");
+ BBTK_INPUT(VectorFilterDouble,In6,"Input vector",std::vector<double>,"");
+ BBTK_INPUT(VectorFilterDouble,In7,"Input vector",std::vector<double>,"");
+ BBTK_INPUT(VectorFilterDouble,In8,"Input vector",std::vector<double>,"");
+ BBTK_INPUT(VectorFilterDouble,In9,"Input vector",std::vector<double>,"");
+ BBTK_OUTPUT(VectorFilterDouble,Out0,"Output vector",std::vector<double>,"");
+ BBTK_OUTPUT(VectorFilterDouble,Out1,"Output vector",std::vector<double>,"");
+ BBTK_OUTPUT(VectorFilterDouble,Out2,"Output vector",std::vector<double>,"");
+ BBTK_OUTPUT(VectorFilterDouble,Out3,"Output vector",std::vector<double>,"");
+ BBTK_OUTPUT(VectorFilterDouble,Out4,"Output vector",std::vector<double>,"");
+ BBTK_OUTPUT(VectorFilterDouble,Out5,"Output vector",std::vector<double>,"");
+ BBTK_OUTPUT(VectorFilterDouble,Out6,"Output vector",std::vector<double>,"");
+ BBTK_OUTPUT(VectorFilterDouble,Out7,"Output vector",std::vector<double>,"");
+ BBTK_OUTPUT(VectorFilterDouble,Out8,"Output vector",std::vector<double>,"");
+ BBTK_OUTPUT(VectorFilterDouble,Out9,"Output vector",std::vector<double>,"");
+BBTK_END_DESCRIBE_BLACK_BOX(VectorFilterDouble);
+//=====
+// 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 // __bbstdVectorFilterDouble_h_INCLUDED__
+
{
pz = bbGetInputlstPointZ()[i]*spc[2];
}
-printf("EED SphereList::GetPoint() %f %f %f\n",px,py,pz);
}
}
}
-
-
void SphereList::Process()
{
-printf ("EED SphereList::Process Start\n");
- int iMin, iMax;
- double px = 0.0;
- double py = 0.0;
- double pz = 0.0;
-
- double cr = 0.0;
- double cg = 0.0;
- double cb = 0.0;
-
-/*
-== igualar la lista de objetos
- si la lista es igual nada que hacer
- si la nueva lista es las corta que la lista existente borrar los actores
- si la lista es mas larga que la lista existente crear los actores
-== acualizar la lista de objetos
-*/
-
-
if (bbGetInputRenderer()!=NULL)
{
-// If it is not the first time Process is executed, the actors have already been created. The only thing to do is to update the opacity.
- if (sphereActor.size() != 0)
- {
- for (int i = 0; i < sphereActor.size(); i++)
+ int sizeLstX=bbGetInputlstPointX().size();
+ int sizeLstY=bbGetInputlstPointY().size();
+ int sizeLstZ=bbGetInputlstPointZ().size();
+ int sizeLstActors=sphereActor.size();
+ if ((sizeLstX==sizeLstY) &&(sizeLstX==sizeLstZ))
+ {
+ if (sizeLstActors>sizeLstX)
+ {
+ int i;
+ int diff=sizeLstActors-sizeLstX;
+ for (i=0;i<diff;i++)
+ {
+ bbGetInputRenderer()->RemoveActor( sphereActor[0] );
+ vtkspheresourceLst[0]->Delete();
+ sphereActor[0]->Delete();
+ vtkspheresourceLst.erase( vtkspheresourceLst.begin() );
+ sphereActor.erase( sphereActor.begin() );
+ } // for
+ } // if size
+
+ if (sizeLstActors<sizeLstX)
+ {
+ int i;
+ int diff=sizeLstX-sizeLstActors;
+ for (i=0;i<diff;i++)
+ {
+ // Sphere
+ vtkSphereSource * newSphere = vtkSphereSource::New();
+ vtkspheresourceLst.push_back(newSphere);
+ newSphere -> SetThetaResolution(20);
+ newSphere -> SetPhiResolution(20);
+ newSphere -> SetRadius( 1 );
+ vtkPolyDataMapper * newMapper = vtkPolyDataMapper::New();
+ newMapper -> SetInput( newSphere -> GetOutput() );
+ vtkActor * newActor = vtkActor::New();
+ sphereActor.push_back(newActor);
+ newActor -> SetMapper(newMapper);
+ newActor -> SetOrigin(0, 0, 0);
+ if ( bbGetInputTransform()!=NULL )
+ {
+ newActor->SetUserTransform( bbGetInputTransform() );
+ }
+ bbGetInputRenderer()->AddActor( newActor );
+ } // for
+ } // if size
+
+ // Refresh data
+ for (int i = 0; i < sphereActor.size() ; i++)
{
+ double px = 0.0;
+ double py = 0.0;
+ double pz = 0.0;
+ double cr = 0.0;
+ double cg = 0.0;
+ double cb = 0.0;
GetPoint(i, px,py,pz);
GetColor(i, cr,cg,cb);
sphereActor[i] ->SetPosition( px,py,pz );
-printf("EED SphereList::Process() %f %f %f\n",px,py,pz);
sphereActor[i] -> GetProperty() -> SetOpacity( bbGetInputOpacity() );
sphereActor[i] -> GetProperty() -> SetColor( cr,cg,cb );
vtkspheresourceLst[i] -> SetRadius( GetRadio(i) );
} // for i
- } else {
- iMin=0;
- iMax=bbGetInputlstPointX().size();
-// printf("EED SphereList::Process iMax=%d \n", iMax);
-// for (int i = 0; i < iMax; i++)
-// {
-// std::cout << "CM SphereList::Process i=" << i << " bbGetInputlstPointX()[i]=" << bbGetInputlstPointX()[i] << std::endl;
-// std::cout << "CM SphereList::Process i=" << i << " bbGetInputlstPointY()[i]=" << bbGetInputlstPointY()[i] << std::endl;
-// std::cout << "CM SphereList::Process i=" << i << " bbGetInputlstPointZ()[i]=" << bbGetInputlstPointZ()[i] << std::endl;
-// } // for i
-
- // If the vector Y or respectively the vector Z has a different size from the vector X, the position value py or respectively pz is set to 0.
- for ( int i=iMin ; i<iMax; i=i+1 )
- {
- GetPoint(i, px,py,pz);
- GetColor(i, cr,cg,cb);
- // Sphere
- vtkSphereSource * newSphere = vtkSphereSource::New();
- vtkspheresourceLst.push_back(newSphere);
-
- newSphere -> SetThetaResolution(20);
- newSphere -> SetPhiResolution(20);
- newSphere -> SetRadius( GetRadio(i) );
- vtkPolyDataMapper * newMapper = vtkPolyDataMapper::New();
- newMapper -> SetInput( newSphere -> GetOutput() );
-
- vtkActor * newActor = vtkActor::New();
- sphereActor.push_back(newActor);
- newActor -> SetMapper(newMapper);
- newActor -> SetOrigin(0, 0, 0);
- newActor -> GetProperty() -> SetColor(cr,cg,cb);
- newActor -> GetProperty() -> SetOpacity( bbGetInputOpacity() );
- newActor -> SetPosition( px,py,pz );
-
- if ( bbGetInputTransform()!=NULL )
- {
- newActor->SetUserTransform( bbGetInputTransform() );
- }
-
- if (bbGetInputRenderer()!=NULL)
- {
- bbGetInputRenderer() -> AddActor( newActor );
- }
-
- } // for
-
- if (sphereActor.size() != 0)
+ if (sphereActor.size() != 0)
{
// Sets the output.
bbSetOutputActorList(sphereActor);
}
-
- } // if (sphereActor.size() != 0)
- } // if (bbGetInputRenderer()!=NULL)
+
+ } else {
+ printf("EED Warning! SphereList::Process Lst XYZ are not of the same size.\n");
+ }// if sizeLst
+ } else {
+ printf("EED Warning! SphereList::Process Render not assigned.\n");
+ }// if Renderer
-printf ("EED SphereList::Process END\n");
+//====================================================================
}
+
void SphereList::bbUserSetDefaultValues()
{