hello again ;-)
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();
}
______________________________________________________
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.
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 would be really great if somebody coukd have a look at it and tell me, if
it is my fault or if something's going wrong with the visad classes.
thanx in advance,
henner