Package org.geotools.styling

Examples of org.geotools.styling.ColorMap


        assertNotNull(rs.getContrastEnhancement());
        assertEquals(ContrastMethod.NORMALIZE, rs.getContrastEnhancement().getMethod());
        assertEquals(0.5, rs.getContrastEnhancement().getGammaValue().evaluate(null, Double.class),
                0.0);
        assertNull(rs.getChannelSelection());
        ColorMap cmap = rs.getColorMap();
        assertEquals(ColorMap.TYPE_RAMP, cmap.getType());
        assertFalse(cmap.getExtendedColors());
        assertEntry("#008000", 70.0, 1.0, null, cmap.getColorMapEntry(0));
        assertEntry("#663333", 256.0, 1.0, null, cmap.getColorMapEntry(1));
    }
View Full Code Here


        assertSimpleStyle(collector);

        // check the symbolizer
        RasterSymbolizer rs = (RasterSymbolizer) collector.symbolizers.get(0);
        assertNull(rs.getChannelSelection());
        ColorMap cmap = rs.getColorMap();
        assertEquals(ColorMap.TYPE_RAMP, cmap.getType());
        assertFalse(cmap.getExtendedColors());
        assertEquals(3, cmap.getColorMapEntries().length);
        assertEntry("#0000FF", 150.0, 1.0, null, cmap.getColorMapEntry(0));
        assertEntry("#FFFF00", 200.0, 1.0, null, cmap.getColorMapEntry(1));
        assertEntry("#FF0000", 250.0, 1.0, null, cmap.getColorMapEntry(2));
    }
View Full Code Here

        assertSimpleStyle(collector);

        // check the symbolizer
        RasterSymbolizer rs = (RasterSymbolizer) collector.symbolizers.get(0);
        assertNull(rs.getChannelSelection());
        ColorMap cmap = rs.getColorMap();
        assertEquals(ColorMap.TYPE_RAMP, cmap.getType());
        assertFalse(cmap.getExtendedColors());
        assertEquals(2, cmap.getColorMapEntries().length);
        assertEntry("#008000", 70.0, 1.0, null, cmap.getColorMapEntry(0));
        assertEntry("#008000", 256.0, 0.0, null, cmap.getColorMapEntry(1));
    }
View Full Code Here

        assertSimpleStyle(collector);

        // check the symbolizer
        RasterSymbolizer rs = (RasterSymbolizer) collector.symbolizers.get(0);
        assertNull(rs.getChannelSelection());
        ColorMap cmap = rs.getColorMap();
        assertEquals(ColorMap.TYPE_INTERVALS, cmap.getType());
        assertFalse(cmap.getExtendedColors());
        assertEquals(2, cmap.getColorMapEntries().length);
        assertEntry("#008000", 150.0, 1.0, null, cmap.getColorMapEntry(0));
        assertEntry("#663333", 256.0, 1.0, null, cmap.getColorMapEntry(1));
    }
View Full Code Here

    @Test
    public void testSVG () throws FileNotFoundException, IOException, SAXException, ParserConfigurationException {
        final File svgFile = TestData.file(this, "sample.svg");
        GradientColorMapGenerator colorMapGenerator = GradientColorMapGenerator.getColorMapGenerator(svgFile);
        ColorMap colorMap = colorMapGenerator.generateColorMap(10, 80);
        assertNotNull(colorMap);
        ColorMapEntry[] colorEntries = colorMap.getColorMapEntries();
        assertNotNull(colorEntries);
        assertEquals(6, colorEntries.length);

        // First and last color entry are transparent
        assertEquals("0", colorEntries[0].getOpacity().toString());
View Full Code Here

    }

    @Test
    public void testHEXcolors () throws FileNotFoundException, IOException, SAXException, ParserConfigurationException {
        GradientColorMapGenerator colorMapGenerator = GradientColorMapGenerator.getColorMapGenerator("#0000ff;#00ffff;#ffff00;#ff0000");
        ColorMap colorMap = colorMapGenerator.generateColorMap(10, 100);
        assertNotNull(colorMap);
        ColorMapEntry[] colorEntries = colorMap.getColorMapEntries();
        assertNotNull(colorEntries);
        assertEquals(6, colorEntries.length);

        // First and last color entry are transparent
        assertEquals("0", colorEntries[0].getOpacity().toString());
View Full Code Here

    rsb_1.setChannelSelection(chSel);
    rsb_1.setOpacity(sldBuilder.literalExpression(1.0));
   
    rsb_1.setOverlap(sldBuilder.literalExpression("AVERAGE"));
   
    final ColorMap cm = sldBuilder.createColorMap(
        new String[] { // labels
          "category",
          "category",
          "category"
        },
View Full Code Here

    rsb_1.setChannelSelection(chSel);
    rsb_1.setOpacity(sldBuilder.literalExpression(1.0));
    rsb_1.setContrastEnhancement(cntEnh);
    rsb_1.setOverlap(sldBuilder.literalExpression("AVERAGE"));

    final ColorMap cm = sldBuilder.createColorMap(
        new String[] { // labels
          "category",
          "category",
          "category"
        },
View Full Code Here

                // build the RasterSymbolizer
                StyleBuilder sldBuilder = new StyleBuilder();
                rsh = new RasterSymbolizerHelper(gc, null);
                rs = sldBuilder.createRasterSymbolizer();
                final ColorMap cm = sldBuilder.createColorMap(
                                new String[] { // labels
                                        "category0",
                                        "category1",
                                        "category2"
                                },
                                new double[] { // quantities
                                        100.0,
                                        500.0,
                                        900.0
                                },
                                new Color[] { // colors
                                        new Color(255,0,0,255),
                                        new Color(0,255,0,(int) (255*0.8)),
                                        new Color(0,0,255,(int) (255*0.2))
                                },
                                ColorMap.TYPE_RAMP);
                cm.setExtendedColors(true);
                rs.setColorMap(cm);

                // visit the RasterSymbolizer
                rsh.visit(rs);
                IndexColorModel icm2 = (IndexColorModel) ((GridCoverage2D)rsh.getOutput()).getRenderedImage().getColorModel();
View Full Code Here

    final SelectedChannelType chTypeGray = new SelectedChannelTypeImpl();
    chTypeGray.setChannelName("1");
    chSel.setGrayChannel(chTypeGray);
    rsb_1.setChannelSelection(chSel);
    rsb_1.setOpacity(sldBuilder.literalExpression(1.0));
    final ColorMap cm = sldBuilder.createColorMap(
        new String[] { // labels
          "category",
          "category",
          "category"
        },
View Full Code Here

TOP

Related Classes of org.geotools.styling.ColorMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.