private void testIndexCoding(Band indexBand, final int expectedIndices) { assertTrue(indexBand.isIndexBand()); assertEquals(expectedIndices, indexBand.getIndexCoding().getNumAttributes()); final ColorPaletteDef paletteDef = indexBand.getImageInfo(ProgressMonitor.NULL).getColorPaletteDef(); assertEquals(expectedIndices, paletteDef.getNumColors()); final Color[] colors = paletteDef.getColors(); assertNotSame(0, colors[0].getRed() | colors[0].getGreen() | colors[0].getBlue()); assertNotSame(0, colors[1].getRed() | colors[1].getGreen() | colors[1].getBlue()); assertNotSame(0, colors[2].getRed() | colors[2].getGreen() | colors[2].getBlue()); assertNotSame(0, colors[3].getRed() | colors[3].getGreen() | colors[3].getBlue()); }
maxSample = getSample(cpd.getLastPoint()); final int numColors = cpd.getNumColors(); final double scalingFactor = 1 / (numColors - 1.0); final Color[] colorPalette = new Color[numColors];
imageInfo.getColorPaletteDef().getNumColors(), bandStatisticsElem); ColorPaletteDef paletteDefinition = imageInfo.getColorPaletteDef();
sXmlW.printLine(indent + 2, DimapProductConstants.TAG_NUM_COLORS, paletteDefinition.getNumColors()); final Iterator iterator = paletteDefinition.getIterator(); while (iterator.hasNext()) {
@Test public void testConstructors() { ColorPaletteDef cpd = new ColorPaletteDef(-1.0, 1.0); assertEquals(256, cpd.getNumColors()); assertEquals(3, cpd.getNumPoints()); assertEquals(-1.0, cpd.getPointAt(0).getSample(), 1e-10); assertEquals(256, cpd.getNumColors()); assertEquals(3, cpd.getNumPoints()); assertEquals(-1.0, cpd.getPointAt(0).getSample(), 1e-10); }); assertEquals(4, cpd.getNumPoints()); assertEquals(256, cpd.getNumColors()); }, 512); assertEquals(4, cpd.getNumPoints()); assertEquals(512, cpd.getNumColors());