[vtkusers] SafeDownCast does not work properly

Maximilian Weiherer weiherer.maximilian at gmx.de
Wed Aug 9 11:50:17 EDT 2017


Hi all, 

 

I defined my own mesh class (named Mesh) by inheriting from vtkPolyData. Now
I am struggling with the SafeDownCast method in order to cast a vtkPolyData
object into a Mesh object. Whenever I am applying a SafeDownCast to a
vtkPolyData object, NULL is returned.

 

The Mesh class looks as follows:

 

class Mesh : public vtkPolyData

{

  public:

    static Mesh* New();

    vtkTypeMacro(Mesh, vtkPolyData);

    void PrintSelf(ostream& os, vtkIndent indent);

 

  protected:

    Mesh();

    ~Mesh();

  private:

    Mesh(const Mesh&); // Not implemented.

    void operator=(const Mesh&); // Not implemented.

};

 

.and this is the cast that does not work properly:

 

Mesh* mesh = Mesh::SafeDownCast(<vtkPolyData object>); // mesh always equals
NULL

 

Any help would be appreciated. Thanks!

 

Best regards

Maximilian



---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170809/622d4a81/attachment.html>


More information about the vtkusers mailing list