1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-1f95ab75"],{"153d":function(e,t,n){"use strict";var i,o,s,r,a,h,c,l,u,m,d=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:"canvas-frame"}})},v=[],f=n("d81c"),p=(n("e3d9"),n("3643")),g=n.n(p),w={data:function(){return{}},mounted:function(){this.threeStart()},methods:{initThree:function(){u=document.getElementById("canvas-frame").clientWidth,m=document.getElementById("canvas-frame").clientHeight,i=new f["WebGLRenderer"],i.setSize(u,m),document.getElementById("canvas-frame").appendChild(i.domElement),i.setClearColor(16777215,1),s=new f["Clock"],o=new g.a,o.domElement.style.position="absolute",o.domElement.style.left="0px",o.domElement.style.top="0px",document.getElementById("canvas-frame").appendChild(o.domElement)},initCamera:function(){a=new f["PerspectiveCamera"](45,u/m,1,1e4),a.position.set(0,0,600),a.up=new f["Vector3"](0,1,0),a.lookAt(0,0,0)},initScene:function(){h=new f["Scene"]},initLight:function(){c=new f["AmbientLight"](16711680),c.position.set(100,100,200),h.add(c)},initObject:function(){r={time:{value:1}};var e=r,t=new f["CylinderGeometry"](100,150,400),n=new f["ShaderMaterial"]({uniforms:e,vertexShader:document.getElementById("vertexShader").textContent,fragmentShader:document.getElementById("fragment_shader").textContent});l=new f["Mesh"](t,n),l.position.x=0,l.position.y=0,l.position.z=0,h.add(l)},threeStart:function(){this.initThree(),this.initCamera(),this.initScene(),this.initLight(),this.initObject(),this.animation()},animation:function(){var e=s.getDelta();r.time.value+=5*e,i.render(h,a),requestAnimationFrame(this.animation),o.update()}}},b=w,x=n("2877"),S=Object(x["a"])(b,d,v,!1,null,null,null);t["a"]=S.exports},"789b":function(e,t,n){"use strict";var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"vtkContour"},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.container_show,expression:"container_show"}],ref:"container_vtk",staticClass:"vtkMovie"}),e._v(" "),n("div",{staticClass:"contour"},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.colorStripShow,expression:"colorStripShow"}],staticClass:"colorStrip"},[n("div",{staticClass:"CP",domProps:{innerHTML:e._s(e.scalarRadio)}}),e._v(" "),n("div",{ref:"colorBlock",staticClass:"colorBlock"},e._l(e.coloras,(function(t,i){return n("li",{key:i,style:{height:e.height,background:t}},[n("span",[e._v(e._s(e.nucolor[i]))])])})),0)])]),e._v(" "),n("div",{staticClass:"movieControl1"},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.contourDivShow,expression:"contourDivShow"}],staticClass:"controlDiv"},[n("span",{staticClass:"movieControlTitle"},[e._v(e._s(e.$t("FEM.results.contour")))]),e._v(" "),n("el-form",[n("el-form-item",{attrs:{label:e.$t("FEM.results.contourLevel"),"label-width":"120px"}},[n("el-input-number",{staticStyle:{width:"130px"},attrs:{"controls-position":"right",min:1,"step-strictly":"",size:"small"},model:{value:e.contourLevel,callback:function(t){e.contourLevel=t},expression:"contourLevel"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"vector Factor","label-width":"120px"}},[n("el-input-number",{staticStyle:{width:"130px"},attrs:{"controls-position":"right",min:1,size:"small"},model:{value:e.vectorFactor,callback:function(t){e.vectorFactor=t},expression:"vectorFactor"}})],1)],1)],1),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.movieDivShow,expression:"movieDivShow"}],staticClass:"contourMovie"},[n("span",{staticClass:"movieControlTitle"},[e._v(e._s(e.$t("FEM.results.movieControl")))]),e._v(" "),n("div",{staticClass:"movieControlBox"},[n("div",{staticClass:"movieControlLeft"},[n("el-form",[n("el-form-item",{attrs:{label:e.$t("FEM.results.startStep"),"label-width":"100px"}},[n("el-input-number",{attrs:{"controls-position":"right",min:1,size:"small","step-strictly":""},model:{value:e.moveLoadStart,callback:function(t){e.moveLoadStart=t},expression:"moveLoadStart"}})],1),e._v(" "),n("el-form-item",{attrs:{label:e.$t("FEM.results.currentStep"),"label-width":"100px"}},[n("span",[e._v(e._s(e.currentStep))])]),e._v(" "),n("el-form-item",{attrs:{label:e.$t("FEM.results.endStep"),"label-width":"100px"}},[n("el-input-number",{attrs:{"controls-position":"right",min:1,size:"small","step-strictly":""},model:{value:e.moveLoadEnd,callback:function(t){e.moveLoadEnd=t},expression:"moveLoadEnd"}})],1),e._v(" "),n("el-form-item",{attrs:{label:e.$t("FEM.results.intervalStep"),"label-width":"100px"}},[n("el-input-number",{attrs:{"controls-position":"right",min:1,size:"small","step-strictly":""},model:{value:e.intervalStep,callback:function(t){e.intervalStep=t},expression:"intervalStep"}})],1)],1)],1),e._v(" "),n("div",{staticClass:"movieControlRight"},[n("el-button",{staticStyle:{margin:"0 0 10px 0"},attrs:{size:"small"},on:{click:function(t){return e.moveLoad()}}},[e._v(e._s(e.$t("FEM.results.loadContourData")))]),e._v(" "),n("div",[n("el-progress",{attrs:{percentage:e.loadpercentage}})],1),e._v(" "),n("div",{staticClass:"spcs"},[n("el-button",{attrs:{size:"small"},on:{click:function(t){return e.moveReStart()}}},[e._v(e._s(e.$t("FEM.results.start")))]),e._v(" "),n("el-button",{attrs:{size:"small"}},[e._v(e._s(e.$t("FEM.results.pause")))]),n("br"),e._v(" "),n("el-button",{attrs:{size:"small"}},[e._v(e._s(e.$t("FEM.results.continue")))]),e._v(" "),n("el-button",{attrs:{size:"small"},on:{click:function(t){return e.moveStop()}}},[e._v(e._s(e.$t("FEM.results.stop")))])],1)],1)])])])])},o=[],s=(n("55dd"),n("3835")),r=n("b85c"),a=(n("ac6a"),n("5df3"),n("f400"),n("c5f6"),n("6b54"),n("a481"),n("28a5"),n("5a89")),h=(n("e3d9"),n("4721")),c={data:function(){return{container_show:!0,scene:null,renderer:null,camera:null,controls:null,maxX:0,maxY:0,maxZ:0,minX:0,minY:0,minZ:0,camerahight:5,mufactor:.2,cawidth:500,cahight:500,baseColors:[],contourLevel:5,allUrls:[],moveUrls:[],moveLoadStart:1,moveLoadEnd:20,vectorFactor:518906,loadpercentage:0,movepercentage:0,intervalStep:1,currentStep:1,moveflag:!1,beginUrl:"",beginZone:"",beginflag:!1,beginMesh:null,endUrl:"",endZone:"",endIsload:!1,endLineMesh:null,endShadeMesh:null,endContourMesh:null,endEdgeMesh:null,endScatterMesh:null,endVectorMesh:[],contourDivShow:!1,colorStripShow:!1,movieDivShow:!1,zones:[],moveMesh:null,moveElem:"",meshs:[],maps:[],coloras:[],height:"30px",nucolor:[],reveColor:[]}},props:{scalarRadio:String,endUrlps:String},mounted:function(){this.initScene(),this.initBaseColors()},watch:{contourLevel:{handler:function(e){this.initBaseColors(),this.offHeight(),this.minMax(this.endZone.colorMap.get(this.scalarRadio).scalars),console.log(this.endZone),console.log(this.coloras),console.log(this.nucolor)},deep:!0,immediate:!1},maps:{handler:function(e){this.emitMap()},deep:!0,immediate:!1}},methods:{offHeight:function(){var e=this.$refs.colorBlock.offsetHeight;this.height=e/this.coloras.length+"px"},getcaHeight:function(e){this.renderer.setSize(e,e)},getmax:function(e,t){this.nucolor=[];for(var n=(t-e)/this.contourLevel,i=1;i<=this.contourLevel;i++){var o=(e+i*n).toExponential(2);this.nucolor.unshift(o)}this.nucolor.push(e.toExponential(2)),this.reveColor=JSON.parse(JSON.stringify(this.nucolor)).reverse()},getColor:function(e){for(var t=1;t<=this.contourLevel;t++)if(e>=this.reveColor[t-1]&&e<this.reveColor[t]){var n=this.baseColors[t-1];return n}return this.baseColors[this.contourLevel-1]},initBaseColors:function(){this.coloras=[],this.baseColors=[];var e=0,t=240;this.baseColors.push(this.colorHex(this.hsltorgb(e,100,50)));for(var n=Math.round((t-e)/this.contourLevel),i=1;i<this.contourLevel-1;i++)this.baseColors.push(this.colorHex(this.hsltorgb(e+n*i,100,50)));this.baseColors.push(this.colorHex(this.hsltorgb(t,100,50))),this.baseColors=this.baseColors.reverse(),this.coloras.push("#D7DCE7")},hsltorgb:function(e,t,n){e/=360,t/=100,n/=100;var i=[];if(0==t)i=[Math.round(255*n),Math.round(255*n),Math.round(255*n)];else for(var o=n>=.5?n+t-n*t:n*(1+t),s=2*n-o,r=(i[0]=e+1/3,i[1]=e,i[2]=e-1/3,0);r<i.length;r++){var a=i[r];switch(a<0?a+=1:a>1&&(a-=1),!0){case a<1/6:a=s+6*(o-s)*a;break;case 1/6<=a&&a<.5:a=o;break;case.5<=a&&a<2/3:a=s+(o-s)*(4-6*a);break;default:a=s;break}i[r]=Math.round(255*a)}return this.colorHex("rgb("+i[0]+","+i[1]+","+i[2]+")")},colorHex:function(e){var t=/^(rgb|RGB)/;if(t.test(e)){for(var n="0x",i=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),o=0;o<i.length;o++){var s=Number(i[o]).toString(16);"0"===s&&(s+=s),n+=s.toUpperCase()}return this.coloras.push(e),Number(n)}return Number(e)},init:function(){this.scene=new a["P"],this.renderer=new a["W"]({antialias:!0,alpha:!0}),this.camera=new a["H"](20,1,.2,1e4),this.controls=new h["a"](this.camera,this.renderer.domElement)},initScene:function(){null==this.scene&&this.init(),this.renderer.setSize(this.cawidth,this.cahight),this.$refs.container_vtk.appendChild(this.renderer.domElement)},initCamera:function(){var e=this;e.camerahight=Math.max(Math.abs(e.maxX),Math.abs(e.maxY),Math.abs(e.maxZ),Math.abs(e.minX),Math.abs(e.minY),Math.abs(e.minZ)),e.controls.target.set(0,0,0),e.controls.update(),e.camera.position.set(-1,3*e.camerahight,4*e.camerahight),e.camera.lookAt(e.scene.position),e.camera.updateMatrix(),e.renderer.render(e.scene,e.camera);var t=function t(){e.renderer.render(e.scene,e.camera),requestAnimationFrame(t)};t()},moveAnimate:function(){var e=this;new Date;e.zones.length>0&&e.moveflag&&e.currentStep<=e.zones.length-1?(null!=e.moveMesh&&e.scene.remove(e.moveMesh),e.moveShowZone(e.zones[e.currentStep-1],e.moveElem),e.scene.add(e.moveMesh),e.currentStep++):e.moveflag=!1},vtk:function(e){var t,n=this,i=/^POINTS /,o=/^CELLS[ ]+(\d+)/,a=/^VECTORS /,h=/^CELL_TYPES[ ]+(\d+)/,c=/(\-?\d+\.?[\d\-\+e]*)\s+(\-?\d+\.?[\d\-\+e]*)\s+(\-?\d+\.?[\d\-\+e]*)/g,l=/(\-?\d+\.?[\d\-\+E]*)\s+(\-?\d+\.?[\d\-\+E]*)\s+(\-?\d+\.?[\d\-\+E]*)/g,u=/^[^\d.\s-]+/,m=/(\-?\d+)\s+([\s\d]*)/,d=/(\-?\d+\.?[\d\-\+E]*)\s/,v=!1,f=!1,p=!1,g=[],w=[],b=[],x=new Map,S=e.split("\n");if(S.forEach((function(e){if(0===e.indexOf("SCALARS")){var s=e.split(" ")[1];"undefined"==typeof x.get(s)&&x.set(s,{inSection:!0,scalars:[]}),v=!1,f=!1,!1,p=!1,x.forEach((function(e,t){t!==s&&(e.inSection=!1)}))}if(x.forEach((function(n,i){n.inSection&&null!==(t=d.exec(e))&&n.scalars.push(parseFloat(t[0]))})),v)while(null!==(t=c.exec(e))){if(null!==u.exec(e))break;var r=parseFloat(t[1]),S=parseFloat(t[2]),_=parseFloat(t[3]);n.maxX=r>n.maxX?r:n.maxX,n.maxY=S>n.maxY?S:n.maxY,n.maxZ=_>n.maxZ?_:n.maxZ,n.minX=r<n.minX?r:n.minX,n.minY=S<n.minY?S:n.minY,n.minZ=_<n.minZ?_:n.minZ,g.push(r,S,_)}if(f&&null!==(t=m.exec(e))){var M=parseInt(t[1]),k=t[2].split(/\s+/);if(M>=3)for(var E,C,L=parseInt(k[0]),y=1,Z=0;Z<M-2;++Z)E=parseInt(k[y]),C=parseInt(k[y+1]),w.push(L,E,C),y++}if(p)while(null!==(t=l.exec(e))){if(null!==u.exec(e))break;r=parseFloat(t[1]),S=parseFloat(t[2]),_=parseFloat(t[3]);b.push(r,S,_)}null!==i.exec(e)&&(v=!0,f=!1,!1,p=!1,x.forEach((function(e,t){e.inSection=!1}))),null!==o.exec(e)&&(v=!1,f=!0,!1,p=!1,x.forEach((function(e,t){e.inSection=!1}))),null!==h.exec(e)&&(v=!1,f=!1,!0,p=!1,x.forEach((function(e,t){e.inSection=!1}))),null!==a.exec(e)&&(v=!1,f=!1,!1,p=!0,x.forEach((function(e,t){e.inSection=!1})))})),0==this.maps.length){var _,M=[],k=Object(r["a"])(x.entries());try{for(k.s();!(_=k.n()).done;){var E=Object(s["a"])(_.value,2),C=E[0],L=E[1];M.push([C,L])}}catch(y){k.e(y)}finally{k.f()}M.forEach((function(e){n.maps.push(e[0])}))}return{cells:w,positions:g,colorMap:x,vectors:b}},emitMap:function(){this.$emit("spenmaps",this.maps)},minMax:function(e){var t=0,n=0;t=Math.max.apply(null,e),n=Math.min.apply(null,e),this.getmax(n,t)},clearAll:function(){var e=this;this.meshs.forEach((function(t){e.scene.remove(t)})),this.endVectorMesh.forEach((function(t){e.scene.remove(t)})),this.maps=[],this.contourLevel=5,this.allUrls=[],this.moveUrls=[],this.moveLoadStart=1,this.moveLoadEnd=20,this.vectorFactor=518906,this.loadpercentage=0,this.movepercentage=0,this.nowIndex=0,this.moveflag=!1,this.beginUrl="",this.beginZone="",this.beginflag=!1,this.beginMesh=null,this.endUrl="",this.endZone="",this.endIsload=!1,this.endLineMesh=null,this.endShadeMesh=null,this.endContourMesh=null,this.endEdgeMesh=null,this.endScatterMesh=null,this.endVectorMesh=[],this.zones=[],this.meshs=[],this.contourDivShow=!1,this.colorStripShow=!1,this.movieDivShow=!1},beginUrlLoad:function(e){this.beginUrl=e;var t=this,n=new a["s"];n.load(e,(function(e){t.beginZone=t.vtk(e),t.initCamera(),t.beginIsload=!0,t.beginShow()}),(function(e){}),(function(e){console.error("An error happened")}))},beginShow:function(){var e=this.beginZone,t=e.cells,n=e.positions,i=(e.colorMap,e.vectors,new a["h"]);i.setIndex(t),i.setAttribute("position",new a["t"](n,3));var o=new a["X"](i),s=new a["A"](o,new a["y"]({color:65280}));s.position.x=-1*(this.maxX+this.minX)/2,s.position.y=-1*(this.maxY+this.minY)/2,s.position.z=-1*(this.maxZ+this.minZ)/2,this.meshs.push(s),this.beginMesh=s,this.beginflag=!0,this.scene.add(s)},beginUnhidden:function(e){this.beginflag?this.scene.add(this.beginMesh):this.beginUrlLoad(e)},beginhidden:function(){this.scene.remove(this.beginMesh)},endhidden:function(e){var t=this;switch(e){case"mesh":this.scene.remove(this.endLineMesh);break;case"shade":this.scene.remove(this.endShadeMesh);break;case"contourAll":this.contourDivShow=this.colorStripShow=!1,this.scene.remove(this.endContourMesh);break;case"contourImg":this.scene.remove(this.endContourMesh);break;case"edge":this.scene.remove(this.endEdgeMesh);break;case"scatter":this.scene.remove(this.endScatterMesh);break;case"vectorAll":this.colorStripShow=this.contourDivShow=!1,this.endVectorMesh.forEach((function(e){t.scene.remove(e)}));break;case"vectorImg":this.endVectorMesh.forEach((function(e){t.scene.remove(e)}));break;case"moveAll":this.contourDivShow=this.colorStripShow=!1,this.moveStop(),this.movieDivShow=!1,this.moveMesh&&this.scene.remove(this.moveMesh);break;case"moveImg":this.moveStop(),this.movieDivShow=!1,this.moveMesh&&this.scene.remove(this.moveMesh);default:}},endMesh:function(e){this.endIsload?this.endMeshShow():this.endUrlLoad(e,this.endMeshShow)},endUrlLoad:function(e,t,n){this.endUrl=e;var i=this,o=new a["s"];o.load(e,(function(e){i.endZone=i.vtk(e),i.initCamera(),i.endIsload=!0,t(n)}),(function(e){}),(function(e){console.error("An error happened")}))},endMeshShow:function(){var e=this.endZone,t=e.cells,n=e.positions,i=(e.colorMap,e.vectors,n.slice(0)),o=new a["h"];o.setIndex(t),o.setAttribute("position",new a["t"](i,3));var s=new a["X"](o),r=new a["A"](s,new a["y"]({color:65280}));r.position.x=-1*(this.maxX+this.minX)/2,r.position.y=-1*(this.maxY+this.minY)/2,r.position.z=-1*(this.maxZ+this.minZ)/2,this.endLineMesh=r,this.meshs.push(r),this.scene.add(r)},endShade:function(e){this.endIsload?this.endShadeShow():this.endUrlLoad(e,this.endShadeShow)},endShadeShow:function(){for(var e=this.endZone,t=e.cells,n=e.positions,i=(e.colorMap,e.vectors,n.slice(0)),o=new a["h"],s=[],r=new a["k"],h=0;h<i.length/3;h++)r.setHex(65280),s.push(r.r),s.push(r.g),s.push(r.b);o.setIndex(t),o.setAttribute("color",new a["t"](s,3)),o.setAttribute("position",new a["t"](i,3));new a["X"](o);var c=new a["F"]({vertexColors:a["V"],side:a["n"]}),l=new a["E"](o,c);l.position.x=-1*(this.maxX+this.minX)/2,l.position.y=-1*(this.maxY+this.minY)/2,l.position.z=-1*(this.maxZ+this.minZ)/2,this.meshs.push(l),this.endShadeMesh=l,this.scene.add(l)},endContour:function(e,t){this.contourDivShow=this.colorStripShow=!0,this.endIsload?this.endContourShow(t):this.endUrlLoad(e,this.endContourShow,t)},endContourShow:function(e){for(var t=this,n=this.endZone,i=n.cells,o=n.positions,s=n.colorMap,r=n.vectors,h=o.slice(0),c=0;c<h.length;c++)h[c]=h[c]+r[c]*this.vectorFactor;var l=[],u=new a["k"];if(s.get(e)){var m=s.get(e).scalars;this.minMax(m),m.forEach((function(e){var n=t.getColor(e);u.setHex(n),l.push(u.r),l.push(u.g),l.push(u.b)}))}var d=new a["h"];d.setIndex(i),d.setAttribute("color",new a["t"](l,3)),d.setAttribute("position",new a["t"](h,3));new a["X"](d);var v=new a["F"]({vertexColors:a["V"],side:a["n"]}),f=new a["E"](d,v);f.position.x=-1*(this.maxX+this.minX)/2,f.position.y=-1*(this.maxY+this.minY)/2,f.position.z=-1*(this.maxZ+this.minZ)/2,this.endContourMesh=f,this.meshs.push(f),this.scene.add(f)},endEdge:function(e){this.endIsload?this.endEdgeShow():this.endUrlLoad(e,this.endEdgeShow)},endEdgeShow:function(){var e=this.endZone,t=e.cells,n=e.positions,i=(e.colorMap,e.vectors,n.slice(0)),o=new a["h"];o.setIndex(t),o.setAttribute("position",new a["t"](i,3));var s=new a["o"](o,50),r=new a["A"](s,new a["y"]({color:16711680,linewidth:3}));r.position.x=-1*(this.maxX+this.minX)/2,r.position.y=-1*(this.maxY+this.minY)/2,r.position.z=-1*(this.maxZ+this.minZ)/2,this.endEdgeMesh=r,this.meshs.push(r),this.scene.add(r)},endScatter:function(e){this.endIsload?this.endScatterShow():this.endUrlLoad(e,this.endScatterShow)},endScatterShow:function(){var e=this.endZone,t=e.cells,n=e.positions,i=(e.colorMap,e.vectors,n.slice(0)),o=new a["h"];o.setIndex(t),o.setAttribute("position",new a["t"](i,3));var s=new a["X"](o),r=new a["K"](s,new a["L"]({color:8947848,size:1}));r.position.x=-1*(this.maxX+this.minX)/2,r.position.y=-1*(this.maxY+this.minY)/2,r.position.z=-1*(this.maxZ+this.minZ)/2,this.endScatterMesh=r,this.meshs.push(r),this.scene.add(r)},endVector:function(e,t){this.colorStripShow=this.contourDivShow=!0,this.endIsload?this.endVectorShow(t):this.endUrlLoad(e,this.endVectorShow,t)},endVectorShow:function(e){var t=this,n=this.endZone,i=(n.cells,n.positions),o=n.colorMap,s=(n.vectors,i.slice(0)),r=o.get(e).scalars;this.endVectorMesh=[],this.minMax(r);for(var h=0,c=0;c<s.length/3;c++){var l=new a["U"](0,1,0),u=new a["U"](s[h++]-1*(this.maxX+this.minX)/2,s[h++]-1*(this.maxY+this.minY)/2,s[h++]-1*(this.maxZ+this.minZ)/2),m=r[c]*this.vectorFactor*5,d=this.getColor(r[c]),v=.2,f=new a["b"](l,u,m,d,v);this.endVectorMesh.push(f)}this.endVectorMesh.forEach((function(e){t.scene.add(e)}))},moveInitUrls:function(e,t){this.allUrls=e,this.contourDivShow=this.colorStripShow=!0,this.movieDivShow=!0,this.moveElem=t},moveUrlsInit:function(){var e=this,t=/([\d]*.vtk)/,n=/([\d]*)/;this.moveUrls=this.allUrls.filter((function(i){var o,s=0;return null!==(o=t.exec(i))&&null!==(o=n.exec(o[1]))&&(s=parseInt(o[1]),s>=e.moveLoadStart&&s<=e.moveLoadEnd)})),this.moveUrls.sort((function(e,i){var o,s=0,r=0;return null!==(o=t.exec(e))&&null!==(o=n.exec(o[1]))&&(s=parseInt(o[1])),null!==(o=t.exec(i))&&null!==(o=n.exec(o[1]))&&(r=parseInt(o[1])),s-r}))},moveLoad:function(){var e=this,t=new a["s"],n=0;e.moveUrlsInit(),e.moveUrls.forEach((function(i){t.load(i,(function(t){n++,e.zones.push(e.vtk(t)),e.loadpercentage=Math.round(n/e.moveUrls.length*100),e.initCamera()}),(function(e){}),(function(e){console.error("An error happened")}))}))},moveShowZone:function(e,t){for(var n=this,i=e.cells,o=e.positions,s=e.colorMap,r=e.vectors,h=o.slice(0),c=0;c<h.length;c++)h[c]=h[c]+r[c]*this.vectorFactor;var l=[],u=new a["k"];if(s.get(t)){var m=s.get(t).scalars;this.minMax(m),m.forEach((function(e){var t=n.getColor(e);u.setHex(t),l.push(u.r),l.push(u.g),l.push(u.b)}))}var d=new a["h"];d.setIndex(i),d.setAttribute("color",new a["t"](l,3)),d.setAttribute("position",new a["t"](h,3));new a["X"](d);var v=new a["F"]({vertexColors:a["V"],side:a["n"]}),f=new a["E"](d,v);f.position.x=-1*(this.maxX+this.minX)/2,f.position.y=-1*(this.maxY+this.minY)/2,f.position.z=-1*(this.maxZ+this.minZ)/2,this.moveMesh=f},moveReStart:function(){this.moveflag=!0,this.currentStep=1;setInterval(this.moveAnimate,1e3)},moveStart:function(){this.moveflag=!0},moveStop:function(){this.moveflag=!1},positive:function(e){"x"==e&&this.camera.position.set(4*this.camerahight,0,0),"y"==e&&this.camera.position.set(0,4*this.camerahight,0),"z"==e&&this.camera.position.set(0,0,4*this.camerahight),this.camera.lookAt(this.scene.position),this.camera.updateMatrix()},negative:function(e){"x"==e&&this.camera.position.set(-4*this.camerahight,0,0),"y"==e&&this.camera.position.set(0,-4*this.camerahight,0),"z"==e&&this.camera.position.set(0,0,-4*this.camerahight),this.camera.lookAt(this.scene.position),this.camera.updateMatrix()},large:function(){var e=this;this.meshs.forEach((function(t){var n=t.scale.x*(1+e.mufactor),i=t.scale.y*(1+e.mufactor),o=t.scale.z*(1+e.mufactor);t.scale.set(n,i,o)}))},small:function(){var e=this;this.meshs.forEach((function(t){var n=t.scale.x*(1-e.mufactor),i=t.scale.y*(1-e.mufactor),o=t.scale.z*(1-e.mufactor);t.scale.set(n,i,o)}))}}},l=c,u=(n("eb4f"),n("2877")),m=Object(u["a"])(l,i,o,!1,null,null,null);t["a"]=m.exports},c1a4:function(e,t,n){},eb4f:function(e,t,n){"use strict";var i=n("c1a4"),o=n.n(i);o.a},f744:function(e,t,n){"use strict";n.r(t);var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{directives:[{name:"show",rawName:"v-show",value:!0,expression:"true"}]},[n("vtkLoad",{ref:"vtkLoad",attrs:{urls:e.urls,vectorFactor:e.vectorFactor,meshType:e.meshType,contourLevel:e.contourLevel}}),e._v(" "),n("el-input-number",{attrs:{min:3,max:20,label:"contour level"},model:{value:e.contourLevel,callback:function(t){e.contourLevel=t},expression:"contourLevel"}})],1),e._v(" "),n("vtk3D",{ref:"vtk3D"}),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.beginUnhidden(e.beginUrl)}}},[e._v("begin")]),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.beginhidden()}}},[e._v("begin_hidden")]),e._v(" "),n("br"),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.endContour(e.endUrl,"Displacement-magnitude")}}},[e._v("end_contour")]),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.endhidden("contour")}}},[e._v("end_contour_hidden")]),e._v(" "),n("br"),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.endEdge(e.endUrl)}}},[e._v("EdgeShow")]),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.endhidden("edge")}}},[e._v("end_edge_hidden")]),e._v(" "),n("br"),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.endScatter(e.endUrl)}}},[e._v("endScatterShow")]),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.endhidden("scatter")}}},[e._v("end_scatter_hidden")]),e._v(" "),n("br"),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.endMesh(e.endUrl)}}},[e._v("endMeshShow")]),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.endhidden("mesh")}}},[e._v("end_mesh_hidden")]),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.endVector(e.endUrl,"Displacement-magnitude")}}},[e._v("endVectorShow")]),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.endhidden("vector")}}},[e._v("end_vector_hidden")]),e._v(" "),n("br"),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.moveInitUrls(e.urls,"Displacement-magnitude")}}},[e._v("moveLoadUrls")]),e._v(" "),n("el-button",{on:{click:function(t){return e.$refs.vtk3D.endhidden("move")}}},[e._v("moveLoadUrls")])],1)},o=[],s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{directives:[{name:"show",rawName:"v-show",value:e.container_show,expression:"container_show"}],ref:"container_vtk"}),e._v(" "),n("el-button",{on:{click:function(t){return e.load()}}},[e._v("Load")]),e._v(" "),n("el-progress",{attrs:{percentage:e.percentage}}),e._v(" "),n("el-button",{on:{click:function(t){return e.moveReStart()}}},[e._v("Restart")]),e._v(" "),n("el-progress",{attrs:{percentage:e.movetage}}),e._v(" "),n("el-button",{on:{click:function(t){return e.moveStop()}}},[e._v("Stop")]),e._v(" "),n("el-button",{on:{click:function(t){return e.moveStart()}}},[e._v("Start")]),e._v(" "),n("el-tag",{attrs:{color:"#0000ff"}},[e._v("#0000ff")]),e._v(" "),e._l(e.baseColors,(function(t,i){return n("el-tag",{key:i,attrs:{color:t}},[e._v("\r\n "+e._s(t))])}))],2)},r=[],a=(n("5df3"),n("f400"),n("ac6a"),n("6b54"),n("a481"),n("28a5"),n("c5f6"),n("5a89")),h=(n("e3d9"),n("4721")),c={data:function(){return{container_show:!0,scene:null,renderer:null,camera:null,controls:null,maxX:0,maxY:0,maxZ:0,minX:0,minY:0,minZ:0,camerahight:5,mufactor:.2,meshs:[],zones:[],percentage:0,movetage:0,nowIndex:0,moveflag:!1,clock:null,baseColors:[]}},props:{urls:Array,vectorFactor:Number,meshType:Number,contourLevel:Number},mounted:function(){this.initScene(),this.initBaseColors()},watch:{contourLevel:{handler:function(e){this.initBaseColors()},deep:!0,immediate:!1}},methods:{getColor:function(e,t,n){for(var i=(t-e)/this.contourLevel,o=0;o<this.contourLevel;o++){var s=e+o*i;if(Math.max(s,n)==s){var r=this.baseColors[o];return r}}return this.baseColors[this.contourLevel-1]},initBaseColors:function(){this.baseColors=[];var e=0,t=240;this.baseColors.push(this.colorHex(this.hsltorgb(e,100,50)));for(var n=Math.round((t-e)/this.contourLevel),i=1;i<this.contourLevel-1;i++)this.baseColors.push(this.colorHex(this.hsltorgb(e+n*i,100,50)));this.baseColors.push(this.colorHex(this.hsltorgb(t,100,50)))},hsltorgb:function(e,t,n){e/=360,t/=100,n/=100;var i=[];if(0==t)i=[Math.round(255*n),Math.round(255*n),Math.round(255*n)];else for(var o=n>=.5?n+t-n*t:n*(1+t),s=2*n-o,r=(i[0]=e+1/3,i[1]=e,i[2]=e-1/3,0);r<i.length;r++){var a=i[r];switch(a<0?a+=1:a>1&&(a-=1),!0){case a<1/6:a=s+6*(o-s)*a;break;case 1/6<=a&&a<.5:a=o;break;case.5<=a&&a<2/3:a=s+(o-s)*(4-6*a);break;default:a=s;break}i[r]=Math.round(255*a)}return this.colorHex("rgb("+i[0]+","+i[1]+","+i[2]+")")},colorHex:function(e){var t=/^(rgb|RGB)/;if(t.test(e)){for(var n="#",i=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),o=0;o<i.length;o++){var s=Number(i[o]).toString(16);"0"===s&&(s+=s),n+=s}return console.log(i),console.log(n),n}return console.log(e),String(e)},init:function(){this.clock=new a["j"],this.scene=new a["P"],this.renderer=new a["W"]({antialias:!0,alpha:!0}),this.camera=new a["H"](20,1,.2,1e4),this.controls=new h["a"](this.camera,this.renderer.domElement)},initScene:function(){null==this.scene&&this.init(),this.renderer.setSize(500,500),this.$refs.container_vtk.appendChild(this.renderer.domElement)},load:function(){var e=this,t=0;e.urls.forEach((function(n){e.loadone(n,(function(){t++,e.percentage=Math.round(t/e.urls.length*100)}))}))},show:function(e){var t=this;this.movetage=Math.round(e/this.zones.length*100);var n=this.zones[e].cells,i=this.zones[e].positions,o=this.zones[e].colorMap,s=this.zones[e].vectors,r=new a["h"];r.setIndex(n),r.setAttribute("position",new a["t"](i,3));var h=new a["X"](r),c=new a["A"](h,new a["y"]({color:65280}));c.position.x=-1*(this.maxX+this.minX)/2,c.position.y=-1*(this.maxY+this.minY)/2,c.position.z=-1*(this.maxZ+this.minZ)/2,this.meshs.push(c),this.scene.add(c);for(var l=i.slice(0),u=0;u<l.length;u++)l[u]=l[u]+s[u]*this.vectorFactor;var m=new a["h"],d=[],v=new a["k"];if(o.get("Displacement-magnitude")){var f=o.get("Displacement-magnitude").scalars,p=0,g=0;f.forEach((function(e){p=Math.max(e,p),g=Math.min(e,g)}));var w=new a["a"](4473924);if(this.scene.add(w),f.forEach((function(e){var n=t.getColor(g,p,e);v.setHex(n),d.push(v.r),d.push(v.g),d.push(v.b)})),m.setIndex(n),m.setAttribute("position",new a["t"](l,3)),1===this.meshType){var b=new a["X"](m),x=new a["A"](b,new a["y"]({color:65280}));x.position.x=-1*(this.maxX+this.minX)/2,x.position.y=-1*(this.maxY+this.minY)/2,x.position.z=-1*(this.maxZ+this.minZ)/2,this.meshs.push(x),this.scene.add(x)}else if(2===this.meshType){m.setAttribute("color",new a["t"](d,3));var S=new a["F"]({vertexColors:a["V"],side:a["n"]}),_=new a["E"](m,S);_.position.x=-1*(this.maxX+this.minX)/2,_.position.y=-1*(this.maxY+this.minY)/2,_.position.z=-1*(this.maxZ+this.minZ)/2,this.meshs.push(_),this.scene.add(_)}}},clear:function(){var e=this;this.meshs.forEach((function(t){e.scene.remove(t)})),this.meshs=[]},loadone:function(e,t){var n=this,i=new a["s"];i.load(e,(function(e){n.vtk(e),t()}),(function(e){}),(function(e){console.error("An error happened")}))},vtk:function(e){var t,n=this,i=/^POINTS /,o=/^CELLS[ ]+(\d+)/,s=/^VECTORS /,r=/^CELL_TYPES[ ]+(\d+)/,a=/(\-?\d+\.?[\d\-\+e]*)\s+(\-?\d+\.?[\d\-\+e]*)\s+(\-?\d+\.?[\d\-\+e]*)/g,h=/(\-?\d+\.?[\d\-\+E]*)\s+(\-?\d+\.?[\d\-\+E]*)\s+(\-?\d+\.?[\d\-\+E]*)/g,c=/^[^\d.\s-]+/,l=/(\-?\d+)\s+([\s\d]*)/,u=/(\-?\d+\.?[\d\-\+E]*)\s/,m=!1,d=!1,v=!1,f=[],p=[],g=[],w=new Map,b=e.split("\n");b.forEach((function(e){if(0===e.indexOf("SCALARS")){var b=e.split(" ")[1];"undefined"==typeof w.get(b)&&w.set(b,{inSection:!0,scalars:[]}),m=!1,d=!1,!1,v=!1,w.forEach((function(e,t){t!==b&&(e.inSection=!1)}))}if(w.forEach((function(n,i){n.inSection&&null!==(t=u.exec(e))&&n.scalars.push(parseFloat(t[0]))})),m)while(null!==(t=a.exec(e))){if(null!==c.exec(e))break;var x=parseFloat(t[1]),S=parseFloat(t[2]),_=parseFloat(t[3]);n.maxX=x>n.maxX?x:n.maxX,n.maxY=S>n.maxY?S:n.maxY,n.maxZ=_>n.maxZ?_:n.maxZ,n.minX=x<n.minX?x:n.minX,n.minY=S<n.minY?S:n.minY,n.minZ=_<n.minZ?_:n.minZ,f.push(x,S,_)}if(d&&null!==(t=l.exec(e))){var M=parseInt(t[1]),k=t[2].split(/\s+/);if(M>=3)for(var E,C,L=parseInt(k[0]),y=1,Z=0;Z<M-2;++Z)E=parseInt(k[y]),C=parseInt(k[y+1]),p.push(L,E,C),y++}if(v)while(null!==(t=h.exec(e))){if(null!==c.exec(e))break;x=parseFloat(t[1]),S=parseFloat(t[2]),_=parseFloat(t[3]);g.push(x,S,_)}null!==i.exec(e)&&(m=!0,d=!1,!1,v=!1,w.forEach((function(e,t){e.inSection=!1}))),null!==o.exec(e)&&(m=!1,d=!0,!1,v=!1,w.forEach((function(e,t){e.inSection=!1}))),null!==r.exec(e)&&(m=!1,d=!1,!0,v=!1,w.forEach((function(e,t){e.inSection=!1}))),null!==s.exec(e)&&(m=!1,d=!1,!1,v=!0,w.forEach((function(e,t){e.inSection=!1})))})),this.zones.push({cells:p,positions:f,colorMap:w,vectors:g}),this.initShow()},initShow:function(){var e=this;e.camerahight=Math.max(Math.abs(e.maxX),Math.abs(e.maxY),Math.abs(e.maxZ),Math.abs(e.minX),Math.abs(e.minY),Math.abs(e.minZ)),e.controls.target.set(0,0,0),e.controls.update(),e.camera.position.set(-1,3*e.camerahight,4*e.camerahight),e.camera.lookAt(e.scene.position),e.camera.updateMatrix(),e.renderer.render(e.scene,e.camera);var t=function t(){e.renderer.render(e.scene,e.camera),requestAnimationFrame(t)};t();setInterval((function(){e.moveflag&&e.nowIndex<e.zones.length&&(e.clear(),e.show(e.nowIndex),e.nowIndex++,e.renderer.render(e.scene,e.camera))}),1e3)},moveReStart:function(){this.moveflag=!0,this.nowIndex=0},moveStart:function(){this.moveflag=!0},moveStop:function(){this.moveflag=!1},positive:function(e){"x"==e&&this.camera.position.set(4*this.camerahight,0,0),"y"==e&&this.camera.position.set(0,4*this.camerahight,0),"z"==e&&this.camera.position.set(0,0,4*this.camerahight),this.camera.lookAt(scene.position),this.camera.updateMatrix()},negative:function(e){"x"==e&&this.camera.position.set(-4*this.camerahight,0,0),"y"==e&&this.camera.position.set(0,-4*this.camerahight,0),"z"==e&&this.camera.position.set(0,0,-4*this.camerahight),this.camera.lookAt(scene.position),this.camera.updateMatrix()},large:function(){var e=this;this.meshs.forEach((function(t){var n=t.scale.x*(1+e.mufactor),i=t.scale.y*(1+e.mufactor),o=t.scale.z*(1+e.mufactor);t.scale.set(n,i,o)}))},small:function(){var e=this;this.meshs.forEach((function(t){var n=t.scale.x*(1-e.mufactor),i=t.scale.y*(1-e.mufactor),o=t.scale.z*(1-e.mufactor);t.scale.set(n,i,o)}))}}},l=c,u=n("2877"),m=Object(u["a"])(l,s,r,!1,null,null,null),d=m.exports,v=n("789b"),f=n("153d"),p={data:function(){return{urls:["http://192.168.0.43:6868/0166ac5ec27843b6b4c029a74f2cc7c8/flat/data_in/FE_Pre_New.vtk"],vectorFactor:1e5,meshType:2,contourLevel:5,beginUrl:"http://192.168.0.43:6868/0166ac5ec27843b6b4c029a74f2cc7c8/flat/data_in/FE_Pre_New.vtk",endUrl:"http://192.168.0.43:6868/8e191ffcb7114304a55022d73e9ccf03/flat/data_out/dynamicResponse-transient1000.vtk"}},mounted:function(){this.init()},components:{vtkLoad:d,GLSL:f["a"],vtk3D:v["a"]},methods:{init:function(){for(var e=1;e<1e3;e++){var t="http://192.168.0.43:6868/Flat_DynamicResponse/data_out/2.2_flat_dynamicResponse-transient"+e+".vtk";this.urls.push(t)}},showEnd:function(){this.$refs.vtk3D.endUrlLoad("http://192.168.0.43:6868/Flat_DynamicResponse/data_out/2.2_flat_dynamicResponse-transient1000.vtk")}}},g=p,w=Object(u["a"])(g,i,o,!1,null,null,null);t["default"]=w.exports}}]);
|