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()\
71 " + mRenderer+".add( " + mMesh+");\
72 " + mRenderer+".render();\
73 " + mMesh+".transform.flipX();\
74 " + mMesh+".transform.flipY();\
75 " + mMesh+".transform.translateY(-10);\
76 " + mRenderer+".render();\
79 std::cout<<"DEBUG ADD OBJECT ---- "<<jsCom<<std::endl;
80 // w->doJavaScript(jsCom);
81 Wt::WApplication::instance()->doJavaScript(jsCom);
90 std::string jsCom = "\
94 "+mMesh+".file = '"+bbGetInputMesh()+"';\
95 "+mMesh+".modified(true);\
96 "+w->jsRef()+".mRenderer.render();\
100 var mMesh = new X.mesh();\
101 " + mMesh+" = mMesh;\
102 mMesh.file = '"+bbGetInputMesh()+"';\
103 mMesh.color = [1,0.8,0];\
105 " + mCont+" = false;\
106 "+w->jsRef() +".mRenderer.onShowtime = function()\
112 " + mMesh+".transform.flipX();\
113 " + mMesh+".transform.flipY();\
114 " + mMesh+".transform.translateY(-10);\
115 " + w->jsRef() +".mRenderer.add( " + mMesh+");\
116 " + mMesh+".transform.flipX();\
117 " + mMesh+".transform.flipY();\
118 " + mMesh+".transform.translateY(-10);\
119 " + mMesh+".visible = true;\
120 "+mMesh+".modified(true);\
121 " + w->jsRef() + ".mRenderer.render();\
124 std::cout<<"DEBUG ADD OBJECT ---- "<<jsCom<<std::endl;
125 // w->doJavaScript(jsCom);
126 Wt::WApplication::instance()->doJavaScript(jsCom);
136 std::string jsCom = "\
140 "+mMesh+".file = '"+bbGetInputMesh()+"';\
141 "+mMesh+".modified(true);\
142 "+w->jsRef()+".mRenderer.render();\
146 var mMesh = new X.mesh();\
147 mMesh.file = '"+bbGetInputMesh()+"';\
148 mMesh.color = [1,0.8,0];\
150 " + mMesh+" = mMesh;\
151 " + mCont+" = false;\
152 "+w->jsRef() +".mRenderer.onShowtime = function()\
156 " + mMesh+".transform.flipX();\
157 " + mMesh+".transform.flipY();\
158 " + mMesh+".transform.translateY(-10);\
159 " + mMesh+".visible = true;\
162 " + w->jsRef() +".mRenderer.add( " + mMesh+");\
163 " + w->jsRef() + ".mRenderer.render();\
166 std::cout<<"DEBUG ADD OBJECT ---- "<<jsCom<<std::endl;
167 // w->doJavaScript(jsCom);
168 Wt::WApplication::instance()->doJavaScript(jsCom);
175 Wt::WContainerWidget* w = (Wt::WContainerWidget*)bbGetInputViewerWt();
176 std::string jsCom = "\
178 " + w->jsRef() + ".cont = true;\
179 " + w->jsRef() + ".mMesh.file = '"+bbGetInputMesh()+"';\
180 "+w->jsRef() +".mRenderer.add( " + w->jsRef() + ".mMesh);\
181 "+w->jsRef()+".mRenderer.render();\
185 var mMesh = new X.mesh();\
186 mMesh.file = '"+bbGetInputMesh()+"';\
187 mMesh.color = [1,0.8,0];\
189 " + w->jsRef() + ".mMesh = mMesh;\
190 " + w->jsRef() + ".cont = false;\
191 "+w->jsRef() +".mRenderer.onShowtime = function() {\
192 if(!" + w->jsRef() + ".cont)\
194 " + w->jsRef() + ".mMesh.transform.flipX();\
195 " + w->jsRef() + ".mMesh.transform.flipY();\
196 " + w->jsRef() + ".mMesh.transform.translateY(-10);\
197 " + w->jsRef() + ".mMesh.visible = true;\
200 " + w->jsRef() + ".mMesh.modified(true);\
201 " + w->jsRef() + ".mRenderer.render();\
204 std::cout<<"DEBUG ADD OBJECT ---- "<<jsCom<<std::endl;
205 // w->doJavaScript(jsCom);
206 Wt::WApplication::instance()->doJavaScript(jsCom);
215 // 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)
217 void AddMesh::bbUserSetDefaultValues()
220 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
221 // Here we initialize the input 'In' to 0
222 bbSetInputMesh("<void>");
223 bbSetInputViewerWt(NULL);
227 // 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)
229 void AddMesh::bbUserInitializeProcessing()
232 // THE INITIALIZATION METHOD BODY :
234 // but this is where you should allocate the internal/output pointers
240 // 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)
242 void AddMesh::bbUserFinalizeProcessing()
245 // THE FINALIZATION METHOD BODY :
247 // but this is where you should desallocate the internal/output pointers