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 "bbwtObject3D.h"
5 #include "bbwtPackage.h"
6 #include "bbtkUtilities.h"
12 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,Object3D)
13 BBTK_BLACK_BOX_IMPLEMENTATION(Object3D,bbtk::WtBlackBox);
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)
17 void Object3D::Process()
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
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");
47 //w->doJavaScript("var r = new X.renderer3D();r.container = " + w->id() + ";r.init();r.add("+w->jsRef()+".mObject);r.render();");
51 void Object3D::CreateWidget(Wt::WContainerWidget* parent)
53 //std::cout<<"DEBUG -------------------------------------------- 5 -----------------"<<std::endl;
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;
69 std::cout<<" --------- Object creado con ref : "<<w->jsRef()<<std::endl;
71 bbSetOutputReference(w->jsRef());
72 bbSetOutputWidget( w );
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)
80 void Object3D::bbUserSetDefaultValues()
83 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
84 // Here we initialize the input 'In' to 0
88 bbSetOutputReference("");
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)
95 void Object3D::bbUserInitializeProcessing()
98 // THE INITIALIZATION METHOD BODY :
100 // but this is where you should allocate the internal/output pointers
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)
108 void Object3D::bbUserFinalizeProcessing()
111 // THE FINALIZATION METHOD BODY :
113 // but this is where you should desallocate the internal/output pointers