Re: Visad basics

  • To: Hanowski, Gregory J
  • Subject: Re: Visad basics
  • From: Bill Hibbard [mailto:billh@xxxxxxxxxxxxx]
  • Date: Wed, 29 Jun 2005 10:23:17 -0600
Thanks for the help.  Your email provided several "ah ha" moments and I
understand it better now.  The first shape apparently was text but it
was scaled so tiny I could barely see it and it looked like a dot so I
missed the shape sequence pattern.  Adding additional values like this
confirmed what you are saying and then I could see the pattern.  
values = new float[][] {{0.0f, 1.0f, 2.0f, 3.0f, 0.0f, 1.0f, 2.0f, 3.0f,

Color is already taken but shape is available so that will work better
for hilighting.  I'm thinking I should be able to create another column
of data that contains the index of the main shape and then just change
the index of the selected point to a different shape index, like your
suggestion for color.
Thanks again,

-----Original Message-----
Sent: Tuesday, June 28, 2005 7:17 AM
Cc: visad@xxxxxxxxxxxxxxxx

Hi Greg,

> I need to provide some visual feedback when a user clicks on a data 
> point.  My thought is to overlay a cross shape on the point, ie create

> a new reference and add it to the display.  Reading the archives keeps

> pointing me to example.  Unfortunately, I just can't 
> follow it very well.  I'm apparently missing some fundamental VisAD 
> understanding.

Another approach to highlighting would be to include RealTypes
ScalarMap'ed to color in your Data, and changing the values of those
RealTypes when you want to highlight.

> I am able to run the example in Jbuilder and I see 6 shapes, at the 
> same elevation from left to right:
> 1) a tiny purple dot,
> 2) a small purple cube,
> 3) a pink "x",
> 4) a medium sized white cube,
> 5) text characters "1.2",
> 6) a large purple cube.
> In setupServerData method I see:
>     values = new float[][] {{0.0f, 1.0f, 2.0f, 3.0f, 0.0f, 1.0f}};
> Presumably, these are the X coordinates of the 6 objects since they 
> are all at the same height. Why it doesn't continue with 4.0f and 5.0f

> after 3.0f, I haven't a clue.  Text is apparently mapped differently 
> for some reason.

As you note, the VisAD library is complex so its better to analyze
examples than to presume, especially when the presumption is not
consistent with the observed behavior.
In this case, the 'values' array is passed to the setSamples() method of
the histograms1 FlatField, which has MathType (ir_radiance -> count).
Hence, the numbers in the 'values'
array have RealType 'count'. 'count' is mapped to Display.Shape rather
than Display.XAxis, so they are not X coordinates.
They are indices into the 'shapes' array passed to
shape_control.setShapes() (treated as ordinary integer indices since
count_set, passed to shape_control.setShapeSet(), is just a sequence of
integers 0, 1, 2, 3). Hence the sequence in 'values', (i.e., 0, 1, 2, 3,
0, 1) iterates through the 4 shapes in the 'shapes' array, then iterates
through the first two again.

In shapes, text is converted by the PlotText.render_label() method into
a geometrical shape and handled like any other shape geometry. When text
is used in a shape, the Display logic doesn't know the shape came from
text. If text is displayed using a ScalarMap to Text then the Display
logic knows it is text.

> Anyway, I really have a hard time following this VisAD code.  So many 
> internal details of the VisAD data structures seem to be hidden or
> layered that it makes it extremely difficult to follow.   I have
> through the tutorials and understand the simpler ones for the most 
> part but this shape mapping I just don't get.  How does each of the 6 
> items get mapped to a new shape?  Does anybody have any examples with 
> comments that document each step along the way?  Preferably one that 
> shows how to provide highlighting or some other type of visual 
> feedback when data points in the display are clicked.

Unfortunately, the Tutorial does not cover Shapes, so you'll need to
consult the VisAD Developer's Guide at:
See sections 4.3.12 and 4.7.

You are correct that VisAD is complex, which is a consequence of its
generality. In order to work with something as complex as shapes, you'll
either need to first really experiment with the simpler topics in the
tutorial, or carefully analyze (as I have above) the examples and
Developers Guide sections about shape (few as they are).  If you do that
and get stuck on some point, we'll be happy to answer questions sent to
the list.

Good luck,

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