MantisBT - VTK
View Issue Details
0010634VTK(No Category)public2010-04-28 10:222013-04-05 19:57
Rodrigo Valiña 
Jeff Baumes 
normalminoralways
closedfixed 
 
 
0010634: vtkInteractorStyleRubberBand2D: unable to obtain selected rectangle
I am using Python wrapping to VTK 5.4.2

I am using vtkInteractorStyleRubberBand2D to allow the user to select
a rectangle in a 2D plot (vtkXYPlotActor).

When I connect, the callback:

       self.inter.AddObserver("SelectionChangedEvent", self.selection)

   def selection(self, obj, evt):
       ...

Does not receive the "callData" argument that is passed to InvokeEvent (which would contain the coordinates of the selected rectangle (rect)) like this:

this->InvokeEvent(vtkCommand::SelectionChangedEvent, reinterpret_cast<void*>(rect));

in (in this case, in C++ is an: "unsigned int rect[5];") that would provide the coordinates of the selected rectangle.

Also, the only variables that would provide the needed information in
vtkInteractorStyleRubberBand2D, are StartPosition and EndPosition, and
they are protected; no method is available to access them.

As a workaround, I managed to get it work by adding observers to "StartInteractionEvent" and "EndInteractionEvent", and recording the two coordinates with iren.GetEventPosition().

I would suggest to provide public methods like vtkInteractorStyleRubberBand2D::GetStartPosition() and vtkInteractorStyleRubberBand2D::GetEndPosition(), or to provide a means to obtain (in Python too) the "callData" argument passed to InvokeEvent.
No tags attached.
txt RubberBandGetPatch.txt (1,444) 2010-04-28 12:03
https://www.vtk.org/Bug/file/8072/RubberBandGetPatch.txt
Issue History
2010-04-28 10:22Rodrigo ValiñaNew Issue
2010-04-28 12:03Eric MonsonFile Added: RubberBandGetPatch.txt
2010-04-28 12:04Eric MonsonNote Added: 0020463
2010-05-03 12:32Jeff BaumesNote Added: 0020520
2010-05-03 12:32Jeff BaumesStatusbacklog => @80@
2010-05-03 12:32Jeff BaumesResolutionopen => fixed
2010-05-03 12:32Jeff BaumesAssigned To => Jeff Baumes
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2013-04-05 19:57Berk GeveciStatuscustomer review => closed

Notes
(0020463)
Eric Monson   
2010-04-28 12:04   
I've attached a simple patch which adds the Get macros for the StartPosition and EndPosition variables to the header files for RubberBand2D and 3D.
(0020520)
Jeff Baumes   
2010-05-03 12:32   
commit 43018ebbb8b527ed1c3f79df98b37209b8da4003
Author: Jeffrey Baumes <jeff.baumes@kitware.com>
Date: Mon May 3 12:30:45 2010

    Fixing bug 10634 for obtaining selection rectangle.
    
    Wrapped languages could not obtain the call data for the selection
    event. The added methods allow wrapped languages to access the start
    and end positions by querying the interactor.