From: Eduardo DAVILA Date: Wed, 16 Nov 2016 15:22:15 +0000 (+0100) Subject: #3037 creaWT Bug New Normal - AddMesh update X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=430578713a572cd83e04ca0f65c6e34e87879cd6;p=creaWT.git #3037 creaWT Bug New Normal - AddMesh update --- diff --git a/wt/bbtk_wt_PKG/bbs/appli/demoPresentacion1Boton03.bbg b/wt/bbtk_wt_PKG/bbs/appli/demoPresentacion1Boton03.bbg index 2e806b0..2dfd1ad 100644 --- a/wt/bbtk_wt_PKG/bbs/appli/demoPresentacion1Boton03.bbg +++ b/wt/bbtk_wt_PKG/bbs/appli/demoPresentacion1Boton03.bbg @@ -19,8 +19,8 @@ FIN_BOX BOX itk:BinaryThresholdImageFilter:Box02 ISEXEC:FALSE -57.945666:-128.858036:-900.000000 -129.120666:-138.858036:-900.000000 +-37.240041:-147.039576:-900.000000 +33.934959:-157.039576:-900.000000 PORT InsideValue:"255" PORT @@ -78,7 +78,7 @@ ISEXEC:FALSE -121.482446:-62.619179:-900.000000 -73.162446:-72.619179:-900.000000 PORT -In:"1250" +In:"1000" PORT Max:"1500" PORT @@ -92,7 +92,7 @@ BOX wt:Slider:Box16 ISEXEC:FALSE -163.108601:-79.545339:-900.000000 --130.333601:-89.545339:-900.000000 +-114.788601:-89.545339:-900.000000 PORT In:"1500" PORT @@ -108,7 +108,7 @@ BOX wt:LayoutLine:Box17 ISEXEC:FALSE -170.375687:-198.734780:-900.000000 --112.815687:-208.734780:-900.000000 +-124.012327:-208.734780:-900.000000 FIN_BOX BOX wt:CommandButton:Box21 @@ -134,7 +134,7 @@ BOX wt:Slider:Box31 ISEXEC:FALSE -78.667210:-47.626578:-900.000000 --45.892210:-57.626578:-900.000000 +-30.347210:-57.626578:-900.000000 PORT In:"1" PORT diff --git a/wt/bbtk_wt_PKG/bbs/appli/demoPresentacion1Boton03.bbs b/wt/bbtk_wt_PKG/bbs/appli/demoPresentacion1Boton03.bbs index 0afc311..bf2ba90 100644 --- a/wt/bbtk_wt_PKG/bbs/appli/demoPresentacion1Boton03.bbs +++ b/wt/bbtk_wt_PKG/bbs/appli/demoPresentacion1Boton03.bbs @@ -42,7 +42,7 @@ new wt:ViewerNVWeb Box12 set Box12.ImagePath "imagesTMP/hola.nii" new wt:Slider Box15 - set Box15.In "1250" + set Box15.In "1000" set Box15.Max "1500" set Box15.Min "0" set Box15.ReactiveOnTrack "true" diff --git a/wt/bbtk_wt_PKG/bbs/boxes/AddMeshB.bbg b/wt/bbtk_wt_PKG/bbs/boxes/AddMeshB.bbg index 21b6358..16cbf3b 100644 --- a/wt/bbtk_wt_PKG/bbs/boxes/AddMeshB.bbg +++ b/wt/bbtk_wt_PKG/bbs/boxes/AddMeshB.bbg @@ -14,22 +14,22 @@ COMPLEXOUTPUTS:0 COMPLEXINPUTS:3 COMPLEX_PORT boxExecute --60.524336:71.546578:-900.000000 +-76.039517:72.132057:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT vtkPolyData -21.793922:71.326104:-900.000000 +-37.339411:76.009932:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT viewerwt --17.624853:72.702521:-900.000000 +21.602210:76.215392:-900.000000 FIN_COMPLEX_PORT BOXES:8 BOX std:RandomString:Box04 ISEXEC:FALSE --6.661884:3.538662:-900.000000 -38.913116:-6.461338:-900.000000 +66.418485:24.205433:-900.000000 +111.993485:14.205433:-900.000000 PORT BoxProcessMode:"Reactive" FIN_BOX @@ -60,28 +60,28 @@ FIN_BOX BOX vtk:PolyDataWriter:Box09 ISEXEC:FALSE -21.320661:-61.821623:-900.000000 -66.895661:-71.821623:-900.000000 +-61.524553:-67.090930:-900.000000 +-15.949553:-77.090930:-900.000000 FIN_BOX BOX wt:AddMesh:Box10 ISEXEC:FALSE --33.151380:-61.807461:-900.000000 -12.423620:-71.807461:-900.000000 +5.782943:-66.198550:-900.000000 +51.357943:-76.198550:-900.000000 FIN_BOX BOX std:MultipleInputs:Box11 ISEXEC:FALSE --64.763199:49.407780:-900.000000 --19.188199:39.407780:-900.000000 +-89.938777:46.480387:-900.000000 +-44.363777:36.480387:-900.000000 PORT BoxProcessMode:"Reactive" FIN_BOX BOX wt:GetConfigServerWt:Box12 ISEXEC:FALSE -116.484416:-14.508239:-900.000000 -162.059416:-24.508239:-900.000000 +116.777155:-14.508239:-900.000000 +162.352155:-24.508239:-900.000000 FIN_BOX CONNECTIONS:12 CONNECTION diff --git a/wt/bbtk_wt_PKG/bbs/boxes/AddMeshB.bbs b/wt/bbtk_wt_PKG/bbs/boxes/AddMeshB.bbs index fef3938..0c6fe21 100644 --- a/wt/bbtk_wt_PKG/bbs/boxes/AddMeshB.bbs +++ b/wt/bbtk_wt_PKG/bbs/boxes/AddMeshB.bbs @@ -16,26 +16,26 @@ description "Description ??" category "" -new RandomString Box04 +new std:RandomString Box04 set Box04.BoxProcessMode "Reactive" -new ConcatStrings Box05 +new std:ConcatStrings Box05 set Box05.In1 "mesh_" set Box05.In3 ".vtk" -new ConcatStrings Box06 +new std:ConcatStrings Box06 set Box06.In1 "imagesTMP/" -new ConcatStrings Box07 +new std:ConcatStrings Box07 -new PolyDataWriter Box09 +new vtk:PolyDataWriter Box09 -new AddMesh Box10 +new wt:AddMesh Box10 -new MultipleInputs Box11 +new std:MultipleInputs Box11 set Box11.BoxProcessMode "Reactive" -new GetConfigServerWt Box12 +new wt:GetConfigServerWt Box12 connect Box04.Out Box05.In2 diff --git a/wt/bbtk_wt_PKG/src/bbwtAddMesh.cxx b/wt/bbtk_wt_PKG/src/bbwtAddMesh.cxx index 34c1a13..b169ebb 100644 --- a/wt/bbtk_wt_PKG/src/bbwtAddMesh.cxx +++ b/wt/bbtk_wt_PKG/src/bbwtAddMesh.cxx @@ -31,187 +31,103 @@ void AddMesh::Process() // (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 +")\ - {\ - " + mMesh+".visible = true;\ - " + mMesh+".transform.flipX();\ - " + mMesh+".transform.flipY();\ - " + mMesh+".transform.translateY(-10);\ - " + mCont+" = true;\ - }\ - };\ - " + mRenderer+".add( " + mMesh+");\ - " + 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 meshFileName=bbGetInputMesh(); + + printf("EED AddMesh::Process meshFileName=%s\n",meshFileName.c_str()); + + bool ok=true; + FILE *ff = fopen( bbGetInputMesh().c_str(), "r" ); + char strtmp[255]; + long int numberPoints; + if (ff==NULL) + { + ok=false; + } else { + fgets(strtmp,255,ff); + fgets(strtmp,255,ff); + fgets(strtmp,255,ff); + fgets(strtmp,255,ff); + fscanf(ff,"%s %ld", strtmp,&numberPoints ); + if (numberPoints==0) + { + ok=false; + } + fclose(ff); + } + + Wt::WContainerWidget* w = (Wt::WContainerWidget*)bbGetInputViewerWt(); + char strPointer[15]; + sprintf(strPointer,"%p",this); + std::string mMesh = w->jsRef() + ".mMesh"+strPointer; + std::string mRemoveActor= w->jsRef() + ".mRemoveActor"+strPointer; + std::string mRenderer = w->jsRef() + ".mRenderer"; + + if (ok==false) + { + ok=false; + meshFileName="imagesTMP/bunny.vtk"; + } /* - 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); + mMesh.transform.translateX(88.9);\ + mMesh.transform.translateY(102.9);\ + mMesh.transform.rotateZ(180);\ */ - - /* - - 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); - + " + mCont+" = false;\ + "+mRenderer+".onShowtime = function()\ + {\ + if(!" + mCont +")\ + {\ + " + mMesh+".visible = true;\ + " + mCont+" = true;\ + }\ + };\ */ - - - + if (ok==true) + { + std::string jsCom = "\ + try\ + {\ + if ("+mRemoveActor+"==true){ " + mRenderer+".add( " + mMesh+"); } \ + " + mMesh+".transform.matrix.identity;\ + " + mMesh+".transform.translateX(88.9);\ + " + mMesh+".transform.translateY(102.9);\ + " + mMesh+".transform.rotateZ(180);\ + " + mMesh+".opacity = 1;\ + " + mMesh+".file = '"+meshFileName+"';\ + " + mMesh+".modified(true);\ + " + mMesh+".color = [0,1,1];\ + " + mRenderer+".render();\ + } catch(err) {\ + var mMesh = new X.mesh();\ + " + mMesh+" = mMesh;\ + mMesh.file = '"+meshFileName+"';\ + mMesh.color = [1,1,0];\ + mMesh.opacity=0.5;\ + mMesh.transform.matrix.makeOrtho;\ + "+mRemoveActor+" = false;\ + "+mRenderer+".add("+mMesh+");\ + "+mRenderer+".render();\ + }"; +// std::cout<<"DEBUG ADD OBJECT ---- "<doJavaScript(jsCom); + Wt::WApplication::instance()->doJavaScript(jsCom); + } else { + std::string jsCom = "\ + try\ + {\ + "+mRenderer+".remove("+mMesh+");\ + "+mRemoveActor+"=true;\ + } catch(err) {\ + }"; + Wt::WApplication::instance()->doJavaScript(jsCom); + }// ok } + //===== // 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) //===== diff --git a/wt/bbtk_wt_PKG/src/bbwtComboBox.cxx b/wt/bbtk_wt_PKG/src/bbwtComboBox.cxx index 3ab0146..971d85b 100644 --- a/wt/bbtk_wt_PKG/src/bbwtComboBox.cxx +++ b/wt/bbtk_wt_PKG/src/bbwtComboBox.cxx @@ -106,7 +106,13 @@ void ComboBox::Process() ComboBoxWidget *widget = (ComboBoxWidget *)bbGetOutputWidget(); widget->SetItems( bbGetInputIn() ); - + bbSetOutputOut( 0 ); + if (bbGetInputIn().size()>0) + { + bbSetOutputOutString( bbGetInputIn()[0] ); + } else { + bbSetOutputOutString( "" ); + } } //===== // 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)