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 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()); }
/** * @return * @uml.property name="name" */ public String getName() { initColorModel(); return this.name; }
new LinearColorMap( "testSWAN", new LinearColorMapElement[] {c0, c1, c3, c4}, new Color(0, 0, 0)); assertEquals(list.getSourceDimensions(), 1); assertEquals(list.getTargetDimensions(), 1); assertEquals(list.getName().toString(), "testSWAN"); assertNotNull(c0.toString());
new LinearColorMap( name, (LinearColorMapElement[])
public double transform(double value) throws TransformationException { initColorModel(); PiecewiseTransform1DElement transform = (PiecewiseTransform1DElement) findDomainElement(value); if (transform != null) return transform.transform(value); return this.preFilteringPiecewise.transform(value); }
public Position transform(Position ptSrc, Position ptDst) throws TransformationException { // ///////////////////////////////////////////////////////////////////// // // input checks // // ///////////////////////////////////////////////////////////////////// ColorMapUtilities.ensureNonNull("ptSrc", ptSrc); if (ptDst == null) { ptDst = new Position(); } ptDst.setOrdinatePosition(transform(ptSrc.getOrdinatePosition())); return ptDst; }
preliminarChecks(standardElements, preFilteringElements);
new LinearColorMap( "testSWAN", new LinearColorMapElement[] {c0, c1, c3, c4},
public double transform(double value) throws TransformationException { initColorModel(); PiecewiseTransform1DElement transform = (PiecewiseTransform1DElement) findDomainElement(value); if (transform != null) return transform.transform(value); return this.preFilteringPiecewise.transform(value); }
public Position transform(Position ptSrc, Position ptDst) throws TransformationException { // ///////////////////////////////////////////////////////////////////// // // input checks // // ///////////////////////////////////////////////////////////////////// ColorMapUtilities.ensureNonNull("ptSrc", ptSrc); if (ptDst == null) { ptDst = new Position(); } ptDst.setOrdinatePosition(transform(ptSrc.getOrdinatePosition())); return ptDst; }
preliminarChecks(standardElements, preFilteringElements);
new LinearColorMap( "", new LinearColorMapElement[] {c0, c1, c3, c4, c5},
/** * @return * @uml.property name="name" */ public String getName() { initColorModel(); return this.name; }
@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()); } }
new LinearColorMap( "", new LinearColorMapElement[] {c0, c1, c3, c4, c5, c6},
/** * Returns a color model for this category list. This method builds up the color model from each category's colors (as returned by * {@link #getColors} ). * * @param visibleBand The band to be made visible (usually 0). All other bands, if any will be ignored. * @param numBands The number of bands for the color model (usually 1). The returned color model will renderer only the {@code visibleBand} and * ignore the others, but the existence of all {@code numBands} will be at least tolerated. Supplemental bands, even invisible, are useful * for processing with Java Advanced Imaging. * @return The requested color model, suitable for {@link RenderedImage} objects with values in the <code> {@link #getRange} </code> * range. * @uml.property name="colorModel" */ public IndexColorModel getColorModel() { initColorModel(); return colorModel; }
@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(); } }
new LinearColorMap( "", new LinearColorMapElement[] {c0, c1, c3, c4, c5, c6},
/** * Returns a color model for this category list. This method builds up the color model from each category's colors (as returned by * {@link #getColors} ). * * @param visibleBand The band to be made visible (usually 0). All other bands, if any will be ignored. * @param numBands The number of bands for the color model (usually 1). The returned color model will renderer only the {@code visibleBand} and * ignore the others, but the existence of all {@code numBands} will be at least tolerated. Supplemental bands, even invisible, are useful * for processing with Java Advanced Imaging. * @return The requested color model, suitable for {@link RenderedImage} objects with values in the <code> {@link #getRange} </code> * range. * @uml.property name="colorModel" */ public IndexColorModel getColorModel() { initColorModel(); return colorModel; }