]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx
#2982 creaMaracasVisu Feature New Normal - ShowNPoints_model
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuManualContourModel_Box.cxx
1 //===== 
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)
3 //===== 
4 #include "bbcreaMaracasVisuManualContourModel_Box.h"
5 #include "bbcreaMaracasVisuPackage.h"
6
7 #include <creaContoursFactory.h>
8
9
10 namespace bbcreaMaracasVisu
11 {
12
13 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualContourModel_Box)
14 BBTK_BLACK_BOX_IMPLEMENTATION(ManualContourModel_Box,bbtk::AtomicBlackBox);
15 //===== 
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)
17 //===== 
18 void ManualContourModel_Box::Process()
19 {
20
21 // THE MAIN PROCESSING METHOD BODY
22 //   Here we simply set the input 'In' value to the output 'Out'
23 //   And print out the output value
24 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
25 //    void bbSet{Input|Output}NAME(const TYPE&)
26 //    const TYPE& bbGet{Input|Output}NAME() const 
27 //    Where :
28 //    * NAME is the name of the input/output
29 //      (the one provided in the attribute 'name' of the tag 'input')
30 //    * TYPE is the C++ type of the input/output
31 //      (the one provided in the attribute 'type' of the tag 'input')
32
33 //    bbSetOutputOut( bbGetInputIn() );
34 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
35         
36         creaContoursFactory f;
37         manualContourModel      *m;
38         std::vector<double> lstX;
39         std::vector<double> lstY;
40         std::vector<double> lstZ;
41         int i,size;
42         double x,y,z;
43
44         m = (manualContourModel*)f.getContourModel( bbGetInputType() );
45         m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
46         m->SetCloseContour( bbGetInputOpenClose() );
47         size = bbGetInputLstControlPointsX().size();
48         for (i=0;i<size;i++)
49         {
50                 m->InsertPoint( bbGetInputLstControlPointsX()[i] , bbGetInputLstControlPointsY()[i] , bbGetInputLstControlPointsZ()[i] );
51         } // for
52         m->UpdateSpline();
53         size = bbGetInputNbPoints();
54         for (i=0;i<size;i++)
55         {
56                 m->GetSpline_i_Point(i,&x,&y,&z);
57                 lstX.push_back(x);
58                 lstY.push_back(y);
59                 lstZ.push_back(z);
60         } // for
61         bbSetOutputLstContourPointsX(lstX);
62         bbSetOutputLstContourPointsY(lstY);
63         bbSetOutputLstContourPointsZ(lstZ);
64
65         delete m;
66
67 }
68 //===== 
69 // 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)
70 //===== 
71 void ManualContourModel_Box::bbUserSetDefaultValues()
72 {
73
74 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
75 //    Here we initialize the input 'In' to 0
76    bbSetInputType(1);
77    bbSetInputOpenClose(false);
78    bbSetInputNbPoints(100);
79   
80 }
81 //===== 
82 // 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)
83 //===== 
84 void ManualContourModel_Box::bbUserInitializeProcessing()
85 {
86
87 //  THE INITIALIZATION METHOD BODY :
88 //    Here does nothing 
89 //    but this is where you should allocate the internal/output pointers 
90 //    if any 
91
92   
93 }
94 //===== 
95 // 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)
96 //===== 
97 void ManualContourModel_Box::bbUserFinalizeProcessing()
98 {
99
100 //  THE FINALIZATION METHOD BODY :
101 //    Here does nothing 
102 //    but this is where you should desallocate the internal/output pointers 
103 //    if any
104   
105 }
106 }
107 // EO namespace bbcreaMaracasVisu
108
109