[Paraview] [paraview] Question about pqView

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Thu May 21 08:37:05 EDT 2009


Andres,

The active pqView can always change -- as you discovered when state file is
loaded or new views are created or client disconnects/reconnects to a server
etc. So it makes sense to get the active view fresh each time. Also note
that the active view can be NULL as well or some other type that the render
view. So a save method would be:

pqView * theView = pqActiveView::instance().current();
vtkSMRenderViewProxy* myProxy = theView?
  vtkSMRenderViewProxy::SafeDownCast(theView->getViewProxy()) : NULL;
if (!myProxy)
  {
  // no active view, or active view is not a render view.
  return;
  }

Hopefully that helps.

Utkarsh


2009/5/20 Andrés Felipe Padilla <anfeken at gmail.com>

> Hello all,
> I'm developing a ParaView plugin that modifies the camera position with
> data coming from a interaction device. I'm using C++ and Linux 64 bit. I
> have tested it with the build in server and it works without a hitch.
> However, when I connect the client to a server used for visualizing data in
> a tiled display, I run on some issues, namely a Segmentation Fault :(.
>
> When I connect my client to the remote server, I load my plugin and connect
> it to the server used for reading the data from the interaction device. It
> works well if I use a build-in source for test (like a cylinder), and
> nothing wrong happen. However, If I try to load a ParaView state of a more
> complex model, the client collapses (Almost every time, sometimes it works
> just fine and I can use the interaction device with the tile display). When
> I run gdb, It says that the segmentation fault is triggered by a call to
> vtkCamera::Roll or some other method of vtkCamera. Since I'm doing this at
> the constructor of my plugin:
>
>   pqView * theView = pqActiveView::instance().current();
>   vtkSMRenderViewProxy* myProxy =
> (vtkSMRenderViewProxy*)theView->getViewProxy();
>  *theCamera = myProxy->GetActiveCamera();
>
> and theCamera is a member of my plugin class, I thought that maybe the
> pqView is changing when I load the state, and the vtkCamera address is no
> longer valid. Obviously, I would get a Segmentation Fault.
>
> Since It seems like pqView changes when I load a state, then I changed my
> code in order to obtain the new pqView each time my method that changes the
> camera position is called (It is a SLOT, by the way). So I changed it like
> this:
>
> void myClass::changeCameraPosition(const float  roll, const float
> elevation, const float  azimuth)
> {
>   pqView * theView = pqActiveView::instance().current();
>   vtkSMRenderViewProxy* myProxy =
> (vtkSMRenderViewProxy*)theView->getViewProxy();
>   vtkCamera *newCamera = myProxy->GetActiveCamera();
>   cout << "AddNewCam "<<newCamera<<" endNC"<<endl;
>   newCamera->Roll(roll);
>   newCamera->Elevation(elevation);
>   newCamera->Azimuth(azimuth);
>   newCamera->OrthogonalizeViewUp();
> }
>
> As you can see, I have added a cout in order to show the new address of
> theCamera. However, when I tried this solution, the client would die even
> before printing the new camera address.
>
> So, I wanted to ask you, What I'm doing wrong? Is there something different
> with pqView in a local setting opposed to a remote setting? And, more
> importantly, why it works sometimes? I would expect a bad behaving code to
> break every single time, not working in isolated occasions.
>
> Thanks a lot in advance for your help.
>
> Best Regards,
>
> Andrés Padilla
> Universidad de los Andes, Graduate Student
>
> _______________________________________________
> 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/20090521/d2662bec/attachment.htm>


More information about the ParaView mailing list