2 // 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)
4 #include "bbcreaMaracasVisuManualContourModel_Box.h"
5 #include "bbcreaMaracasVisuPackage.h"
7 #include <creaContoursFactory.h>
10 namespace bbcreaMaracasVisu
13 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualContourModel_Box)
14 BBTK_BLACK_BOX_IMPLEMENTATION(ManualContourModel_Box,bbtk::AtomicBlackBox);
16 // 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)
20 void ManualContourModel_Box::ProcessBySegment(
22 int &iGeneral, int sizeSegment,
23 std::vector<double> *lstInX,std::vector<double> *lstInY, std::vector<double> *lstInZ,
24 std::vector<double> *lstOutX,std::vector<double> *lstOutY, std::vector<double> *lstOutZ,
25 std::vector<int> *lstIndexsOut )
27 creaContoursFactory f;
28 manualContourModel *m;
29 int i,size=iGeneral+sizeSegment;
33 m = (manualContourModel*)f.getContourModel( bbGetInputType() );
34 m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
35 m->SetCloseContour( bbGetInputOpenClose() );
36 for (i=iGeneral;i<size;i++)
38 m->AddPoint( (*lstInX)[i] , (*lstInY)[i] , (*lstInZ)[i] );
41 int sizeContour = bbGetInputNbPoints();
42 for (i=0;i<sizeContour;i++)
44 m->GetSpline_i_Point(i,&x,&y,&z);
45 lstOutX->push_back(x);
46 lstOutY->push_back(y);
47 lstOutZ->push_back(z);
49 iGeneral=iGeneral+sizeSegment;
50 lstIndexsOut->push_back( sizeContour );
54 void ManualContourModel_Box::Process()
56 // THE MAIN PROCESSING METHOD BODY
57 // Here we simply set the input 'In' value to the output 'Out'
58 // And print out the output value
59 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
60 // void bbSet{Input|Output}NAME(const TYPE&)
61 // const TYPE& bbGet{Input|Output}NAME() const
63 // * NAME is the name of the input/output
64 // (the one provided in the attribute 'name' of the tag 'input')
65 // * TYPE is the C++ type of the input/output
66 // (the one provided in the attribute 'type' of the tag 'input')
68 // bbSetOutputOut( bbGetInputIn() );
69 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
72 std::vector<double> lstInX=bbGetInputLstControlPointsX();
73 std::vector<double> lstInY=bbGetInputLstControlPointsY();
74 std::vector<double> lstInZ=bbGetInputLstControlPointsZ();
76 if ( (lstInX.size()!=lstInY.size()) || (lstInY.size()!=lstInZ.size()) )
78 printf("Warnning !! .. ManualContourModel_Box: The list X Y Z, no have the same number of elements \n");
82 std::vector<int> lstIndexsIn=bbGetInputLstIndexsIn();
83 std::vector<int> lstIndexsOut;
84 std::vector<double> lstOutX;
85 std::vector<double> lstOutY;
86 std::vector<double> lstOutZ;
88 if (bbGetInputLstIndexsIn().size()==0)
90 lstIndexsIn.push_back( lstInX.size() );
93 int i,size=lstIndexsIn.size();
97 ProcessBySegment( bbGetInputType() ,
98 iGeneral, lstIndexsIn[i] ,
99 &lstInX,&lstInY,&lstInZ,
100 &lstOutX,&lstOutY,&lstOutZ,
103 bbSetOutputLstContourPointsX(lstOutX);
104 bbSetOutputLstContourPointsY(lstOutY);
105 bbSetOutputLstContourPointsZ(lstOutZ);
106 bbSetOutputLstIndexsOut(lstIndexsOut);
110 // 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)
112 void ManualContourModel_Box::bbUserSetDefaultValues()
115 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
116 // Here we initialize the input 'In' to 0
118 bbSetInputOpenClose(false);
119 bbSetInputNbPoints(100);
123 // 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)
125 void ManualContourModel_Box::bbUserInitializeProcessing()
128 // THE INITIALIZATION METHOD BODY :
130 // but this is where you should allocate the internal/output pointers
136 // 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)
138 void ManualContourModel_Box::bbUserFinalizeProcessing()
141 // THE FINALIZATION METHOD BODY :
143 // but this is where you should desallocate the internal/output pointers
148 // EO namespace bbcreaMaracasVisu