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

Re: Now including text in a 2D display.

> Carlos Pleguezuelos wrote:
>
> Now I wanna do the same thing but with 2D display, and Im not quite sure how 
> to do it, though I think is very simple and similar. Do I have to
> create a new object that extends from VisADCanvasJ2D? With 3D I have to 
> override the "renderField" method, but, since that method doesnt
> appear in VisADCanvasJ2D, do i have to override "renderTrigger"? How can i do 
> it?

By far the easiest way to do this is to use:

  new DisplayImplJ3D("display", new TwoDDisplayRendererJ3D());

in place of:

  new DisplayImplJ2D("display");

If you can use Java3D, it will give much better performance
than Java2D, and with the TwoDDisplayRendererJ3D looks the
same.

Then you can use the same text solution.

> I have another question. When you create a DisplayImplJ3D and add it to a 
> widget, a JFrame for example, the "cube" inside the display grows
> through the display: if I include the display in a very large frame, I get a 
> big "cube". How can I define the dimensions of the cube to get an
> smaller one?

There are two approaches. You could call:

  ProjectionControl p = display.getProjectionControl();
  p.setAspectCartesian(new double[] {0.1, 0.1, 0.1}); // or whatever

Or you could use the getMatrix() and setMatrix() methods
of ProjectionControl - I think Tom has some utilities for
doing this from Python.

Good luck,
Bill


 
 
  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