NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Celine,
Is it possible to get an instance of the current Graphics to be able to draw String instead of using ScalarMap and References. I'd like to to the same thing as the drawCursorStringVector methid from DisplayRendererJ2D.
Sorry for the delay in my response; I have been traveling these past few days. It should be possible to get a handle on a Java2D display's Graphics2D somehow, though I haven't explored it. For Java3D displays, however, that's not how things work. However, in VisBio, I use a technique to display text to a Display without using a screen locked renderer or other method involving ScalarMaps and DataReferences. Essentially, you can do it with DataRenderer's setException method. Here is a boiled down version: DisplayImpl d = ...; // VisAD display DataRenderer rend = ...; // linked data renderer String[] messages = ...; // list of messages // set exception messages rend.clearExceptions(); for (int i=0; i<messages.length; i++) { rend.addException(new VisADException(messages[i])); } // force redraw of exception messages // BE SURE TO DO THIS IN AWT EVENT THREAD DisplayRenderer dr = d.getDisplayRenderer(); if (dr instanceof DisplayRendererJ2D) { ((DisplayRendererJ2D) dr).getCanvas().repaint(); } else { // renderer instanceof DisplayRendererJ3D DisplayRendererJ3D dr3d = (DisplayRendererJ3D) dr; dr3d.getCanvas().renderField(0); } -Curtis On 3/28/07, Celine Gestas <celine.gestas@xxxxxxxxx> wrote:
Hi, Is it possible to get an instance of the current Graphics to be able to draw String instead of using ScalarMap and References. I'd like to to the same thing as the drawCursorStringVector methid from DisplayRendererJ2D. Cheers, Celine Gestas
============================================================================== To unsubscribe visad, visit: http://www.unidata.ucar.edu/mailing-list-delete-form.html ==============================================================================
visad
archives: