Package org.geotools.map

Examples of org.geotools.map.MapContent


     * @param style
     * @return
     */
    public static BufferedImage renderIcon(Style style) {
        int size = findIconSize(style)+2; // size is an int because icons are always square
        MapContent mapContent = new MapContent();
        mapContent.addLayer(new FeatureLayer(sampleData, style));
        BufferedImage image = new BufferedImage(size * Icons.RENDER_SCALE_FACTOR,
                size * Icons.RENDER_SCALE_FACTOR, BufferedImage.TYPE_INT_ARGB);
        Graphics2D graphics = image.createGraphics();
        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        graphics.scale(Icons.RENDER_SCALE_FACTOR, Icons.RENDER_SCALE_FACTOR);
        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setMapContent(mapContent);
        try {
            try {
                renderer.paint(graphics, new Rectangle(size, size), sampleArea);
            } finally {
                graphics.dispose();
            }
        } finally {
            mapContent.dispose();
        }
        return image;
    }
View Full Code Here


            resetToNewShape();
        }

        // Create a map content and add our file to it
        map = new MapContent();
        map.setTitle("Map");

                /*try {
                    parseFeatureSource(simpleFeatureSource.getFeatures());
                } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.geotools.map.MapContent

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.