Re: labeling within the display + getting cursor points.

Hi Tolga,


> Yes, I have missed that paragraph at the end of section 1. The fact that I 
> have a 2-button mouse and I hardly ever press 2 buttons at
> the same time prevented me from discovering this feature accidentally. Is 
> there a way to turn this display to ON at all times? And how
> can I change the coordinates of those text labels?

Have a look at the following message from Unidata's VisAD-List archive:

http://www.unidata.ucar.edu/staff/russ/visad/msg02013.html

Bill's answer is at

http://www.unidata.ucar.edu/staff/russ/visad/msg02015.html

from which I got this excerpt:

> 
> In order to print different Strings in the upper left corner,
> in your extension of DefaultDisplayRendererJ3D.java, override
> the implemention of:
> 
>   public void setCursorStringVector()
> 
> (which is in visad/DisplayRenderer.java) to create a Vector
> of Strings you do want, and then call:
> 
>   public void setCursorStringVector(Vector vect)
> 
> to actually set the Strings on the screen.
> 



>  
> About getCursor(), here's what I use:
>  
>         display.addDisplayListener(new DisplayListener() {
>             public void displayChanged(DisplayEvent e) {
>                 if(e.getId() == DisplayEvent.MOUSE_PRESSED_LEFT) {
>                     double[] coords = displayRenderer.getCursor();
>                     System.out.println("x : " + coords[0] + "  y : " + 
> coords[1]);
>                 }                
>             }
>         });
> 
> with no luck. Even when you drag it around, it's still 0.0, 0.0 . I went over 
> the VisAD source to see how the labels are printed, but
> could not find it. Can you tell me which class handles it?
>  

_From Bill's answers, I'd say it's

visad/java3d/DefaultDisplayRendererJ3D.java 
or
visad/java2d/DefaultDisplayRendererJ2D.java

according to your favourite display.

By the way, the list archive is available under

http://www.unidata.ucar.edu/staff/russ/visad/

and includes a search engine. It's worth having a look there before
posting your question to the list, although the logic dictates the
opposite: Questions posted to the list are often answered faster than I
can find the answer in the archives ;-)


> Thanks a bunch,

Your're welcome.

Ugo


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