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 "bbwtAddMesh.h"
5 #include "bbwtPackage.h"
7 #include<Wt/WApplication>
13 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,AddMesh)
14 BBTK_BLACK_BOX_IMPLEMENTATION(AddMesh,bbtk::AtomicBlackBox);
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)
18 void AddMesh::Process()
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
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')
34 printf("EED =====================================================AddMesh::Process() mesh %s\n", bbGetInputMesh().c_str() );
39 Wt::WContainerWidget* w = (Wt::WContainerWidget*)bbGetInputViewerWt();
41 sprintf(strPointer,"%p",this);
42 std::string mMesh = w->jsRef() + ".mMesh"+strPointer;
43 std::string mCont = w->jsRef() + ".mCont"+strPointer;
44 std::string mRenderer = w->jsRef() + ".mRenderer";
46 printf("EED =====================================================AddMesh::Process() mMesh %s\n", mMesh.c_str() );
49 std::string jsCom = "\
53 "+mMesh+".file = '"+bbGetInputMesh()+"';\
54 "+mMesh+".modified(true);\
55 "+mRenderer+".render();\
59 var mMesh = new X.mesh();\
61 mMesh.file = '"+bbGetInputMesh()+"';\
62 mMesh.color = [1,0.8,0];\
65 "+mRenderer+".onShowtime = function()\
69 " + mMesh+".visible = true;\
70 " + mMesh+".transform.flipX();\
71 " + mMesh+".transform.flipY();\
72 " + mMesh+".transform.translateY(-10);\
76 " + mRenderer+".add( " + mMesh+");\
77 " + mRenderer+".render();\
80 std::cout<<"DEBUG ADD OBJECT ---- "<<jsCom<<std::endl;
81 // w->doJavaScript(jsCom);
82 Wt::WApplication::instance()->doJavaScript(jsCom);
91 std::string jsCom = "\
95 "+mMesh+".file = '"+bbGetInputMesh()+"';\
96 "+mMesh+".modified(true);\
97 "+w->jsRef()+".mRenderer.render();\
101 var mMesh = new X.mesh();\
102 " + mMesh+" = mMesh;\
103 mMesh.file = '"+bbGetInputMesh()+"';\
104 mMesh.color = [1,0.8,0];\
106 " + mCont+" = false;\
107 "+w->jsRef() +".mRenderer.onShowtime = function()\
113 " + mMesh+".transform.flipX();\
114 " + mMesh+".transform.flipY();\
115 " + mMesh+".transform.translateY(-10);\
116 " + w->jsRef() +".mRenderer.add( " + mMesh+");\
117 " + mMesh+".transform.flipX();\
118 " + mMesh+".transform.flipY();\
119 " + mMesh+".transform.translateY(-10);\
120 " + mMesh+".visible = true;\
121 "+mMesh+".modified(true);\
122 " + w->jsRef() + ".mRenderer.render();\
125 std::cout<<"DEBUG ADD OBJECT ---- "<<jsCom<<std::endl;
126 // w->doJavaScript(jsCom);
127 Wt::WApplication::instance()->doJavaScript(jsCom);
137 std::string jsCom = "\
141 "+mMesh+".file = '"+bbGetInputMesh()+"';\
142 "+mMesh+".modified(true);\
143 "+w->jsRef()+".mRenderer.render();\
147 var mMesh = new X.mesh();\
148 mMesh.file = '"+bbGetInputMesh()+"';\
149 mMesh.color = [1,0.8,0];\
151 " + mMesh+" = mMesh;\
152 " + mCont+" = false;\
153 "+w->jsRef() +".mRenderer.onShowtime = function()\
157 " + mMesh+".transform.flipX();\
158 " + mMesh+".transform.flipY();\
159 " + mMesh+".transform.translateY(-10);\
160 " + mMesh+".visible = true;\
163 " + w->jsRef() +".mRenderer.add( " + mMesh+");\
164 " + w->jsRef() + ".mRenderer.render();\
167 std::cout<<"DEBUG ADD OBJECT ---- "<<jsCom<<std::endl;
168 // w->doJavaScript(jsCom);
169 Wt::WApplication::instance()->doJavaScript(jsCom);
176 Wt::WContainerWidget* w = (Wt::WContainerWidget*)bbGetInputViewerWt();
177 std::string jsCom = "\
179 " + w->jsRef() + ".cont = true;\
180 " + w->jsRef() + ".mMesh.file = '"+bbGetInputMesh()+"';\
181 "+w->jsRef() +".mRenderer.add( " + w->jsRef() + ".mMesh);\
182 "+w->jsRef()+".mRenderer.render();\
186 var mMesh = new X.mesh();\
187 mMesh.file = '"+bbGetInputMesh()+"';\
188 mMesh.color = [1,0.8,0];\
190 " + w->jsRef() + ".mMesh = mMesh;\
191 " + w->jsRef() + ".cont = false;\
192 "+w->jsRef() +".mRenderer.onShowtime = function() {\
193 if(!" + w->jsRef() + ".cont)\
195 " + w->jsRef() + ".mMesh.transform.flipX();\
196 " + w->jsRef() + ".mMesh.transform.flipY();\
197 " + w->jsRef() + ".mMesh.transform.translateY(-10);\
198 " + w->jsRef() + ".mMesh.visible = true;\
201 " + w->jsRef() + ".mMesh.modified(true);\
202 " + w->jsRef() + ".mRenderer.render();\
205 std::cout<<"DEBUG ADD OBJECT ---- "<<jsCom<<std::endl;
206 // w->doJavaScript(jsCom);
207 Wt::WApplication::instance()->doJavaScript(jsCom);
216 // 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)
218 void AddMesh::bbUserSetDefaultValues()
221 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
222 // Here we initialize the input 'In' to 0
223 bbSetInputMesh("<void>");
224 bbSetInputViewerWt(NULL);
228 // 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)
230 void AddMesh::bbUserInitializeProcessing()
233 // THE INITIALIZATION METHOD BODY :
235 // but this is where you should allocate the internal/output pointers
241 // 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)
243 void AddMesh::bbUserFinalizeProcessing()
246 // THE FINALIZATION METHOD BODY :
248 // but this is where you should desallocate the internal/output pointers