[Paraview] changing the current view in pvw

Cagatay Bilgin bilgincc at gmail.com
Thu May 3 17:40:59 EDT 2012


It only re-initializes if I create another session like this
paraview.createSession("Shuttle", "", "default");
but I think I shouldn't be creating a new session
just to see a different object.

I am completely ok with using different file formats. All
I am trying to do is to minimize the paraviewweb-js-python
scripting part as I have very limited experience there.  That's
why I was using state files. Is it better to use something else ?

Thank you,
Cagatay

On Thu, May 3, 2012 at 2:09 PM, Sebastien Jourdain <
sebastien.jourdain at kitware.com> wrote:

> 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
> >>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120503/a9c51bc8/attachment-0001.htm>


More information about the ParaView mailing list