]> Creatis software - creaWT.git/blob - wt/bbtk_wt_PKG/src/bbwtAddMesh.cxx
#2691 creaWT Feature New Normal - Implementation temp files
[creaWT.git] / wt / bbtk_wt_PKG / src / bbwtAddMesh.cxx
1 //===== 
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)
3 //===== 
4 #include "bbwtAddMesh.h"
5 #include "bbwtPackage.h"
6
7 #include<Wt/WApplication>
8
9
10 namespace bbwt
11 {
12
13 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,AddMesh)
14 BBTK_BLACK_BOX_IMPLEMENTATION(AddMesh,bbtk::AtomicBlackBox);
15 //===== 
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)
17 //===== 
18 void AddMesh::Process()
19 {
20
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 
27 //    Where :
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')
32
33
34      printf("EED =====================================================AddMesh::Process() mesh %s\n", bbGetInputMesh().c_str() );
35
36
37
38
39      Wt::WContainerWidget* w = (Wt::WContainerWidget*)bbGetInputViewerWt();
40      char strPointer[15];
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";
45
46      printf("EED =====================================================AddMesh::Process() mMesh %s\n", mMesh.c_str() );
47
48
49       std::string jsCom = "\
50       try\
51       {\
52                         " + mCont+" = true;\
53       "+mMesh+".file = '"+bbGetInputMesh()+"';\
54       "+mMesh+".modified(true);\
55       "+mRenderer+".render();\
56       }\
57       catch(err)\
58       {\
59         var mMesh = new X.mesh();\
60                           " + mMesh+" = mMesh;\
61                           mMesh.file = '"+bbGetInputMesh()+"';\
62                           mMesh.color = [1,0.8,0];\
63                           mMesh.opacity=1;\
64                           " + mCont+" = false;\
65                           "+mRenderer+".onShowtime = function()\
66                           {\
67                             if(!" + mCont +")\
68                             {\
69                               " + mMesh+".visible = true;\
70                               " + mMesh+".transform.flipX();\
71                               " + mMesh+".transform.flipY();\
72                               " + mMesh+".transform.translateY(-10);\
73                               " + mCont+" = true;\
74                             }\
75                           };\
76                               " + mRenderer+".add( " + mMesh+");\
77                               " + mRenderer+".render();\
78         }";
79
80           std::cout<<"DEBUG ADD OBJECT ----  "<<jsCom<<std::endl;
81   // w->doJavaScript(jsCom);
82      Wt::WApplication::instance()->doJavaScript(jsCom);
83
84
85
86
87
88
89 /*
90
91       std::string jsCom = "\
92       try\
93       {\
94                         " + mCont+" = true;\
95       "+mMesh+".file = '"+bbGetInputMesh()+"';\
96       "+mMesh+".modified(true);\
97       "+w->jsRef()+".mRenderer.render();\
98       }\
99       catch(err)\
100       {\
101         var mMesh = new X.mesh();\
102                           " + mMesh+" = mMesh;\
103                           mMesh.file = '"+bbGetInputMesh()+"';\
104                           mMesh.color = [1,0.8,0];\
105                           mMesh.opacity=1;\
106                           " + mCont+" = false;\
107                           "+w->jsRef() +".mRenderer.onShowtime = function()\
108                           {\
109                             if(!" + mCont +")\
110                             {\
111                             }\
112                           };\
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();\
123         }";
124
125           std::cout<<"DEBUG ADD OBJECT ----  "<<jsCom<<std::endl;
126   // w->doJavaScript(jsCom);
127      Wt::WApplication::instance()->doJavaScript(jsCom);
128
129
130 */
131
132
133
134
135
136 /*
137       std::string jsCom = "\
138       try\
139       {\
140                         " + mCont+" = true;\
141       "+mMesh+".file = '"+bbGetInputMesh()+"';\
142       "+mMesh+".modified(true);\
143       "+w->jsRef()+".mRenderer.render();\
144       }\
145       catch(err)\
146       {\
147         var mMesh = new X.mesh();\
148                           mMesh.file = '"+bbGetInputMesh()+"';\
149                           mMesh.color = [1,0.8,0];\
150                           mMesh.opacity=1;\
151                           " + mMesh+" = mMesh;\
152                           " + mCont+" = false;\
153                           "+w->jsRef() +".mRenderer.onShowtime = function()\
154                           {\
155                             if(!" + mCont +")\
156                             {\
157                               " + mMesh+".transform.flipX();\
158                               " + mMesh+".transform.flipY();\
159                               " + mMesh+".transform.translateY(-10);\
160                               " + mMesh+".visible = true;\
161                             }\
162                           };\
163                           " + w->jsRef() +".mRenderer.add( " + mMesh+");\
164                           " + w->jsRef() + ".mRenderer.render();\
165         }";
166
167           std::cout<<"DEBUG ADD OBJECT ----  "<<jsCom<<std::endl;
168   // w->doJavaScript(jsCom);
169      Wt::WApplication::instance()->doJavaScript(jsCom);
170 */
171
172   
173
174 /*
175
176      Wt::WContainerWidget* w = (Wt::WContainerWidget*)bbGetInputViewerWt();
177                                                 std::string jsCom = "\
178       try{\
179                         " + w->jsRef() + ".cont = true;\
180       " + w->jsRef() + ".mMesh.file = '"+bbGetInputMesh()+"';\
181       "+w->jsRef() +".mRenderer.add( " + w->jsRef() + ".mMesh);\
182       "+w->jsRef()+".mRenderer.render();\
183       }\
184       catch(err)\
185       {\
186         var mMesh = new X.mesh();\
187                           mMesh.file = '"+bbGetInputMesh()+"';\
188                           mMesh.color = [1,0.8,0];\
189                           mMesh.opacity=1;\
190                           " + w->jsRef() + ".mMesh = mMesh;\
191                           " + w->jsRef() + ".cont = false;\
192                           "+w->jsRef() +".mRenderer.onShowtime = function() {\
193                           if(!" + w->jsRef() + ".cont)\
194                           {\
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;\
199                           }\
200                           };\
201                           " + w->jsRef() + ".mMesh.modified(true);\
202                           " + w->jsRef() + ".mRenderer.render();\
203                           }";
204
205           std::cout<<"DEBUG ADD OBJECT ----  "<<jsCom<<std::endl;
206   // w->doJavaScript(jsCom);
207      Wt::WApplication::instance()->doJavaScript(jsCom);
208
209 */
210
211
212
213
214 }
215 //===== 
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)
217 //===== 
218 void AddMesh::bbUserSetDefaultValues()
219 {
220
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);
225   
226 }
227 //===== 
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)
229 //===== 
230 void AddMesh::bbUserInitializeProcessing()
231 {
232
233 //  THE INITIALIZATION METHOD BODY :
234 //    Here does nothing 
235 //    but this is where you should allocate the internal/output pointers 
236 //    if any 
237
238   
239 }
240 //===== 
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)
242 //===== 
243 void AddMesh::bbUserFinalizeProcessing()
244 {
245
246 //  THE FINALIZATION METHOD BODY :
247 //    Here does nothing 
248 //    but this is where you should desallocate the internal/output pointers 
249 //    if any
250   
251 }
252 }
253 // EO namespace bbwt
254
255