Package org.geotools.renderer.lite.gridcoverage2d

Examples of org.geotools.renderer.lite.gridcoverage2d.GradientColorMapGenerator


        double arg2 = (getExpression(2).evaluate(feature, Double.class)).doubleValue();
        return evaluate(arg0, arg1, arg2);
    }

    public Object evaluate(String colorMap, final double min, final double max) {
        GradientColorMapGenerator generator = null;
        Resource xmlFile = null;
        if (!colorMap.startsWith(GradientColorMapGenerator.RGB_INLINEVALUE_MARKER)
                && !colorMap.startsWith(GradientColorMapGenerator.HEX_INLINEVALUE_MARKER)) {
           
            GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
            colorMap = colorMap.replace('\\', '/');
           
            String path = Paths.path("styles", "ramps", colorMap + ".svg");
           
            xmlFile = loader.get( path );
            if( xmlFile.getType() != Type.RESOURCE ){
                throw new IllegalArgumentException(
                        "The specified colorMap do not exist in the styles/ramps folder\n"
                                + "Check that "
                                + path
                                + " exists and is an .svg file");
            }
        }
        try {
            if (xmlFile != null) {
                generator = GradientColorMapGenerator.getColorMapGenerator(xmlFile.file());
            } else {
                generator = GradientColorMapGenerator.getColorMapGenerator(colorMap);
            }
            return generator.generateColorMap(min, max);
        } catch (Exception e) {
            // probably a type error
            throw new IllegalArgumentException("Filter Function problem for function colormap", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.geotools.renderer.lite.gridcoverage2d.GradientColorMapGenerator

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.