Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$1, preservingElements)); final ConstantColorMapElement nc = (ConstantColorMapElement) preservingElements[i]; if (nc.getColors().length != 1) throw new IllegalArgumentException( Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$1, nc.getColors())); if (i == 0) { outval = nc.getOutputMaximum(); color = nc.getColors()[0]; } else { if (compare(outval, nc.getOutputMaximum()) != 0) throw new IllegalArgumentException( Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$1, nc.getColors())); if (!color.equals(nc.getColors()[0])) throw new IllegalArgumentException( Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$1, nc.getColors()));
LinearColorMapElement.create( "ColorMapEntry" + this.colormapElements.size(), lastColorValue, RangeFactory.create( previous.getRange().getMax().doubleValue(), true, Double.POSITIVE_INFINITY, false), previous.getOutputRange().getMax().intValue()); this.colormapElements.add(last); final int value = (int) last.getOutputMaximum() + 1; for (int i = 0; i < preservedValuesElement.length; i++) { preservedValuesElement[i] = LinearColorMapElement.create( org.geotools.metadata.i18n.Vocabulary.format( org.geotools.metadata.i18n.VocabularyKeys.NODATA) new LinearColorMap( name, (LinearColorMapElement[])
if (LinearColorMapType.validateColorMapTye(this.linearColorMapType)) throw new IllegalStateException(Errors.format(ErrorKeys.ILLEGAL_STATE)); if (!LinearColorMapType.validateColorMapTye(colorMapType)) throw new IllegalArgumentException( Errors.format(
LinearColorMapElement.create( "c0", Color.green, LinearColorMapElement.create( "c2", Color.yellow, RangeFactory.create(0.3, false, 0.6, true), 1); LinearColorMapElement.create( "c2", Color.BLACK, RangeFactory.create(0.3, false, 0.6, true), 1); final LinearColorMapElement c1c = LinearColorMapElement.create( "c2", Color.yellow, RangeFactory.create(0.3, false, 0.6, true), 1); assertFalse(c1.equals(c1b)); assertTrue(c1.equals(c1c)); LinearColorMapElement.create( "c3", Color.red, RangeFactory.create(0.60, false, 0.90, true), 2); LinearColorMapElement.create( "c4", Color.BLUE, LinearColorMapElement.create( "nodata", new Color(0, 0, 0, 0), RangeFactory.create(-9.0, -9.0), 4); new LinearColorMap( "testSWAN", new LinearColorMapElement[] {c0, c1, c3, c4},
@Test public void testDynamicColor() { entry.setColor(ff.literal("${strConcat('#FF','0000')}")); builder.addColorMapEntry(entry); LinearColorMap colorMap = builder.buildLinearColorMap(); LinearColorMapElement[] domainElements = colorMap.getDomainElements(); assertEquals(1, domainElements.length); assertEquals(1, domainElements[0].getColors().length); assertEquals(255, domainElements[0].getColors()[0].getRed()); assertEquals(0, domainElements[0].getColors()[0].getGreen()); assertEquals(0, domainElements[0].getColors()[0].getBlue()); }
LinearColorMapElement.create( "c0", Color.yellow, LinearColorMapElement.create( "c2", Color.blue, RangeFactory.create(1100.0, false, 1200.0, true), 1); LinearColorMapElement.create( "c3", Color.green, RangeFactory.create(1200.0, false, 1400.0, true), 7); LinearColorMapElement.create( "c4", Color.blue, RangeFactory.create(1400.0, false, 1600, true), 1); LinearColorMapElement.create( "c4", Color.CYAN, LinearColorMapElement.create( "nodata", new Color(0, 0, 0, 0), new LinearColorMap( "", new LinearColorMapElement[] {c0, c1, c3, c4, c5},
case ColorMap.TYPE_RAMP: colormapElements.add( LinearColorMapElement.create( label, newColorValue, break; case ColorMap.TYPE_VALUES: colormapElements.add(LinearColorMapElement.create(label, newColorValue, q, 0)); break; case ColorMap.TYPE_INTERVALS: colormapElements.add( LinearColorMapElement.create( label, newColorValue, double previousMax = ((Range) previous.getRange()).getMax().doubleValue(); Color[] previousColors = previous.getColors(); if (PiecewiseUtilities.compare(previousMax, q) != 0) { Range valueRange = RangeFactory.create(previousMax, true, q, false); case ColorMap.TYPE_RAMP: Color[] colors = new Color[] {lastColorValue, newColorValue}; int previousMaximum = (int) previous.getOutputRange().getMax().intValue(); false); colormapElements.add( LinearColorMapElement.create( label, colors, valueRange, sampleRange));
LinearColorMapElement.create( "nodata", new Color(0, 0, 0, 0), 9999); final LinearColorMap list = new LinearColorMap("", new LinearColorMapElement[] {n0}); assertEquals(list.transform(testNum), testNum, 0.0); assertTrue(false); } catch (Exception e) { assertEquals(list.transform(Double.NaN), 9999, 0.0);
@Test public void testDynamicQuantity() { entry.setQuantity(ff.literal("${6.0+4.0}")); builder.addColorMapEntry(entry); LinearColorMap colorMap = builder.buildLinearColorMap(); LinearColorMapElement[] domainElements = colorMap.getDomainElements(); assertEquals(1, domainElements.length); assertEquals(10.0, domainElements[0].getInputMinimum(), 0.0); assertEquals(10.0, domainElements[0].getInputMaximum(), 0.0); }
/** Apply a Raster classification on the underlying image. */ public ImageWorker classify(ColorMapTransform domain1D, Integer bandIndex) { ParameterBlock pb = new ParameterBlock(); pb.setSource(image, 0); // The source image. pb.set(domain1D, 0); pb.set(bandIndex, 1); pb.set(roi, 2); pb.set(nodata, 3); if (isNoDataNeeded()) { if (domain1D.hasGaps()) { // We must set the new NoData value setNoData( RangeFactory.create( domain1D.getDefaultValue(), domain1D.getDefaultValue())); } } image = JAI.create("RasterClassifier", pb, getRenderingHints()); return this; }
public RasterClassifierOpImage(RenderedImage image, ColorMapTransform<T> lic, ImageLayout layout, Integer bandIndex, ROI roi, Range nodata, RenderingHints hints) { super(image, lic, prepareLayout(image, layout, lic), bandIndex, roi, nodata, prepareHints(hints), true); this.isByteData = false; }
/** * @return * @uml.property name="name" */ public String getName() { initColorModel(); return this.name; }
/** * @see LinearColorMapElement#ClassificationCategory(CharSequence, Color[], NumberRange, NumberRange) */ public static LinearColorMapElement create(final CharSequence name, final Color color, final double value, final int sample) throws IllegalArgumentException { return new ConstantColorMapElement(name, color, value, sample); }
@Test public void testDynamicOpacity() { entry.setOpacity(ff.literal("${0.25*2}")); builder.addColorMapEntry(entry); LinearColorMap colorMap = builder.buildLinearColorMap(); LinearColorMapElement[] domainElements = colorMap.getDomainElements(); assertEquals(1, domainElements.length); assertEquals(1, domainElements[0].getColors().length); assertEquals(128, domainElements[0].getColors()[0].getAlpha()); } }
LinearColorMapElement.create( "c0", Color.BLACK, LinearColorMapElement.create( "c2", Color.blue, RangeFactory.create(10.0f, false, 100.0f, true), 1); LinearColorMapElement.create( "c3", Color.green, RangeFactory.create(100.0f, false, 300.0f, true), 2); LinearColorMapElement.create( "c4", new Color[] {Color.green, Color.red}, LinearColorMapElement.create( "c5", new Color[] {Color.red, Color.white}, LinearColorMapElement.create("c6", Color.red, 1001.0f, 2001); LinearColorMapElement.create( "nodata", new Color(0, 0, 0, 0), new LinearColorMap( "", new LinearColorMapElement[] {c0, c1, c3, c4, c5, c6},
@Test public void testDynamicQuantityEnv() { EnvFunction.setLocalValue("quantity", 10.0); try { entry.setQuantity(ff.literal("${env('quantity')}")); builder.addColorMapEntry(entry); LinearColorMap colorMap = builder.buildLinearColorMap(); LinearColorMapElement[] domainElements = colorMap.getDomainElements(); assertEquals(1, domainElements.length); assertEquals(10.0, domainElements[0].getInputMinimum(), 0.0); assertEquals(10.0, domainElements[0].getInputMaximum(), 0.0); } finally { EnvFunction.clearLocalValues(); } }
@Test public void testDynamicColorEnv() { EnvFunction.setLocalValue("color", "#FF0000"); try { entry.setColor(ff.literal("${env('color')}")); builder.addColorMapEntry(entry); LinearColorMap colorMap = builder.buildLinearColorMap(); LinearColorMapElement[] domainElements = colorMap.getDomainElements(); assertEquals(1, domainElements.length); assertEquals(1, domainElements[0].getColors().length); assertEquals(255, domainElements[0].getColors()[0].getRed()); assertEquals(0, domainElements[0].getColors()[0].getGreen()); assertEquals(0, domainElements[0].getColors()[0].getBlue()); } finally { EnvFunction.clearLocalValues(); } }
LinearColorMapElement.create( "c0", Color.BLACK, LinearColorMapElement.create( "c2", Color.blue, RangeFactory.create(10.0, false, 100.0, true), 1); LinearColorMapElement.create( "c3", Color.green, RangeFactory.create(100.0, false, 300.0, true), 2); LinearColorMapElement.create( "c4", new Color[] {Color.green, Color.red}, LinearColorMapElement.create( "c5", new Color[] {Color.red, Color.white}, LinearColorMapElement.create("c6", Color.red, 1001.0, 2001); LinearColorMapElement.create( "nodata", new Color(0, 0, 0, 0), new LinearColorMap( "", new LinearColorMapElement[] {c0, c1, c3, c4, c5, c6},
@Test public void testDynamicOpacityEnv() { EnvFunction.setLocalValue("opacity", 0.5); try { entry.setOpacity(ff.literal("${env('opacity')}")); builder.addColorMapEntry(entry); LinearColorMap colorMap = builder.buildLinearColorMap(); LinearColorMapElement[] domainElements = colorMap.getDomainElements(); assertEquals(1, domainElements.length); assertEquals(1, domainElements[0].getColors().length); assertEquals(128, domainElements[0].getColors()[0].getAlpha()); } finally { EnvFunction.clearLocalValues(); } }
LinearColorMapElement.create( "c0", Color.green, LinearColorMapElement.create( "c2", Color.yellow, RangeFactory.create(0.3, false, 0.6, true), 1); LinearColorMapElement.create( "c3", Color.red, RangeFactory.create(0.70, false, 0.90, true), 2); LinearColorMapElement.create( "c4", Color.BLUE, LinearColorMapElement.create( "nodata", Color.red, RangeFactory.create(-9.0, -9.0), 4); new LinearColorMap( "testSWAN", new LinearColorMapElement[] {c0, c1, c3, c4},