]> Creatis software - creaWT.git/blobdiff - wt/bbtk_wt_PKG/src/bbwtAddMesh.cxx
bugs wt xtk
[creaWT.git] / wt / bbtk_wt_PKG / src / bbwtAddMesh.cxx
diff --git a/wt/bbtk_wt_PKG/src/bbwtAddMesh.cxx b/wt/bbtk_wt_PKG/src/bbwtAddMesh.cxx
new file mode 100644 (file)
index 0000000..ef7f69d
--- /dev/null
@@ -0,0 +1,254 @@
+//===== 
+// 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 "bbwtAddMesh.h"
+#include "bbwtPackage.h"
+
+#include<Wt/WApplication>
+
+
+namespace bbwt
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,AddMesh)
+BBTK_BLACK_BOX_IMPLEMENTATION(AddMesh,bbtk::AtomicBlackBox);
+//===== 
+// 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 AddMesh::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')
+
+
+     printf("EED =====================================================AddMesh::Process() mesh %s\n", bbGetInputMesh().c_str() );
+
+
+
+
+     Wt::WContainerWidget* w = (Wt::WContainerWidget*)bbGetInputViewerWt();
+     char strPointer[15];
+     sprintf(strPointer,"%p",this);
+     std::string mMesh = w->jsRef() + ".mMesh"+strPointer;
+     std::string mCont = w->jsRef() + ".mCont"+strPointer;
+     std::string mRenderer = w->jsRef() + ".mRenderer";
+
+     printf("EED =====================================================AddMesh::Process() mMesh %s\n", mMesh.c_str() );
+
+
+      std::string jsCom = "\
+      try\
+      {\
+                       " + mCont+" = true;\
+      "+mMesh+".file = '"+bbGetInputMesh()+"';\
+      "+mMesh+".modified(true);\
+      "+mRenderer+".render();\
+      }\
+      catch(err)\
+      {\
+        var mMesh = new X.mesh();\
+                         " + mMesh+" = mMesh;\
+                         mMesh.file = '"+bbGetInputMesh()+"';\
+                         mMesh.color = [1,0.8,0];\
+                         mMesh.opacity=1;\
+                         " + mCont+" = false;\
+                         "+mRenderer+".onShowtime = function()\
+                          {\
+                           if(!" + mCont +")\
+                           {\
+                           }\
+                         };\
+                             " + mRenderer+".add( " + mMesh+");\
+                             " + mRenderer+".render();\
+                             " + mMesh+".transform.flipX();\
+                             " + mMesh+".transform.flipY();\
+                             " + mMesh+".transform.translateY(-10);\
+                             " + mRenderer+".render();\
+        }";
+
+         std::cout<<"DEBUG ADD OBJECT ----  "<<jsCom<<std::endl;
+  // w->doJavaScript(jsCom);
+     Wt::WApplication::instance()->doJavaScript(jsCom);
+
+
+
+
+
+
+/*
+
+      std::string jsCom = "\
+      try\
+      {\
+                       " + mCont+" = true;\
+      "+mMesh+".file = '"+bbGetInputMesh()+"';\
+      "+mMesh+".modified(true);\
+      "+w->jsRef()+".mRenderer.render();\
+      }\
+      catch(err)\
+      {\
+        var mMesh = new X.mesh();\
+                         " + mMesh+" = mMesh;\
+                         mMesh.file = '"+bbGetInputMesh()+"';\
+                         mMesh.color = [1,0.8,0];\
+                         mMesh.opacity=1;\
+                         " + mCont+" = false;\
+                         "+w->jsRef() +".mRenderer.onShowtime = function()\
+                          {\
+                           if(!" + mCont +")\
+                           {\
+                           }\
+                         };\
+                             " + mMesh+".transform.flipX();\
+                             " + mMesh+".transform.flipY();\
+                             " + mMesh+".transform.translateY(-10);\
+                          " + w->jsRef() +".mRenderer.add( " + mMesh+");\
+                             " + mMesh+".transform.flipX();\
+                             " + mMesh+".transform.flipY();\
+                             " + mMesh+".transform.translateY(-10);\
+                             " + mMesh+".visible = true;\
+      "+mMesh+".modified(true);\
+                         " + w->jsRef() + ".mRenderer.render();\
+        }";
+
+         std::cout<<"DEBUG ADD OBJECT ----  "<<jsCom<<std::endl;
+  // w->doJavaScript(jsCom);
+     Wt::WApplication::instance()->doJavaScript(jsCom);
+
+
+*/
+
+
+
+
+
+/*
+      std::string jsCom = "\
+      try\
+      {\
+                       " + mCont+" = true;\
+      "+mMesh+".file = '"+bbGetInputMesh()+"';\
+      "+mMesh+".modified(true);\
+      "+w->jsRef()+".mRenderer.render();\
+      }\
+      catch(err)\
+      {\
+        var mMesh = new X.mesh();\
+                         mMesh.file = '"+bbGetInputMesh()+"';\
+                         mMesh.color = [1,0.8,0];\
+                         mMesh.opacity=1;\
+                         " + mMesh+" = mMesh;\
+                         " + mCont+" = false;\
+                         "+w->jsRef() +".mRenderer.onShowtime = function()\
+                          {\
+                           if(!" + mCont +")\
+                           {\
+                             " + mMesh+".transform.flipX();\
+                             " + mMesh+".transform.flipY();\
+                             " + mMesh+".transform.translateY(-10);\
+                             " + mMesh+".visible = true;\
+                           }\
+                         };\
+                          " + w->jsRef() +".mRenderer.add( " + mMesh+");\
+                         " + w->jsRef() + ".mRenderer.render();\
+        }";
+
+         std::cout<<"DEBUG ADD OBJECT ----  "<<jsCom<<std::endl;
+  // w->doJavaScript(jsCom);
+     Wt::WApplication::instance()->doJavaScript(jsCom);
+*/
+
+  
+
+/*
+
+     Wt::WContainerWidget* w = (Wt::WContainerWidget*)bbGetInputViewerWt();
+                                               std::string jsCom = "\
+      try{\
+                       " + w->jsRef() + ".cont = true;\
+      " + w->jsRef() + ".mMesh.file = '"+bbGetInputMesh()+"';\
+      "+w->jsRef() +".mRenderer.add( " + w->jsRef() + ".mMesh);\
+      "+w->jsRef()+".mRenderer.render();\
+      }\
+      catch(err)\
+      {\
+        var mMesh = new X.mesh();\
+                         mMesh.file = '"+bbGetInputMesh()+"';\
+                         mMesh.color = [1,0.8,0];\
+                         mMesh.opacity=1;\
+                         " + w->jsRef() + ".mMesh = mMesh;\
+                         " + w->jsRef() + ".cont = false;\
+                         "+w->jsRef() +".mRenderer.onShowtime = function() {\
+                         if(!" + w->jsRef() + ".cont)\
+                         {\
+                         " + w->jsRef() + ".mMesh.transform.flipX();\
+                         " + w->jsRef() + ".mMesh.transform.flipY();\
+                         " + w->jsRef() + ".mMesh.transform.translateY(-10);\
+                         " + w->jsRef() + ".mMesh.visible = true;\
+                         }\
+                         };\
+                         " + w->jsRef() + ".mMesh.modified(true);\
+                         " + w->jsRef() + ".mRenderer.render();\
+                         }";
+
+         std::cout<<"DEBUG ADD OBJECT ----  "<<jsCom<<std::endl;
+  // w->doJavaScript(jsCom);
+     Wt::WApplication::instance()->doJavaScript(jsCom);
+
+*/
+
+
+
+
+}
+//===== 
+// 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 AddMesh::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputMesh("<void>");
+   bbSetInputViewerWt(NULL);
+  
+}
+//===== 
+// 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 AddMesh::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 AddMesh::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbwt
+
+