[vtkusers] creating your own widget

AIs royalmatador at gmail.com
Mon Mar 3 02:57:49 EST 2014


Hi Chasank,
According to your previous post, I tried to implement two classes for
developing my own widget but I encountered some difficulties.
My first class is to have my own representation for the widget. This
representation I want to be a pointer to my actor. The second class inherits
public member function of the abstract widget for my widget API

class MyWidRep
{
    public:

     MyRep ( vtkActor *actor );

};

class MyWid : public vtkAbstractWidget
{

// member function to perform my operation

static void ProcessEvents ( vtkObject* object, unsigned long event, void*
clientdata, void*calldata );

void SetRepresentation ( MyRep *r );

}

// main function which calls the widget

int main ( int, char* [ ])
{
   //calling my widget and its representation

   vtkSmartPointer<MyWidRep > myrep = vtkSmartPointer<MyWidRep> ::New( );
   myrep->MyRep ( actor );

   vtkSmartPointer<MyWid> widget = vtkSmartPointer<MyWid>::New( );
   widget->SetInteractor ( iren );
   widget->SetRepresentation( myrep );

   widget->On ( );
}

I get the following error:  MyWid cannot  instantiate abstract class, due to
following members:
     'void vtkAbstractWidget::CreateDefaultRepresentation see declaration of
vtkAbstractWidget::CreateDefaultRepresentation'

In online example that I followed -
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/SphereWidgetEvents

works well enough for me, but the representation of the widget is always
default representation. How can I change this representation to the one that
I want.

I also tried to inherit the public member function of the
vtkWidgetRepresentation for MyWidRep but I cannot initialize the
vtkWidgetRepresentation *r to my own representation.

If someone can please guide me through this. I believe that my pipeline for
widget is not connected properly to vtk superclass for widget and I cannot
override the default parameters.
Cheers
AIs



--
View this message in context: http://vtk.1045678.n5.nabble.com/creating-your-own-widget-tp5725823p5726161.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list