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 std::string meshFileName=bbGetInputMesh();
36 printf("EED AddMesh::Process meshFileName=%s\n",meshFileName.c_str());
39 FILE *ff = fopen( bbGetInputMesh().c_str(), "r" );
41 long int numberPoints;
50 fscanf(ff,"%s %ld", strtmp,&numberPoints );
58 Wt::WContainerWidget* w = (Wt::WContainerWidget*)bbGetInputViewerWt();
60 sprintf(strPointer,"%p",this);
61 std::string mMesh = w->jsRef() + ".mMesh"+strPointer;
62 std::string mRemoveActor= w->jsRef() + ".mRemoveActor"+strPointer;
63 std::string mRenderer = w->jsRef() + ".mRenderer";
68 meshFileName="imagesTMP/bunny.vtk";
73 mMesh.transform.translateX(88.9);\
74 mMesh.transform.translateY(102.9);\
75 mMesh.transform.rotateZ(180);\
80 "+mRenderer+".onShowtime = function()\
84 " + mMesh+".visible = true;\
92 std::string jsCom = "\
95 if ("+mRemoveActor+"==true){ " + mRenderer+".add( " + mMesh+"); } \
96 " + mMesh+".transform.matrix.identity;\
97 " + mMesh+".transform.translateX(88.9);\
98 " + mMesh+".transform.translateY(102.9);\
99 " + mMesh+".transform.rotateZ(180);\
100 " + mMesh+".opacity = 1;\
101 " + mMesh+".file = '"+meshFileName+"';\
102 " + mMesh+".modified(true);\
103 " + mMesh+".color = [0,1,1];\
104 " + mRenderer+".render();\
106 var mMesh = new X.mesh();\
107 " + mMesh+" = mMesh;\
108 mMesh.file = '"+meshFileName+"';\
109 mMesh.color = [1,1,0];\
111 mMesh.transform.matrix.makeOrtho;\
112 "+mRemoveActor+" = false;\
113 "+mRenderer+".add("+mMesh+");\
114 "+mRenderer+".render();\
116 // std::cout<<"DEBUG ADD OBJECT ---- "<<jsCom<<std::endl;
117 // w->doJavaScript(jsCom);
118 Wt::WApplication::instance()->doJavaScript(jsCom);
120 std::string jsCom = "\
123 "+mRenderer+".remove("+mMesh+");\
124 "+mRemoveActor+"=true;\
127 Wt::WApplication::instance()->doJavaScript(jsCom);
132 // 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)
134 void AddMesh::bbUserSetDefaultValues()
137 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
138 // Here we initialize the input 'In' to 0
139 bbSetInputMesh("<void>");
140 bbSetInputViewerWt(NULL);
144 // 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)
146 void AddMesh::bbUserInitializeProcessing()
149 // THE INITIALIZATION METHOD BODY :
151 // but this is where you should allocate the internal/output pointers
157 // 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)
159 void AddMesh::bbUserFinalizeProcessing()
162 // THE FINALIZATION METHOD BODY :
164 // but this is where you should desallocate the internal/output pointers