Re: VisaD Tutorial, Section 2.1, P2_01 Application

Hi Luke,

"Luke A. Catania" wrote:
> 
> I am working with the P2_01 java app in the tutorial and the figure in this
> example shows a cursor on the plot, and the value of where the cursor is is
> displayed in the upper left corner.  But when I run the example, I can't do
> anything but move the graph around within the frame by left clicking on it
> and dragging the mouse.  I can also zoom in and out by shift clicking.  How
> is the cursor and getting data implemented in this example and if it is not,
> is there an example in a tutorial that does show how to do this?

Section 1.3 (at the very bottom of the section, just under the
screenshot) explains it as follows:

"By pressing and dragging with the left mouse button on the display you
can move the graph around. By shift-clicking and moving the mouse up and
down you can zoom in and out.  Pressing and dragging the middle mouse
button (on two-button mouse emulated by simultaneously clicking both
buttons) shows a cross cursor that moves with the mouse. The values of
the RealTypes at the cursor's position are shown on the upper left
corner of the display."

Thus you can get the cursor drawn in all tutorial examples (clicking
with the right mouse button OR simultaneously clicking with both mouse
buttons - left and right - in case you mouse has 2 buttons only). In
fact, all VisAD displays (2- or 3D) have this behaviour. 

By the way, here's the tip of the day ;-), the method

visad.DisplayRenderer.getCursor() 

will return an array giving the cursor location as (XAxis, YAxis, ZAxis)
coordinates.

To get the display renderer, remember of the tip of yesterday:

DisplayRenderer dRenderer = display.getDisplayRenderer();

where we used the renderer to change the background color.

float[] backColor = colorToFloats(Color.lightGray);
dRenderer.setBackgroundColor(backColor[0], backColor[1],backColor[2]);

Cheers,

Ugo


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