[vtkusers] Derive your own Actor class from vtkActor?

P Bai apbai at yahoo.com
Fri Aug 16 14:44:09 EDT 2002


Hi all,

I wonder if anyone has experience deriving your own
actor class from vtkActor? 

Actually I was just trying to store a user-defined
pointer in each actor. But vtkActor seems to have no
way to store user defined data... so I try to derive a
simple actor class from vtkActor but it doesn't work
(see the following code). Does anyone know how to do
it? A sample code would be highly appreciated. 

Thanks!

My code is like this:

#include <vtkActor.h>

class CMyActor : public vtkActor  
{
public:
    vtkTypeMacro(CMyActor, vtkActor);
    void PrintSelf(ostream& os, vtkIndent indent)
    {
        vtkActor::PrintSelf(os, indent);
    }
	
    static CMyActor* New()
    {
        /***** got compile warning here *****/
        return new CMyActor;
    }

    void SetPointer(void* p) { m_Pointer = p; }
    void* GetPointer() { return m_Pointer; }

protected:
    CMyActor() {}
    virtual ~CMyActor() {}

private:
    CMyActor(const CMyActor&);  // Not implemented.
    void operator=(const CMyActor&);  // Not
implemented.

protected:
    void* m_pPointer;
};



__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com



More information about the vtkusers mailing list