[Paraview] changing the current view in pvw
Sebastien Jourdain
sebastien.jourdain at kitware.com
Thu May 3 17:09:28 EDT 2012
Normally loading a state file should re-initialize everything, so the
activeView = paraview.CreateIfNeededRenderView();
paraview.ResetCamera();
activeView.setCenterOfRotation(activeView.getCameraFocalPoint());
should be redone and all the renderer should be re-init with the new view id.
Seb
On Thu, May 3, 2012 at 5:02 PM, Sebastien Jourdain
<sebastien.jourdain at kitware.com> wrote:
> Hi Cagatay,
>
> does your data needs to be a ParaView state file, our would it be
> better if it was some other VTK compatible file ?
>
> Seb
>
> On Thu, May 3, 2012 at 3:18 PM, Cagatay Bilgin <bilgincc at gmail.com> wrote:
>> I am trying to build a web application that
>> can visualize different objects by the use
>> of a drop down bar. I do not want to create
>> new connections or sessions every time the
>> user changes object to be visualized. I've
>> been trying the whole morning and could not
>> figure out how to i) delete the current view,
>> ii) set it to the view view and iii) refresh the
>> page. Here is what I have so far.
>>
>>
>>
>> var renderers = {};
>> var paraview;
>> var activeView;
>> var basePath =
>> '/bioimaging/home/ccbilgin/opt/apache-tomcat-6.0.35/webapps/PWShuttle/data/';
>> var dataFile = 'tmp.pvsm';
>> * paraview = new Paraview(serverUrl);
>> * paraview.createSession("Shuttle", "", "default");
>>
>> function start(){
>> //paraview.LoadState({filename: basePath +
>> '/state.pvsm'});
>> paraview.updateConfiguration(true, "JPEG", "-");
>> paraview.LoadState({filename: basePath + dataFile});
>> activeView = paraview.CreateIfNeededRenderView();
>> paraview.ResetCamera();
>>
>> activeView.setCenterOfRotation(activeView.getCameraFocalPoint());
>>
>> // Create renderers
>> renderers.java = new HttpAppletRenderer("javaRenderer",
>> serverUrl);
>> renderers.java.init(paraview.sessionId,
>> activeView.__selfid__);
>> renderers.java.setSize("1","1");
>>
>> renderers.flash = new FlashRenderer("flashRenderer",
>> serverUrl);
>> renderers.flash.init(paraview.sessionId,
>> activeView.__selfid__);
>>
>> renderers.js = new JavaScriptRenderer("jsRenderer",
>> serverUrl);
>> renderers.js.init(paraview.sessionId,
>> activeView.__selfid__);
>>
>> paraview.updateConfiguration(true, "JPEG", "WebGL");
>> renderers.webgl = new WebGLRenderer("webglRenderer",
>> serverUrl);
>> renderers.webgl.init(paraview.sessionId,
>> activeView.__selfid__);
>>
>> // Remove Java when use in IE
>> if (navigator.appName.indexOf ('Microsoft') != -1) {
>> var e = document.getElementById("java")
>> var parent = e.parentNode;
>> if(e){
>> parent.removeChild(e);
>> }
>> }
>>
>> // Use webgl as default
>> renderers.current = renderers.webgl;
>> renderers.current.bindToElementId("renderercontainer");
>> renderers.current.start();
>>
>> // Update render size
>> updateSize();
>>
>> // Action images
>> updateActionButtons(true);
>> }
>>
>> ....
>>
>> function switchData(){
>> var type = document.getElementById("data-type").value;
>> dataFile = 'cone.pvsm';
>> start();
>> }
>>
>> ....
>>
>> <select id="data-type" name="data-type"
>> style="z-index: 5;width: 100px; position: absolute; right:
>> 40px; top: 30px;"
>> onchange="switchData()" >
>> <option value="1">1.mhd</option>
>> <option value="2">2.mhd</option>
>> <option value="3">3.mhd</option>
>> </select>
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>
More information about the ParaView
mailing list