Examples of PNGMapResponse


Examples of org.geoserver.wms.map.PNGMapResponse

                throw (IOException) new IOException().initCause(e);
            }

            final RenderedImageMapOutputFormat pngProducer = new RenderedImageMapOutputFormat(
                    "image/png", wms);
            final PNGMapResponse pngEncoder = new PNGMapResponse(wms);

            ZipEntry images = new ZipEntry("images/");
            zip.putNextEntry(images);
           
            // write the images
            for (int i = 0; i < mapContext.getLayerCount(); i++) {
                MapLayer mapLayer = mapContext.getLayer(i);

                // create a context for this single layer
                WMSMapContext subContext = new WMSMapContext();
                subContext.addLayer(mapLayer);
                subContext.setRequest(mapContext.getRequest());
                subContext.setMapHeight(mapContext.getMapHeight());
                subContext.setMapWidth(mapContext.getMapWidth());
                subContext.setAreaOfInterest(mapContext.getAreaOfInterest());
                subContext.setBgColor(mapContext.getBgColor());
                subContext.setBuffer(mapContext.getBuffer());
                subContext.setContactInformation(mapContext.getContactInformation());
                subContext.setKeywords(mapContext.getKeywords());
                subContext.setAbstract(mapContext.getAbstract());
                subContext.setTransparent(true);

                // render the map
                RenderedImageMap imageMap;
                try {
                    imageMap = pngProducer.produceMap(subContext);
                } finally {
                    subContext.dispose();
                }

                // write it to the zip stream
                entry = new ZipEntry("images/layer_" + i + ".png");
                zip.putNextEntry(entry);
                pngEncoder.write(imageMap, zip, operation);
                zip.closeEntry();
            }
            zip.closeEntry();// close the images/ folder

            zip.finish();
View Full Code Here

Examples of org.geoserver.wms.map.PNGMapResponse

    protected byte[] toBytes(WebMap map) throws IOException {
        ByteArrayOutputStream bout = new ByteArrayOutputStream();

        if (map instanceof RenderedImageMap) {
            RenderedImageMapResponse response = JPEG_MIME_TYPE.equals(map.getMimeType()) ? new JPEGMapResponse(
                    wms) : new PNGMapResponse(wms);
            response.write(map, bout, null);
        } else if (map instanceof RawMap) {
            ((RawMap) map).writeTo(bout);
        }
        bout.flush();
View Full Code Here

Examples of org.geoserver.wms.map.PNGMapResponse

                throw (IOException) new IOException().initCause(e);
            }

            final RenderedImageMapOutputFormat pngProducer = new RenderedImageMapOutputFormat(
                    "image/png", wms);
            final PNGMapResponse pngEncoder = new PNGMapResponse(wms);

            ZipEntry images = new ZipEntry("images/");
            zip.putNextEntry(images);
           
            // write the images
            List<Layer> layers = mapContent.layers();
            for (int i = 0; i < layers.size(); i++) {
                Layer mapLayer = layers.get(i);

                // create a context for this single layer
                WMSMapContent subContext = new WMSMapContent();
                subContext.addLayer(mapLayer);
                subContext.setRequest(mapContent.getRequest());
                subContext.setMapHeight(mapContent.getMapHeight());
                subContext.setMapWidth(mapContent.getMapWidth());
                subContext.getViewport().setBounds(mapContent.getRenderingArea());
                subContext.setBgColor(mapContent.getBgColor());
                subContext.setBuffer(mapContent.getBuffer());
                subContext.setContactInformation(mapContent.getContactInformation());
                subContext.setKeywords(mapContent.getKeywords());
                subContext.setAbstract(mapContent.getAbstract());
                subContext.setTransparent(true);

                // render the map
                RenderedImageMap imageMap;
                try {
                    imageMap = pngProducer.produceMap(subContext);
                } finally {
                    subContext.dispose();
                }

                // write it to the zip stream
                entry = new ZipEntry("images/layer_" + i + ".png");
                zip.putNextEntry(entry);
                pngEncoder.write(imageMap, zip, operation);
                zip.closeEntry();
            }
            zip.closeEntry();// close the images/ folder
           
            Map<String, Style> embeddedIcons = transformer.getEmbeddedIcons();
View Full Code Here

Examples of org.geoserver.wms.map.PNGMapResponse

        encoder.encode(kml, zip, context);

        // prepare for the ground overlays
        final RenderedImageMapOutputFormat pngProducer = new RenderedImageMapOutputFormat(
                "image/png", wms);
        final PNGMapResponse pngEncoder = new PNGMapResponse(wms);
        ZipEntry images = new ZipEntry("images/");
        zip.putNextEntry(images);
        // write the images
        WMSMapContent mapContent = context.getMapContent();
        for (Entry<String, Layer> goEntry : context.getKmzGroundOverlays().entrySet()) {
            String path = goEntry.getKey();
            Layer mapLayer = goEntry.getValue();

            // create a context for this single layer
            WMSMapContent subContext = new WMSMapContent();
            subContext.addLayer(mapLayer);
            subContext.setRequest(mapContent.getRequest());
            subContext.setMapHeight(mapContent.getMapHeight());
            subContext.setMapWidth(mapContent.getMapWidth());
            subContext.getViewport().setBounds(mapContent.getRenderingArea());
            subContext.setBgColor(mapContent.getBgColor());
            subContext.setBuffer(mapContent.getBuffer());
            subContext.setContactInformation(mapContent.getContactInformation());
            subContext.setKeywords(mapContent.getKeywords());
            subContext.setAbstract(mapContent.getAbstract());
            subContext.setTransparent(true);

            // render the map
            RenderedImageMap imageMap;
            try {
                imageMap = pngProducer.produceMap(subContext);
            } finally {
                subContext.dispose();
            }

            // write it to the zip stream
            entry = new ZipEntry(path);
            zip.putNextEntry(entry);
            pngEncoder.write(imageMap, zip, operation);
            zip.closeEntry();
        }
        zip.closeEntry();// close the images/ folder

        //write out the icons
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.