[vtkusers] Troubles with New() and vtkTypeMacro

David Doria daviddoria at gmail.com
Fri Aug 24 08:56:12 EDT 2012


On Fri, Aug 24, 2012 at 8:33 AM, Heidler, Kirstin (GE Oil & Gas)
<Kirstin.Heidler at ge.com> wrote:
> Thanks, you are right. J
>
>
>
> But that still does not save the issues with the TypeMacro.  Did I forget to
> include something?

You should always try to provide a compilable example of the problem
(see http://www.vtk.org/Wiki/VTK/MinimalExample). It helps us debug as
quickly as possible. I think the problem here is that you had
vtkInteractorStyleTrackballActor in the vtkTypeMacro instead of the
parent class vtkInteractorStyleTrackballCamera (see below).

#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkSmartPointer.h>
#include <vtkObjectFactory.h>

class vtkKeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera
{
public:
    static vtkKeyPressInteractorStyle* New();
    //vtkTypeMacro(vtkKeyPressInteractorStyle,
vtkInteractorStyleTrackballActor); // errors with this.
    vtkTypeMacro(vtkKeyPressInteractorStyle,
vtkInteractorStyleTrackballCamera); // works correctly
};

int main(int , char *[])
{
  return EXIT_SUCCESS;
}

Hope that helps,

David



More information about the vtkusers mailing list