[vtkusers] Superclass not being set correctly?

Jérôme jerome.velut at gmail.com
Wed Dec 2 16:55:25 EST 2009


Hi David,
In your vtkImageCamera.h, the line

   vtkTypeRevisionMacro(vtkImageCamera,vtkObject);

effectively tells that vtkImageCamera "is a" vtkObject!

You should use
   vtkTypeRevisionMacro(vtkImageCamera,vtkPhysicalCamera)
instead

HTH,
Jerome


2009/12/2 David Doria <daviddoria+vtk at gmail.com <daviddoria%2Bvtk at gmail.com>
>

> I have 2 classes, vtkImageCamera that inherits from vtkPhysicalCamera -
>
> class vtkImageCamera : public vtkPhysicalCamera
>
> The PrintSelf function of the derived class is:
>
> void vtkImageCamera::PrintSelf(ostream& os, vtkIndent indent)
> {
>  this->Superclass::PrintSelf(os,indent);
>  os << "new info here.";
> }
>
> When I output the derived class, I'd expect it to first call PrintSelf
> of vtkPhysicalCamera. However, the vtkImageCamera::PrintSelf thinks
> the Superclass is vtkObject and it never calls
> vtkPhysicalCamera::PrintSelf.
>
> The output of:
> vtkstd::cout << "ImageCamera Superclass: " <<
> this->Superclass::GetClassName() << vtkstd::endl;
>
> is
> ImageCamera Superclass: vtkImageCamera
>
> Is there something that needs to be done manually to set the
> SuperClass variable to vtkPhysicalCamera?
> The vtkObject::PrintSelf function is called, but it skips the
> vtkPhysicalCamera::PrintSelf.
>
> Here is an extracted example of the problem:
> http://www.rpi.edu/~doriad/VTK_List/SuperClass/<http://www.rpi.edu/%7Edoriad/VTK_List/SuperClass/>
>
> Thanks,
>
> David
> _______________________________________________
> 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 VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091202/54991006/attachment.htm>


More information about the vtkusers mailing list