Package org.geotools.data.wms.request

Examples of org.geotools.data.wms.request.GetLegendGraphicRequest


                    ISharedImages.GRID_OBJ);
        }

        ImageDescriptor imageDescriptor = null;
        try {
            GetLegendGraphicRequest request = wms.createGetLegendGraphicRequest();
            request.setLayer(layer.getName());
            request.setWidth("16"); //$NON-NLS-1$
            request.setHeight("16"); //$NON-NLS-1$

            List<String> formats = wms.getCapabilities().getRequest().getGetLegendGraphic()
                    .getFormats();

            Collections.sort(formats, new Comparator<String>(){
View Full Code Here


            org.geotools.data.ows.Layer layer = target.getResource(
                    org.geotools.data.ows.Layer.class, null);

            if (wms.getCapabilities().getRequest().getGetLegendGraphic() != null) {

                GetLegendGraphicRequest request = wms.createGetLegendGraphicRequest();
                request.setLayer(layer.getName());

                String desiredFormat = null;
                List formats = wms.getCapabilities().getRequest()
                        .getGetLegendGraphic().getFormats();
                if (formats.contains("image/png")) { //$NON-NLS-1$
                    desiredFormat = "image/png"; //$NON-NLS-1$
                }
                if (desiredFormat == null && formats.contains("image/gif")) { //$NON-NLS-1$
                    desiredFormat = "image/gif"; //$NON-NLS-1$
                }
                if (desiredFormat == null) {
                    return null;
                }
                request.setFormat(desiredFormat);

                return ImageDescriptor.createFromURL(request.getFinalURL());
            }
        } catch (Exception e) {
            // darn
        }
        return null;
View Full Code Here

        URL onlineResource = getCapabilities().getRequest().getGetLegendGraphic().getGet();
        if (onlineResource == null) {
            onlineResource = serverURL;
        }
       
        GetLegendGraphicRequest request = getSpecification().createGetLegendGraphicRequest(onlineResource);
       
        return request;       
    }
View Full Code Here

                OperationType getLegendGraphic = getCapabilities().getRequest().getGetLegendGraphic();
                if( getLegendGraphic == null ){
                    // this wms server does not support legend graphics
                    return icon;
                }
                GetLegendGraphicRequest request = createGetLegendGraphicRequest();
                request.setLayer( layer.getName() );
                request.setWidth("16");
                request.setHeight("16");

                String desiredFormat = null;
                List<String> formats = getLegendGraphic.getFormats();
                if (formats.contains("image/png")) {
                    desiredFormat = "image/png";
                }
                else if (formats.contains("image/gif")) {
                    desiredFormat = "image/gif";
                }
                else {
                    // there is no format that I am sure we can deal with :-(
                    // the danger here is requesting PDF from geoserver
                    // (because everyone wants a PDF legend graphics - wot?)
                    return icon;
                }
                request.setFormat(desiredFormat);
                request.setStyle("");

                URL legendGraphics = request.getFinalURL();
                icon = new ImageIcon( legendGraphics );
            }
            return icon;
        }
View Full Code Here

TOP

Related Classes of org.geotools.data.wms.request.GetLegendGraphicRequest

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.