[Paraview] PV4.1, Custom Dock Widget: How to automatically add a glyph3d filter after loading data ?

Florian Hoffmann florian.hoffmann at inutech.de
Mon Sep 15 10:23:57 EDT 2014


I would like to automatically add a glyph filter and render the 
correctly scaled spheres after the user has opened a file in my custom 
dock widget.
I created a DockWidget using the example in /examples/Plugins/DockWidget.
When pressing a button a specific file is being opened for the user by 
the following calls:

  void on_button_clicked()
{
         QStringxdmfFile="C:\\..\\unknown_case.xdmf";

     QStringList  visuFiles;

     visuFiles.append(xdmfFile);

     pqPipelineSource*  pqPlinesource  =  pqLoadDataReaction::loadData(visuFiles);

     pqPlinesource->updatePipeline();

    // TODO:
    // add spherical glyph for loaded polyData
    // scale spherical glyphs by a scalar attribute/property
    // render glyphs

}

I would like to include that the code automatically adds spherical 
glyphs and renders them for the data just loaded.

I tried the following code but I am not sure if it works

vtkSMProxy*myProxy=pqPlinesource->getProxy();

         vtkObjectBase  *myObject  =  myProxy->GetClientSideObject();

         vtkAlgorithm  *myvtkAlgo  =  vtkAlgorithm::SafeDownCast(myObject);

         vtkGlyph3D  *myspheres  =   vtkGlyph3D::New();

         myspheres->SetSourceConnection(myvtkAlgo->GetOutputPort());



In case this is supposed to work, how can I now update the pipeline and 
render the spheres using C++ PV core functionality ? (The user should 
also see the result in the pipeline browser dock of the GUI).

In case my approach is totally wrong, what would be the right way of 
handling this situation ?

Thank you.

Best regards,

Florian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140915/2ca13fa2/attachment.html>


More information about the ParaView mailing list