[Paraview] changing the current view in pvw
Cagatay Bilgin
bilgincc at gmail.com
Thu May 3 15:18:53 EDT 2012
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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120503/45c41bb3/attachment.htm>
More information about the ParaView
mailing list