[vtkusers] Superclass not being set correctly?

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Wed Dec 2 16:52:17 EST 2009


Make sure vtkTypeRevisionMacro is setup correctly in both the headers
with correct superclass names.

Utkarsh

On Wed, Dec 2, 2009 at 4:50 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> 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/
>
> 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
>



More information about the vtkusers mailing list