]> Creatis software - creaWT.git/blobdiff - wt/bbtk_wt_PKG/src/bbwtshape3D.cxx
2498 BBTK FeatureNewNormal wt-version PackageWt
[creaWT.git] / wt / bbtk_wt_PKG / src / bbwtshape3D.cxx
diff --git a/wt/bbtk_wt_PKG/src/bbwtshape3D.cxx b/wt/bbtk_wt_PKG/src/bbwtshape3D.cxx
new file mode 100644 (file)
index 0000000..5b560a0
--- /dev/null
@@ -0,0 +1,191 @@
+//===== 
+// 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)
+//===== 
+#include "bbwtshape3D.h"
+#include "bbwtPackage.h"
+#include "bbtkUtilities.h"
+
+namespace bbwt
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,shape3D)
+BBTK_BLACK_BOX_IMPLEMENTATION(shape3D,bbtk::WtBlackBox);
+//===== 
+// 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 shape3D::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+//   bbSetOutputOut( bbGetInputIn() );
+//  std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+       std::cout<<"JFGA shape3D::Process START"<<std::endl;
+       flip = flip *(-1);
+       Wt::WContainerWidget* w = (Wt::WContainerWidget*)bbGetOutputWidget();
+/**
+       
+                                                       skull.file = 'http://x.babymri.org/?skull.vtk';
+                                               r.add(skull);
+               
+
+       
+               
+                                               r.render();
+*/
+//w->doJavaScript("alert(window.rr.container);");
+//w->doJavaScript("skull3.file = 'http://x.babymri.org/?skull.vtk';\
+               window.rr.add(skull3);\
+               window.rr.render();");
+                       w->doJavaScript(w->jsRef() + ".skull.file = 'http://x.babymri.org/?skull.vtk';\
+                                       " + w->jsRef() + ".r.add("+ w->jsRef()+".skull);                        \
+                                       " + w->jsRef() + ".r.render();");
+
+       if(flip == -1)
+       {
+
+//                     w->doJavaScript("var skull = new X.mesh(); skull.file= 'http://x.babymri.org/?skull.vtk';window.rr.add(skull);window.rr.render();");
+       }
+       else
+       {
+//                     w->doJavaScript("var skull2 = new X.mesh();skull2.file= ''http://x.babymri.org/?lefthemisphere.smoothwm'';window.rr.add(skull2);window.rr.render();");
+       }
+//  w->doJavaScript("r.add(skull);");
+       //w->doJavaScript(";alert('-+++>  '+x+'<>'+y);");
+//     w->doJavaScript("r.render();");
+               std::cout<<"JFGA shape3D::Process END"<<std::endl;
+}
+
+//===== 
+// 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 shape3D::CreateWidget(Wt::WContainerWidget* parent)
+{
+
+
+       Wt::WContainerWidget* w = new Wt::WContainerWidget(parent);
+       //Wt::WText* text = new Wt::WText("<div id=\"3d\" style=\"background-color: #000; width: 100%; height: 70%; margin-bottom: 2px;\"></div>",w);
+
+//     std::string cadena ="var x = 100;\
+       //                              var y = 200;";
+
+
+       /*std::string cadena =   "                                      \
+                               goog.require('X.renderer3D');           \
+                               goog.require('X.cube');                 \
+                               goog.require('X.mesh');                 \
+                               var run = function() {                  \
+                                       window.r = new X.renderer3D();  \
+                                       r.container = 'r';              \
+                                       r.init();                       \
+                                       window.skull = new X.mesh();    \
+                               };                                      \
+                               var bot1 = function(){                  \
+                                       skull.file = 'http://x.babymri.org/?skull.vtk'; \
+                                       r.add(skull);                   \
+                                       r.render();                     \
+                               };                                      \
+                               var bot3 = function()                   \
+                               {                                       \
+                                       skull.file = 'mesh1.vtk';       \
+                                       r.add(skull);                   \
+                                       r.render();                     \
+                               };                                      \
+                               var bot2 = function(){                  \
+                                       r.removeAll()                   \                               };"*/
+/*     
+       std::string cadena =" \
+                       window.r = new X.renderer3D();  \
+                       r.container = '" +text->id()+ "';       \
+                       r.init();       \
+                       window.skull = new X.mesh();    \
+                       window.skull2 = new X.mesh();   \
+                               ";
+*/
+
+
+/*
+               std::string cadena =" \
+                       window.r = new X.renderer3D();  \
+                       r.container = '" +text->id()+ "';       \
+                       r.init();       \
+                       window.skull     = new X.mesh();        \
+                       skull.file='http://x.babymri.org/?skull.vtk';\
+                       r.add(skull);   \
+                       r.render()      \
+                               ";
+*/
+       std::string cadena =" \
+                       var r = new X.renderer3D();     \
+                       " + w->jsRef() + ".r = r;       \
+                       r.container = '" +w->id()+ "';  \
+                       r.init();       \
+                       var skull = new X.mesh();       \
+                       skull.file = 'http://x.babymri.org/?avf.vtk';\
+                       " + w->jsRef() + ".skull = skull;               \
+                       r.add(skull);   \
+                       r.render();     \
+                       window.rr = r; \
+                       window.skulll = skull; \
+                               ";
+//window.rr=r;
+       
+       std::cout<<"SHAPE 3d --- CADENA ----   "<<cadena<<std::endl;
+       std::cout<<"SHAPE 3d --- JSREF ----   "<<w->jsRef()<<std::endl;
+//     Wt::WWebWidget::jsStringLiteral(cadena);
+       w->doJavaScript(cadena);
+       bbSetOutputWidget( w );
+       //Process();
+       //Wt::WContainerWidget* l = (Wt::WContainerWidget*)bbGetOutputWidget();
+       //w->doJavaScript("x = 13; alert('Ahasora   ' + x + '  <>  ' + y);");
+}
+//===== 
+// 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 shape3D::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputShape("C");
+   flip = 1;
+  
+}
+//===== 
+// 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 shape3D::bbUserInitializeProcessing()
+{
+
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+
+  
+}
+//===== 
+// 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 shape3D::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbwt
+
+