Examples of ColorMap


Examples of org.geotools.styling.ColorMap

        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

Examples of org.geotools.styling.ColorMap

        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

Examples of org.geotools.styling.ColorMap

    @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

Examples of org.geotools.styling.ColorMap

    }

    @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

Examples of org.geotools.styling.ColorMap

    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

Examples of org.geotools.styling.ColorMap

    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

Examples of org.geotools.styling.ColorMap

                // 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

Examples of org.geotools.styling.ColorMap

    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

Examples of org.geotools.styling.ColorMap

                intervals = true;
            } else {
                intervals = false;
            }
        }
        ColorMap colorMap = new ColorMapImpl();

        // Adding transparent color entry before the min
        double start = min - (intervals ? 0 : 1E-2);
        ColorMapEntry entry = entries[0].getColorMapEntry(start);
        entry.setOpacity(filterFactory.literal(0));
        colorMap.addColorMapEntry(entry);

        if (intervals) {
            colorMap.setType(ColorMap.TYPE_INTERVALS);
            for (int i = 1; i < numEntries - 1; i += 2) {
                colorMap.addColorMapEntry(entries[i].getColorMapEntry(min, range));
            }
        } else {
            colorMap.setType(ColorMap.TYPE_RAMP);
            for (int i = 0; i < numEntries - 1; i ++) {
                colorMap.addColorMapEntry(entries[i].getColorMapEntry(min, range));
            }
        }
        colorMap.addColorMapEntry(entries[numEntries - 1].getColorMapEntry(max));

        // Adding transparent color entry after the max
        ColorMapEntry entryEnd = entries[numEntries - 1].getColorMapEntry(max + 1E-2);
        entryEnd.setOpacity(filterFactory.literal(0));
        colorMap.addColorMapEntry(entryEnd);

        return colorMap;
    }
View Full Code Here

Examples of org.geotools.styling.ColorMap

    // /////////////////////////////////////////////////////////////////////
    //
    // COLOR MAP
    //
    // /////////////////////////////////////////////////////////////////////
    final ColorMap cm = rs.getColorMap();
    cmNode.addSource(csNode);
    csNode.addSink(cmNode);
    cmNode.visit(cm);

    // /////////////////////////////////////////////////////////////////////
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.