Re: ProjectionControlJ3D and Zoom

Ben,

> I was implemented a 2x zoom on my 2D display (with a right click) by
> accessing the ProjectionControlJ3D object and getting the matrix
> associated with it and multiplying everything by two (except the last
> element) and then calling the setMatrix() method:
>
> ProjectionControlJ3D pc = (ProjectionControlJ3D)
> display.getProjectionControl();
>
> double[] matrix = pc.getMatrix();
> for (int i = 0; i < 15; i++)
>       matrix[i] = matrix[i]*2;
> pc.setMatrix(matrix);
>
> By the way my matrix looks like this:
> [0.65][0.00][0.00][0.0]
> [0.00][0.65][0.00][0.0]
> [0.00][0.00][0.65][0.0]
> [0.00][0.00][0.00][1.0]
>
> So my problem is, I currently have a RubberBandBox object collecting all
> the user interaction which I want to use to zoom instead, but I don't
> know how to incorporate the bounding box they choose to zoom my display.
> I tried to use the latMap.setRange() and lonMap.setRange() but that
> screws up my display (height and width ratio).
>
> So I am wondering the best way to accomplish this (and if I could using
> the ProjectionControlJ3D object)? Or should I just write the code that
> will best fit their bounding box to the current ratio and call the
> setRange() methods?

You could go either way. I'd probably try to fit their bounding
box to the current ration and call setRange().

Bill


  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: