[vtkusers] abstract classes in vtkLocal

Joris van Zwieten vanzwieten at gmail.com
Thu Dec 9 07:32:39 EST 2004


Hi all,

I've created some local classes using the vtkLocal project, among
which one abstract class. After some reading of other CMakeList.txt
files, I've added the following to the CMakeList.txt of vtkLocal:

SET_SOURCE_FILES_PROPERTIES(
# vtkObjectBase is marked ABSTRACT so that instantiators are happy.
vtkSeparableKernel
ABSTRACT
)

Here, vtkSeparableKernel is my local abstract class. After this change
I was able to compile the vtkLocal project. (Before this change this
was not possible, because the generated file vtkLocalInstantiator
included a reference to the New method of vtkSeparableKernel, which
obviously didn't exist). So far, so good.

However, the code is also wrapped in python, and it seems python is
unable to recognise derived classes of vtkSeparableKernel as such. In
the following example, vtkGaussianKernel is a subclass of
vtkSeparableKernel, and vtkImageSepConvolution.SetKernel() expects a
vtkSeparableKernel.

>>> import vtkLocalPython
>>> kernel=vtkLocalPython.vtkGaussianKernel()
>>> conv=vtkLocalPython.vtkImageSepConvolution()
>>> conv.SetKernel(kernel)
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
ValueError: method requires a vtkSeparableKernel, a vtkGaussianKernel
was provided.

Any ideas what I might be missing? 

A comparable situation with vtkSuperQuadric and vtkSampleFilter, i.e.
vtkSuperQuadric is a subclass of the abstract class
vtkImplicitFunction and vtkSampleFilter.SetImplicitFunction expects a
vtkImplicitFunction works fine.

Thanks,

    Joris van Zwieten



More information about the vtkusers mailing list