[Paraview] Property Panel and Inheritance?

B.W.H. van Beest bwvb at xs4all.nl
Thu Oct 2 06:44:45 EDT 2014


Hello, I'm struggling with getting the properties panel right for a new
Source defined in plugin that I'm writing.

In the class below, I'm extending the VTK class for a rectangular box,
vtkCubeSource. The class also derives from another class,
that has the well known method  "foo".   I have made corresponding
changes to the server manager file (xml), given below.

In the xml-file, I can specify the panel entries for the vtkCubeSource,
referring to the methods of this vtk class which are available via
inheritance, for instance "SetXLength(double)". However, when I do the
same for the method "foo(int)" of the other base class, ParaView bombs,
telling me that:

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
tkPVSessionCore (0x113a740): Object type: sphBoxSource, could not find
requested method: "foo"
or the method was called with incorrect arguments.

while processing
Message 0 = Invoke
  Argument 0 = vtk_object_pointer {sphBoxSource (0x30fbe00)}
  Argument 1 = string_value {foo}
  Argument 2 = int32_value {1024}
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

The problem is gone when I provide the derived class also with a method
"foo", which calls the "foo" of the base class.
In short, I can refer, in the panel, to the methods of vtkCubeSource (as
expected due to inheritance), but not for the other base class.
What am I overlooking here, and what do I need to do to have the
expected inheritance?

Your view
Kind Regards,
Bertwim
---------------------


This is my class:
=====================================
class sphBoxSource : public vtkCubeSource
                                 , public SPHParticleProps
{
public:
  static sphBoxSource* New();
   vtkTypeMacro(sphBoxSource,vtkCubeSource);

public:
   sphBoxSource( double, double, double );
   ~sphBoxSource();

public:  // testing purposes only
   void foo( int i ){ SPHParticleProps::foo(i);}   // For the Properties
pane,: Why can I can not just inherit the method "foo"?
};
=======================================

The server manager configuration is taken from "sources.xml" that comes
with ParaView (4.2), but extended with a property for "foo".

=======================================
<ServerManagerConfiguration>
   <ProxyGroup name="sources">
   <!--
==================================================================== -->
   <SourceProxy class="sphBoxSource"
                label="SPHBox"
                name="SPHBoxSource">
      ...
      <DoubleVectorProperty animateable="1"
                            command="SetXLength"
                            default_values="10.0"
                            name="XLength"
                            number_of_elements="1"
                            panel_visibility="default">
         <DoubleRangeDomain min="0" name="range" />
         <Documentation>This property specifies the length of the box in
the X direction.</Documentation>
      </DoubleVectorProperty>

      ....

      <!-- Add gui component for testing purposes -->
      <IntVectorProperty command="foo"
                         default_values="1024"
                         name="foobar"
                         number_of_elements="1">
         <IntRangeDomain min="0" name="range" />
         <Documentation>Just for testing. Does nothing.</Documentation>
      </IntVectorProperty>

      <!-- End Box -->
   </SourceProxy>
   <!--
==================================================================== -->
  </ProxyGroup>
</ServerManagerConfiguration>



More information about the ParaView mailing list