Package org.geoserver.wms.map

Examples of org.geoserver.wms.map.RenderedImageMapOutputFormat


                zip.closeEntry();
            } catch (TransformerException e) {
                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
View Full Code Here


            mc.getViewport().setBounds(new ReferencedEnvelope(targetModelSpace, getMap.getCrs()));
            mc.setMapWidth(paintAreaSize);
            mc.setMapHeight(paintAreaSize);
           
            // and now run the rendering _almost_ like a GetMap
            RenderedImageMapOutputFormat rim = new RenderedImageMapOutputFormat(wms) {
   
                private Graphics2D graphics;

                @Override
                protected RenderedImage prepareImage(int width, int height, IndexColorModel palette,
                        boolean transparent) {
                    return image;
                }

                @Override
                protected Graphics2D getGraphics(boolean transparent, Color bgColor,
                        RenderedImage preparedImage, Map<Key, Object> hintsMap) {
                    graphics = super.getGraphics(transparent, bgColor, preparedImage,
                            hintsMap);
                    return graphics;
                }
   
                @Override
                protected void onBeforeRender(StreamingRenderer renderer) {
                    // force the renderer into serial painting mode, as we need to check what
                    // was painted to decide which features to include in the results
                    Map hints = renderer.getRendererHints();
                    hints.put(StreamingRenderer.OPTIMIZE_FTS_RENDERING_KEY, Boolean.FALSE);
                    // disable antialiasing to speed up rendering
                    hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
   
                    // TODO: should we disable the screenmap as well?
                    featureInfoListener.setGraphics(graphics);
                    featureInfoListener.setRenderer(renderer);
                    renderer.addRenderListener(featureInfoListener);
                }
            };
            rim.produceMap(mc);
           
            List<SimpleFeature> features = featureInfoListener.getFeatures();
            return aggregateByFeatureType(features);
        } finally {
            mc.dispose();
View Full Code Here

*
*/
public class TurboJPEGMapResponseTest extends WMSTestSupport {

    protected RenderedImageMapOutputFormat getProducerInstance() {
        return new RenderedImageMapOutputFormat("image/jpeg",new String[]{"image/jpeg"}, getWMS());
    }
View Full Code Here

    GetFeatureInfoOutputFormat getInfoFormat;
   
   
   
    void addMimeTypes() {
        getMapFormat = new RenderedImageMapOutputFormat(getWMS());
        getInfoFormat = new TextFeatureInfoOutputFormat(getWMS());
        WMSInfo wms = getWMS().getServiceInfo();
        wms.getGetMapMimeTypes().add(getMapFormat.getMimeType());
        wms.getGetFeatureInfoMimeTypes().add(getInfoFormat.getContentType());
        wms.setGetMapMimeTypeCheckingEnabled(true);
View Full Code Here

    }

   
   
    void addMimeTypes() {
        getMapFormat = new RenderedImageMapOutputFormat(getWMS());
        getInfoFormat = new TextFeatureInfoOutputFormat(getWMS());
        WMSInfo wms = getWMS().getServiceInfo();
        wms.getGetMapMimeTypes().add(getMapFormat.getMimeType());
        wms.getGetFeatureInfoMimeTypes().add(getInfoFormat.getContentType());
        wms.setGetMapMimeTypeCheckingEnabled(true);
View Full Code Here

   
    @Test
    public void testAllowedMimeTypes() throws Exception {
       
        WMSInfo wms = getWMS().getServiceInfo();
        GetMapOutputFormat format = new RenderedImageMapOutputFormat(getWMS());       
        wms.getGetMapMimeTypes().add(format.getMimeType());
        wms.setGetMapMimeTypeCheckingEnabled(true);
        getGeoServer().save(wms);

     // check mime type allowed
        MockHttpServletResponse response = getAsServletResponse("wms?bbox=" + bbox
View Full Code Here

  private String mapFormat = "image/dds";
  protected RenderedImageMapOutputFormat rasterMapProducer;

    protected RenderedImageMapOutputFormat getProducerInstance() {
        return new RenderedImageMapOutputFormat(this.mapFormat, getWMS());
    }
View Full Code Here

                zip.closeEntry();
            } catch (TransformerException e) {
                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
View Full Code Here

   
    @Test
    public void testAllowedMimeTypes() throws Exception {
       
        WMSInfo wms = getWMS().getServiceInfo();
        GetMapOutputFormat format = new RenderedImageMapOutputFormat(getWMS());       
        wms.getGetMapMimeTypes().add(format.getMimeType());
        wms.setGetMapMimeTypeCheckingEnabled(true);
       

        getGeoServer().save(wms);
View Full Code Here

        ZipEntry entry = new ZipEntry("wms.kml");
        zip.putNextEntry(entry);
        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
View Full Code Here

TOP

Related Classes of org.geoserver.wms.map.RenderedImageMapOutputFormat

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.