X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=wt%2Fbbtk_wt_PKG%2Fsrc%2FbbwtAddMesh.cxx;fp=wt%2Fbbtk_wt_PKG%2Fsrc%2FbbwtAddMesh.cxx;h=ef7f69ddf5283e6aa8a59a5174b3891fa124f323;hb=1830bf64f6ad13d04f4fd7589317f0515fae837c;hp=0000000000000000000000000000000000000000;hpb=8330bb7bb23c8b5521a6ab9470d0dcbd19b9117e;p=creaWT.git diff --git a/wt/bbtk_wt_PKG/src/bbwtAddMesh.cxx b/wt/bbtk_wt_PKG/src/bbwtAddMesh.cxx new file mode 100644 index 0000000..ef7f69d --- /dev/null +++ b/wt/bbtk_wt_PKG/src/bbwtAddMesh.cxx @@ -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 + + +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 ---- "<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 ---- "<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 ---- "<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 ---- "<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(""); + 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 + +