<div>It only re-initializes if I create another session like this</div><div>paraview.createSession(&quot;Shuttle&quot;, &quot;&quot;, &quot;default&quot;);</div><div>but I think I shouldn&#39;t be creating a new session </div>
<div>just to see a different object. </div><div><br></div><div>I am completely ok with using different file formats. All </div><div>I am trying to do is to minimize the paraviewweb-js-python </div><div>scripting part as I have very limited experience there.  That&#39;s </div>
<div>why I was using state files. Is it better to use something else ?</div><div><br></div><div>Thank you, </div><div>Cagatay                    </div><br><div class="gmail_quote">On Thu, May 3, 2012 at 2:09 PM, Sebastien Jourdain <span dir="ltr">&lt;<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Normally loading a state file should re-initialize everything, so the<br>
<div class="im"><br>
activeView = paraview.CreateIfNeededRenderView();<br>
paraview.ResetCamera();<br>
activeView.setCenterOfRotation(activeView.getCameraFocalPoint());<br>
<br>
</div>should be redone and all the renderer should be re-init with the new view id.<br>
<br>
Seb<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Thu, May 3, 2012 at 5:02 PM, Sebastien Jourdain<br>
&lt;<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>&gt; wrote:<br>
&gt; Hi Cagatay,<br>
&gt;<br>
&gt; does your data needs to be a ParaView state file, our would it be<br>
&gt; better if it was some other VTK compatible file ?<br>
&gt;<br>
&gt; Seb<br>
&gt;<br>
&gt; On Thu, May 3, 2012 at 3:18 PM, Cagatay Bilgin &lt;<a href="mailto:bilgincc@gmail.com">bilgincc@gmail.com</a>&gt; wrote:<br>
&gt;&gt; I am trying to build a web application that<br>
&gt;&gt; can visualize different objects by the use<br>
&gt;&gt; of a drop down bar. I do not want to create<br>
&gt;&gt; new connections or sessions every time the<br>
&gt;&gt; user changes object to be visualized. I&#39;ve<br>
&gt;&gt; been trying the whole morning and could not<br>
&gt;&gt; figure out how to i) delete the current view,<br>
&gt;&gt; ii) set it to the view view and iii) refresh the<br>
&gt;&gt; page. Here is what I have so far.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;                 var renderers = {};<br>
&gt;&gt;                 var paraview;<br>
&gt;&gt;                 var activeView;<br>
&gt;&gt;                 var basePath =<br>
&gt;&gt; &#39;/bioimaging/home/ccbilgin/opt/apache-tomcat-6.0.35/webapps/PWShuttle/data/&#39;;<br>
&gt;&gt;                 var dataFile = &#39;tmp.pvsm&#39;;<br>
&gt;&gt;  *               paraview = new Paraview(serverUrl);<br>
&gt;&gt;  *               paraview.createSession(&quot;Shuttle&quot;, &quot;&quot;, &quot;default&quot;);<br>
&gt;&gt;<br>
&gt;&gt;                 function start(){<br>
&gt;&gt;                      //paraview.LoadState({filename: basePath +<br>
&gt;&gt; &#39;/state.pvsm&#39;});<br>
&gt;&gt;                     paraview.updateConfiguration(true, &quot;JPEG&quot;, &quot;-&quot;);<br>
&gt;&gt;                     paraview.LoadState({filename: basePath + dataFile});<br>
&gt;&gt;                     activeView = paraview.CreateIfNeededRenderView();<br>
&gt;&gt;                     paraview.ResetCamera();<br>
&gt;&gt;<br>
&gt;&gt; activeView.setCenterOfRotation(activeView.getCameraFocalPoint());<br>
&gt;&gt;<br>
&gt;&gt;                     // Create renderers<br>
&gt;&gt;                     renderers.java = new HttpAppletRenderer(&quot;javaRenderer&quot;,<br>
&gt;&gt; serverUrl);<br>
&gt;&gt;                     renderers.java.init(paraview.sessionId,<br>
&gt;&gt; activeView.__selfid__);<br>
&gt;&gt;                     renderers.java.setSize(&quot;1&quot;,&quot;1&quot;);<br>
&gt;&gt;<br>
&gt;&gt;                     renderers.flash = new FlashRenderer(&quot;flashRenderer&quot;,<br>
&gt;&gt; serverUrl);<br>
&gt;&gt;                     renderers.flash.init(paraview.sessionId,<br>
&gt;&gt; activeView.__selfid__);<br>
&gt;&gt;<br>
&gt;&gt;                     renderers.js = new JavaScriptRenderer(&quot;jsRenderer&quot;,<br>
&gt;&gt; serverUrl);<br>
&gt;&gt;                     renderers.js.init(paraview.sessionId,<br>
&gt;&gt; activeView.__selfid__);<br>
&gt;&gt;<br>
&gt;&gt;                     paraview.updateConfiguration(true, &quot;JPEG&quot;, &quot;WebGL&quot;);<br>
&gt;&gt;                     renderers.webgl = new WebGLRenderer(&quot;webglRenderer&quot;,<br>
&gt;&gt; serverUrl);<br>
&gt;&gt;                     renderers.webgl.init(paraview.sessionId,<br>
&gt;&gt; activeView.__selfid__);<br>
&gt;&gt;<br>
&gt;&gt;                     // Remove Java when use in IE<br>
&gt;&gt;                     if (navigator.appName.indexOf (&#39;Microsoft&#39;) != -1) {<br>
&gt;&gt;                         var e = document.getElementById(&quot;java&quot;)<br>
&gt;&gt;                         var parent = e.parentNode;<br>
&gt;&gt;                         if(e){<br>
&gt;&gt;                             parent.removeChild(e);<br>
&gt;&gt;                         }<br>
&gt;&gt;                     }<br>
&gt;&gt;<br>
&gt;&gt;                     // Use webgl as default<br>
&gt;&gt;                     renderers.current = renderers.webgl;<br>
&gt;&gt;                     renderers.current.bindToElementId(&quot;renderercontainer&quot;);<br>
&gt;&gt;                     renderers.current.start();<br>
&gt;&gt;<br>
&gt;&gt;                     // Update render size<br>
&gt;&gt;                     updateSize();<br>
&gt;&gt;<br>
&gt;&gt;                     // Action images<br>
&gt;&gt;                     updateActionButtons(true);<br>
&gt;&gt;                 }<br>
&gt;&gt;<br>
&gt;&gt; ....<br>
&gt;&gt;<br>
&gt;&gt; function switchData(){<br>
&gt;&gt;                     var type = document.getElementById(&quot;data-type&quot;).value;<br>
&gt;&gt;                     dataFile = &#39;cone.pvsm&#39;;<br>
&gt;&gt;                     start();<br>
&gt;&gt;                 }<br>
&gt;&gt;<br>
&gt;&gt; ....<br>
&gt;&gt;<br>
&gt;&gt; &lt;select id=&quot;data-type&quot; name=&quot;data-type&quot;<br>
&gt;&gt;                 style=&quot;z-index: 5;width: 100px; position: absolute; right:<br>
&gt;&gt; 40px; top: 30px;&quot;<br>
&gt;&gt;                 onchange=&quot;switchData()&quot; &gt;<br>
&gt;&gt;             &lt;option value=&quot;1&quot;&gt;1.mhd&lt;/option&gt;<br>
&gt;&gt;             &lt;option value=&quot;2&quot;&gt;2.mhd&lt;/option&gt;<br>
&gt;&gt;             &lt;option value=&quot;3&quot;&gt;3.mhd&lt;/option&gt;<br>
&gt;&gt;         &lt;/select&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;<br>
&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;<br>
&gt;&gt; Please keep messages on-topic and check the ParaView Wiki at:<br>
&gt;&gt; <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
&gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
&gt;&gt;<br>
</div></div></blockquote></div><br>