Quantcast

2D vs 3D rubber band interactor style

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

2D vs 3D rubber band interactor style

David Doria-2
It looks like the only difference between vtkInteractorStyleRubberBand2D and vtkInteractorStyleRubberBand3D is that the right mouse button rotates instead of zooms in the 3D version. There seems to be a massive code duplication here.

Couldn't one of them just derive from the other and override that little part?

Am I missing a bigger difference?

Thanks,

David

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 2D vs 3D rubber band interactor style

David E DeMarle
The rubber band interactor styles should definately be unified. I stole from rubberbandzoom to make rubberbandpick and later the other two were stolen from one of those.

They should all have a common helper class which does the xor rendering of the rubber band (and whatever else is common) and leaves the functionality differences to the existing classes.

David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109


On Tue, Feb 2, 2010 at 6:26 PM, David Doria <[hidden email]> wrote:
It looks like the only difference between vtkInteractorStyleRubberBand2D and vtkInteractorStyleRubberBand3D is that the right mouse button rotates instead of zooms in the 3D version. There seems to be a massive code duplication here.

Couldn't one of them just derive from the other and override that little part?

Am I missing a bigger difference?

Thanks,

David

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers




_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 2D vs 3D rubber band interactor style

David Doria-2
On Tue, Feb 2, 2010 at 6:46 PM, David E DeMarle <[hidden email]> wrote:
The rubber band interactor styles should definately be unified. I stole from rubberbandzoom to make rubberbandpick and later the other two were stolen from one of those.

They should all have a common helper class which does the xor rendering of the rubber band (and whatever else is common) and leaves the functionality differences to the existing classes.

David E DeMarle


What about just a vtkInteractorStyleRubberBand superclass for the vtkInteractorStyleRubberBand* classes?

OnLeftButtonDown() and OnLeftButtonUp() should be the same for all the rubberband classes - they just get the start and end position of the rubberband selection.

I believe RedrawRubberBand() is also the same for all of them.

So OnLeftButtonDown(), OnLeftButtonUp(), and RedrawRubberBand() could just live in the superclass.

Those 3 functions are the bulk of the duplicated code. The other mouse buttons could stay duplicated because they are short and the name of the class doesn't indicate anything about what those buttons should do.

Thoughts?

David

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 2D vs 3D rubber band interactor style

John Platt-3
David,

There has been some discussion on this before. RedrawRubberBand() is just
too slow on Windows because it copies all the pixel data in the viewport.
The attached version of vtkInteractorStyleRubberBandZoom just copies the 4
lines of the box
and consequently is considerably quicker. It also zooms out if the control
key is down. I would be pleased if this code could be used in any
refactoring.

John.


----- Original Message -----
From: David Doria
Cc: VTK Developers
Sent: Wednesday, February 03, 2010 12:56 AM
Subject: Re: [vtk-developers] 2D vs 3D rubber band interactor style


On Tue, Feb 2, 2010 at 6:46 PM, David E DeMarle <[hidden email]>
wrote:

The rubber band interactor styles should definately be unified. I stole from
rubberbandzoom to make rubberbandpick and later the other two were stolen
from one of those.

They should all have a common helper class which does the xor rendering of
the rubber band (and whatever else is common) and leaves the functionality
differences to the existing classes.

David E DeMarle




What about just a vtkInteractorStyleRubberBand superclass for the
vtkInteractorStyleRubberBand* classes?


OnLeftButtonDown() and OnLeftButtonUp() should be the same for all the
rubberband classes - they just get the start and end position of the
rubberband selection.


I believe RedrawRubberBand() is also the same for all of them.


So OnLeftButtonDown(), OnLeftButtonUp(), and RedrawRubberBand() could just
live in the superclass.


Those 3 functions are the bulk of the duplicated code. The other mouse
buttons could stay duplicated because they are short and the name of the
class doesn't indicate anything about what those buttons should do.


Thoughts?


David



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers 

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers


vtkInteractorStyleRubberBandZoom1.h (2K) Download Attachment
vtkInteractorStyleRubberBandZoom1.cxx (17K) Download Attachment
Loading...