Im working on a ScatterVBO and I want to add a AWTColorBarLegend to it. When refreshing the chart and its legend getImageGenerator() is called at multiple times, for example to get the dimension of the image :
AWTColorbarImageGenerator gen = getImageGenerator();
// We add the margin width because margin is handled by this viewport
// and not included inside the generated image.
int w = gen.getPreferredWidth(painter) + margin.getWidth();
The problem is that the imageGenerator is null and never initialized because ScatterVBO isn’t an instance of IMultiColorable.
protected void initImageGenerator(Drawable parent, ITickProvider provider,
ITickRenderer renderer) {
if (parent != null && parent instanceof IMultiColorable) {
IMultiColorable mc = ((IMultiColorable) parent);
if (mc.getColorMapper() != null) {
imageGenerator = new maser.customjzy3d.AWTColorbarImageGenerator(mc.getColorMapper(), provider, renderer);
if (font != null)
imageGenerator.setFont(font);
}
}
if (imageGenerator == null) {
LogManager.getLogger(this.getClass()).info(
"Passed a drawable object that is not IMultiColorable or has no ColorMapper defined");
}
}
Is there a way to make ScatterVBO instanceof IMultiColorable or any other solution ? I would be very grateful for some help.
.