[Paraview] Property Panel and Inheritance?

B.W.H. van Beest bwvb at xs4all.nl
Thu Oct 2 11:15:33 EDT 2014


Hi Utkarsh,

Not sure how to do that, really in Paraview. The relationshop and
dynamics between what is in the xml file, source files I write and
generated files by mysterious macros make me still a bit uncomfortable
in finding my way in ParaView.   
Maybe you could a bit more verbose?

Regards,
Bertwim

On 10/02/2014 03:24 PM, Utkarsh Ayachit wrote:
> It will only warp the 1 base. I'd suggest using a proxy pattern rather
> than multiple inheritance.
>
> On Thu, Oct 2, 2014 at 9:20 AM, B.W.H. van Beest <bwvb at xs4all.nl> wrote:
>> It seems to work. Inheritance of the vtkCubeSource methods just works.
>> Also when I reverse the inheritance order, or when I have single
>> inheritance (of vtkCubeSource), in the xml-file I can just refer to the
>> methods of the base class vtkCubeSource (say SetLength()) and it works.
>> But not so for the oher base class!
>>
>> So I *think* I am using the two baseclasses the same way, the effect
>> however, is asymmetrial.
>>
>> I looked, as you suggested,  into sphBoxSourceClientServer.h  The
>> methods of the baseclasses (vtkCubeSource), e.g. SetXLength(), do not
>> show-up there either. But it works, so that might not be the place where
>> to look.
>>
>> Any other ideas?
>>
>> Regards,
>> Bertwim
>>
>>
>>
>> On 10/02/2014 02:23 PM, Utkarsh Ayachit wrote:
>>> I can't remember if the wrapping code can handle multiple inheritance.
>>> If you removed the second superclass, does that work?
>>>
>>> Also look the sphBoxSourceClientServer.h file generated in your build
>>> directory. That will indicate which methods from this class are
>>> getting wrapped and which ones aren't.
>>>
>>> Utkarsh
>>>
>>> On Thu, Oct 2, 2014 at 6:44 AM, B.W.H. van Beest <bwvb at xs4all.nl> wrote:
>>>> 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>
>>>>
>>>> _______________________________________________
>>>> 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://public.kitware.com/mailman/listinfo/paraview
>



More information about the ParaView mailing list