Search in sources :

Example 1 with ColorModel

use of org.knime.core.data.property.ColorHandler.ColorModel in project knime-core by knime.

the class ColorExtractNodeModel method extractColorTable.

private DataTable extractColorTable(final DataTableSpec colorSpec) throws InvalidSettingsException {
    // first column has column handler (convention in ColorHandlerPO)
    ColorHandler clrHdl = colorSpec.getColumnSpec(0).getColorHandler();
    final ColorModel model = clrHdl.getColorModel();
    if (model.getClass() == ColorModelNominal.class) {
        ColorModelNominal nom = (ColorModelNominal) model;
        return extractColorTable(nom);
    } else if (model.getClass() == ColorModelRange.class) {
        ColorModelRange range = (ColorModelRange) model;
        return extractColorTable(range);
    } else {
        throw new InvalidSettingsException("Unknown ColorModel class: " + model.getClass());
    }
}
Also used : ColorModelRange(org.knime.core.data.property.ColorModelRange) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) ColorModel(org.knime.core.data.property.ColorHandler.ColorModel) ColorModelNominal(org.knime.core.data.property.ColorModelNominal) ColorHandler(org.knime.core.data.property.ColorHandler)

Aggregations

ColorHandler (org.knime.core.data.property.ColorHandler)1 ColorModel (org.knime.core.data.property.ColorHandler.ColorModel)1 ColorModelNominal (org.knime.core.data.property.ColorModelNominal)1 ColorModelRange (org.knime.core.data.property.ColorModelRange)1 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)1