[vtkusers] Access style class member variables in a callback?
David Doria
daviddoria+vtk at gmail.com
Thu Oct 22 10:39:21 EDT 2009
I've added an observer to a rubberband2d style:
//setup 2D interaction style
vtkInteractorStyleRubberBand2D* style = vtkInteractorStyleRubberBand2D::New();
style->AddObserver(vtkCommand::SelectionChangedEvent,SelectionChangedCallback);
//setup render window interactor
vtkRenderWindowInteractor* RenderWindowInteractor =
vtkRenderWindowInteractor::New();
RenderWindowInteractor->SetInteractorStyle( style );
Now in the callback, I want to access the style's StartPosition variable:
void SelectionChangedCallbackFunction(vtkObject* caller, long unsigned
int eventId, void* clientData, void* callData)
{
vtkstd::cout << "Selection changed callback" << vtkstd::endl;
//vtkstd::cout << "Start: " << this->StartPosition[0] << " " <<
this->StartPosition[1] << vtkstd::endl; //can't use 'this' in
non-member function
}
Since this callback is not a member function of the style class, the
variable is not accessible. This should be very easy - as I'd imagine
the whole idea of this style is to get the StartPosition and
EndPosition of the selection?
Any suggestions/comments?
Thanks,
David
More information about the vtkusers
mailing list