//=====
// 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 ManualContourModel_Box::Process()
+
+
+void ManualContourModel_Box::ProcessBySegment(
+ int Type,
+ int &iGeneral, int sizeSegment,
+ std::vector<double> *lstInX,std::vector<double> *lstInY, std::vector<double> *lstInZ,
+ std::vector<double> *lstOutX,std::vector<double> *lstOutY, std::vector<double> *lstOutZ,
+ std::vector<int> *lstIndexsOut )
{
+ creaContoursFactory f;
+ manualContourModel *m;
+ int i,size=iGeneral+sizeSegment;
+
+ double x,y,z;
+
+ m = (manualContourModel*)f.getContourModel( bbGetInputType() );
+ m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
+ m->SetCloseContour( bbGetInputOpenClose() );
+ for (i=iGeneral;i<size;i++)
+ {
+ m->AddPoint( (*lstInX)[i] , (*lstInY)[i] , (*lstInZ)[i] );
+ } // for
+ m->UpdateSpline();
+ int sizeContour = bbGetInputNbPoints();
+ for (i=0;i<sizeContour;i++)
+ {
+ m->GetSpline_i_Point(i,&x,&y,&z);
+ lstOutX->push_back(x);
+ lstOutY->push_back(y);
+ lstOutZ->push_back(z);
+ } // for
+ iGeneral=iGeneral+sizeSegment;
+ lstIndexsOut->push_back( sizeContour );
+ delete m;
+}
+void ManualContourModel_Box::Process()
+{
// THE MAIN PROCESSING METHOD BODY
// Here we simply set the input 'In' value to the output 'Out'
// And print out the output value
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-
- creaContoursFactory f;
- manualContourModel *m;
- std::vector<double> lstX;
- std::vector<double> lstY;
- std::vector<double> lstZ;
- int i,size;
- double x,y,z;
- m = (manualContourModel*)f.getContourModel( bbGetInputType() );
- m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
- m->SetCloseContour( bbGetInputOpenClose() );
- size = bbGetInputLstControlPointsX().size();
- for (i=0;i<size;i++)
+
+ std::vector<double> lstInX=bbGetInputLstControlPointsX();
+ std::vector<double> lstInY=bbGetInputLstControlPointsY();
+ std::vector<double> lstInZ=bbGetInputLstControlPointsZ();
+
+ if ( (lstInX.size()!=lstInY.size()) || (lstInY.size()!=lstInZ.size()) )
+ {
+ printf("Warnning !! .. ManualContourModel_Box: The list X Y Z, no have the same number of elements \n");
+ return;
+ }
+
+ std::vector<int> lstIndexsIn=bbGetInputLstIndexsIn();
+ std::vector<int> lstIndexsOut;
+ std::vector<double> lstOutX;
+ std::vector<double> lstOutY;
+ std::vector<double> lstOutZ;
+
+ if (bbGetInputLstIndexsIn().size()==0)
{
-// m->InsertPoint( bbGetInputLstControlPointsX()[i] , bbGetInputLstControlPointsY()[i] , bbGetInputLstControlPointsZ()[i] );
- m->AddPoint( bbGetInputLstControlPointsX()[i] , bbGetInputLstControlPointsY()[i] , bbGetInputLstControlPointsZ()[i] );
- } // for
- m->UpdateSpline();
- size = bbGetInputNbPoints();
+ lstIndexsIn.push_back( lstInX.size() );
+ }
+
+ int i,size=lstIndexsIn.size();
+ int iGeneral=0;
for (i=0;i<size;i++)
{
- m->GetSpline_i_Point(i,&x,&y,&z);
- lstX.push_back(x);
- lstY.push_back(y);
- lstZ.push_back(z);
+ ProcessBySegment( bbGetInputType() ,
+ iGeneral, lstIndexsIn[i] ,
+ &lstInX,&lstInY,&lstInZ,
+ &lstOutX,&lstOutY,&lstOutZ,
+ &lstIndexsOut);
} // for
- bbSetOutputLstContourPointsX(lstX);
- bbSetOutputLstContourPointsY(lstY);
- bbSetOutputLstContourPointsZ(lstZ);
-
- delete m;
+ bbSetOutputLstContourPointsX(lstOutX);
+ bbSetOutputLstContourPointsY(lstOutY);
+ bbSetOutputLstContourPointsZ(lstOutZ);
+ bbSetOutputLstIndexsOut(lstIndexsOut);
}
//=====
BBTK_DECLARE_INPUT(Type,int);
BBTK_DECLARE_INPUT(OpenClose,bool);
BBTK_DECLARE_INPUT(NbPoints,int);
+
+ BBTK_DECLARE_INPUT(LstIndexsIn,std::vector<int>);
+
BBTK_DECLARE_INPUT(LstControlPointsX,std::vector<double>);
BBTK_DECLARE_INPUT(LstControlPointsY,std::vector<double>);
BBTK_DECLARE_INPUT(LstControlPointsZ,std::vector<double>);
+
BBTK_DECLARE_OUTPUT(LstContourPointsX,std::vector<double>);
BBTK_DECLARE_OUTPUT(LstContourPointsY,std::vector<double>);
BBTK_DECLARE_OUTPUT(LstContourPointsZ,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(LstIndexsOut,std::vector<int>);
BBTK_PROCESS(Process);
void Process();
+
+
+ void ProcessBySegment(
+ int Type,
+ int &iGeneral, int sizeSegment,
+ std::vector<double> *lstInX,std::vector<double> *lstInY, std::vector<double> *lstInZ,
+ std::vector<double> *lstOutX,std::vector<double> *lstOutY, std::vector<double> *lstOutZ,
+ std::vector<int> *lstIndexsOut );
+
+
//=====
// 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_INPUT(ManualContourModel_Box,Type,"(1 default) 1=spline, 2=rectangle, 3=circle, 4=bullEye, 6=Line, 7=points, 8=rotationTool, 10=polygon, 12=Spline3D",int,"");
BBTK_INPUT(ManualContourModel_Box,OpenClose,"(false default) false=open, true=close",bool,"");
BBTK_INPUT(ManualContourModel_Box,NbPoints,"(100 default) Number of points int the spline",int,"");
+ BBTK_INPUT(ManualContourModel_Box,LstIndexsIn,"Lst number of points by segment",std::vector<int>,"");
+
BBTK_INPUT(ManualContourModel_Box,LstControlPointsX,"List of control points",std::vector<double>,"");
BBTK_INPUT(ManualContourModel_Box,LstControlPointsY,"List of control points",std::vector<double>,"");
BBTK_INPUT(ManualContourModel_Box,LstControlPointsZ,"List of control points",std::vector<double>,"");
BBTK_OUTPUT(ManualContourModel_Box,LstContourPointsX,"List of points in the contour",std::vector<double>,"");
BBTK_OUTPUT(ManualContourModel_Box,LstContourPointsY,"List of points in the contour",std::vector<double>,"");
BBTK_OUTPUT(ManualContourModel_Box,LstContourPointsZ,"List of points in the contour",std::vector<double>,"");
+ BBTK_OUTPUT(ManualContourModel_Box,LstIndexsOut,"Lst number of points by segment",std::vector<int>,"");
BBTK_END_DESCRIBE_BLACK_BOX(ManualContourModel_Box);
//=====