[Paraview] Paraviewweb

Sebastien Jourdain sebastien.jourdain at kitware.com
Sun Apr 8 14:15:43 EDT 2012


Ok, I miss understood your goal.

Then, the missing part should be something like that.

var view = paraview.GetRenderView(); // this is optional if you
already have a reference to the view...
view.setInteractionMode(2);

Although, I've quickly tried it online with firebug and I did not
manage to see the selection. I'm wondering if we are both missing
something here... Like the creation of a selection proxy that is
created to get the selected screen area and convert it to a set of
cellId...

Utkarsh might have a better insight on that selection part.

Seb

PS: Here is the mapping based on the string values

file: ParaView-SRC/ParaViewCore/ServerImplementation/Resources/views_and_representations.xml

<IntVectorProperty name="InteractionMode"
       command="SetInteractionMode"
       number_of_elements="1"
       default_values="0">
       <EnumerationDomain name="enum">
         <Entry text="3D" value="0" />
         <Entry text="2D" value="1" />
         <Entry text="Selection" value="2" />
       </EnumerationDomain>
     </IntVectorProperty>

On Sun, Apr 8, 2012 at 12:43 PM, Jane Hickmott <jane.hickmott at yahoo.com> wrote:
> Hi Seb,
> Thank you for your help.  However, your code appears to only toggle
> 'SelectionPointLabelVisibility' on/off.  What I really need is the
> equivalent of 'select points on' button as on the GUI that will enable me to
> interactively select an area on the plot to display labels on.  I can do
> this easily interactively, but the python trace appears not to record all of
> the clicks.  There is something I'm missing...
>
> Frustrated... :(
>
> Jane.
>
> ________________________________
> From: Sebastien Jourdain <sebastien.jourdain at kitware.com>
> To: Jane Hickmott <jane.hickmott at yahoo.com>
> Cc: paraview at paraview.org
> Sent: Sunday, 8 April 2012, 14:44
> Subject: Re: [Paraview] Paraviewweb
>
> Hi Jane,
>
> keep the prarview mailing list in the loop so anyone could contribute and
> learn.
>
> In your case that will be pretty simple.
> If you use jQuery as JavaScript library that could look like that:
>
> var sourceProxy = paraview.FindSource({name:"Fluid_f2.vtk"});
> var representation = paraview.GetDisplayProperties({proxy: sourceProxy});
> $('.my-button-class').click(function() {
>   if($(this).toggleClass("showLabel").hasClass("showLabel")) {
>     representation.setSelectionPointLabelVisibility(1);
>   } else {
>     representation.setSelectionPointLabelVisibility(0);
>   }
> });
>
> Or you can create a python script on the server side that can be
> called from the JavaScript.
> For more details on that you can read the plugin documentation of
> ParaViewWeb here.
>
> http://www.paraview.org/Wiki/ParaViewWeb_Plugins
>
> Seb
>
> On Sun, Apr 8, 2012 at 4:10 AM, Jane Hickmott <jane.hickmott at yahoo.com>
> wrote:
>> Thank you, Seb.  Much appreciated.  Sorry I'm a novice in Javascript.
>>  Here
>> is a python trace of what I would like to accomplish - can anyone please
>> show me how to convert this to javascript?  Many thanks.
>> As an aside is there no way to call an external python module from within
>> javascript?  That would solve everything.
>>
>> Jane.
>>
>> try: paraview.simple
>> except: from paraview.simple import *
>> paraview.simple._DisableFirstRenderCameraReset()
>>
>> Fluid_f2 = FindSource("Fluid_f2.vtk")
>> DataRepresentation1 = GetDisplayProperties(Fluid_f2)
>> RenderView1 = GetRenderView()
>> DataRepresentation1.SelectionPointLabelVisibility = 1
>>
>> RenderView1.InteractionMode = 'Selection'
>>
>> RenderView1.CameraClippingRange = [19767.705902611211, 38094.489486240847]
>> RenderView1.InteractionMode = '3D'
>>
>> Render()
>>
>> ________________________________
>> From: Sebastien Jourdain <sebastien.jourdain at kitware.com>
>> To: Jane Hickmott <jane.hickmott at yahoo.com>
>> Cc: "paraview at paraview.org" <paraview at paraview.org>
>> Sent: Saturday, 7 April 2012, 19:29
>> Subject: Re: [Paraview] Paraviewweb
>>
>> Hi Jane,
>>
>> The best thing to do to figure out what is needed in your use case, is
>> to load your state inside ParaView and do the action that you want to
>> achieve while the Python trace is recording your changes.
>>
>> Once you get the trace of your actions you can either convert that
>> code to JavaScript or write a plugin that execute somehow the same
>> action in Python as we are using python to write ParaViewWeb plugins.
>>
>> The access of the trace mechanism is inside the Tools menu of ParaView.
>>
>> If you need some help to figure out the conversion between Python and
>> JS, just post the trace on the mailing list.
>>
>> I'm glad you managed to produce your own first Web application using
>> ParaViewWeb.
>>
>> Seb
>>
>> On Sat, Apr 7, 2012 at 6:44 AM, Jane Hickmott <jane.hickmott at yahoo.com>
>> wrote:
>>> Hi Paraview community!
>>> I am trying to develop a paraviewweb application that involves loading of
>>> a
>>> state file plus the creation of a 'button' to allow data labels to appear
>>> on
>>> the plot.  I can load the state file but have no idea how to create the
>>> necessary button and functionality.  I would be grateful to anyone kind
>>> enough to give me a few pointers.  Thank you.
>>>
>>> Jane
>>>
>>> _______________________________________________
>>> 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