[vtkusers] Window->Image coordinate conversions?

David Doria daviddoria+vtk at gmail.com
Fri Oct 23 17:22:26 EDT 2009


On Fri, Oct 23, 2009 at 1:09 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> In the callback, I think that Caller is a vtkInteractor?
>
> Can you print Caller->GetClassName()?
>
> Bill


Bill,

Ah, you are correct:
caller: vtkInteractorStyleRubberBand2D

I've never used GetClassName - it is very helpful! It's too bad the
clientData is passed as a void* so you cannot do this, otherwise it
would really help with these callbacks.

The segfault is gone, but my actor is NULL so I am seeing the "Invalid
actor" output in the following:

void SelectionChangedCallbackFunction ( vtkObject* caller, long
unsigned int eventId, void* clientData, void* callData )
{
  vtkInteractorStyleRubberBand2D* rb =
reinterpret_cast<vtkInteractorStyleRubberBand2D*>(caller);

  vtkRenderer* renderer = rb->GetCurrentRenderer();
  if(renderer == NULL)
  {
    vtkstd::cout << "Invalid renderer!" << vtkstd::endl;
    return;
  }

  vtkstd::cout << "Getting actor..." << vtkstd::endl;
  vtkActorCollection* ActorCollection = renderer->GetActors();
  ActorCollection->InitTraversal();
  vtkActor* actor = ActorCollection->GetNextActor();

  if(actor == NULL)
  {
    vtkstd::cout << "Invalid actor!" << vtkstd::endl;
    return;
  }

Anyone know why this might be?

Thanks,

David



More information about the vtkusers mailing list