]> Creatis software - creaWT.git/commitdiff
#3037 creaWT Bug New Normal - AddMesh update
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 16 Nov 2016 15:22:15 +0000 (16:22 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 16 Nov 2016 15:22:15 +0000 (16:22 +0100)
wt/bbtk_wt_PKG/bbs/appli/demoPresentacion1Boton03.bbg
wt/bbtk_wt_PKG/bbs/appli/demoPresentacion1Boton03.bbs
wt/bbtk_wt_PKG/bbs/boxes/AddMeshB.bbg
wt/bbtk_wt_PKG/bbs/boxes/AddMeshB.bbs
wt/bbtk_wt_PKG/src/bbwtAddMesh.cxx
wt/bbtk_wt_PKG/src/bbwtComboBox.cxx

index 2e806b01f4100b5ba67ec386df1e192d21e136da..2dfd1ade5a96a80abac6cb2b4ad6baedb0a8e81d 100644 (file)
@@ -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
index 0afc311c31a8c91f4e5c27dd55953893c7f6689b..bf2ba90c67bdedc00ef56a8952d2e5d53adbe563 100644 (file)
@@ -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"
index 21b63586ab5bd9686289e72aa460b0b2f42ecc82..16cbf3b627323e58c1b65503a5e153377fc84ee9 100644 (file)
@@ -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
index fef393834f856c68c28d97c12924bb6605ecb906..0c6fe2128954ca64732ca25e59c16358570542bb 100644 (file)
@@ -16,26 +16,26 @@ description "Description ??"
 
 category "<VOID>"
 
-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
index 34c1a13febbdb25977c233565bcb00d2f3753179..b169ebb18da6df284d13ac53a6530a974c33ff52 100644 (file)
@@ -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 ----  "<<jsCom<<std::endl;
-  // w->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 ----  "<<jsCom<<std::endl;
-  // w->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 ----  "<<jsCom<<std::endl;
-  // w->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 ----  "<<jsCom<<std::endl;
-  // w->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 ----  "<<jsCom<<std::endl;
+//             w->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)
 //===== 
index 3ab014667bb14bfd98b72815ff8747650e9b5e5e..971d85b334c848549762299ccf232f9c00583b5d 100644 (file)
@@ -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)