subclassing vtkCamera

Bill Hoffman bill.hoffman at kitware.com
Thu Jun 1 09:54:01 EDT 2000


It can be done with a factory.   If you create a factory that
overrides "vtkOpenGLCamera", something like this:



class VTK_EXPORT TestFactoryOne : public vtkObjectFactory
{
public:
   static TestFactoryOne *New() {return new TestFactoryOne;};
   const char *GetClassName() {return "TestFactoryOne";};
   void PrintSelf(ostream& os, vtkIndent indent);
   virtual const char* GetVTKSourceVersion();
   virtual const char* GetDescription();
protected:
   TestFactoryOne();
   ~TestFactoryOne() {};
   TestFactoryOne(const TestFactoryOne&) {};
   void operator=(const TestFactoryOne&) {};
};

extern "C" VTK_EXPORT vtkObjectFactory* vtkLoad();



vtkObject* createvtkMyOpenGLCamera()
{
   return new vtkMyOpenGLCamera;
}

TestFactoryOne::TestFactoryOne()
{
   this->RegisterOverride("vtkOpenGLCamera",
                          "vtkMyOpenGLCamera",
                          "My camera",
                          1,
                          createvtkMyOpenGLCamera);
}


Then either register the factory in your program or register it
by makeing it a dll or shared library and putting it in your
VTK_AUTOLOAD_PATH.


At 09:23 AM 6/1/00 -0400, David Gobbi wrote:
>Hi Matt,
>
>I don't think there is any correct way to do this.  If the
>existing vtkCamera class is not flexible enough for what
>you are trying to do, then perhaps the vtkCamera class
>needs to be changed.  If the changes are generally useful,
>then they could be added to VTK.
>
>  - David
>
>--
>   David Gobbi, MSc                    dgobbi at irus.rri.on.ca
>   Advanced Imaging Research Group
>   Robarts Research Institute, University of Western Ontario
>
>On Thu, 1 Jun 2000, Matt Clarkson wrote:
>
> > Hi there,
> >       how am I meant to create sub classes of vtkCamera.
> > I want to add some functionality to it, but I have just
> > been looking through the source code, and I see
> > how vtkCamera is created with vtkGraphicsFactory,
> > and it actually creates an instance of vtkOpenGLCamera etc.
> > 
> > Whats the `correct' way to do it.
> > 
> > Thanks in advance
> > 
> > Matt
> > 
>
>--------------------------------------------------------------------
>This is the private VTK discussion list. Please keep messages on-topic.
>Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
><majordomo at public.kitware.com>. For help, send message body containing
>"info vtkusers" to the same address.
>-------------------------------------------------------------------- 

--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list