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
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
// (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)
//=====