Re: Rubberband zoom

Hi Ben,

> Hi, it's me again.  I would like to implement a way to zoom that would
> allow the user to right click and drag a box out and then zoom in to that
> box.  I have noticed something called  in the
> javadoc and mentioned on the list.  As you may remember, I am using 2D to
> create line plots.  I have been thinking(I haven't checked to see how much
> work it will be) that I could possibly convert RubberBandBoxRenderJ3D to a
> J2D version.  Is using this kind of thing even the best way to go about
> something like this? Or is there a simpler way?  If it's going to be too
> messy I may be able to deal with not having the rubberband displayed on
> the screen.  In that case I'm assuming I would just need to keep track of
> the mouse events.

This is a good approach. Writing a new RubberBandBoxRendererJ2D
will be tricky because RubberBandBoxRenderJ3D does some explicit
manipulation of the Java3D scene graph in its doTransform(),
drag_direct() and release_direct() methods. It also has a couple
variables declared as Java3D BranchGroups.

It will be much easier if you can use a DisplayImplJ3D with a
TwoDDisplayRendererJ3D instead of the DisplayImplJ2D. Then you
will have 2-D graphs but can use RubberBandBoxRenderJ3D. As you
can see in the main() method of RubberBandBoxRenderJ3D, it gives
you the box corners in Data coordinates, which you can then pass
to the setRange() methods of your ScalarMaps to XAxis and YAxis
to implement your zoom.

Good luck,
Bill