Search in sources :

Example 1 with ClassStylingPolicy

use of de.lmu.ifi.dbs.elki.visualization.style.ClassStylingPolicy in project elki by elki-project.

the class Parallel3DRenderer method prepareColors.

private void prepareColors(final StylingPolicy sp) {
    if (colors == null) {
        final ColorLibrary cols = shared.stylelib.getColorSet(StyleLibrary.PLOT);
        if (sp instanceof ClassStylingPolicy) {
            ClassStylingPolicy csp = (ClassStylingPolicy) sp;
            final int maxStyle = csp.getMaxStyle();
            colors = new float[maxStyle * 3];
            for (int c = 0, s = csp.getMinStyle(); s < maxStyle; c += 3, s++) {
                Color col = SVGUtil.stringToColor(cols.getColor(s));
                colors[c + 0] = col.getRed() / 255.f;
                colors[c + 1] = col.getGreen() / 255.f;
                colors[c + 2] = col.getBlue() / 255.f;
            }
        } else {
            // Render in black.
            colors = new float[] { 0f, 0f, 0f };
        }
    }
}
Also used : Color(java.awt.Color) ClassStylingPolicy(de.lmu.ifi.dbs.elki.visualization.style.ClassStylingPolicy) ColorLibrary(de.lmu.ifi.dbs.elki.visualization.colors.ColorLibrary)

Aggregations

ColorLibrary (de.lmu.ifi.dbs.elki.visualization.colors.ColorLibrary)1 ClassStylingPolicy (de.lmu.ifi.dbs.elki.visualization.style.ClassStylingPolicy)1 Color (java.awt.Color)1