[vtkusers] Fw: Callback not firing?

John Platt jcplatt at dsl.pipex.com
Thu Oct 22 05:35:26 EDT 2009


----- Original Message ----- 
From: "John Platt" <jcplatt at dsl.pipex.com>
To: "David Doria" <daviddoria+vtk at gmail.com>
Sent: Thursday, October 22, 2009 10:30 AM
Subject: Re: [vtkusers] Callback not firing?


> Hi David,
>
> Thanks for your reply. I have modified vtkInteractorStyleRubberBandZoom so 
> that it just sets/gets the pixels for the 4 lines of the box rather than 
> the whole viewport and performance on Windows XP is now acceptable. I will 
> post the code to the list after some more testing and see if there is an 
> apetite for it.
>
> You say that the rubber band is not being erased. I cannot see any code in 
> your override to do this ....
>
>    void vtkInteractorStyleRubberBand2D::OnLeftButtonUp()
>    {
>      vtkstd::cout << "Left Button Up." << vtkstd::endl;
>      InvokeEvent(vtkCommand::SelectionChangedEvent);
>    }
>
> Since the existing OnLeftButtonUp() handler already calls
>
>    this->InvokeEvent(vtkCommand::SelectionChangedEvent, 
> reinterpret_cast<void*>(rect));
>
> I don't see what you are gaining.
>
> The mechanism VTK provides for customising behaviour is to add observers 
> for particular events rather than having to write new subclasses. As Jeff 
> has suggested, add observers to your interactor style where you can handle 
> your particular needs ...
>
> 
> style->AddObserver(vtkCommand::SelectionChangedEvent,SelectionChangedCallback);
>
> You can now do what you want in SelectionChangedCallback(). It even 
> supplies some useful data for you in the calldata parameter.
>
> Add as many observers as you like to the same call back and use
>
>    switch( eventId )
>
> to handle each event.
>
> HTH
>
> John.
>
>
>
>
> ----- Original Message ----- 
> From: "David Doria" <daviddoria+vtk at gmail.com>
> Cc: "vtkusers" <vtkusers at vtk.org>
> Sent: Thursday, October 22, 2009 12:29 AM
> Subject: Re: [vtkusers] Callback not firing?
>
>
>> On Tue, Oct 20, 2009 at 4:07 AM, John Platt <jcplatt at dsl.pipex.com> 
>> wrote:
>>> Hi David,
>>>
>>> I noticed you were using a rubber band interactor. Is the redraw of the 
>>> band
>>> on mouse move done at an acceptable rate when the image is at full 
>>> screen.
>>> If so, what o/s?
>>>
>>> Many thanks.
>>>
>>> John.
>>
>>
>> @John
>>
>> The rubberband looks fine even at fullscreen. I am using Fedora 11.
>>
>> @All,
>>
>> Does anyone know why the rubberband is still not disappearing?
>> Also, StartPosition, etc are in window coordinates - is there anything
>> in place that will get the coordinate (pixel) in the original image
>> that the mouse has selected even if the camera has changed? This would
>> be used, for example, to select a region from the original image even
>> after you've zoomed/panned around using the render window interactor.
>>
>> Thanks,
>>
>> David
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at 
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: 
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
> 





More information about the vtkusers mailing list