]> Creatis software - creaWT.git/blob - wt/bbtk_wt_PKG/src/bbwtObject3D.cxx
2498 BBTK FeatureNewNormal wt-version PackageWt
[creaWT.git] / wt / bbtk_wt_PKG / src / bbwtObject3D.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 "bbwtObject3D.h"
5 #include "bbwtPackage.h"
6 #include "bbtkUtilities.h"
7
8
9 namespace bbwt
10 {
11
12 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,Object3D)
13 BBTK_BLACK_BOX_IMPLEMENTATION(Object3D,bbtk::WtBlackBox);
14 //===== 
15 // 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)
16 //===== 
17 void Object3D::Process()
18 {
19
20 // THE MAIN PROCESSING METHOD BODY
21 //   Here we simply set the input 'In' value to the output 'Out'
22 //   And print out the output value
23 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
24 //    void bbSet{Input|Output}NAME(const TYPE&)
25 //    const TYPE& bbGet{Input|Output}NAME() const 
26 //    Where :
27 //    * NAME is the name of the input/output
28 //      (the one provided in the attribute 'name' of the tag 'input')
29 //    * TYPE is the C++ type of the input/output
30 //      (the one provided in the attribute 'type' of the tag 'input')
31         //std::cout<<"DEBUG --------------------------------------------   7    -----------------"<<std::endl;
32         Wt::WContainerWidget *w = (Wt::WContainerWidget*)bbGetOutputWidget();
33 //      w->doJavaScript("alert('EXISTE   " + w->jsRef() + " ---' + " + w->jsRef() + ".mObject.classname);");
34         //std::cout<<"Existe  ++++++++++++++++++++++ " + w->jsRef()<<std::endl;
35         //std::cout<<"DEBUG    XTK  ----  PROCESS OBJECT --- "<<w->jsRef() + ".mObject.file = '" + bbGetInputImage() + "';"<<std::endl;
36         std::string cadena = "\
37                                                                 var mObject = " + w->jsRef() + ".mObject; \
38                                                                 mObject.file = '" + bbGetInputImage() + "'; \
39                                                                 " + w->jsRef() + ".mObject  = mObject;";
40         w->doJavaScript(cadena);
41         //w->doJavaScript(w->jsRef() + ".mObject.file = '" + bbGetInputImage() + "';");
42         //w->doJavaScript("alert('EXISTE   ---' + " + w->jsRef() + ".mObject.classname + ' -----' + "+w->jsRef()+".mObject.file);");
43         std::cout<<"                ---------  Object modificado con ref  :   "<<w->jsRef()<<std::endl;
44         //std::cout<<"DEBUG --------------------------------------------   8    -----------------"<<std::endl;
45         //bbSignalOutputModification("Out");    
46 //JFGA
47         //w->doJavaScript("var r = new X.renderer3D();r.container = " + w->id() + ";r.init();r.add("+w->jsRef()+".mObject);r.render();");
48
49 }
50
51 void Object3D::CreateWidget(Wt::WContainerWidget* parent)
52 {
53         //std::cout<<"DEBUG --------------------------------------------   5    -----------------"<<std::endl;
54
55         //std::cout<<"DEBUG    XTK  ---- CREANDO OBJETO  START------------ "<<std::endl;
56         Wt::WContainerWidget* w = new Wt::WContainerWidget(parent);
57         std::string tipo = "";
58         if (bbtk::Utilities::loosematch(bbGetInputType(),"m|M|Mesh|MESH")==true)  { tipo = "mesh"; }
59         if (bbtk::Utilities::loosematch(bbGetInputType(),"v|V|Volume|VOLUME")==true)  { tipo = "volume"; }
60         if (bbtk::Utilities::loosematch(bbGetInputType(),"f|F|Fibers|FIBERS")==true)  { tipo = "fibers"; }
61         std::string cadena = "          \
62                                                                                         var mObject = new X." + tipo+ "();              \
63                                                                                         " + w->jsRef() +".mObject       = mObject;";
64         w->doJavaScript(cadena);
65         //w->doJavaScript("alert(" + w->jsRef() + ".mObject.classname);");
66         //std::cout<<"DEBUG    XTK  ---- CREANDO OBJETO    DONE------------ "<<cadena<<std::endl;
67         //std::cout<<"DEBUG --------------------------------------------   6    -----------------"<<std::endl;
68
69         std::cout<<"         ---------  Object creado con ref  :   "<<w->jsRef()<<std::endl;
70
71         bbSetOutputReference(w->jsRef());
72         bbSetOutputWidget( w );
73         //Process();
74
75 }
76
77 //===== 
78 // 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)
79 //===== 
80 void Object3D::bbUserSetDefaultValues()
81 {
82
83 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
84 //    Here we initialize the input 'In' to 0
85   bbSetInputImage("");
86   bbSetInputType("");
87   bbSetOutputType("");
88   bbSetOutputReference("");
89
90   
91 }
92 //===== 
93 // 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)
94 //===== 
95 void Object3D::bbUserInitializeProcessing()
96 {
97
98 //  THE INITIALIZATION METHOD BODY :
99 //    Here does nothing 
100 //    but this is where you should allocate the internal/output pointers 
101 //    if any 
102
103   
104 }
105 //===== 
106 // 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)
107 //===== 
108 void Object3D::bbUserFinalizeProcessing()
109 {
110
111 //  THE FINALIZATION METHOD BODY :
112 //    Here does nothing 
113 //    but this is where you should desallocate the internal/output pointers 
114 //    if any
115   
116 }
117 }
118 // EO namespace bbwt
119
120