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

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,

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