Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

ProjectionControlJ3D and Zoom

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?

Thanks.



 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690