Re: mixing points and lines in a display

Hi Henner,

> i have a new problem that i didn't manage to get rid of for hours:
> 
> i have a model class that can be plugged into a display class that uses a
> DisplayImplJ(2/3)D. an instance of this model contains a time series with
> realtime data and also computes an average curve that just has one sample
> per day. both can be received as datareferences that are ready to add to the
> display. here are the lines of code that should do the work:
> 
> ______________________________________________________
>                 GraphModel[] gms = getModels();         // get all
> dataReferences that should be displayed
>                 try {
>                         display.removeAllReferences();                  //
> remove all refs
>                         display.clearMaps();
> // ... and maps
>                         addMaps(maps);
> // add all the maps needed to the naked display
>                         for (int i = 0; i < gms.length; i++) {
>                                 try { // to add each dataReference
> seperately
>                 //                              if
> (gms[i].getDisplayIntradayData()) {
>                                                 int count
> colorMaps[i].length;            // these colorMap[] contain 4 constant maps
> (r,g,b, linewidth)
>                                                 ConstantMap[] idMaps = new
> ConstantMap[count];
>                                                 for (int j = 0; j < count-1;
> j++) idMaps[j] = (ConstantMap) colorMaps[i][j].clone();
>                                                 idMaps[count-1] = new
> ConstantMap(3, Display.PointSize);      // the linewidth map is substituted
> by a pointsize map
> 
> display.addReference(gms[i].getIntradayDataReference(), idMaps);
>                 //                              }
>                                 } catch (Exception e) {
>                                         e.printStackTrace();
>                                         System.out.println("failed to add
> intra day data of " + gms[i]);
>                                 }
>                                 try {
> 
> display.addReference(gms[i].getDataReference(), colorMaps[i]);  // add each
> dataReference
> 
> legendData.add(legendLabels[i].setModel(gms[i]));
>                                 } catch (Exception e) {
>                                         System.out.println("failed to add
> average data of " + gms[i]);
>                                 }
>                         }
>                         title.setText(""+ gms[0].toString());
>                         legend.setListData((gms.length > 1) ? legendData :
> new Vector());
>                 } catch (Exception e) {
>                         e.printStackTrace();
>                 }

This is unreadable.  Please indent less (in VisAD we only indent
by 2 spaces) and set your email program to send much longer lines.

> the both graphs (assuming the code above would get one model by calling
> getModels()) are always displayed as lines - both. although i can't see any
> significant difference to the code of example P2_05.

Picking through your code, there is not enough informration
to tell why you are getting only lines.  It depends on your
MathTypes and ScalarMaps.  If you print your MathTypes and
your ScalarMaps, and do the same for P2_05, you may see the
difference.

> in a 3d plot it is even worse. the above code produces the following stack
> trace:
> 
> ______________________________________________________
> java.lang.ArrayIndexOutOfBoundsException: 1
>         at
> visad.ShadowFunctionOrSetType.doTransform(ShadowFunctionOrSetType.java:2147)
>         at
> visad.java3d.ShadowFunctionOrSetTypeJ3D.doTransform(ShadowFunctionOrSetTypeJ
> 3D.java, Compiled Code)
>         at
> visad.java3d.DefaultRendererJ3D.doTransform(DefaultRendererJ3D.java,
> Compiled Code)
>         at visad.java3d.RendererJ3D.doAction(RendererJ3D.java, Compiled
> Code)
>         at visad.DisplayImpl.doAction(DisplayImpl.java, Compiled Code)
>         at visad.ActionImpl.run(ActionImpl.java, Compiled Code)
>         at visad.util.ThreadPool$ThreadMinnow.run(ThreadPool.java, Compiled
> Code)
> java.lang.ArrayIndexOutOfBoundsException: 1
>         at
> visad.ShadowFunctionOrSetType.doTransform(ShadowFunctionOrSetType.java:2147)
>         at
> visad.java3d.ShadowFunctionOrSetTypeJ3D.doTransform(ShadowFunctionOrSetTypeJ
> 3D.java, Compiled Code)
>         at
> visad.java3d.DefaultRendererJ3D.doTransform(DefaultRendererJ3D.java,
> Compiled Code)
>         at visad.java3d.RendererJ3D.doAction(RendererJ3D.java, Compiled
> Code)
>         at visad.DisplayImpl.doAction(DisplayImpl.java, Compiled Code)
>         at visad.ActionImpl.run(ActionImpl.java, Compiled Code)
>         at visad.util.ThreadPool$ThreadMinnow.run(ThreadPool.java, Compiled
> Code)
> ______________________________________________________
> 
> ... and the display hangs, reading : "please wait". but if i choose point
> mode (in the corresponding widget panel) the data gets visible - visualized
> as points. if i switch back the exception occurs again.

It is failing in the texture mapping logic, and setting point
mode disables texture mapping.  There is not enough information
to understand the Exception.  Somehow domain_set.getLengths()
is returning an array of length 0.  Since I know you can't
send me your application to run, can you please run it under
jdb, catch the ArrayIndexOutOfBoundsException, and send me the
output of 'dump domain_set' and 'dump lengths' after the
ArrayIndexOutOfBoundsException.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html


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